[clang] [clang][AST] Add 'IgnoreTemplateParmDepth' to structural equivalence cache (PR #115518)

2024-11-11 Thread Michael Buch via cfe-commits
Michael137 wrote: > Another possible solution: Use two `NonEquivalentDecls` sets, one for > `IgnoreTemplateParmDepth` = true and one for false. This may use less memory > (no rarely used third value in the key) but requires more code changes. > Probably use these two caches only in `ASTImporte

[clang] [clang][AST] Add 'IgnoreTemplateParmDepth' to structural equivalence cache (PR #115518)

2024-11-11 Thread Michael Buch via cfe-commits
https://github.com/Michael137 approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/115518 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libcxxabi] [lldb] [llvm] [WIP][lldb] Alternative implementation of more reliable function call infrastructure (PR #115245)

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

[clang] [libcxxabi] [lldb] [llvm] [WIP][lldb] Alternative implementation of more reliable function call infrastructure (PR #115245)

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

[clang] [libcxxabi] [lldb] [llvm] [WIP (PR #115245)

2024-11-06 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/115245 None >From f8087e96f8d8d242a4da2e74a3259161a3bfc179 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Tue, 5 Nov 2024 00:22:07 + Subject: [PATCH] Init --- clang/include/clang/Basic/Attr.td

[clang] [lldb] [lldb] Analyze enum promotion type during parsing (PR #115005)

2024-11-05 Thread Michael Buch via cfe-commits
Michael137 wrote: I haven't done an in-depth review of the patch yet but my first instinct here is that this looks like a lot of work for LLDB which the compiler has already done, so we ideally don't want to repeat. Where is this actually an issue from a user perspective? In the example you ga

[clang] [lldb] [llvm] [WIP][lldb][Expression] More reliable function call resolution (PR #114529)

2024-11-05 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/114529 >From 9337e170d920eaabe2b59a25622f0c554ca5afcf Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sun, 20 Oct 2024 11:35:15 +0100 Subject: [PATCH 1/2] [WIP][lldb][Expression] More reliable function call resol

[clang] [lldb] [llvm] [WIP][lldb][Expression] More reliable function call resolution (PR #114529)

2024-11-05 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/114529 >From 9337e170d920eaabe2b59a25622f0c554ca5afcf Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sun, 20 Oct 2024 11:35:15 +0100 Subject: [PATCH 1/2] [WIP][lldb][Expression] More reliable function call resol

[clang] [lldb] [llvm] [WIP][lldb][Expression] More reliable function call resolution (PR #114529)

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

[clang] [lldb] [llvm] [WIP][lldb][Expression] More reliable function call resolution (PR #114529)

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

[clang] [lldb] [llvm] [WIP][lldb][Expression] More reliable function call resolution (PR #114529)

2024-11-01 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/114529 >From 7f18d96b7117e83c4ed246ac498ee4c9a72064ff Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sun, 20 Oct 2024 11:35:15 +0100 Subject: [PATCH] [WIP][lldb][Expression] More reliable function call resolutio

[clang] [lldb] [llvm] [WIP][lldb][Expression] More reliable function call resolution (PR #114529)

2024-11-01 Thread Michael Buch via cfe-commits
Michael137 wrote: Example constructor decl would look like the following: ``` | `-CXXConstructorDecl 0x246e6f8 <> Bar 'void ()' | `-StructorMangledNamesAttr 0x246e7c0 <> Implicit 2:$__lldb_func_0x014B6560:257 1:$__lldb_func_0x014B6560:294 ``` https://github.com/llvm/llvm-proj

[clang] [lldb] [llvm] [WIP][lldb][Expression] More reliable function call resolution (PR #114529)

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

[clang] [lldb] [llvm] [WIP][lldb][Expression] More reliable function call resolution (PR #114529)

2024-11-01 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/114529 >From 9337e170d920eaabe2b59a25622f0c554ca5afcf Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sun, 20 Oct 2024 11:35:15 +0100 Subject: [PATCH] [WIP][lldb][Expression] More reliable function call resolutio

[clang] [lldb] [llvm] [WIP][lldb][Expression] More reliable function call resolution (PR #114529)

2024-11-01 Thread Michael Buch via cfe-commits
@@ -140,6 +141,64 @@ void MangleContext::mangleName(GlobalDecl GD, raw_ostream &Out) { const ASTContext &ASTContext = getASTContext(); const NamedDecl *D = cast(GD.getDecl()); + if (const StructorMangledNamesAttr *SMA = + D->getAttr()) { +CXXConstructorDecl

[clang] [lldb] [llvm] [WIP][lldb][Expression] More reliable function call resolution (PR #114529)

2024-11-01 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/114529 Naive implementation of all the parts of following RFC: https://discourse.llvm.org/t/rfc-lldb-handling-abi-tagged-constructors-destructors-in-expression-evaluator/82816 Main changes: 1. Instead of relying on

[clang] [lldb] [clang][RecordLayoutBuilder] Be stricter about inferring packed-ness in ExternalLayouts (PR #97443)

2024-10-21 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/97443 >From 38b7837bcc5da9e89778191654f9552ebccacbd5 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Tue, 2 Jul 2024 18:43:34 +0200 Subject: [PATCH 1/3] [clang][RecordLayoutBuilder] Be stricter about inferring pa

[clang] [lldb] [clang][RecordLayoutBuilder] Be stricter about inferring packed-ness in ExternalLayouts (PR #97443)

2024-10-21 Thread Michael Buch via cfe-commits
https://github.com/Michael137 commented: gentle ping @efriedma-quic mind taking another look? Latest iteration skips over empty fields that overlap. https://github.com/llvm/llvm-project/pull/97443 ___ cfe-commits mailing list cfe-commits@lists.llvm.o

[clang] [lldb] [clang][RecordLayoutBuilder] Be stricter about inferring packed-ness in ExternalLayouts (PR #97443)

2024-10-11 Thread Michael Buch via cfe-commits
Michael137 wrote: ping (btw, @labath is the alignment miscalculation still causing issues for you internally? or did you find a workaround?) https://github.com/llvm/llvm-project/pull/97443 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[clang] [lldb] [ASTImporter][lldb] Avoid implicit imports in VisitFieldDecl (PR #107828)

2024-10-10 Thread Michael Buch via cfe-commits
Michael137 wrote: Just to circle back on this. Managed to reduce the crash I was seeing to something pretty simple. The gist of the issue is that we silently create ODR violations in LLDB's scratch context (and LLDB uses `ODRHandlingType::Liberal`, so we try to continue `ASTImport`ing despite

[clang] [clang][DebugInfo] Revert to printing canonical typenames for template aliases (PR #110767)

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

[clang] [clang][DebugInfo] Revert to printing canonical typenames for template aliases (PR #110767)

2024-10-02 Thread Michael Buch via cfe-commits
Michael137 wrote: Test failure unrelated. Will merge to unblock libc++ and investigate a path forward as a follow-up https://github.com/llvm/llvm-project/pull/110767 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [clang][DebugInfo] Revert to printing canonical typenames for template aliases (PR #110767)

2024-10-02 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/110767 >From 53bfa785514f9811952aa5122f60d16129136285 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 2 Oct 2024 00:42:35 +0100 Subject: [PATCH 1/3] [clang][DebugInfo] Revert to printing canonical typenames

[clang] [clang][DebugInfo] Revert to printing canonical typenames for template aliases (PR #110767)

2024-10-02 Thread Michael Buch via cfe-commits
Michael137 wrote: > If we're still producing the typedef-style DWARF for these alias template > specializations - perhaps lldb could not cache pretty printers for typedefs? > (I guess the pretty printers shouldn't be typedef-specific, right, since > typedefs are transparent anyway - but I gues

[clang] [clang][DebugInfo] Revert to printing canonical typenames for template aliases (PR #110767)

2024-10-02 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/110767 >From 53bfa785514f9811952aa5122f60d16129136285 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 2 Oct 2024 00:42:35 +0100 Subject: [PATCH 1/2] [clang][DebugInfo] Revert to printing canonical typenames

[clang] [lldb] [clang][RecordLayoutBuilder] Be stricter about inferring packed-ness in ExternalLayouts (PR #97443)

2024-10-02 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/97443 >From 3a718c75d0458b7aece72f2ba8e5aa5a68815237 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Tue, 2 Jul 2024 18:43:34 +0200 Subject: [PATCH 1/3] [clang][RecordLayoutBuilder] Be stricter about inferring pa

[clang] [lldb] [clang][RecordLayoutBuilder] Be stricter about inferring packed-ness in ExternalLayouts (PR #97443)

2024-10-02 Thread Michael Buch via cfe-commits
Michael137 wrote: > If I'm understanding correctly, the way this currently works is that you do > normal field layout, then if you discover that the actual offset of a field > is less than the offset normal field layout would produce, you assume the > struct is packed. This misses cases where

[clang] [lldb] [clang][RecordLayoutBuilder] Be stricter about inferring packed-ness in ExternalLayouts (PR #97443)

2024-10-02 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/97443 >From 3a718c75d0458b7aece72f2ba8e5aa5a68815237 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Tue, 2 Jul 2024 18:43:34 +0200 Subject: [PATCH 1/2] [clang][RecordLayoutBuilder] Be stricter about inferring pa

[clang] [lldb] [clang][RecordLayoutBuilder] Be stricter about inferring packed-ness in ExternalLayouts (PR #97443)

2024-10-02 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/97443 >From 3a718c75d0458b7aece72f2ba8e5aa5a68815237 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Tue, 2 Jul 2024 18:43:34 +0200 Subject: [PATCH 1/6] [clang][RecordLayoutBuilder] Be stricter about inferring pa

[clang] [lldb] [clang][RecordLayoutBuilder] Be stricter about inferring packed-ness in ExternalLayouts (PR #97443)

2024-10-02 Thread Michael Buch via cfe-commits
Michael137 wrote: > > Skipping empty fields does seem like a better heuristic here > > FWIW, I (independently) came to the same conclusion when investigating the > fallout of #76756, though it's not fully clear to me whether the PR has been > updated to do that. Not yet, but will have a look

[clang] [clang][DebugInfo] Revert to printing canonical typenames for template aliases (PR #110767)

2024-10-02 Thread Michael Buch via cfe-commits
Michael137 wrote: Test failures in `Sema/aarch64-sve-vector-trig-ops.c` unrelated https://github.com/llvm/llvm-project/pull/110767 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Revert to printing canonical typenames for template aliases (PR #110767)

2024-10-01 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/110767 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Revert to printing canonical typenames for template aliases (PR #110767)

2024-10-01 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/110767 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Revert to printing canonical typenames for template aliases (PR #110767)

2024-10-01 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/110767 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Revert to printing canonical typenames for template aliases (PR #110767)

2024-10-01 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/110767 This was originally added in https://reviews.llvm.org/D142268 have LLDB display variable typenames that benefit from suppressing defaulted template arguments. We currently represent template aliases as `DW_A

[clang] [llvm] [clang] Add "debug_transparent" attribute (PR #110188)

2024-10-01 Thread Michael Buch via cfe-commits
https://github.com/Michael137 commented: CGDebugInfo related changes LGTM, I'll let the others comment on the rest https://github.com/llvm/llvm-project/pull/110188 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/m

[clang] [lldb] [clang][RecordLayoutBuilder] Be stricter about inferring packed-ness in ExternalLayouts (PR #97443)

2024-10-01 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/97443 >From 3a718c75d0458b7aece72f2ba8e5aa5a68815237 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Tue, 2 Jul 2024 18:43:34 +0200 Subject: [PATCH] [clang][RecordLayoutBuilder] Be stricter about inferring packed

[clang] [llvm] [clang] Add "debug_transparent" attribute (PR #110188)

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

[clang] [llvm] [clang] Add "debug_transparent" attribute (PR #110188)

2024-09-27 Thread Michael Buch via cfe-commits
@@ -4566,6 +4583,7 @@ void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc, llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(D); llvm::DISubroutineType *STy = getOrCreateFunctionType(D, FnType, Unit); + Michael137 wrote: stray

[clang] [llvm] [clang] Add "debug_transparent" attribute (PR #110188)

2024-09-27 Thread Michael Buch via cfe-commits
https://github.com/Michael137 commented: Can we add tests that we do the right thing for constructors/destructors/inlined functions? https://github.com/llvm/llvm-project/pull/110188 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists

[clang] [llvm] [clang] Add "debug_transparent" attribute (PR #110188)

2024-09-27 Thread Michael Buch via cfe-commits
@@ -109,6 +110,20 @@ static bool IsArtificial(VarDecl const *VD) { cast(VD->getDeclContext())->isImplicit()); } +static bool usesDebugTransparent(const Decl *D, const CodeGenModule &CGM) { + if (!D) +return false; + + if (auto *attr = D->get

[clang] [llvm] [clang] Add "debug_transparent" attribute (PR #109490)

2024-09-26 Thread Michael Buch via cfe-commits
@@ -109,6 +110,21 @@ static bool IsArtificial(VarDecl const *VD) { cast(VD->getDeclContext())->isImplicit()); } +static bool usesDebugTransparent(const Decl *D, const CodeGenModule &CGM) { + if (!D) +return false; + + if (auto *attr = D->get

[clang] [llvm] [clang] Add "debug_transparent" attribute (PR #109490)

2024-09-23 Thread Michael Buch via cfe-commits
@@ -4160,6 +4178,8 @@ llvm::DISubprogram *CGDebugInfo::getFunctionFwdDeclOrStub(GlobalDecl GD, if (Stub) { Flags |= getCallSiteRelatedAttrs(); SPFlags |= llvm::DISubprogram::SPFlagDefinition; +if (usesDebugTransparent(FD, CGM)) Michael137 wrote:

[clang] [llvm] [clang] Add "debug_transparent" attribute (PR #109490)

2024-09-23 Thread Michael Buch via cfe-commits
@@ -109,6 +110,21 @@ static bool IsArtificial(VarDecl const *VD) { cast(VD->getDeclContext())->isImplicit()); } +static bool usesDebugTransparent(const Decl *D, const CodeGenModule &CGM) { + if (!D) +return false; + + if (auto *attr = D->get

[clang] [llvm] [clang] Add "debug_transparent" attribute (PR #109490)

2024-09-23 Thread Michael Buch via cfe-commits
https://github.com/Michael137 commented: Seems reasonable to me modulo nits. We'll also need a test for the "attribute ignored because not DWARF" diagnostic https://github.com/llvm/llvm-project/pull/109490 ___ cfe-commits mailing list cfe-commits@list

[clang] [llvm] [clang] Add "debug_transparent" attribute (PR #109490)

2024-09-23 Thread Michael Buch via cfe-commits
@@ -109,6 +110,21 @@ static bool IsArtificial(VarDecl const *VD) { cast(VD->getDeclContext())->isImplicit()); } +static bool usesDebugTransparent(const Decl *D, const CodeGenModule &CGM) { + if (!D) +return false; + + if (auto *attr = D->get

[clang] [llvm] [clang] Add "debug_transparent" attribute (PR #109490)

2024-09-23 Thread Michael Buch via cfe-commits
@@ -109,6 +110,21 @@ static bool IsArtificial(VarDecl const *VD) { cast(VD->getDeclContext())->isImplicit()); } +static bool usesDebugTransparent(const Decl *D, const CodeGenModule &CGM) { + if (!D) +return false; + + if (auto *attr = D->get

[clang] [llvm] [clang] Add "debug_transparent" attribute (PR #109490)

2024-09-23 Thread Michael Buch via cfe-commits
@@ -109,6 +110,21 @@ static bool IsArtificial(VarDecl const *VD) { cast(VD->getDeclContext())->isImplicit()); } +static bool usesDebugTransparent(const Decl *D, const CodeGenModule &CGM) { + if (!D) +return false; + + if (auto *attr = D->get

[clang] [llvm] [clang] Add "debug_transparent" attribute (PR #109490)

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

[clang] [clang][CodeGen] Check initializer of zero-size fields for nullptr (PR #109271)

2024-09-20 Thread Michael Buch via cfe-commits
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/109271 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CodeGen] Check initializer of zero-size fields for nullptr (PR #109271)

2024-09-20 Thread Michael Buch via cfe-commits
@@ -738,7 +738,7 @@ bool ConstStructBuilder::Build(const InitListExpr *ILE, bool AllowOverwrite) { // Zero-sized fields are not emitted, but their initializers may still // prevent emission of this struct as a constant. if (isEmptyFieldForLayout(CGM.getContext(), F

[clang] [clang][CodeGen] Check initializer of zero-size fields for nullptr (PR #109271)

2024-09-20 Thread Michael Buch via cfe-commits
@@ -738,7 +738,7 @@ bool ConstStructBuilder::Build(const InitListExpr *ILE, bool AllowOverwrite) { // Zero-sized fields are not emitted, but their initializers may still // prevent emission of this struct as a constant. if (isEmptyFieldForLayout(CGM.getContext(), F

[clang] [clang][CodeGen] Check initializer of zero-size fields for nullptr (PR #109271)

2024-09-20 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/109271 >From 6d541092e00f0c59861ad17c8bf6988d849c42f0 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 19 Sep 2024 11:41:51 +0100 Subject: [PATCH 1/2] [clang][CodeGen] Check initializer of zero-size fields fo

[clang] [clang][CodeGen] Check initializer of zero-size fields for nullptr (PR #109271)

2024-09-20 Thread Michael Buch via cfe-commits
@@ -0,0 +1,11 @@ +// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s --check-prefixes=CHECK +// RUN: %clang_cc1 -x c++ %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s --check-prefixes=CHECK-CXX + +union Foo { + struct Empty {} val; +}; + +u

[clang] [clang][CodeGen] Check initializer of zero-size fields for nullptr (PR #109271)

2024-09-20 Thread Michael Buch via cfe-commits
@@ -738,7 +738,7 @@ bool ConstStructBuilder::Build(const InitListExpr *ILE, bool AllowOverwrite) { // Zero-sized fields are not emitted, but their initializers may still // prevent emission of this struct as a constant. if (isEmptyFieldForLayout(CGM.getContext(), F

[clang] [lldb] [ASTImporter][lldb] Avoid implicit imports in VisitFieldDecl (PR #107828)

2024-09-19 Thread Michael Buch via cfe-commits
Michael137 wrote: > > Our idea is summarized in > > https://discourse.llvm.org/t/rfc-lldb-more-reliable-completion-of-record-types/77442. > > Basically the goal is to guarantee that a call to `getDefinition`, _will_ > > fetch the definition. This is something that Clang already does, but we >

[clang] [clang][CodeGen] Check initializer of zero-size fields for nullptr (PR #109271)

2024-09-19 Thread Michael Buch via cfe-commits
@@ -0,0 +1,11 @@ +// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s --check-prefixes=CHECK +// RUN: %clang_cc1 -x c++ %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s --check-prefixes=CHECK-CXX + +union Foo { + struct Empty {} val; +}; + +u

[clang] [clang][CodeGen] Check initializer of zero-size fields for nullptr (PR #109271)

2024-09-19 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/109271 In https://github.com/llvm/llvm-project/pull/96422 we started treating empty records as zero-sized for the purpose of layout. In `C`, empty fields were never considered `isZeroSize`, so we would never have t

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-09-18 Thread Michael Buch via cfe-commits
Michael137 wrote: > This change leads to a crash in `ConstStructBuilder::Build()` for the > following program: > > ``` > struct S { > }; > > union U { > struct S s; > int x; > }; > > void foo() { > union U bar = {}; > } > ``` > > `isEmptyRecordForLayout` returns false for `union

[clang] [lldb] [ASTImporter][lldb] Avoid implicit imports in VisitFieldDecl (PR #107828)

2024-09-10 Thread Michael Buch via cfe-commits
Michael137 wrote: > As I understand it, minimal import is used in LLDB for performance reasons, > so we don't waste time parsing and loading AST elements that we don't need. > It sounds like a fine idea in general. Implicit imports of external sources > in Clang, however, turn import process i

[clang] [lldb] [ASTImporter][lldb] Avoid implicit imports in VisitFieldDecl (PR #107828)

2024-09-09 Thread Michael Buch via cfe-commits
Michael137 wrote: Thanks for taking a stab at this and for the analysis. You rightly point out that this is the root problem: > If an implicit import happens between (2) and (3), it may indirectly bring > the same field into the context. When (3) happens we add it again, > duplicating the f

[clang] [clang][DebugInfo] Don't mark structured bindings as artificial (PR #100355)

2024-08-09 Thread Michael Buch via cfe-commits
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/100355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Don't mark structured bindings as artificial (PR #100355)

2024-08-08 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/100355 >From 2b1255de05856e4c79f58d3e4071384ba80a881d Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 18 Jul 2024 16:26:16 -0500 Subject: [PATCH 1/3] [clang][Sema] Don't mark VarDecls of bindings in tuple-li

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-08-01 Thread Michael Buch via cfe-commits
@@ -137,6 +137,16 @@ bool isEmptyField(ASTContext &Context, const FieldDecl *FD, bool AllowArrays, bool isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays, bool AsIfNoUniqueAddr = false); +/// isEmptyFieldForLayout - Return true iff the field i

[clang] [clang][DebugInfo] Don't mark structured bindings as artificial (PR #100355)

2024-07-31 Thread Michael Buch via cfe-commits
Michael137 wrote: ping https://github.com/llvm/llvm-project/pull/100355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "Reland [clang][ASTImport] Add support for import of empty records" (PR #100903)

2024-07-29 Thread Michael Buch via cfe-commits
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/100903 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CGDebugInfo] Don't generate an implicit 'this' parameter if one was specified explicitly (PR #100767)

2024-07-29 Thread Michael Buch via cfe-commits
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/100767 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "Reland [clang][ASTImport] Add support for import of empty records" (PR #100903)

2024-07-27 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/100903 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "Reland [clang][ASTImport] Add support for import of empty records" (PR #100903)

2024-07-27 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/100903 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "Reland [clang][ASTImport] Add support for import of empty records" (PR #100903)

2024-07-27 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/100903 This reverts commit 88e5206f2c96a34e23a4d63f0a38afb2db044f0a. The original change went in a while ago (last year) in https://reviews.llvm.org/D145057. The specific reason I'm proposing a revert is that this

[clang] [clang][CGDebugInfo] Don't generate an implicit 'this' parameter if one was specified explicitly (PR #100767)

2024-07-26 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/100767 >From 427fe3468534d31778ae361cc057dad817ecffea Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 26 Jul 2024 16:40:04 +0100 Subject: [PATCH 1/2] [clang][CGDebugInfo] Don't generate an implicit 'this' pa

[clang] [clang][DebugInfo] Don't mark structured bindings as artificial (PR #100355)

2024-07-24 Thread Michael Buch via cfe-commits
Michael137 wrote: > It looks like this is working for all other kinds of structured binding > because `EmitDeclare(BindingDecl*, ...)` emits a proper `DILocalVariable` for > them. But it skips `BindingDecl`s that have a holding variable for some > reason. Perhaps a cleaner approach would be to

[clang] [clang][DebugInfo] Don't mark structured bindings as artificial (PR #100355)

2024-07-24 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/100355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Don't emit DW_AT_artificial for bindings of tuple-like decompositions (PR #100355)

2024-07-24 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/100355 >From 2b1255de05856e4c79f58d3e4071384ba80a881d Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 18 Jul 2024 16:26:16 -0500 Subject: [PATCH 1/3] [clang][Sema] Don't mark VarDecls of bindings in tuple-li

[clang] [clang][DebugInfo] Don't emit DW_AT_artificial for bindings of tuple-like decompositions (PR #100355)

2024-07-24 Thread Michael Buch via cfe-commits
Michael137 wrote: Updated the PR and description with the alternative approach https://github.com/llvm/llvm-project/pull/100355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Don't emit DW_AT_artificial for bindings of tuple-like decompositions (PR #100355)

2024-07-24 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/100355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DebugInfo] Don't emit DW_AT_artificial for bindings of tuple-like decompositions (PR #100355)

2024-07-24 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/100355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Don't mark VarDecls of bindings in tuple-like decompositions as implicit (PR #100355)

2024-07-24 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/100355 >From 2b1255de05856e4c79f58d3e4071384ba80a881d Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 18 Jul 2024 16:26:16 -0500 Subject: [PATCH 1/2] [clang][Sema] Don't mark VarDecls of bindings in tuple-li

[clang] [clang][Sema] Don't mark VarDecls of bindings in tuple-like decompositions as implicit (PR #100355)

2024-07-24 Thread Michael Buch via cfe-commits
Michael137 wrote: > Thanks for the patch! > > I would actually prefer option 2 here. > > `isImplicit` has other uses - namely for AST matchers and refactoring tools > that also rely on knowing whether something was spelled in source. > > Note that I cannot comment on what make sense for debug

[clang] [clang][Sema] Don't mark VarDecls of bindings in tuple-like decompositions as implicit (PR #100355)

2024-07-24 Thread Michael Buch via cfe-commits
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/100355 This patch is motivated by the debug-info issue in https://github.com/llvm/llvm-project/issues/48909. Clang is currently emitting the `DW_AT_artificial` attribute on debug-info entries for structured binding

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

2024-07-15 Thread Michael Buch via cfe-commits
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/93809 ___ 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-07-15 Thread Michael Buch via cfe-commits
Michael137 wrote: Closing in favour of https://github.com/llvm/llvm-project/pull/96422 https://github.com/llvm/llvm-project/pull/93809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

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

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-07-15 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/96422 >From 46d15431cae1123282f4c0856360c9e3ce7322fc Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 21 Jun 2024 12:15:07 +0100 Subject: [PATCH 01/20] [clang][CGRecordLayout] Remove dependency on isZeroSize

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-07-12 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/96422 >From 07e603f7afc98e5af31962a5b1f44f4e4c079ebb Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 21 Jun 2024 12:15:07 +0100 Subject: [PATCH 01/19] [clang][CGRecordLayout] Remove dependency on isZeroSize

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-07-11 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/96422 >From 07e603f7afc98e5af31962a5b1f44f4e4c079ebb Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 21 Jun 2024 12:15:07 +0100 Subject: [PATCH 01/16] [clang][CGRecordLayout] Remove dependency on isZeroSize

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-07-11 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/96422 >From 07e603f7afc98e5af31962a5b1f44f4e4c079ebb Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 21 Jun 2024 12:15:07 +0100 Subject: [PATCH 01/15] [clang][CGRecordLayout] Remove dependency on isZeroSize

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-07-11 Thread Michael Buch via cfe-commits
Michael137 wrote: > Some of the libc++ tests seem to be crashing on the x86_64 bot (can repro > locally, on aarch64 too). Looks like they're segfaulting trying to access the > member of an empty class. E.g., in > > ``` > Process 1370440 stopped > * thread #1, name = 't.tmp.exe', stop reason =

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-07-11 Thread Michael Buch via cfe-commits
Michael137 wrote: Some of the libc++ tests seem to be crashing on the x86_64 bot (can repro this on my x86_64 at home, not aarch64 though). Looks like they're segfaulting trying to access the member of an empty class. E.g., in ``` Process 1370440 stopped * thread #1, name = 't.tmp.exe', stop re

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-07-10 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/96422 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-07-10 Thread Michael Buch via cfe-commits
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/96422 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-07-10 Thread Michael Buch via cfe-commits
@@ -1,7 +1,19 @@ -// RUN: %clang_cc1 -emit-llvm < %s | grep "zeroinitializer, i16 16877" +// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s --check-prefixes=CHECK,EMPTY +// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-windows-msvc -o - | FileCheck %s

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-07-10 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/96422 >From 07e603f7afc98e5af31962a5b1f44f4e4c079ebb Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 21 Jun 2024 12:15:07 +0100 Subject: [PATCH 01/13] [clang][CGRecordLayout] Remove dependency on isZeroSize

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-07-09 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/96422 >From 07e603f7afc98e5af31962a5b1f44f4e4c079ebb Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 21 Jun 2024 12:15:07 +0100 Subject: [PATCH 01/12] [clang][CGRecordLayout] Remove dependency on isZeroSize

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-07-09 Thread Michael Buch via cfe-commits
@@ -1,7 +1,17 @@ -// RUN: %clang_cc1 -emit-llvm < %s | grep "zeroinitializer, i16 16877" +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s // PR4390 struct sysfs_dirent { - union { struct sysfs_elem_dir {} s_dir; }; + union { struct sysfs_elem_dir { int x; } s_dir; }; unsi

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-07-09 Thread Michael Buch via cfe-commits
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/96422 >From 07e603f7afc98e5af31962a5b1f44f4e4c079ebb Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 21 Jun 2024 12:15:07 +0100 Subject: [PATCH 01/11] [clang][CGRecordLayout] Remove dependency on isZeroSize

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

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

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2024-07-09 Thread Michael Buch via cfe-commits
@@ -185,6 +203,18 @@ CALL_AO(PackedMembers) // CHECK: call void @llvm.memcpy.p0.p0.i64({{.*}} align 1 {{.*}} align 1 {{.*}}i64 16, i1 {{.*}}) // CHECK: ret ptr +// WithEmptyField copy-assignment: +// CHECK-LABEL: define linkonce_odr nonnull align {{[0-9]+}} dereferenceable({

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

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

[clang] [lldb] [clang][RecordLayoutBuilder] Be stricter about inferring packed-ness in ExternalLayouts (PR #97443)

2024-07-09 Thread Michael Buch via cfe-commits
Michael137 wrote: > If I'm understanding correctly, the way this currently works is that you do > normal field layout, then if you discover that the actual offset of a field > is less than the offset normal field layout would produce, you assume the > struct is packed. This misses cases where

  1   2   3   4   >