summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-02-08 16:09:32 +0000
committerReid Kleckner <rnk@google.com>2017-02-08 16:09:32 +0000
commita858981c1d6c10b7e1d9dc14bd4be5b3ac846b1e (patch)
treef44bfedbb3ab554ee9da1596385aba2386bc5589 /clang/lib/CodeGen/CodeGenFunction.cpp
parentd6ae62455281ee40486baf27ec896801c508af22 (diff)
downloadbcm5719-llvm-a858981c1d6c10b7e1d9dc14bd4be5b3ac846b1e.tar.gz
bcm5719-llvm-a858981c1d6c10b7e1d9dc14bd4be5b3ac846b1e.zip
[MS] Fix C++ destructor thunk line info for a declaration
Sometimes the MS ABI needs to emit thunks for declarations that don't have bodies. Destructor thunks make calls to inlinable functions, so they need line info or LLVM will complain. Fixes PR31893 llvm-svn: 294465
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 126390957fb..00d5b5fe688 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1089,8 +1089,13 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
if (FD->hasAttr<NoDebugAttr>())
DebugInfo = nullptr; // disable debug info indefinitely for this function
+ // The function might not have a body if we're generating thunks for a
+ // function declaration.
SourceRange BodyRange;
- if (Stmt *Body = FD->getBody()) BodyRange = Body->getSourceRange();
+ if (Stmt *Body = FD->getBody())
+ BodyRange = Body->getSourceRange();
+ else
+ BodyRange = FD->getLocation();
CurEHLocation = BodyRange.getEnd();
// Use the location of the start of the function to determine where
OpenPOWER on IntegriCloud