[clang] 7c3707a - Reland "clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (#70639)"

2023-11-06 Thread Michael Buch via cfe-commits
Author: Michael Buch Date: 2023-11-07T04:53:54Z New Revision: 7c3707aea8a6f1fc245ad2862982b8a51b6c0fea URL: https://github.com/llvm/llvm-project/commit/7c3707aea8a6f1fc245ad2862982b8a51b6c0fea DIFF: https://github.com/llvm/llvm-project/commit/7c3707aea8a6f1fc245ad2862982b8a51b6c0fea.diff LOG:

[lldb] [clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-11-08 Thread Michael Buch via cfe-commits
Michael137 wrote: > This causes Clang to assert: > > ``` > llvm/lib/IR/Metadata.cpp:689: > void llvm::MDNode::resolve(): Assertion `isUniqued() && "Expected this > to be uniqued"' failed. > ``` > > See https://bugs.chromium.org/p/chromium/issues/detail?id=1500262#c1 for a > reprod

[lldb] [clang] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-08 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/71780 This patch relands https://github.com/llvm/llvm-project/pull/70639 It was reverted because under certain conditions we triggered an assertion in `DIBuilder`. Specifically, in the original patch we called `Emi

[lldb] [clang] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-08 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/71780 >From e5bc858c35b479d29174c9945c6c67f4d2dc085b Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 9 Nov 2023 01:13:21 + Subject: [PATCH 1/2] Reland "[clang][DebugInfo] Emit global variable definitions

[lldb] [clang] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-09 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/71780 >From e5bc858c35b479d29174c9945c6c67f4d2dc085b Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 9 Nov 2023 01:13:21 + Subject: [PATCH 1/3] Reland "[clang][DebugInfo] Emit global variable definitions

[lldb] [clang] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-09 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/71780 >From e5bc858c35b479d29174c9945c6c67f4d2dc085b Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 9 Nov 2023 01:13:21 + Subject: [PATCH 1/4] Reland "[clang][DebugInfo] Emit global variable definitions

[lldb] [clang] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-09 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/71780 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-09 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/71780 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-10 Thread Michael Buch via cfe-commits
@@ -5596,6 +5587,42 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, const APValue &Init) { TemplateParameters, Align)); } +void CGDebugInfo::EmitGlobalVariable(const VarDecl *VD) { + assert(VD->hasInit()); + assert(CGM.getCodeGenOpts().hasReducedDebugInfo

[lldb] [clang] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-10 Thread Michael Buch via cfe-commits
@@ -5800,6 +5827,18 @@ void CGDebugInfo::setDwoId(uint64_t Signature) { } void CGDebugInfo::finalize() { + for (auto const *VD : StaticDataMemberDefinitionsToEmit) { +assert(VD->isStaticDataMember()); + +if (DeclCache.contains(VD)) + continue; + +if (!VD->has

[lldb] [clang] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-10 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/71780 >From e5bc858c35b479d29174c9945c6c67f4d2dc085b Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 9 Nov 2023 01:13:21 + Subject: [PATCH 1/4] Reland "[clang][DebugInfo] Emit global variable definitions

[lldb] [clang] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-11 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/71780 >From e5bc858c35b479d29174c9945c6c67f4d2dc085b Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 9 Nov 2023 01:13:21 + Subject: [PATCH 1/5] Reland "[clang][DebugInfo] Emit global variable definitions

[clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-11 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/71780 >From e5bc858c35b479d29174c9945c6c67f4d2dc085b Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 9 Nov 2023 01:13:21 + Subject: [PATCH 1/6] Reland "[clang][DebugInfo] Emit global variable definitions

[lldb] [clang] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-12 Thread Michael Buch via cfe-commits
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/71780 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang] [llvm][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72234)

2023-11-14 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/72234 This patch adds the LLVM-side infrastructure to implement DWARFv5 issue 161118.1: "DW_TAG for C++ static data members". The clang-side of this patch will simply construct the DIDerivedType with a different D

[clang] [clang][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72235)

2023-11-14 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/72235 This patch implements the DWARFv5 issue 161118.1: "DW_TAG for C++ static data members". This will simplify LLDB's handling of static data members greatly in the long term since we no longer need to differentia

[clang] [clang][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72235)

2023-11-14 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/72235 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72235)

2023-11-14 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/72235 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72235)

2023-11-14 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/72235 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [llvm][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72234)

2023-11-14 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/72234 >From af4a49c1f468705f2f7226e4244936363c41155e Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Mon, 6 Nov 2023 11:52:47 + Subject: [PATCH 1/2] [llvm][DebugInfo] DWARFv5: static data members declarations

[clang] [lldb] [clang][DebugInfo] Revert "emit variable definitions for constant-initialized static data-members" (PR #74580)

2023-12-06 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/74580 This commit reverts the changes in https://github.com/llvm/llvm-project/pull/71780 and all of its follow-up patches. We got reports of the `.debug_names/.debug_gnu_pubnames/gdb_index/etc.` sections growing

[clang] [lldb] [clang][DebugInfo] Revert "emit definitions for constant-initialized static data-members" (PR #74580)

2023-12-06 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/74580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[lldb] [clang] [clang][DebugInfo] Revert "emit definitions for constant-initialized static data-members" (PR #74580)

2023-12-06 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/74580 >From fe9624fdf898a2a629bb34f070d0e084f6dc0aa9 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Tue, 5 Dec 2023 14:52:00 + Subject: [PATCH 1/2] [clang][DebugInfo] Revert "emit variable definitions for co

[clang] [lldb] [clang][DebugInfo] Revert "emit definitions for constant-initialized static data-members" (PR #74580)

2023-12-06 Thread Michael Buch via cfe-commits
Michael137 wrote: > Do you need me to merge that for you? Was going to wait until some more people had the chance to look. But if urgent, I don't think there should be any trouble merging this sooner https://github.com/llvm/llvm-project/pull/74580 __

[clang] [lldb] [clang][DebugInfo] Revert "emit definitions for constant-initialized static data-members" (PR #74580)

2023-12-06 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/74580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lldb] [clang][DebugInfo] Revert "emit definitions for constant-initialized static data-members" (PR #74580)

2023-12-06 Thread Michael Buch via cfe-commits
Michael137 wrote: > > To support access to such constants from LLDB we'll most likely have to > > have to make LLDB find the constants by looking at the containing class > > first. > > Tangentially related to: > https://discourse.llvm.org/t/rfc-improve-dwarf-5-debug-names-type-lookup-parsing-

[clang] [lldb] [clang][DebugInfo] Revert "emit definitions for constant-initialized static data-members" (PR #74580)

2023-12-06 Thread Michael Buch via cfe-commits
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/74580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[lldb] [clang] fixing issue #64441 (PR #74814)

2023-12-08 Thread Michael Buch via cfe-commits
@@ -56,10 +56,10 @@ namespace Foo = A::B; // namespace alias using Foo::myfunc; // using declaration -using namespace Foo;// using directive +//removing namespace foo; for quality naming Michael137 wrote: The `using` directive was used here to ma

[llvm] [clang] [llvm][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72234)

2023-11-14 Thread Michael Buch via cfe-commits
Michael137 wrote: > I think this is missing a test in clang/test/CodeGenCXX that verifies Clang > generates the expected LLVM IR. I added those tests here: https://github.com/llvm/llvm-project/pull/72235 The IR doesn't change with this patch. It merely adds the necessary parameter to the DIBu

[clang] [llvm] [llvm][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72234)

2023-11-15 Thread Michael Buch via cfe-commits
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/72234 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang] [flang] [compiler-rt] [llvm] [libc] [clang][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72235)

2023-11-15 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/72235 >From c0db61f318f50a1cf219c69af9c6b624b05c9da1 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Mon, 13 Nov 2023 09:48:39 + Subject: [PATCH] [clang][DebugInfo] DWARFv5: static data members declarations a

[clang] [llvm] [llvm][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72234)

2023-11-15 Thread Michael Buch via cfe-commits
Michael137 wrote: Looks like the OCaml bindings are using the C-API that was changed in this PR. Will make a follow-up fix for those https://github.com/llvm/llvm-project/pull/72234 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang] 8e8bad7 - Revert "[llvm][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (#72234)"

2023-11-15 Thread Michael Buch via cfe-commits
Author: Michael Buch Date: 2023-11-15T08:50:16Z New Revision: 8e8bad70e6db0b04198c025bef9acccfd06f36f0 URL: https://github.com/llvm/llvm-project/commit/8e8bad70e6db0b04198c025bef9acccfd06f36f0 DIFF: https://github.com/llvm/llvm-project/commit/8e8bad70e6db0b04198c025bef9acccfd06f36f0.diff LOG:

[clang] da90fd7 - Reland "[llvm][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (#72234)"

2023-11-15 Thread Michael Buch via cfe-commits
Author: Michael Buch Date: 2023-11-15T10:26:35Z New Revision: da90fd75241d5b149fd307e3eeae84f7317d9d9b URL: https://github.com/llvm/llvm-project/commit/da90fd75241d5b149fd307e3eeae84f7317d9d9b DIFF: https://github.com/llvm/llvm-project/commit/da90fd75241d5b149fd307e3eeae84f7317d9d9b.diff LOG:

[clang] [clang][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72235)

2023-11-15 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/72235 >From a933f170dcbdbaf76f93a15cdb1c1148d78a82e8 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Mon, 13 Nov 2023 09:48:39 + Subject: [PATCH] [clang][DebugInfo] DWARFv5: static data members declarations a

[clang] [clang][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72235)

2023-11-15 Thread Michael Buch via cfe-commits
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/72235 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang] [llvm][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72234)

2023-11-15 Thread Michael Buch via cfe-commits
Michael137 wrote: > @adrian-prantl We do have a pretty strong guarantee of compatibility in the > llvm-c API. A new parameter pretty much means you need to define a new > function. Ended not changing the C-API in the relanded version https://github.com/llvm/llvm-project/pull/72234 ___

[clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-15 Thread Michael Buch via cfe-commits
Michael137 wrote: > We're seeing crashes after this. Here is a reproducer: > https://bugs.chromium.org/p/chromium/issues/detail?id=1502489#c1 > > Please consider reverting if it can't be fixed quickly (I had a look, but it > seems there are some dependent changes on top). Thanks for reporting

[clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-15 Thread Michael Buch via cfe-commits
Michael137 wrote: > > We're seeing crashes after this. Here is a reproducer: > > https://bugs.chromium.org/p/chromium/issues/detail?id=1502489#c1 > > Please consider reverting if it can't be fixed quickly (I had a look, but > > it seems there are some dependent changes on top). > > Thanks for

[lldb] [clang] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-15 Thread Michael Buch via cfe-commits
Michael137 wrote: Ok with ASAN I could trigger this quite consistently. Turns out we can't iterate over the `StaticDataMemberDefinitionsToEmit` using a `for each` because during `EmitGlobalVariable` we can end up adding more things to the vector, invalidating the iterators. Will push a fix for

[clang] [clang][DebugInfo] Fix iterator invalidation during EmitGlobalVariable (PR #72415)

2023-11-15 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/72415 This patch fixes an issue introduced in https://github.com/llvm/llvm-project/pull/71780 where, if `EmitGlobalVariable` triggered a call to `CreateRecordStaticField` it would invalidate the `StaticDataMemberD

[clang] [clang][DebugInfo] Fix iterator invalidation during EmitGlobalVariable (PR #72415)

2023-11-15 Thread Michael Buch via cfe-commits
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/72415 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[lldb] [clang] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-15 Thread Michael Buch via cfe-commits
Michael137 wrote: @zmodem Fix pushed in `14a84510f5d07b05b348188c7dfbe54076fa1485`. Your reproducer works fine for me now. Let me know if you're still seeing issues. https://github.com/llvm/llvm-project/pull/71780 ___ cfe-commits mailing list cfe-comm

[llvm] [clang] [llvm][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72234)

2023-11-15 Thread Michael Buch via cfe-commits
Michael137 wrote: > we're seeing debug info verifier issues in Rust with this change, e.g. > > ``` > > invalid tag > > !50 = !DIDerivedType(tag: DW_TAG_imported_declaration, name: "DISCR_EXACT", > scope: !37, file: !2, baseType: !51, flags: DIFlagStaticMember, extraData: > i64 0) > > inv

[llvm] [clang] [llvm][DebugInfo] DWARFv5: static data members declarations are DW_TAG_variable (PR #72234)

2023-11-15 Thread Michael Buch via cfe-commits
Michael137 wrote: Is it possible that this is to be fixed at the callsites in the rust frontend? Dont think i missed any callers in LLVM (then again I'm not at a PC to confirm this atm) https://github.com/llvm/llvm-project/pull/72234 ___ cfe-commits

[lldb] [clang] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-15 Thread Michael Buch via cfe-commits
Michael137 wrote: > Hi @Michael137, we are seeing a failure in one of our internal tests that I > bisected back to this change. Consider the following code: > > ```c++ > struct X > { > static const int constant = 1; > int x; > > X() { x = constant; } > }; > const int X::constant; >

[clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-15 Thread Michael Buch via cfe-commits
Michael137 wrote: > The member is const with an initializer in-class. How is the constant value > not available for the definition? Right, it is available, we just don't attach it if we have a location for it. Don't see why we couldn't put it on the definition if we have the constant on hand

[clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-15 Thread Michael Buch via cfe-commits
Michael137 wrote: > So I guess what you are saying in this case is that it is expected and the > value is at the location indicated by the DW_AT_location value? As long as > the value is still available I suppose that is fine then and the test just > needs updating. Yup that's exactly right.

[clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-17 Thread Michael Buch via cfe-commits
Michael137 wrote: > Hi, we're seeing some breakages, similar to the above in our debugger tests > with this patch. > > A failing bot can be found here: > https://luci-milo.appspot.com/ui/p/fuchsia/builders/ci/clang_toolchain.ci.core.x64-debug/b8764552260903625809/overview > > You can find a f

[clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-17 Thread Michael Buch via cfe-commits
Michael137 wrote: > Fantastic! @ilovepi To clarify the upcoming change, we are planning to attach the `DW_AT_const_value` to the definition, not the declaration like we used to. In case that's what your unit-test is expecting https://github.com/llvm/llvm-project/pull/71780 ___

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-17 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/72730 In https://github.com/llvm/llvm-project/pull/71780 we started emitting definitions for all static data-members with constant initialisers, even if they were constants (i.e., didn't have a location). We also d

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-17 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/72730 >From 6dcb09dcc50a9b9e92640412242927b3e226929e Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sat, 18 Nov 2023 00:20:05 + Subject: [PATCH 1/4] [clang][DebugInfo][NFC] Create evaluateConstantInitializer

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-17 Thread Michael Buch via cfe-commits
Michael137 wrote: @ilovepi https://github.com/llvm/llvm-project/pull/72730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-18 Thread Michael Buch via cfe-commits
Michael137 wrote: > Overall this looks good, thanks! > > I think we may want to add a test to check that the output DWARF has a const > value in the expected place, since consumers are relying on it. Any suggestions where to put such end-to-end test? This patch makes sure we encode the consta

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-18 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/72730 >From 6dcb09dcc50a9b9e92640412242927b3e226929e Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sat, 18 Nov 2023 00:20:05 + Subject: [PATCH 1/5] [clang][DebugInfo][NFC] Create evaluateConstantInitializer

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-20 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/72730 >From 6dcb09dcc50a9b9e92640412242927b3e226929e Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sat, 18 Nov 2023 00:20:05 + Subject: [PATCH 1/6] [clang][DebugInfo][NFC] Create evaluateConstantInitializer

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-20 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/72730 >From 6dcb09dcc50a9b9e92640412242927b3e226929e Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sat, 18 Nov 2023 00:20:05 + Subject: [PATCH 1/7] [clang][DebugInfo][NFC] Create evaluateConstantInitializer

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-20 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/72730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-20 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/72730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-20 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/72730 >From 6dcb09dcc50a9b9e92640412242927b3e226929e Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sat, 18 Nov 2023 00:20:05 + Subject: [PATCH 1/8] [clang][DebugInfo][NFC] Create evaluateConstantInitializer

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-20 Thread Michael Buch via cfe-commits
Michael137 wrote: This will need a slight tweak in DwarfCompileUnit because it currently doesn't attach a DW_AT_location to global variable DIEs that already have a DW_AT_const_value https://github.com/llvm/llvm-project/pull/72730 ___ cfe-commits mai

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-20 Thread Michael Buch via cfe-commits
Michael137 wrote: > Hmm, I can't quite tell from the test case updates in the patch, at least at > a glance: How does this get encoded at the IR level? Do we end up with two > DIGlobalVariableExpressions? One with the constant value expresison, and one > that references the actual global varia

[clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-20 Thread Michael Buch via cfe-commits
Michael137 wrote: > I'm unclear on the specifics of the check, but it's probably something we can > adjust if that is the long-term solution. > > CC @petrhosek Since he was interested in getting this resolved soon. There's a few things left to iron out with https://github.com/llvm/llvm-projec

[clang] [clang][DebugInfo] Improve heuristic to determine whether to evaluate a static variable's initializer (PR #72974)

2023-11-21 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/72974 This patch extracts the logic to evaluate a C++ static data-member's constant initializer such that it can be used by an upcoming patch. It also makes the check for whether we are dealing with a constant init

[clang] [clang][DebugInfo] Improve heuristic to determine whether to evaluate a static variable's initializer (PR #72974)

2023-11-21 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/72974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-21 Thread Michael Buch via cfe-commits
Michael137 wrote: I extracted the parts that are clean-ups/bugfixes into a new PR: https://github.com/llvm/llvm-project/pull/72974 https://github.com/llvm/llvm-project/pull/72730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

[clang] [clang][DebugInfo] Improve heuristic to determine whether to evaluate a static variable's initializer (PR #72974)

2023-11-21 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/72974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Improve heuristic to determine whether to evaluate a static variable's initializer (PR #72974)

2023-11-21 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/72974 >From 012096290352438668d8f4bb7a97179952a87a3a Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sat, 18 Nov 2023 00:20:05 + Subject: [PATCH] [clang][DebugInfo] Create evaluateConstantInitializer helper f

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-21 Thread Michael Buch via cfe-commits
Michael137 wrote: > > My understanding was that the DIExpression parameter to > > DIGlobalVariableExpression was empty for global variables with locations. > > So the patch just encodes the constant into that expression if it's > > otherwise empty. > > I think in theory it can be non-empty (s

[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

2023-11-22 Thread Michael Buch via cfe-commits
Michael137 wrote: > Do we end up with two DIGlobalVariableExpressions? Just checked. With this patch, MergeGlobals would produce following IR: ``` ... !10 = !DIGlobalVariableExpression(var: !11, expr: !DIExpression(DW_OP_plus_uconst, 4, DW_OP_constu, 200, DW_OP_stack_value)) !11 = distinct !DIG

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70551)

2023-10-28 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/70551 When an LLDB user asks for the value of a static data member, LLDB starts by searching the Names accelerator table for the corresponding variable definition DIE. For static data members with out-of-class defini

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70551)

2023-10-28 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/70551 >From e02939572877cdc839894454a6fab36ab143d924 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 27 Oct 2023 16:33:07 +0100 Subject: [PATCH 1/3] [clang][DebugInfo][NFC] Add createConstantValueExpression

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70551)

2023-10-28 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/70551 >From e02939572877cdc839894454a6fab36ab143d924 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 27 Oct 2023 16:33:07 +0100 Subject: [PATCH 1/4] [clang][DebugInfo][NFC] Add createConstantValueExpression

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-30 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/70639 When an LLDB user asks for the value of a static data member, LLDB starts by searching the Names accelerator table for the corresponding variable definition DIE. For static data members with out-of-class defini

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-30 Thread Michael Buch via cfe-commits
Michael137 wrote: Summing the size of all *.o files in my local debug Clang build increased by `0.7%` with this patch https://github.com/llvm/llvm-project/pull/70639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-30 Thread Michael Buch via cfe-commits
https://github.com/Michael137 ready_for_review https://github.com/llvm/llvm-project/pull/70639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70551)

2023-10-30 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/70551 >From e02939572877cdc839894454a6fab36ab143d924 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 27 Oct 2023 16:33:07 +0100 Subject: [PATCH 1/4] [clang][DebugInfo][NFC] Add createConstantValueExpression

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-30 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/70639 >From cbae5425ac00e3cb597827e4b6c402446cc40d9d Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 27 Oct 2023 16:33:07 +0100 Subject: [PATCH 1/3] [clang][DebugInfo][NFC] Add createConstantValueExpression

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-30 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/70639 >From cbae5425ac00e3cb597827e4b6c402446cc40d9d Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 27 Oct 2023 16:33:07 +0100 Subject: [PATCH 1/4] [clang][DebugInfo][NFC] Add createConstantValueExpression

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70551)

2023-10-30 Thread Michael Buch via cfe-commits
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/70551 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-30 Thread Michael Buch via cfe-commits
Michael137 wrote: This could also help with the type merging issues discussed in https://github.com/llvm/llvm-project/pull/68721#issuecomment-1764685418 https://github.com/llvm/llvm-project/pull/70639 ___ cfe-commits mailing list cfe-commits@lists.llv

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-30 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/70639 >From 18db082fc5008283f77cc98d9c733a47c63b7096 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 27 Oct 2023 16:19:47 +0100 Subject: [PATCH 1/3] [clang][DebugInfo] Emit global variable definitions for st

[clang] [clang][DebugInfo][NFC] Add createConstantValueExpression helper (PR #70674)

2023-10-30 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/70674 This patch factors out the code to create a DIExpression from an APValue into a separate helper function. This will be useful in a follow-up patch where we re-use this logic elsewhere. Pre-requisite for http

[clang] [clang][DebugInfo][NFC] Add createConstantValueExpression helper (PR #70674)

2023-10-30 Thread Michael Buch via cfe-commits
@@ -5935,3 +5918,28 @@ llvm::DINode::DIFlags CGDebugInfo::getCallSiteRelatedAttrs() const { return llvm::DINode::FlagAllCallsDescribed; } + +llvm::DIExpression * +CGDebugInfo::createConstantValueExpression(clang::ValueDecl const *VD, +

[clang] [clang][DebugInfo][NFC] Add createConstantValueExpression helper (PR #70674)

2023-10-30 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/70674 >From 82795f2e8b06c8ae866c2f58e463d21958105108 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 27 Oct 2023 16:33:07 +0100 Subject: [PATCH 1/2] [clang][DebugInfo][NFC] Add createConstantValueExpression

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-30 Thread Michael Buch via cfe-commits
Michael137 wrote: > > Should not we remove constant initializer from the type definition if we > > have a DW_TAG_variable with a DW_AT_const_value now? > > Yep, +1 to this. This is where the type normalization benefit would come from > - no longer having this const value on the member declarat

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-30 Thread Michael Buch via cfe-commits
@@ -0,0 +1,87 @@ +// RUN: %clangxx -target arm64-apple-macosx11.0.0 -g %s -emit-llvm -S -o - | FileCheck --check-prefixes=CHECK %s + +enum class Enum : int { + VAL = -1 +}; + +struct Empty {}; + +constexpr auto func() { return 25; } + +struct Foo { +static constexpr int cexp

[clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-30 Thread Michael Buch via cfe-commits
Michael137 wrote: > I use `bloaty` for this ( https://github.com/google/bloaty ) - though it's a > bit involved to do this to sum over all the object files - summing up the > results from per-object file, etc... ``` bloaty `find ./patched-build/lib -name *.o` │ bloaty `find ./no-patch-

[clang] [clang][DebugInfo][NFC] Add createConstantValueExpression helper (PR #70674)

2023-10-31 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/70674 >From 82795f2e8b06c8ae866c2f58e463d21958105108 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 27 Oct 2023 16:33:07 +0100 Subject: [PATCH 1/3] [clang][DebugInfo][NFC] Add createConstantValueExpression

[clang] [lldb] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-31 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/70639 >From 18db082fc5008283f77cc98d9c733a47c63b7096 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 27 Oct 2023 16:19:47 +0100 Subject: [PATCH 1/4] [clang][DebugInfo] Emit global variable definitions for st

[lldb] [clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-31 Thread Michael Buch via cfe-commits
@@ -67,15 +67,15 @@ int C::a = 4; // CHECK-NOT:size: // CHECK-NOT:align: // CHECK-NOT:offset: -// CHECK-SAME: flags: DIFlagStaticMember, -// CHECK-SAME: extraData: i1 true) +// CHECK-SAME: flags: DIFlagStaticMemb

[lldb] [clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-31 Thread Michael Buch via cfe-commits
Michael137 wrote: > size report sounds generally OK - but there's a bunch of what look like > unrelated or strange results in there, perhaps they weren't compared at > exactly the same version? (like why did the apple_names size go down? How did > the .text and .debuG_line size change at all?

[lldb] [clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-31 Thread Michael Buch via cfe-commits
Michael137 wrote: > > Few minor issues, but looks good to me. (you metnioned somewhere an lldb > > issue I think with this patch when the value is removed from the static > > member declaration inside the class? If that's a problem - probably hold > > off on committing this until lldb's been f

[lldb] [clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-31 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/70639 >From 18db082fc5008283f77cc98d9c733a47c63b7096 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 27 Oct 2023 16:19:47 +0100 Subject: [PATCH 1/7] [clang][DebugInfo] Emit global variable definitions for st

[clang] [lldb] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-10-31 Thread Michael Buch via cfe-commits
Michael137 wrote: > The DWARFASTParserClang.cpp will try to create the class from the DWARF for > the class definition. You will need to find the DW_TAG_variable when we are > creating the static field if there is no DW_AT_const_value in the > DW_TAG_member. But we also need to support the DW_

[clang] [lldb] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-11-01 Thread Michael Buch via cfe-commits
Michael137 wrote: Hmmm it seems like for `constexpr static` data members we don't get a symbol in the MachO the same way we do for out-of-line `const static`s that have a location: ``` struct Foo { static const int val1; static constexpr int val2 = 5; };

[lldb] [clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-11-01 Thread Michael Buch via cfe-commits
Michael137 wrote: > One question I have here: where will the DW_TAG_variable get emitted for > these `constexpr`? For actual static member variables we emit a single > DW_TAG_variable in the file that declares the global variable, but for > `constexpr` we won't be able to do this will we? Will

[clang] [lldb] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-11-01 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/70639 >From 18db082fc5008283f77cc98d9c733a47c63b7096 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 27 Oct 2023 16:19:47 +0100 Subject: [PATCH 1/8] [clang][DebugInfo] Emit global variable definitions for st

[clang] [lldb] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-11-01 Thread Michael Buch via cfe-commits
Michael137 wrote: > > That's true, if defined in a header, we'll emit a DW_TAG_variable for the > > constant in each compile unit the header is included in. GCC does do the > > right thing and only emit the definition DIE in a single CU. We should > > probably do the same. Though not sure at w

[lldb] [clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

2023-11-01 Thread Michael Buch via cfe-commits
Michael137 wrote: > The DWARFASTParserClang, with the current state of things, will automatically > add the const value initializer to the clang AST field. See > `DWARFASTParserClang::ParseSingleMember(...)` around the `// Handle static > members` around > lldb/source/Plugins/SymbolFile/DWARF

  1   2   3   4   5   6   >