diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2014-06-05 04:31:43 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2014-06-05 04:31:43 +0000 |
commit | ff114dae5afadfc95ab8f670402ba8f141d52de2 (patch) | |
tree | 27250e730e68d817d5f6d14535a46fe51b2567fe /llvm/lib/Transforms | |
parent | 54741fe603e52b1a8cfe7f577194781c2a9b3632 (diff) | |
download | bcm5719-llvm-ff114dae5afadfc95ab8f670402ba8f141d52de2.tar.gz bcm5719-llvm-ff114dae5afadfc95ab8f670402ba8f141d52de2.zip |
Fix coverage for files with global constructors again. Adds a testcase to the commit from r206671, as requested by David Blaikie.
llvm-svn: 210239
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 583a0944689..cfeb62eb1f9 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -457,8 +457,13 @@ static bool functionHasLines(Function *F) { // Debug intrinsic locations correspond to the location of the // declaration, not necessarily any statements or expressions. if (isa<DbgInfoIntrinsic>(I)) continue; + const DebugLoc &Loc = I->getDebugLoc(); if (Loc.isUnknown()) continue; + + // Artificial lines such as calls to the global constructors. + if (Loc.getLine() == 0) continue; + return true; } } @@ -521,8 +526,13 @@ void GCOVProfiler::emitProfileNotes() { // Debug intrinsic locations correspond to the location of the // declaration, not necessarily any statements or expressions. if (isa<DbgInfoIntrinsic>(I)) continue; + const DebugLoc &Loc = I->getDebugLoc(); if (Loc.isUnknown()) continue; + + // Artificial lines such as calls to the global constructors. + if (Loc.getLine() == 0) continue; + if (Line == Loc.getLine()) continue; Line = Loc.getLine(); if (SP != getDISubprogram(Loc.getScope(*Ctx))) continue; |