aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp15
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);
}
}