Re: [cfe-users] -Winvalid-noreturn warning

2022-01-06 Thread David Blaikie via cfe-users
FWIW, GCC does warn on similar code - the reason it doesn't warn here is that the function is `inline` and never called, so GCC probably never analyses it (I pasted your code here and added a few cases to demonstrate GCC's quirks compared to Clang's here: https://godbolt.org/z/YM9q91bx1 ) So far a

Re: [cfe-users] (bug?) ParsedAttr::getNumArgs() always return zero

2021-12-02 Thread David Blaikie via cfe-users
I'm /guessing/ this API doesn't respond with attributes clang doesn't recognize (CC'd Aaron Ballman who would likely know the details better than I do). Does the API correctly respond with a non-zero number of attributes for any clang-supported attribute (listed here: https://clang.llvm.org/docs/At

Re: [cfe-users] Clang (with Visual Studio) wrongly complains about missing variables

2021-09-23 Thread David Blaikie via cfe-users
On Thu, Sep 23, 2021 at 3:34 AM John Emmas via cfe-users < cfe-users@lists.llvm.org> wrote: > On 22/09/2021 18:21, Reid Kleckner via cfe-users wrote: > > Looking back in the thread, I found the example code, and I see that > > MSVC refuses to inline this helper, but clang will inline it. I > > bel

Re: [cfe-users] Clang (with Visual Studio) wrongly complains about missing variables

2021-09-22 Thread David Blaikie via cfe-users
Probably Reid and Hans are folks to start with for Windows support On Wed, Sep 22, 2021 at 4:38 AM Jeffrey Walton via cfe-users < cfe-users@lists.llvm.org> wrote: > On Wed, Sep 22, 2021 at 7:21 AM John Emmas via cfe-users > wrote: > > > > On 21/09/2021 14:24, John Emmas via cfe-users wrote: > >

Re: [cfe-users] Clang (with Visual Studio) wrongly complains about missing variables

2021-09-20 Thread David Blaikie via cfe-users
I'm not sure it's the right/necessary solution, but one way would be to move the function definition (for the_keyboard) out of line (define it in some .cpp/.cc/whatever file, not in the header) - if you don't want it to be inlined. On Mon, Sep 20, 2021 at 6:56 AM John Emmas via cfe-users < cfe-use

Re: [cfe-users] [cfe-dev] Removing or obfuscating RTTI type name strings

2021-09-03 Thread David Blaikie via cfe-users
On Fri, Sep 3, 2021 at 2:55 PM Richard Smith via cfe-dev < cfe-...@lists.llvm.org> wrote: > On Fri, 27 Aug 2021 at 11:03, Andy Gibbs via cfe-users < > cfe-users@lists.llvm.org> wrote: > >> Hi there, >> >> I'm hitting a rather difficult problem. I have to compile with RTTI data >> structures gener

Re: [cfe-users] detect default in SwitchInst

2021-07-16 Thread David Blaikie via cfe-users
Ah, LLVM IR isn't really the place to determine how the source was written - the names of those LLVM values aren't always preserved (generally in optimized builds of clang the names will not be generated) - that said, even some LLVM features rely on the names, so it's not totally unusable. You can

Re: [cfe-users] detect default in SwitchInst

2021-07-16 Thread David Blaikie via cfe-users
LLVM IR switch instructions always have a default: https://llvm.org/docs/LangRef.html#switch-instruction - that jumps over the body of the switch. (when lowering C code to LLVM IR the default would be put after the loop, and the breaks from any case statements would jump over that default block) O

Re: [cfe-users] No macros in DI metadata

2021-07-14 Thread David Blaikie via cfe-users
On Wed, Jul 14, 2021 at 10:16 AM Bella V wrote: > > Thanks a lot! It works. > > Also there is no IR code generated for macros. Is there a way to relate > llvm::value's that refer to macros. Not that I know of, no. If you're interested in doing source analysis like this - you might want to use a

Re: [cfe-users] No macros in DI metadata

2021-07-13 Thread David Blaikie via cfe-users
You could check where the macro is defined, I guess? If it's in a DIMacroFile i guess it's not a compiler builtin. It might still be from a system header, etc, if that matters to you - so then you'd have to filter by the DIMacroFile's 'file' attribute. On Tue, Jul 13, 2021 at 7:00 PM Bella V wrot

Re: [cfe-users] No macros in DI metadata

2021-07-13 Thread David Blaikie via cfe-users
Add -fdebug-macro On Tue, Jul 13, 2021 at 4:05 PM Bella V via cfe-users wrote: > > Hello All, > > I'm trying to build a list of macros in a compilation unit using > CU->getMacros(). > I do not see the macros field in DICompileUnit output. > https://godbolt.org/z/b8cM1Yf7v > > Please let me know

Re: [cfe-users] fetch variable names through debugInfo attached to load instructors

2021-05-25 Thread David Blaikie via cfe-users
On Tue, May 25, 2021 at 1:13 PM Bella V wrote: > Thanks! It works. > > One sub-question: How do we analyze the member dereferenced struct > variables as dbg.declares only has the declaration info as inside the > function the struct variable types could have members dereferenced as well. > > Examp

Re: [cfe-users] fetch variable names through debugInfo attached to load instructors

2021-05-20 Thread David Blaikie via cfe-users
You'd have to analyze the dbg.declares and track that they refer to the same thing as the geps/loads you're interested in - from the dbg.declares (& dbg.values) you can follow those to find the variables they refer to. On Thu, May 20, 2021 at 12:18 PM Bella V via cfe-users < cfe-users@lists.llvm.o

Re: [cfe-users] Clang Sizeof give diff value for Microsoft and Linux

2021-02-18 Thread David Blaikie via cfe-users
On Wed, Feb 17, 2021 at 9:17 PM Vivek Pandey < vivek.pan...@tallysolutions.com> wrote: > Dear David, > > > > Greeting! > > > > Please find details inline. > > > > Looking forward to hear from you. > > > > > > Best Regards, > > > > Vivek > > > > *From:* David Blaikie > *Sent:* Thursday, February 1

Re: [cfe-users] Clang Sizeof give diff value for Microsoft and Linux

2021-02-17 Thread David Blaikie via cfe-users
On Wed, Feb 17, 2021 at 12:08 AM Vivek Pandey < vivek.pan...@tallysolutions.com> wrote: > I think Clang, on/for windows, should give a compile time flag/option that > can be used to control it (A flag when set make compile-time operator like > sizeoff to behave like MSVC or non-MSVC) > But that w

Re: [cfe-users] Clang Sizeof give diff value for Microsoft and Linux

2021-01-28 Thread David Blaikie via cfe-users
Clang on Windows is designed to be compatible with MSVC - which has different layout requirements than the Itanium ABI/GCC on Linux. I don't think there's a way to use the same ABI on both platforms - especially not if you are interacting with any code compiled by another compiler on both platforms

Re: [cfe-users] Get Source Location details from IR code (Function Pass)

2021-01-27 Thread David Blaikie via cfe-users
from the llvm::Function you can get a DISubprogram (Function's getSubprogram), from there you could get the DISubprogram's type (getType) and then poke around at the elements of the type, I guess. On Tue, Jan 26, 2021 at 10:39 PM Bella V wrote: > Thank you for the clarification. How do we access

Re: [cfe-users] Get Source Location details from IR code (Function Pass)

2021-01-26 Thread David Blaikie via cfe-users
the location of composite types isn't stored in a DILocation - it's stored in the 'file'/'line' attributes of the DICompositeType (similarly, the members have a 'file' and 'line' attribute). See for instance line 39 of the LLVM IR in https://godbolt.org/z/o3oce5 : !12 = distinct !DICompositeType(

Re: [cfe-users] Get Source Location details from IR code (Function Pass)

2021-01-17 Thread David Blaikie via cfe-users
Not sure I understand the question - llvm.dbg.declare can be queried/examined/etc through the usual LLVM IR APIs, yes - it's an intrinsic call, with operands, etc. It's a DbgVariableIntrinsic ( https://llvm.org/doxygen/classllvm_1_1DbgVariableIntrinsic.html ) you can interrogate for information. O

Re: [cfe-users] Get Source Location details from IR code (Function Pass)

2021-01-12 Thread David Blaikie via cfe-users
You'd have to get IR from somewhere that has attached debug info - such as clang -g On Tue, Jan 12, 2021 at 1:22 PM Bella V wrote: > Do we have to initially attach some metadata to the Value? Because in > function pass, when I do F.getAllMetadata(MDs), i do not see any metadata > appending to MD

Re: [cfe-users] Get Source Location details from IR code (Function Pass)

2021-01-11 Thread David Blaikie via cfe-users
On Mon, Jan 11, 2021 at 4:33 PM Ayush Mittal via cfe-users < cfe-users@lists.llvm.org> wrote: > Hello Cfe Users, > > Could you please point to an effective way to get Source Location details > from an IR code. > From the documentation, I think this could be a way: > Function Pass-> LLVM Value-> MD

Re: [cfe-users] Machine code footprint

2021-01-10 Thread David Blaikie via cfe-users
Looks like most of the difference can be accounted for by the fact that A is not default constructible - which probably causes some more complicated code in the standard library which the compiler isn't currently able to see through. I haven't looked at the specifics of what that might be: $ cat v

Re: [cfe-users] Missing AST Node for parsing code with std::vector::data()

2020-12-03 Thread David Blaikie via cfe-users
You might need to provide more details - at least a cursory example shows the function call in the ast dump: https://godbolt.org/z/zvqTa3 On Thu, Dec 3, 2020 at 4:02 AM Владимир Фролов via cfe-users < cfe-users@lists.llvm.org> wrote: > Greetings! I'm using clang for source-to-source translation.

Re: [cfe-users] -Wconversion does not produce warnings when it should

2020-11-16 Thread David Blaikie via cfe-users
On Mon, Nov 16, 2020 at 4:49 PM Sven Köhler via cfe-users wrote: > > Am 16.11.20 um 21:49 schrieb David Blaikie via cfe-users: > > On Mon, Nov 16, 2020 at 12:36 PM Sven Köhler via cfe-users > > wrote: > >> > >> Can you elaborate what is happening here? >

Re: [cfe-users] -Wconversion does not produce warnings when it should

2020-11-16 Thread David Blaikie via cfe-users
On Mon, Nov 16, 2020 at 12:36 PM Sven Köhler via cfe-users wrote: > > Hi, > > consider the following code: > > uint16_t testa4(uint8_t x, uint8_t y) { > return ( (uint16_t)x << 0 ) > | ( (uint16_t)y << 8 ); > } > uint16_t testb3(uint16_t x, uint16_t y) { > return x|y; > } > uin

Re: [cfe-users] Adding linker flag `-save-temps` resolves the clang-8 error: "unable to make temporary file"

2020-10-05 Thread David Blaikie via cfe-users
Yep, pretty weird that it tries to write to an empty file name. What's the exact raw clang command you used that printed that cc1 command line? On Mon, Oct 5, 2020 at 6:46 AM Danijel DOMAZET < p-danijel.doma...@devialet.com> wrote: > Hi David, Hi Fang-rui, > > Just to remind, when I add -save-te

Re: [cfe-users] Compiling on network share using relative paths fails

2020-09-10 Thread David Blaikie via cfe-users
Can you confirm other tools given similar path specifications in similar circumstances (command line/current working directory/etc) succeed where clang fails? (MSVC, notepad, gcc, 'cat' (if Windows has a 'cat')) On Wed, Sep 9, 2020 at 10:41 AM Telium Technical Support via cfe-users < cfe-users@lis

Re: [cfe-users] How to debug cryptic error message?

2020-08-25 Thread David Blaikie via cfe-users
Unfortunately, probably the first thing I'd try is assembling with the GNU assembler instead (using clang -fno-integrated-as, or using gcc as your assembler driver should reach your system assembler which is probably gas). LLVM's integrated assembler could use a better error message, to be sure.

Re: [cfe-users] inconsistent compilation error inside constexpr if

2020-08-23 Thread David Blaikie via cfe-users
On Sun, Aug 23, 2020 at 9:40 AM Manu agarwal wrote: > Hi David, > > Thanks for the reply. I missed to mention the environment and what i am > trying to do. > > >1. Environment is ClangCL (version 10.0), Microsoft Visual Studio. > >2. I assumed that since the 'constexpr if' evaluates t

Re: [cfe-users] inconsistent compilation error inside constexpr if

2020-08-21 Thread David Blaikie via cfe-users
From what I could test on godbolt, using LLVM evrsions back to 5.0, Clang does reject the "return ClientMain();" call you aren't seeing an error on. So I'm not sure what compiler/version/situation you're running, but at least at first blush it doesn't look like clang. On Fri, Aug 21, 2020 at 1:29

Re: [cfe-users] Adding linker flag `-save-temps` resolves the clang-8 error: "unable to make temporary file"

2020-08-13 Thread David Blaikie via cfe-users
Oh, sorry, I didn't read the question in detail about how -save-temps was making things work when they otherwise were not. If you run clang with -### it'll show the command lines it's using, which should show you where it's trying to write the files so you can change that/make them writable. I'm n

Re: [cfe-users] Adding linker flag `-save-temps` resolves the clang-8 error: "unable to make temporary file"

2020-08-13 Thread David Blaikie via cfe-users
On Thu, Aug 13, 2020 at 2:59 AM Danijel DOMAZET wrote: > > Thanks David. > Why do you think this could be about current dir? > Isn't it about TMP (or TEMP or TMPDIR) environment variables? Because I ran it locally, and observed that that's where the files were written to. > > Thanks, > Danijel D

Re: [cfe-users] Adding linker flag `-save-temps` resolves the clang-8 error: "unable to make temporary file"

2020-08-12 Thread David Blaikie via cfe-users
Looks like it writes the files to the current directory - do you have permission to access the current directory? On Wed, Aug 12, 2020 at 6:28 AM Danijel DOMAZET via cfe-users wrote: > > Hi clang users, > I am using Windows10 + Cygwin + Eclipse + LLVM toolchain to build a C/C++ > project. > > Th

Re: [cfe-users] Binary modifications

2020-07-24 Thread David Blaikie via cfe-users
I don't think clang/llvm provides much in the way of infrastructure that would help with that task. I've seen things like that done with https://github.com/microsoft/detours fwiw. On Fri, Jul 24, 2020 at 7:34 AM Mahmood Naderan via cfe-users wrote: > > Hi, > I would like to know if it is possible

Re: [cfe-users] How is clang binary compatibility?

2020-07-12 Thread David Blaikie via cfe-users
In the sense of "can I link an object built with clang 10 with an object built with clang 7" - generally: yes. That's defined by the Itanium ABI, the same thing that lets you link Clang built objects with GCC built objects, for instance. On Sun, Jul 12, 2020 at 9:29 AM Danny Zhu via cfe-users wro

Re: [cfe-users] Please help

2020-06-14 Thread David Blaikie via cfe-users
On Sun, Jun 14, 2020 at 2:13 PM JacobK622 via cfe-users wrote: > > To, llvm/clang > Firstly I'd like to preface this by saying a few things: > > 1. I don't always know what is or isn't socially appropriate to > say/ask/do, so please don't get mad at me if I say/ask/do something > inappr

Re: [cfe-users] Implicit or explicit public inheritance in the AST

2020-06-08 Thread David Blaikie via cfe-users
Looks like comparing getAccessSpecifierAsWritten with getAccessSpecifier might help: https://clang.llvm.org/doxygen/classclang_1_1CXXBaseSpecifier.html#a6abcd6d5d707f4cab88bab1fc916bfad On Mon, Jun 8, 2020 at 1:09 PM Csaba Raduly via cfe-users wrote: > > Hi all, > > If I run `clang++ -std=c++17 -

Re: [cfe-users] Linking problem with implicit instantiation of constructor/destructor

2020-04-19 Thread David Blaikie via cfe-users
Yeah, can't seem to divine the concrete wording here either - perhaps Richard will have a moment to chime in. On Sun, Apr 19, 2020 at 6:10 AM Jaroslav Zeman via cfe-users < cfe-users@lists.llvm.org> wrote: > > > > What happens if you change the order of the .cpp files, putting > > template.cpp fi

Re: [cfe-users] Linking problem with implicit instantiation of constructor/destructor

2020-04-17 Thread David Blaikie via cfe-users
I don't believe this code is valid according to C++. I believe it would require an explicit instantiation of the ctor/dtor somewhere to make that code valid - though I don't have chapter and verse on the spec at hand just now to back that up. On Fri, Apr 17, 2020 at 6:54 AM Jaroslav Zeman via cfe-

Re: [cfe-users] Problem building llvm from source

2020-03-07 Thread David Blaikie via cfe-users
What make command did you run? On Sat, Mar 7, 2020 at 8:09 AM Mahmood Naderan via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi, > I want to use a specific revision number and for the cmake command below > > cmake ~/codestitcher/source/llvm-3.9 -DCMAKE_BUILD_TYPE=Release > -DLLVM_TARGETS_TO_B

Re: [cfe-users] How to determine if variable is templated?

2020-02-20 Thread David Blaikie via cfe-users
I don't understand - you'll need to be more specific. (anything that's "this doesn't /always/ happen" sounds like there's a /lot/ going on that's not specified in your question... compilers in general and clang in particular are /very/ deterministic, so they do do the same thing every time - so if

Re: [cfe-users] How to determine if variable is templated?

2020-02-17 Thread David Blaikie via cfe-users
Guessing these sort of functions would be relevant: https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html#a617bcdd5baaab0ccba71a96cd9c2ed03 On Sun, Feb 16, 2020 at 5:43 PM Robert Ankeney via cfe-users < cfe-users@lists.llvm.org> wrote: > Suppose I have some code like: > > template > Type tVar

Re: [cfe-users] clangd --clang-tidy: // NOLINT only works sometimes

2020-01-26 Thread David Blaikie via cfe-users
+Sam in case he's got some thoughts or can rope in others who might. On Sun, Jan 26, 2020 at 1:03 PM tastytea via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi, > I recently started using clangd (9.0.1) with --clang-tidy. I noticed > that suppressing diagnostics only sometimes works. > > For

Re: [cfe-users] Clang optimization options with out dead code elimination?

2019-12-19 Thread David Blaikie via cfe-users
There are lots of reasons a program might fail to do what's desired when optimized - dead code is only one of them, any reason to believe that's the issue at hand? But no, LLVM doesn't really have any support for that. You might try running your program using the various sanitizersn (address, memo

Re: [cfe-users] DeclRefExpr question

2019-12-03 Thread David Blaikie via cfe-users
I'd guess you'd call "getDecl" to get the decl the DeclRefExpr is referencing, then dyn_cast that (the decl is a ValueDecl*) to VarDecl to see if it's a variable that's being referenced (could be a function, etc, etc) then do whatever you want to do with that VarDecl. On Tue, Dec 3, 2019 at 1:33 P

Re: [cfe-users] dumb question about record-command-line

2019-11-19 Thread David Blaikie via cfe-users
Depends on your platform, but probably in some section or another in the object/executable. Try running objdump (or llvm-objdump) -h on the object or executable with/without the switch and see which new section shows up. Then you can use objdump -s (I think it's -s, check the man page, etc) to dump

Re: [cfe-users] Clang9 UBSan and GMP

2019-11-07 Thread David Blaikie via cfe-users
Looks like valgrind catches some things around here: ==115793== Conditional jump or move depends on uninitialised value(s) ==115793==at 0x402671: main (t-sqrlo.c:106) ==115793== ==115793== Conditional jump or move depends on uninitialised value(s) ==115793==at 0x40268A: main (t-sqrlo.c:107

Re: [cfe-users] Clang9 UBSan and GMP

2019-11-07 Thread David Blaikie via cfe-users
UBSan doesn't cover this sort of thing - MSan is the sanitizer for catching uninitialized values. (MSan is, unfortunately, a bit more finicky to use because the whole program (including the standard library) must be compiled with the feature enabled for it to work correctly - I don't have an MSan e

Re: [cfe-users] Why is clang defining NULL as __null ??

2019-11-04 Thread David Blaikie via cfe-users
clang generally also understands __null (for the same reasons GCC does - to provide better diagnostics when using NULL in non-pointer contexts). See, for example, this warning (not an error): https://godbolt.org/z/KvdW7a Can't say I know much about the NDK or what version of clang it has, what fla

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-31 Thread David Blaikie via cfe-users
On Thu, Oct 31, 2019 at 1:51 PM Hans Åberg wrote: > > > On 31 Oct 2019, at 21:40, David Blaikie wrote: > > > >> On Thu, Oct 31, 2019 at 12:00 PM Hans Åberg wrote: > >> > >> > On 31 Oct 2019, at 18:40, David Blaikie wrote: > >> > > >> >> Right, but that is something one would avoid when computi

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-31 Thread David Blaikie via cfe-users
On Thu, Oct 31, 2019 at 12:00 PM Hans Åberg wrote: > > > On 31 Oct 2019, at 18:40, David Blaikie wrote: > > > >> Right, but that is something one would avoid when computing > arithmetical results. > > > > One would try to, yes - but that's sort of what the whole discussion is > resolving around:

Re: [cfe-users] clang-tidy bug?

2019-10-31 Thread David Blaikie via cfe-users
On Thu, Oct 31, 2019 at 11:19 AM Aaron Ballman wrote: > On Thu, Oct 31, 2019 at 1:31 PM David Blaikie wrote: > > > > > > > > On Thu, Oct 31, 2019 at 8:45 AM Aaron Ballman > wrote: > >> > >> On Wed, Oct 30, 2019 at 9:23 PM David Blaikie > wrote: > >> > > >> > Two separate issues here > >> > > >

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-31 Thread David Blaikie via cfe-users
On Thu, Oct 31, 2019 at 2:30 AM Hans Åberg wrote: > > > On 31 Oct 2019, at 01:53, David Blaikie wrote: > > > >> Yes, but assuming that the GMP adheres to the C standard, there should > be no difference in the arithmetical values produced. > > > > Not necessarily - C (well, I don't know the C sta

Re: [cfe-users] clang-tidy bug?

2019-10-31 Thread David Blaikie via cfe-users
On Thu, Oct 31, 2019 at 8:45 AM Aaron Ballman wrote: > On Wed, Oct 30, 2019 at 9:23 PM David Blaikie wrote: > > > > Two separate issues here > > > > 1) the fixit hint, as one of a set of alternatives, isn't likely to be > removed/changed - the (albeit quirky) convention of using extra () to > in

Re: [cfe-users] clang-tidy bug?

2019-10-30 Thread David Blaikie via cfe-users
Two separate issues here 1) the fixit hint, as one of a set of alternatives, isn't likely to be removed/changed - the (albeit quirky) convention of using extra () to indicate an intentional assignment in a condition has been around for a while. So if you use the extra parens without writing an ass

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-30 Thread David Blaikie via cfe-users
On Wed, Oct 30, 2019 at 5:36 PM Hans Åberg wrote: > > > > On 31 Oct 2019, at 00:28, David Blaikie wrote: > > > > > > > > On Wed, Oct 30, 2019 at 4:25 PM Hans Åberg wrote: > > > >> I believe that GMP is just using integer types, and then uses that to > make multiprecision integers, rational numb

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-30 Thread David Blaikie via cfe-users
On Wed, Oct 30, 2019 at 4:25 PM Hans Åberg wrote: > > > On 30 Oct 2019, at 23:50, David Blaikie wrote: > > > >> On Wed, Oct 30, 2019 at 2:29 PM Hans Åberg wrote: > >> Indeed, very hard to figure out. If it is some hidden undefined > behavior causing it, the UBSan should have caught it, but it d

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-30 Thread David Blaikie via cfe-users
On Wed, Oct 30, 2019 at 2:29 PM Hans Åberg wrote: > Indeed, very hard to figure out. If it is some hidden undefined behavior > causing it, the UBSan should have caught it, but it does not. Right - but especially with numerics (especially floating point) there's loads of room for valid but diffe

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-30 Thread David Blaikie via cfe-users
I ran the test & understand it a bit better now - so the abort is part of the code, when the test fails, the test harness uses abort to fail. So this isn't "clang causes abort" (it didn't select a bad instruction, etc) this is "clang causes test failure" - this could be any number of things in ter

Re: [cfe-users] clang-tidy bug?

2019-10-28 Thread David Blaikie via cfe-users
clang-tidy in the command line you gave didn't seem to modify the file for me, did it modify the file for you? Are you objecting to the suggestion, or that it was automatically applied? I would think it'd be a bug to apply any fixit/hint if there are multiple possible suggestions. But the existen

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-25 Thread David Blaikie via cfe-users
ly tested with ubsan > and results are included at https://gmplib.org/devel/tm/gmp/date.html. > > On Oct 25, 2019, at 15:32, David Blaikie via cfe-users < > cfe-users@lists.llvm.org> wrote: > > UBSan doesn't catch everything - you could also try ASan and/or valgrind,

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-25 Thread David Blaikie via cfe-users
UBSan doesn't catch everything - you could also try ASan and/or valgrind, etc. (MSan if you want, but that's a bit fussier/more work to use) On Fri, Oct 25, 2019 at 3:16 PM Hans Åberg wrote: > That is the reason I tried the UBSan, but as it changes optimization, it > does not wrok. > > > > On 26

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-25 Thread David Blaikie via cfe-users
Yeah, coming across compiler bugs does happen - but more often it's bugs in input programs. (one of the reasons compiler engineers aren't likely to jump on reproducing and reducing misbehaving programs, because on the odds, it's not a bug in the compiler) On Fri, Oct 25, 2019 at 3:12 PM Hans Åberg

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-25 Thread David Blaikie via cfe-users
It's hard to know if it's the compiler's fault without a test case - due to the nature of undefined behavior and other things (implementation defined behavior and unspecified behavior) in C++, that the program behaves as expected with another compiler or another set of flags doesn't give a strong i

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-25 Thread David Blaikie via cfe-users
It's pretty hard to conclude whether it's a bug in your code or in the compiler, or both, without narrowing down a test case. On Fri, Oct 25, 2019 at 2:01 PM Hans Åberg wrote: > So then there probably is an issue with the optimization. > > Just run 'gmp-6.1.2’ with MacPorts clang 9.0.0; I got: >

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-25 Thread David Blaikie via cfe-users
Hard to know what might be happening - what sort of failure you're seeing, etc. Perhaps UBSan is stabilizing/changing unspecified rather than undefined behavior - or the test is failing due to some undefined behavior that UBSan doesn't catch, etc. On Fri, Oct 25, 2019 at 11:25 AM Hans Åberg wrote

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-25 Thread David Blaikie via cfe-users
UBSan adds code to check things, it necessarily changes optimizations by having those checks in. It shouldn't affect the behavior of programs that don't exhibit UB (but I imagine it could affect the behavior of programs relying on specific IB (Implementation Defined Behavior)). Reducing a test ca

Re: [cfe-users] Clang9 UBSan and GMP

2019-10-25 Thread David Blaikie via cfe-users
You mentioned "the check gives one error" - which check? On Fri, Oct 25, 2019 at 8:21 AM Hans Åberg via cfe-users < cfe-users@lists.llvm.org> wrote: > [Please cc me, as I am not on the list.] > > When compiling GMP 6.1.2 with MacPorts clang9 on MacOS 10.15, the check > gives one error, but if tur

Re: [cfe-users] Why re-compile clang with clang?

2019-10-19 Thread David Blaikie via cfe-users
Not a requirement, but a suggestion - generally clang/llvm are optimized best with themselves. So it's generally considered the "optimal" setup. On Sat, Oct 19, 2019 at 10:48 AM Pratyush Das via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi, > > I noticed here - > https://clang.llvm.org/docs/

Re: [cfe-users] Why does clang not always produce constant value for same static constexpr

2019-09-25 Thread David Blaikie via cfe-users
On Wed, Sep 25, 2019 at 2:03 PM Christopher Williams wrote: > Thank you Dave. I have an understanding of constexpr evaluation, and > realise the compiler is free to do what it likes in all but test4... I > suppose I'd really like to know if there is an actual limit/threshold in > place. If test3

Re: [cfe-users] Why does clang not always produce constant value for same static constexpr

2019-09-25 Thread David Blaikie via cfe-users
constexpr is a red herring here - except in 4, where you've used the constexpr keyword to create a constexpr context, in 1-3 these are just normal function calls the compiler optimizes as it sees fit - and it seems it saw fit to unroll and optimize to a constant cases 1 and 2, but not case 3 (perha

Re: [cfe-users] Should clang++ -g produce debugging info for all types?

2019-08-09 Thread David Blaikie via cfe-users
On Fri, Aug 9, 2019 at 6:03 PM Bob Eastbrook wrote: > On Mon, Aug 5, 2019 at 1:36 PM David Blaikie wrote: > > > Does it work with gdb? > > It works with gdb. More info: > > g++ & gdb -- works, even without debuginfo for libstdc++ > ^ for std::string I'd expect this. For std::fstream, I expect

Re: [cfe-users] Should clang++ -g produce debugging info for all types?

2019-08-05 Thread David Blaikie via cfe-users
Does it work with gdb? I'm guessing maybe lldb doesn't support the build-id feature that redhat uses ( https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/developer_guide/intro.debuginfo ) ? I'd try gdb + gcc + binutils ld (or gold) + libstdc++ (use std::fstream as an exa

Re: [cfe-users] Should clang++ -g produce debugging info for all types?

2019-07-25 Thread David Blaikie via cfe-users
No, it shouldn't - clang attempts to avoid emitting duplicate debug info across the program (it assumes you built the whole program and all libraries with debug info), gcc assumes the same thing though in slightly different/fewer ways. The solution is to install the -dbg build of your libstdc++ pa

Re: [cfe-users] How do I make CMake use LLD

2019-03-04 Thread David Blaikie via cfe-users
Generally the linker is invoked via the compiler wrapper (eg: "clang x.o y.o" to produce a.out), so you can add to your linker flags "-fuse-ld=lld" to tell the compiler wrapper to lld. On Mon, Mar 4, 2019 at 7:06 AM Itaru Kitayama via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi, > Keeping t

Re: [cfe-users] -Warray-bounds

2018-12-31 Thread David Blaikie via cfe-users
Supporting the oldest form doesn't seem to be a priority for a warning - if you have a very old codebase, probably not worth building it with warnings enabled. Updating code to use more modern/idiomatic forms is within scope for Clang's warnings, within reason, I think. - Dave On Fri, Dec 28, 201

Re: [cfe-users] Error: ISO C++17 does not allow 'register' storage class specifier [-Wregister] when building Boost 1.69.0

2018-12-30 Thread David Blaikie via cfe-users
You could add -Wno-register to the compilation flags, or remove the use of the register keyword from boost, or not compile in C++17 mode? - Dave On Tue, Dec 25, 2018 at 1:10 PM Osman Zakir via cfe-users < cfe-users@lists.llvm.org> wrote: > When I tried to build Boost with LLVM, I got the error m

Re: [cfe-users] My compiler crashes .... but the online godbolt one doesn't ?!

2018-12-12 Thread David Blaikie via cfe-users
On Wed, Dec 12, 2018 at 1:30 AM Andy Gibbs wrote: > On 10 December 2018 18:17, David Blaikie wrote: > > Possible that the online one isn't built with assertions enabled (you > could test this with other known crashers to see if they reproduce on > godbolt with assertion crash dumps or only with r

Re: [cfe-users] My compiler crashes .... but the online godbolt one doesn't ?!

2018-12-10 Thread David Blaikie via cfe-users
Possible that the online one isn't built with assertions enabled (you could test this with other known crashers to see if they reproduce on godbolt with assertion crash dumps or only with raw segfaults)? If that's the case,t hen it's possible that the codepath that should assert continues on and pe

Re: [cfe-users] problem with `candidate template ignored: invalid explicitly-specified argument'

2018-11-06 Thread David Blaikie via cfe-users
Sure, that'd be great - http://bugs.llvm.org On Tue, Nov 6, 2018 at 3:02 AM Werner LEMBERG wrote: > > > Yeah, looks like a bug in Clang to me - CC'ing Richard Smith in case > > this is quick/easy/obvious to him. > > Thanks to all for checking! Shall I open an issue for clang? > > > Werner >

Re: [cfe-users] problem with `candidate template ignored: invalid explicitly-specified argument'

2018-11-05 Thread David Blaikie via cfe-users
ether it violates the standard or not is beyond my knowledge > though. > > type params > https://godbolt.org/z/WpET78 > > nontype params > https://godbolt.org/z/PZIaDn > > Jan > > > On Nov 5, 2018, at 4:36 PM, David Blaikie via cfe-users < > cfe-users@lists

Re: [cfe-users] problem with `candidate template ignored: invalid explicitly-specified argument'

2018-11-05 Thread David Blaikie via cfe-users
Yeah, looks like a bug in Clang to me - CC'ing Richard Smith in case this is quick/easy/obvious to him. Here's my slightly modified test case comparing Clang and GCC's behavior, and adding a non-member overload situation to demonstrate that that works on both compilers: https://godbolt.org/z/cTq06R

Re: [cfe-users] A question regarding formatting of function try-block

2018-09-25 Thread David Blaikie via cfe-users
Not sure who's doing most of the work on clang-format these days - Sam, maybe you know? On Mon, Sep 24, 2018 at 2:07 AM Jakob van Bethlehem via cfe-users < cfe-users@lists.llvm.org> wrote: > Dear all, > > Recently we introduced clang-format into our company, for formatting > c++-code. After some

Re: [cfe-users] Default compiler flags

2018-09-24 Thread David Blaikie via cfe-users
Don't know of any quick way to do that in LLVM - I guess companies/folks who do this go into the source code in Clang's driver and mess with it. - Dave On Mon, Sep 17, 2018 at 10:10 PM Alexander Biddulph via cfe-users < cfe-users@lists.llvm.org> wrote: > I am trying to compile clang/llvm to targ

Re: [cfe-users] Using llvm-ar & llvm-ranlib vs ar & ranlib for creating static libraries when thinLTO is enabled.

2018-08-13 Thread David Blaikie via cfe-users
(Teresa, perhaps you can correct me if I'm wrong here) On Thu, Aug 9, 2018 at 2:21 PM Mateusz Zych via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi :) > > I am trying to compile simple project consisting of an executable "app" > and static library "bar". > Note that I'm enabling thinLTO for

Re: [cfe-users] [cfe-dev] Clang - Requesting Help

2018-08-09 Thread David Blaikie via cfe-users
If you're looking to contribute to Clang & have a particular interest in the AST, etc - the way I started was to look at simple/small bugs in diagnostics - either false positives (a diagnostic (often a warning) produced when it shouldn't be (wehn it doesn't tell the user something actionable/buggy)

Re: [cfe-users] Unexpected (IMO) constant-conversion warning

2018-06-25 Thread David Blaikie via cfe-users
Yeah, the problem is that '~a' is an expression of type 'int' due to something called "the usual arithmetic conversions" - basically in almost any arithmetic expression in C++, all the smaller int types get promoted up to int (this is oversimplifying a bit - but sufficient here - if you look up tha

Re: [cfe-users] cfe-users proof of life

2018-05-07 Thread David Blaikie via cfe-users
Yeah - it's here, but not sure it's really all that much use in my humble opinion. I think the idea was to make it more accessible (you can send mail without subscribing) & to separate the user questions from the developer questions - but I'm not sure there are enough users here to bootstrap much o

Re: [cfe-users] Syncing up clang and clang-tools-extra with llvm for git

2018-03-12 Thread David Blaikie via cfe-users
+Adrian for questions about dsymutil. Though I'm not quite sure how the subject line relates to the question? On Thu, Mar 8, 2018 at 7:03 PM Michael Eisel via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi, > > I'm hitting some segfault when I run dsymutil without any flags, but when > I add

Re: [cfe-users] Writing gcc-style dependency files with clang-cl

2018-03-12 Thread David Blaikie via cfe-users
+Reid for clang-cl info On Tue, Mar 6, 2018 at 6:49 AM Ted Mielczarek via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi there, > > We're continuing to work on making Firefox build with clang-cl in more > configurations, and one of my colleagues recently wondered[1] if we could > generate Make

Re: [cfe-users] Regarding issue with compilation of multiple source files

2018-01-29 Thread David Blaikie via cfe-users
can you show the actual command & it's exact output? I'm guessing you've got a -c (or -S, etc) in there somewhere, perhaps? On Wed, Jan 24, 2018 at 12:08 AM Sameer Joshi via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi, > > I am compiling multiple source files and trying to generate one exec

Re: [cfe-users] [llvm-bugs] Question about debug symbol

2016-10-18 Thread David Blaikie via cfe-users
(moving this thread from llvm-bugs (which is just for our automated bug database emails) to cfe-users) GCC uses an optimization for debug info that Clang has, but does not enable on platforms where the default debugger is LLDB (because LLDB doesn't handle debug info that has this optimization enab

Re: [cfe-users] uniquely identifying names

2016-08-30 Thread David Blaikie via cfe-users
Do you want to identify the same entity across a valid program's various source files? Across changes to that program? (what changes?) If you want to do the former, then producing the mangled name of the entity is probably what you want. (some part of the ABI code in Clang could give you that, I w

Re: [cfe-users] uniquely identifying names

2016-08-26 Thread David Blaikie via cfe-users
There's no structural identity of code in Clang that I know of - I know someone's building a tool for doing structural similarity for things like plagiarism detection (I think there are some patches on the clang mailing list). But if you only need identity within a single process, the pointer valu

Re: [cfe-users] -Wunreachable-code warnings can no longer be suppressed?

2016-08-06 Thread David Blaikie via cfe-users
On Fri, Aug 5, 2016 at 3:56 PM Chris Peterson via cfe-users < cfe-users@lists.llvm.org> wrote: > I suppressed a -Wunreachable-code warning in Firefox earlier this year > [1] by adding extra parentheses, as suggested by Xcode's clang on OS X: > > objdir-osx/dom/bindings/TestJSImplGenBinding.cpp:476

Re: [cfe-users] Code optimization issue Xcode 7

2016-07-18 Thread David Blaikie via cfe-users
It's really hard to help much without a reproduction - also, trying to create a reduced example of the problem can often help you find the issue. So, if you want further advice, I'd suggest starting by ripping apart (a copy of) your program until you can't remove anything else without losing the in

Re: [cfe-users] Help Needed: How to get source line number from .ll file LLVM

2016-07-12 Thread David Blaikie via cfe-users
you would need to build with debug info (-g) or similar (there are a few other options that enable the same source location info) to produce the debuglocs that will tell you about that On Mon, Jul 11, 2016 at 9:40 PM, Shail Dave via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi, > > I am work

Re: [cfe-users] dereferencing null pointers

2016-04-25 Thread David Blaikie via cfe-users
Short answer: No, unfortunately. Longer answer: The runtime failure should help you catch these. Clang does have a diagnostic for /really/ obvious cases of null dereference: null.c:3:3: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference] *((int*)NULL

Re: [cfe-users] Clang-Format: Spacing around operator function definitions

2016-04-08 Thread David Blaikie via cfe-users
+Daniel Jasper, one of the clang-format developers On Fri, Apr 8, 2016 at 12:13 AM, Felix Mauch via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi all, > > I recently stumbled across clang-format and I really like it so far :) > However, I was not able to reproduce some of our csg guidelines.

Re: [cfe-users] Clang 3.9 running 50% slower than 3.7

2016-03-23 Thread David Blaikie via cfe-users
out first removing the cache, >>> CMakeCache.txt. Since the option () command that sets >>> LLVM_ENABLE_ASSERTIONS didn't include FORCE, the previous cached value is >>> preserved. >>> >>> Therefore, I'd recommend always re

  1   2   >