summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-04-24 20:52:04 +0000
committerVedant Kumar <vsk@apple.com>2017-04-24 20:52:04 +0000
commitbc370f0c1808a83fada0b8547bc09d84e5301a0a (patch)
tree2d640f8aef77e8de8781ffa9680151c8a6785316 /clang/lib/CodeGen
parentc7524f05b2701c4d2d6742d0d83f31a48509023a (diff)
downloadbcm5719-llvm-bc370f0c1808a83fada0b8547bc09d84e5301a0a.tar.gz
bcm5719-llvm-bc370f0c1808a83fada0b8547bc09d84e5301a0a.zip
[Coverage] Avoid null deref in skipRegionMappingForDecl (fixes PR32761)
Patch by Adam Folwarczny! Differential Revision: https://reviews.llvm.org/D32406 llvm-svn: 301249
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CodeGenPGO.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp
index 6acedc033a6..96fc1452293 100644
--- a/clang/lib/CodeGen/CodeGenPGO.cpp
+++ b/clang/lib/CodeGen/CodeGenPGO.cpp
@@ -669,6 +669,9 @@ bool CodeGenPGO::skipRegionMappingForDecl(const Decl *D) {
if (SkipCoverageMapping)
return true;
+ if (!D->getBody())
+ return true;
+
// Don't map the functions in system headers.
const auto &SM = CGM.getContext().getSourceManager();
auto Loc = D->getBody()->getLocStart();
OpenPOWER on IntegriCloud