[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-07-02 Thread David Blaikie via cfe-commits
dwblaikie wrote: > It looks like the presence of `static` on template variable specializations > makes difference in the namespace context: https://gcc.godbolt.org/z/WGsreqbz8 > > Specifically, the specializations not marked `static` result in an exported > variable. Thus, we have seemingly

[clang] [Driver] Add -Wa, options --crel and --allow-experimental-crel (PR #97378)

2024-07-02 Thread David Blaikie via cfe-commits
@@ -0,0 +1,25 @@ +// RUN: not %clang -### -c --target=x86_64 -Wa,--crel %s 2>&1 | FileCheck %s --check-prefix=NOEXP + +// NOEXP: error: -Wa,--allow-experimental-crel must be specified to use -Wa,--crel. CREL is experimental and takes a non-standard section type code + +// RUN:

[clang] [clang] Use std::make_unique (NFC) (PR #97176)

2024-06-29 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie approved this pull request. https://github.com/llvm/llvm-project/pull/97176 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Use std::make_unique (NFC) (PR #97176)

2024-06-29 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie edited https://github.com/llvm/llvm-project/pull/97176 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Clang: Add warning flag for storage class specifiers on explicit specializations (PR #96699)

2024-06-27 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie closed https://github.com/llvm/llvm-project/pull/96699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Clang: Add warning flag for storage class specifiers on explicit specializations (PR #96699)

2024-06-27 Thread David Blaikie via cfe-commits
dwblaikie wrote: > Minor nit: Probably don't need to explicitly define a diagnostic group, since > it's only ever used for this diagnostic. Not sure what the conventions are - but I rather like the normalization of having the explicit group, better chance of finding the group/reusing it

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-26 Thread David Blaikie via cfe-commits
dwblaikie wrote: @cor3ntin ping on this? https://github.com/llvm/llvm-project/pull/93430 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

2024-06-26 Thread David Blaikie via cfe-commits
dwblaikie wrote: Oh, this code was touched really recently in 66df6141659375e738d9b9b74bf79b2317576042 (@augusto2112 ) (see notes in previous comments about how this code should be generalized) https://github.com/llvm/llvm-project/pull/93809 ___

[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

2024-06-26 Thread David Blaikie via cfe-commits
dwblaikie wrote: Here's the smallest patch that would put explicit alignment on any packed structure: ``` diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index a072475ba770..bbb13ddd593b 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++

[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

2024-06-26 Thread David Blaikie via cfe-commits
dwblaikie wrote: The other effects of `packed` are encoded (the changes to the member offsets) but that's not the only effect, and we shouldn't use that effect (which isn't guaranteed to be observable - as in the case of "packed struct with a single member/that just happens to not have

[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

2024-06-26 Thread David Blaikie via cfe-commits
dwblaikie wrote: oh, slight misquote above - `aligned(1)` is a no-op, as that attribute can't reduce the alignment... But I think my argument still stands, roughly as - if increases in alignment are explicitly specified, decreases in alignment should be too.

[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

2024-06-26 Thread David Blaikie via cfe-commits
dwblaikie wrote: Ah, I think this right solution to /this/ case is that the compiler should be emitting the alignment for the structure? Like there's no way for the debugger to know that this structure is underaligned at the moment: ``` struct __attribute__((packed)) t1 { int i; }; ```

[clang] Clang: Add warning flag for storage class specifiers on explicit specializations (PR #96699)

2024-06-25 Thread David Blaikie via cfe-commits
dwblaikie wrote: > Should we add a test for this flag? Something around existing tests in > clang/test/CXX/temp/temp.spec/temp.expl.spec/p2-20.cpp and > clang/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp. Oh, right, I did have a new test I meant to add, but that's a better place for it - so I've

[clang] Clang: Add warning flag for storage class specifiers on explicit specializations (PR #96699)

2024-06-25 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie updated https://github.com/llvm/llvm-project/pull/96699 >From a539afc7b81502ffcab7028bfe8266b8e32951d9 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Tue, 25 Jun 2024 21:02:50 + Subject: [PATCH 1/2] Clang: Add warning flag for storage class specifiers on

[clang] [llvm] [MC,llvm-readobj,yaml2obj] Support CREL relocation format (PR #91280)

2024-06-25 Thread David Blaikie via cfe-commits
@@ -86,6 +86,8 @@ DYNAMIC_TAG(RELRSZ, 35) // Size of Relr relocation table. DYNAMIC_TAG(RELR, 36)// Address of relocation table (Relr entries). DYNAMIC_TAG(RELRENT, 37) // Size of a Relr relocation entry. +DYNAMIC_TAG(CREL, 38) // CREL relocation table +

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-06-25 Thread David Blaikie via cfe-commits
dwblaikie wrote: Sent a patch to add a warning flag for the warning this patch uses: https://github.com/llvm/llvm-project/pull/96699 With that, we could disable the warning during the compiler migration, decoupling compiler migration from code cleanup.

[clang] Clang: Add warning flag for storage class specifiers on explicit specializations (PR #96699)

2024-06-25 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie created https://github.com/llvm/llvm-project/pull/96699 With the recent fix for this situation in class members (#93873) (for which the fixed code is invalid prior to this patch - making migrating code difficult as it must be in lock-step with the compiler

[clang] [Clang] Static and explicit object member functions with the same parameter-type-lists (PR #93430)

2024-06-24 Thread David Blaikie via cfe-commits
dwblaikie wrote: Hit an msan use-of-uninitialized on an internal use case (a tool that uses Clang via API). the test was compiling this source code: ``` #include namespace proto2 { struct Message {}; } // namespace proto2 struct FakeProto : proto2::Message { const std::string& getter()

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-06-24 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie approved this pull request. https://github.com/llvm/llvm-project/pull/79230 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-06-24 Thread David Blaikie via cfe-commits
@@ -28,7 +29,7 @@ namespace llvm { } // Prefix of the name of the artificial inline frame. -#define CLANG_TRAP_PREFIX "__clang_trap_msg" +inline constexpr llvm::StringRef CLANG_TRAP_PREFIX = "__clang_trap_msg"; dwblaikie wrote: The name should be changed to

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-06-24 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie edited https://github.com/llvm/llvm-project/pull/79230 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Driver] Expose `-fno-eliminate-unused-debug-types` to clang-cl (PR #95259)

2024-06-24 Thread David Blaikie via cfe-commits
dwblaikie wrote: > > I will say, `-fno-eliminate-unused-debug-types` is a really heavy hammer > > that makes debug info much larger - and my understanding was that games > > tended to have trouble with large debug builds, so I'd be surprised if this > > was a great path forward. > >

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-06-22 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie approved this pull request. Looks OK - one minor nit, I'd probably avoid defining CLANG_TRAP_PREFIX as a macro, but instead as an inline or some other form of constant https://github.com/llvm/llvm-project/pull/79230 ___

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-06-22 Thread David Blaikie via cfe-commits
@@ -27,6 +27,9 @@ namespace llvm { } } +// Prefix of the name of the artificial inline frame. +#define CLANG_TRAP_PREFIX "__clang_trap_msg" dwblaikie wrote: inline StringRef? usual reasons to avoid macros, etc

[clang] [Clang][Driver] Expose `-fno-eliminate-unused-debug-types` to clang-cl (PR #95259)

2024-06-22 Thread David Blaikie via cfe-commits
dwblaikie wrote: I will say, `-fno-eliminate-unused-debug-types` is a really heavy hammer that makes debug info much larger - and my understanding was that games tended to have trouble with large debug builds, so I'd be surprised if this was a great path forward. Do you have a small example

[clang] [Clang][Driver] Expose `-fno-eliminate-unused-debug-types` to clang-cl (PR #95259)

2024-06-22 Thread David Blaikie via cfe-commits
dwblaikie wrote: Yes, the initializers do have to be lazyily evaluated to be a conforming C++ compiler. eg: this code must compile without error so far as I understand: ``` template struct t1 { static constexpr int x = 3 / Value; }; t1<0> v1; ``` Though it seems MSVC doesn't implement this

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-06-20 Thread David Blaikie via cfe-commits
dwblaikie wrote: I think my last comment/question is still open? How/why did the symbol name end up dropping any llvm/clang component to avoid collisions with other names? https://github.com/llvm/llvm-project/pull/79230 ___ cfe-commits mailing list

[clang] [llvm] [BPF] Fix linking issues in static map initializers (PR #91310)

2024-06-18 Thread David Blaikie via cfe-commits
dwblaikie wrote: happy with the test coverage, but I'm probably not the right person to review th ecode in more detail https://github.com/llvm/llvm-project/pull/91310 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

2024-06-18 Thread David Blaikie via cfe-commits
dwblaikie wrote: > That would mean if someone wrote `struct Empty {}; struct Z { Empty a,b,c; > }`, we'd lower it to `{ [3 x i8] }` instead of `{%Empty, %Empty, %Empty}`, > which is a bit ugly. Other than that, sure, I guess we could do that. Ah, fair enough. Glad to understand and I don't

[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

2024-06-17 Thread David Blaikie via cfe-commits
dwblaikie wrote: > Oh, in this particular case, the issue isn't the computed datasize, it's that > FieldDecl::isZeroSize() returns the wrong result. If that's the case, maybe > we can just change FieldDecl::isZeroSize() to say the field is zero size? So > essentially, we pretend all empty

[clang] Revert "Add option to generate additional debug info for expression dereferencing pointer to pointers. #94100" (PR #95174)

2024-06-11 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie approved this pull request. https://github.com/llvm/llvm-project/pull/95174 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Bump the DWARF version number to 5 on Darwin. (PR #95164)

2024-06-11 Thread David Blaikie via cfe-commits
dwblaikie wrote: Congrats on the milestone! Glad to have more of us together on the same version for all the positive feedback loops, etc :) https://github.com/llvm/llvm-project/pull/95164 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [llvm] Add option to generate additional debug info for expression dereferencing pointer to pointers. (PR #94100)

2024-06-10 Thread David Blaikie via cfe-commits
dwblaikie wrote: > G'day -- we've got some tests for -O0 that, with this patch applied, generate > different code with-and-without the `-g` flag, if > `-fdebug-info-for-profiling` is enabled. Example godbolt: > https://godbolt.org/z/qooo5Eah1 . > > It seems the intention of this patch is

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-06-07 Thread David Blaikie via cfe-commits
@@ -1830,6 +1830,9 @@ void ItaniumCXXABI::emitVTableDefinitions(CodeGenVTables , if (VTable->hasInitializer()) return; + if (RD->shouldEmitInExternalSource()) +return; dwblaikie wrote: But this logic (using available externally definitions) is

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-06-06 Thread David Blaikie via cfe-commits
@@ -1830,6 +1830,9 @@ void ItaniumCXXABI::emitVTableDefinitions(CodeGenVTables , if (VTable->hasInitializer()) return; + if (RD->shouldEmitInExternalSource()) +return; dwblaikie wrote: Yes, and we do emit them in normal builds above -O0 if the

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-06-04 Thread David Blaikie via cfe-commits
@@ -3239,6 +3239,12 @@ bool ASTReader::isConsumerInterestedIn(Decl *D) { if (ES->hasExternalDefinitions(D) == ExternalASTSource::EK_Never) return true; + // The dynamic class defined in a named module is interesting. + // The code generator needs to emit its

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-06-04 Thread David Blaikie via cfe-commits
@@ -1185,6 +1190,21 @@ bool CodeGenVTables::isVTableExternal(const CXXRecordDecl *RD) { TSK == TSK_ExplicitInstantiationDefinition) return false; + // Itanium C++ ABI [5.2.3]: + // Virtual tables for dynamic classes are emitted as follows: + // + // - If the

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-06-04 Thread David Blaikie via cfe-commits
dwblaikie wrote: Per ( https://llvm.org/docs/GitHub.html#updating-pull-requests ) please don't force push, makes it hard to follow the changes to the review as they progress. https://github.com/llvm/llvm-project/pull/75912 ___ cfe-commits mailing

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-06-03 Thread David Blaikie via cfe-commits
@@ -1180,6 +1185,21 @@ bool CodeGenVTables::isVTableExternal(const CXXRecordDecl *RD) { TSK == TSK_ExplicitInstantiationDefinition) return false; + // Itanium C++ ABI [5.2.3]: + // Virtual tables for dynamic classes are emitted as follows: + // + // - If the

[clang] [llvm] Add option to generate additional debug info for expression dereferencing pointer to pointers. (PR #94100)

2024-06-01 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie approved this pull request. Looks worth a shot. Please commit this at a time where you can respond to bot fail-mail for a while after the commit. And ensure the commit message has most/all of the details of the original commit, plus the original commit and revert

[clang] 6e975ec - Reapply "[DebugInfo] Add flag to only emit referenced member functions" (#93767)

2024-05-30 Thread David Blaikie via cfe-commits
Author: David Blaikie Date: 2024-05-30T20:36:47Z New Revision: 6e975ecf5c93c40d2f088425548eb6476332629c URL: https://github.com/llvm/llvm-project/commit/6e975ecf5c93c40d2f088425548eb6476332629c DIFF: https://github.com/llvm/llvm-project/commit/6e975ecf5c93c40d2f088425548eb6476332629c.diff

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-05-30 Thread David Blaikie via cfe-commits
@@ -1180,6 +1185,21 @@ bool CodeGenVTables::isVTableExternal(const CXXRecordDecl *RD) { TSK == TSK_ExplicitInstantiationDefinition) return false; + // Itanium C++ ABI [5.2.3]: + // Virtual tables for dynamic classes are emitted as follows: + // + // - If the

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-05-30 Thread David Blaikie via cfe-commits
@@ -1802,6 +1802,12 @@ void ItaniumCXXABI::emitVTableDefinitions(CodeGenVTables , if (VTable->hasInitializer()) return; + // If the class is attached to a C++ named module other than the one + // we're currently compiling, the vtable should be defined there. + if

[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

2024-05-30 Thread David Blaikie via cfe-commits
dwblaikie wrote: Could probably adjust the assertions to be `assert (debug || whatever)` rather than `if (!debug) assert(whatever)`. My understanding/expectation was that these assertions would be removed entirely - that whatever generated the AST should just be trusted, whether it's the

[clang] Revert "[DebugInfo] Add flag to only emit referenced member functions" (PR #93767)

2024-05-29 Thread David Blaikie via cfe-commits
dwblaikie wrote: Thanks! Sorry I didn't get to it sooner https://github.com/llvm/llvm-project/pull/93767 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Add option to generate additional debug info for expression dereferencing pointer to pointers. (PR #81545)

2024-05-29 Thread David Blaikie via cfe-commits
dwblaikie wrote: > There is a broken test in CI: > https://lab.llvm.org/buildbot/#/builders/272/builds/17864 Fixed in ea1ecb50fa831583241fc531153bd2c072955d29 https://github.com/llvm/llvm-project/pull/81545 ___ cfe-commits mailing list

[clang] ea1ecb5 - Fix test - remove unnecessary/incorrect `-S`, in favor of `-emit-llvm`

2024-05-29 Thread David Blaikie via cfe-commits
Author: David Blaikie Date: 2024-05-29T23:36:43Z New Revision: ea1ecb50fa831583241fc531153bd2c072955d29 URL: https://github.com/llvm/llvm-project/commit/ea1ecb50fa831583241fc531153bd2c072955d29 DIFF: https://github.com/llvm/llvm-project/commit/ea1ecb50fa831583241fc531153bd2c072955d29.diff

[clang] [DebugInfo] Add flag to only emit referenced member functions (PR #87018)

2024-05-29 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie closed https://github.com/llvm/llvm-project/pull/87018 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Add option to generate additional debug info for expression dereferencing pointer to pointers. (PR #81545)

2024-05-29 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie approved this pull request. Fair enough - let's give it a go. https://github.com/llvm/llvm-project/pull/81545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [llvm] [BPF] Fix linking issues in static map initializers (PR #91310)

2024-05-29 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie commented: Is there some test coverage that shows that unreferenced variables/functions aren't included in the output? https://github.com/llvm/llvm-project/pull/91310 ___ cfe-commits mailing list

[clang] [llvm] [DebugInfo][BPF] Add 'btf:type_tag' annotation in DWARF (PR #91423)

2024-05-29 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie approved this pull request. approving mostly on the basis of my own previous approval on phab https://github.com/llvm/llvm-project/pull/91423 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-05-29 Thread David Blaikie via cfe-commits
@@ -1802,6 +1802,12 @@ void ItaniumCXXABI::emitVTableDefinitions(CodeGenVTables , if (VTable->hasInitializer()) return; + // If the class is attached to a C++ named module other than the one + // we're currently compiling, the vtable should be defined there. + if

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-05-29 Thread David Blaikie via cfe-commits
@@ -1180,6 +1185,21 @@ bool CodeGenVTables::isVTableExternal(const CXXRecordDecl *RD) { TSK == TSK_ExplicitInstantiationDefinition) return false; + // Itanium C++ ABI [5.2.3]: + // Virtual tables for dynamic classes are emitted as follows: + // + // - If the

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-05-29 Thread David Blaikie via cfe-commits
@@ -1180,6 +1185,21 @@ bool CodeGenVTables::isVTableExternal(const CXXRecordDecl *RD) { TSK == TSK_ExplicitInstantiationDefinition) return false; + // Itanium C++ ABI [5.2.3]: + // Virtual tables for dynamic classes are emitted as follows: + // + // - If the

[clang] [Serialization] Check for stack exhaustion when reading declarations (PR #79875)

2024-05-29 Thread David Blaikie via cfe-commits
dwblaikie wrote: (a bunch of compiler-rt tests also use ulimit, but doesn't look like any llvm core tests do... ) https://github.com/llvm/llvm-project/pull/79875 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Serialization] Check for stack exhaustion when reading declarations (PR #79875)

2024-05-29 Thread David Blaikie via cfe-commits
dwblaikie wrote: there's a couple of tests that use `ulimit` (`clang/test/SemaCXX/PR51712-large-array-constexpr-check-oom.cpp` and `clang/test/PCH/leakfiles.test`) - so that technique could be used to test this in a way that's fast enough to check in?

[clang] [llvm] [Clang] Fix definition of layout-compatible to ignore empty classes (PR #92103)

2024-05-29 Thread David Blaikie via cfe-commits
dwblaikie wrote: Ah, OK - guess this might not be an ABI issue, then - carry on :) (I'll leave it to other Clang-y folks to do the rest of the review, the ABI issues were my only concern) https://github.com/llvm/llvm-project/pull/92103 ___

[clang] [llvm] [Clang] Fix definition of layout-compatible to ignore empty classes (PR #92103)

2024-05-28 Thread David Blaikie via cfe-commits
dwblaikie wrote: > @dwblaikie This patch will bring Clang in line with GCC and MSVC: > https://godbolt.org/z/nj715zbsW would the change be ABI incompatible with previous versions of clang? If so, then it'll need to be versioned in Clang's ClangABI handling, so that platforms (like Sony's

[clang] [llvm] [llvm] Add triples for managarm (PR #87845)

2024-05-28 Thread David Blaikie via cfe-commits
dwblaikie wrote: @MaskRay seems like this target might be too niche to go into LLVM at this time? is it worth considering some bar before accepting such a thing into LLVM, rather than encouraging folks to maintain such a thing in a branch for now?

[clang] [DebugInfo] Add flag to only emit referenced member functions (PR #87018)

2024-05-28 Thread David Blaikie via cfe-commits
@@ -4260,6 +4260,13 @@ defm strict_dwarf : BoolOption<"g", "strict-dwarf", "the specified version, avoiding features from later versions.">, NegFlag, BothFlags<[], [ClangOption, CLOption, DXCOption]>>, Group; +defm omit_unreferenced_members : BoolOption<"g",

[clang] [DebugInfo] Add flag to only emit referenced member functions (PR #87018)

2024-05-24 Thread David Blaikie via cfe-commits
dwblaikie wrote: > I think the comment about `s/members/methods/` is still outstanding - I agree > that methods is more descriptive than members. Yeah, seems I'm outvoted here. I'm a bit of a pedant for the C++ standard language, which doesn't talk about "methods", only "member functions".

[clang] [DebugInfo] Add flag to only emit referenced member functions (PR #87018)

2024-05-24 Thread David Blaikie via cfe-commits
@@ -4260,6 +4260,13 @@ defm strict_dwarf : BoolOption<"g", "strict-dwarf", "the specified version, avoiding features from later versions.">, NegFlag, BothFlags<[], [ClangOption, CLOption, DXCOption]>>, Group; +defm omit_unreferenced_members : BoolOption<"g",

[clang] [DebugInfo] Add flag to only emit referenced member functions (PR #87018)

2024-05-24 Thread David Blaikie via cfe-commits
@@ -2755,7 +2755,7 @@ CGDebugInfo::CreateTypeDefinition(const RecordType *Ty) { // Collect data fields (including static variables and any initializers). CollectRecordFields(RD, DefUnit, EltTys, FwdDecl); - if (CXXDecl) + if (CXXDecl &&

[clang] [DebugInfo] Add flag to only emit referenced member functions (PR #87018)

2024-05-24 Thread David Blaikie via cfe-commits
@@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -gomit-unreferenced-members %s -emit-llvm -o - | FileCheck %s dwblaikie wrote: Done https://github.com/llvm/llvm-project/pull/87018 ___ cfe-commits

[clang] [DebugInfo] Add flag to only emit referenced member functions (PR #87018)

2024-05-24 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie updated https://github.com/llvm/llvm-project/pull/87018 >From 6834c245205d1e38a615e97217dada3cd941ed03 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 2 Jun 2023 15:04:14 + Subject: [PATCH 1/3] [DebugInfo] Add flag to only emit referenced member

[clang] [llvm] [Clang] Fix definition of layout-compatible to ignore empty classes (PR #92103)

2024-05-20 Thread David Blaikie via cfe-commits
dwblaikie wrote: How's this compare with other implementations clang is trying to be compatible with (gcc (in the normal clang driver mode) and msvc (in clang-cl mode))? Would this be an ABI break against them, or is this intended as an ABI fix to align better with them? Or some third option?

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-05-13 Thread David Blaikie via cfe-commits
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile *CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent, return DBuilder.createTempMacroFile(Parent, Line, FName); } +llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor( dwblaikie wrote: Eh, I'm not too

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-05-13 Thread David Blaikie via cfe-commits
dwblaikie wrote: Hmm, do other builtins actually end up as symbol names? I think most of them lower to an instruction or two - I guess this one doesn't lower to an actual symbol, only a DWARF symbol - but maybe that's still different enough it should use an llvm or clang in the name...

[clang] [clang-tools-extra] [flang] [llvm] [mlir] [polly] [test]: fix filecheck annotation typos (PR #91854)

2024-05-13 Thread David Blaikie via cfe-commits
dwblaikie wrote: @pogo59 - you might find this interesting in terms of bitrotten tests, etc. https://github.com/llvm/llvm-project/pull/91854 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [llvm] [MC,llvm-readobj,yaml2obj] Support CREL relocation format (PR #91280)

2024-05-09 Thread David Blaikie via cfe-commits
dwblaikie wrote: > Switched to 0x4014 (generic range) to retain linker errors while making > the experimental status stand out. Add a comment to make the intention > clearer. Seems a bit weird/problematic, using something in the reserved range/not in a user extension space, but I guess

[clang] [llvm] [MC,clang,llvm-readobj,yaml2obj] Support CREL relocation format (PR #91280)

2024-05-08 Thread David Blaikie via cfe-commits
dwblaikie wrote: > This approahc parallels the strategy used for > [-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang](https://reviews.llvm.org/D125142), > albeit a nicer name. Fair enough - yeah, if we're wordsmithing this. Maybe "allow" would be a good word, rather

[clang] [llvm] [MC,clang,llvm-readobj,yaml2obj] Support CREL relocation format (PR #91280)

2024-05-07 Thread David Blaikie via cfe-commits
dwblaikie wrote: Oh, and I take it there's no /official/ extension space in the SHT_* space? The intent is to standardize it where it lies? (like use 20 for the shipped version? Or eventually get some lower designation?) I understand tnhe hesitance to use "SHT_LLVM" or the like (though

[clang] [llvm] [MC,clang,llvm-readobj,yaml2obj] Support CREL relocation format (PR #91280)

2024-05-07 Thread David Blaikie via cfe-commits
dwblaikie wrote: Presumably this'll be split out into separate reviews for the components here? (I'd guess llvm-mc then clang integrated assembler, with readobj and yaml2obj in any order/don't have dependencies, unless they're needed for testing, in which case I guess they come first?) I

[clang] [Modules] Detect ODR mismatches for enums in non-C++ like in C++. (PR #90298)

2024-05-06 Thread David Blaikie via cfe-commits
dwblaikie wrote: > Though we detect when the types aren't identical and don't try to use them > interchangeably. The change extends the existing behavior for structs/unions > to enums. OK, still a bit confused though - "like in C++", I assume in C++ we reject mismatched types coming from

[clang] [llvm] Add option to generate additional debug info for expression dereferencing pointer to pointers. (PR #81545)

2024-05-06 Thread David Blaikie via cfe-commits
@@ -5636,6 +5636,84 @@ void CGDebugInfo::EmitExternalVariable(llvm::GlobalVariable *Var, Var->addDebugInfo(GVE); } +void CGDebugInfo::EmitPseudoVariable(CGBuilderTy , + llvm::Instruction *Value, QualType Ty) { + // Only when -g2 or

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-05-06 Thread David Blaikie via cfe-commits
@@ -27,6 +27,9 @@ namespace llvm { } } +// Prefix for __builtin_verbose_trap. +#define CLANG_VERBOSE_TRAP_PREFIX "__llvm_verbose_trap" dwblaikie wrote: & not sure it being a compile time constant regex is super important - the regex compilation probably

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-05-06 Thread David Blaikie via cfe-commits
@@ -27,6 +27,9 @@ namespace llvm { } } +// Prefix for __builtin_verbose_trap. +#define CLANG_VERBOSE_TRAP_PREFIX "__llvm_verbose_trap" dwblaikie wrote: I think we usually use some llvm or clang prefix in these sort of things, to reduce the chance of

[clang] [Clang] Fall back to DW_TAG_typedef for instantiation dependent template aliases (PR #90032)

2024-05-03 Thread David Blaikie via cfe-commits
dwblaikie wrote: > > Comment in the code should probably mention this as a FIXME and include a > > reference to the issue? > > Sure, added in > [f78949a](https://github.com/llvm/llvm-project/commit/f78949a07e33017a798c410a102c95455685a9b1) Thanks! > > Also, there's another bug here - the

[clang] 1cb3371 - Ensure test writes objects to test temp dir

2024-04-29 Thread David Blaikie via cfe-commits
Author: David Blaikie Date: 2024-04-29T23:50:18Z New Revision: 1cb33713910501c6352d0eb2a15b7a15e6e18695 URL: https://github.com/llvm/llvm-project/commit/1cb33713910501c6352d0eb2a15b7a15e6e18695 DIFF: https://github.com/llvm/llvm-project/commit/1cb33713910501c6352d0eb2a15b7a15e6e18695.diff

[clang] [Modules] Detect ODR mismatches for enums in non-C++ like in C++. (PR #90298)

2024-04-29 Thread David Blaikie via cfe-commits
dwblaikie wrote: > > C doesn't have an odr, does it? > > For non-C++ "ODR" has a meaning more like "ODR-inspired checks". But there is > no language rule that would require enforcement and there is no impact on > linkage (at least during deserialization). Not sure I'm following the response

[clang] [Clang] Fall back to DW_TAG_typedef for instantiation dependent template aliases (PR #90032)

2024-04-29 Thread David Blaikie via cfe-commits
dwblaikie wrote: Comment in the code should probably mention this as a FIXME and include a reference to the issue? Also, there's another bug here - the DW_TAG_typedef is in the CU scope, instead of the struct scope. But if the struct is a non-template, the typedef is in the struct scope as

[clang] [Modules] Detect ODR mismatches for enums in non-C++ like in C++. (PR #90298)

2024-04-27 Thread David Blaikie via cfe-commits
dwblaikie wrote: C doesn't have an odr, does it? https://github.com/llvm/llvm-project/pull/90298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-04-22 Thread David Blaikie via cfe-commits
@@ -3379,6 +3379,60 @@ Query for this feature with ``__has_builtin(__builtin_debugtrap)``. Query for this feature with ``__has_builtin(__builtin_trap)``. +``__builtin_verbose_trap`` dwblaikie wrote: Ah, OK - that seems like more reason the prefix should be

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-04-22 Thread David Blaikie via cfe-commits
@@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify %s + +#if !__has_builtin(__builtin_verbose_trap) +#error +#endif + +constexpr char const* constMsg1 = "hello"; +char const* const constMsg2 = "hello"; +char const constMsg3[] = "hello"; +

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-04-22 Thread David Blaikie via cfe-commits
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile *CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent, return DBuilder.createTempMacroFile(Parent, Line, FName); } +llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor( dwblaikie wrote: I think I agree

[clang] [llvm] Add option to generate additional debug info for expression dereferencing pointer to pointers. (PR #81545)

2024-04-22 Thread David Blaikie via cfe-commits
@@ -5636,6 +5636,84 @@ void CGDebugInfo::EmitExternalVariable(llvm::GlobalVariable *Var, Var->addDebugInfo(GVE); } +void CGDebugInfo::EmitPseudoVariable(CGBuilderTy , + llvm::Instruction *Value, QualType Ty) { + // Only when -g2 or

[clang] [llvm] Add option to generate additional debug info for expression dereferencing pointer to pointers. (PR #81545)

2024-04-22 Thread David Blaikie via cfe-commits
@@ -5636,6 +5636,84 @@ void CGDebugInfo::EmitExternalVariable(llvm::GlobalVariable *Var, Var->addDebugInfo(GVE); } +void CGDebugInfo::EmitPseudoVariable(CGBuilderTy , + llvm::Instruction *Value, QualType Ty) { + // Only when -g2 or

[clang] [llvm] Add option to generate additional debug info for expression dereferencing pointer to pointers. (PR #81545)

2024-04-22 Thread David Blaikie via cfe-commits
@@ -1787,7 +1787,26 @@ Value *ScalarExprEmitter::VisitMemberExpr(MemberExpr *E) { } } - return EmitLoadOfLValue(E); + llvm::Value *Result = EmitLoadOfLValue(E); + + // If -fdebug_info_for_profiling is specified, emit a pseudo variable and its

[clang] Reapply "[Clang][Sema] placement new initializes typedef array with correct size (#83124)" (PR #89036)

2024-04-19 Thread David Blaikie via cfe-commits
dwblaikie wrote: > Yes it's fixed now. Please include details of the fix I the patch description https://github.com/llvm/llvm-project/pull/89036 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] Reapply "[Clang][Sema] placement new initializes typedef array with correct size (#83124)" (PR #89036)

2024-04-18 Thread David Blaikie via cfe-commits
dwblaikie wrote: > The original patch pointed out a regression: > > https://github.com/llvm/llvm-project/pull/83124#issuecomment-2060090590 > > Please contact that person and get a reproducer and make sure you aren't > breaking them. Repro was provided further down:

[clang] [Clang][Sema] placement new initializes typedef array with correct size (PR #83124)

2024-04-17 Thread David Blaikie via cfe-commits
dwblaikie wrote: Simplified a bit more: ``` template void f1() { int (*x)[1] = new int[1][1]; // fails } template void f1(); void f2() { int (*x)[1] = new int[1][1]; // passes } ``` https://godbolt.org/z/MhaYbvefG - yeah seems pretty clear this is a regression. Compiles with GCC, fails

[clang] [llvm] [Clang] Emit DW_TAG_template_alias for template aliases (PR #87623)

2024-04-15 Thread David Blaikie via cfe-commits
dwblaikie wrote: > Thanks @dwblaikie > > > Bit unfortunate to store template parameters in different ways (in the > > extraData for the alias template, but in the templateParams for the > > composite types) - but I guess it'd be more invasive to try to represent > > alias templates as

[clang] [llvm] [Clang] Emit DW_TAG_template_alias for template aliases (PR #87623)

2024-04-12 Thread David Blaikie via cfe-commits
dwblaikie wrote: Re: code: Looks about right. Bit unfortunate to store template parameters in different ways (in the `extraData` for the alias template, but in the `templateParams` for the composite types) - but I guess it'd be more invasive to try to represent alias templates as composite

[clang] [C++20] [Modules] Introduce -fexperimental-modules-reduced-bmi (PR #85050)

2024-04-12 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie edited https://github.com/llvm/llvm-project/pull/85050 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] [Modules] Introduce -fexperimental-modules-reduced-bmi (PR #85050)

2024-04-12 Thread David Blaikie via cfe-commits
https://github.com/dwblaikie approved this pull request. Give it a go https://github.com/llvm/llvm-project/pull/85050 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] [Modules] Introduce -fexperimental-modules-reduced-bmi (PR #85050)

2024-04-12 Thread David Blaikie via cfe-commits
@@ -1061,6 +1070,16 @@ CodeGenAction::CreateASTConsumer(CompilerInstance , StringRef InFile) { CI.getPreprocessor().addPPCallbacks(std::move(Callbacks)); } + if (CI.getFrontendOpts().GenReducedBMI && + !CI.getFrontendOpts().ModuleOutputPath.empty()) { +

[clang] [llvm] [Clang] Emit DW_TAG_template_alias for template aliases (PR #87623)

2024-04-12 Thread David Blaikie via cfe-commits
dwblaikie wrote: > > I'm a little uncomfortable with adding a new user-facing option for > > template aliases. Even with that in place, we should not warn and refuse to > > do what the user asked for, based on DWARF version. -gdwarf-2 -gsplit-dwarf > > generates a .dwo file claiming to be v2,

[clang] [llvm] Add option to generate additional debug info for expression dereferencing pointer to pointers. (PR #81545)

2024-04-02 Thread David Blaikie via cfe-commits
dwblaikie wrote: > As for impact, I believe @namhyung did some measurement for building the > Linux kernel, and it does not have a significant impact. That'd surprise me quite a bit - perhaps a self-host build of clang (ideally in Google's build config, that being the one you and I care about

[clang] [clang][Sema] Ignore the parentheses in the guard of DiagnoseUnexpandedParameterPack (PR #86401)

2024-04-01 Thread David Blaikie via cfe-commits
dwblaikie wrote: Thanks for continuing to look into this! @cor3ntin - perhaps you've got some more thoughts on this too? https://github.com/llvm/llvm-project/pull/86401 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-04-01 Thread David Blaikie via cfe-commits
@@ -1483,10 +1483,15 @@ void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) { if (D->isThisDeclarationADefinition()) Record.AddCXXDefinitionData(D); - // Store (what we currently believe to be) the key function to avoid - // deserializing every method so we can

  1   2   3   4   5   6   7   8   9   10   >