mirror of https://github.com/microsoft/clang.git
[Coverage] Avoid null deref in skipRegionMappingForDecl (fixes PR32761)
Patch by Adam Folwarczny! Differential Revision: https://reviews.llvm.org/D32406 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301249 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4316aeccae
commit
29f0cdc96e
|
@ -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();
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: %clang_cc1 -triple i686-windows -emit-llvm-only -fcoverage-mapping -dump-coverage-mapping -fprofile-instrument=clang %s | FileCheck %s
|
||||
|
||||
struct A {
|
||||
virtual ~A();
|
||||
};
|
||||
|
||||
// CHECK: ?PR32761@@YAXXZ:
|
||||
// CHECK-NEXT: File 0, [[@LINE+1]]:16 -> [[@LINE+3]]:2 = #0
|
||||
void PR32761() {
|
||||
A a;
|
||||
}
|
Loading…
Reference in New Issue