aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2014-06-05 04:31:43 +0000
committerNick Lewycky <nicholas@mxc.ca>2014-06-05 04:31:43 +0000
commitff114dae5afadfc95ab8f670402ba8f141d52de2 (patch)
tree27250e730e68d817d5f6d14535a46fe51b2567fe /llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
parent54741fe603e52b1a8cfe7f577194781c2a9b3632 (diff)
downloadllvm-ff114dae5afadfc95ab8f670402ba8f141d52de2.zip
llvm-ff114dae5afadfc95ab8f670402ba8f141d52de2.tar.gz
llvm-ff114dae5afadfc95ab8f670402ba8f141d52de2.tar.bz2
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/Instrumentation/GCOVProfiling.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index 583a094..cfeb62e 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;