diff options
| author | Carlos Alberto Enciso <47597242+CarlosAlbertoEnciso@users.noreply.github.com> | 2023-10-25 10:35:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-25 10:35:03 +0100 |
| commit | 2399c77c8593b0ed3bd3988a5b72f8bf6b30b0de (patch) | |
| tree | 20319760f691c514f9df29ce35415f1ce6d95626 /clang/lib/CodeGen/CGDebugInfo.cpp | |
| parent | c912f88c2177f44d9a584b338f94b29a7873e028 (diff) | |
| download | llvm-2399c77c8593b0ed3bd3988a5b72f8bf6b30b0de.zip llvm-2399c77c8593b0ed3bd3988a5b72f8bf6b30b0de.tar.gz llvm-2399c77c8593b0ed3bd3988a5b72f8bf6b30b0de.tar.bz2 | |
[Clang][DebugInfo] Clang generates an extra spurious unnamed 'dbg.declare' (#69681)
Do not emit call to llvm.dbg.declare when the variable declaration
is a DecompositionDecl as its instance class is always unnamed.
The emitted debug declare looks like:
call void @llvm.dbg.declare(metadata ..., metadata !xx, metadata ...)
!xx = !DILocalVariable(scope: !..., file: !..., line: ..., type: !...)
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 181e500..0aaf678 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -4881,11 +4881,15 @@ CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *VD, llvm::Value *Storage, const bool UsePointerValue) { assert(CGM.getCodeGenOpts().hasReducedDebugInfo()); - if (auto *DD = dyn_cast<DecompositionDecl>(VD)) + if (auto *DD = dyn_cast<DecompositionDecl>(VD)) { for (auto *B : DD->bindings()) { EmitDeclare(B, Storage, std::nullopt, Builder, VD->getType()->isReferenceType()); } + // Don't emit an llvm.dbg.declare for the composite storage as it doesn't + // correspond to a user variable. + return nullptr; + } return EmitDeclare(VD, Storage, std::nullopt, Builder, UsePointerValue); } |
