diff options
author | Reid Kleckner <rnk@google.com> | 2025-04-23 21:27:33 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2025-04-23 22:09:02 +0000 |
commit | cd826d6e840ed33ad88458c862da5f9fcc6e908c (patch) | |
tree | 775e147b1aed3fd7657606e84cb4563ea3b392a6 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | ee617f195a2677abd274e4047246fed3a1501b77 (diff) | |
download | llvm-cd826d6e840ed33ad88458c862da5f9fcc6e908c.zip llvm-cd826d6e840ed33ad88458c862da5f9fcc6e908c.tar.gz llvm-cd826d6e840ed33ad88458c862da5f9fcc6e908c.tar.bz2 |
Revert "[Clang,debuginfo] added vtt parameter in destructor DISubroutineType (#130674)"
This reverts commit 27c1aa9b9cf9e0b14211758ff8f7d3aaba24ffcf.
See comments on PR. After this change, Clang now asserts like this:
clang: ../llvm/include/llvm/IR/Metadata.h:1435: const MDOperand &llvm::MDNode::getOperand(unsigned int) const: Assertion `I < getNumOperands() && "Out of range"' failed.
...
#8 0x000055f345c4e4cb clang::CodeGen::CGDebugInfo::getOrCreateInstanceMethodType()
#9 0x000055f345c5ba4f clang::CodeGen::CGDebugInfo::EmitFunctionDecl()
#10 0x000055f345b52519 clang::CodeGen::CodeGenModule::EmitExternalFunctionDeclaration()
This is due to pre-existing jankiness in the way BPF emits extra
declarations for debug info, but we should rollback and then fix forward.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 83d8d4f..a073c5d 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -5837,15 +5837,24 @@ void CodeGenModule::EmitExternalVarDeclaration(const VarDecl *D) { } } +static GlobalDecl getBaseVariantGlobalDecl(const FunctionDecl *FD) { + if (auto const *CD = dyn_cast<const CXXConstructorDecl>(FD)) + return GlobalDecl(CD, CXXCtorType::Ctor_Base); + else if (auto const *DD = dyn_cast<const CXXDestructorDecl>(FD)) + return GlobalDecl(DD, CXXDtorType::Dtor_Base); + return GlobalDecl(FD); +} + void CodeGenModule::EmitExternalFunctionDeclaration(const FunctionDecl *FD) { if (CGDebugInfo *DI = getModuleDebugInfo()) if (getCodeGenOpts().hasReducedDebugInfo()) { + GlobalDecl GD = getBaseVariantGlobalDecl(FD); auto *Ty = getTypes().ConvertType(FD->getType()); - StringRef MangledName = getMangledName(FD); + StringRef MangledName = getMangledName(GD); auto *Fn = cast<llvm::Function>( - GetOrCreateLLVMFunction(MangledName, Ty, FD, /* ForVTable */ false)); + GetOrCreateLLVMFunction(MangledName, Ty, GD, /* ForVTable */ false)); if (!Fn->getSubprogram()) - DI->EmitFunctionDecl(FD, FD->getLocation(), FD->getType(), Fn); + DI->EmitFunctionDecl(GD, FD->getLocation(), FD->getType(), Fn); } } |