Fix coverage for files with global constructors again. Adds a testcase to the commit from r206671, as requested by David Blaikie.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210239 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky
2014-06-05 04:31:43 +00:00
parent 0bc7690e34
commit 59aecc1cf0
2 changed files with 68 additions and 0 deletions

View File

@ -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;