aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 0ca9465..578b8a8 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1304,8 +1304,14 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
QualType ResTy = BuildFunctionArgList(GD, Args);
// Check if we should generate debug info for this function.
- if (FD->hasAttr<NoDebugAttr>())
- DebugInfo = nullptr; // disable debug info indefinitely for this function
+ if (FD->hasAttr<NoDebugAttr>()) {
+ // Clear non-distinct debug info that was possibly attached to the function
+ // due to an earlier declaration without the nodebug attribute
+ if (Fn)
+ Fn->setSubprogram(nullptr);
+ // Disable debug info indefinitely for this function
+ DebugInfo = nullptr;
+ }
// The function might not have a body if we're generating thunks for a
// function declaration.