Ignore line numbers on debug intrinsics. Add an assert to ensure that we aren't emitting line number zero, the .gcno format uses this to indicate that the next field is a filename.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210068 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky
2014-06-03 04:25:36 +00:00
parent 9a2d239740
commit c69c42240e
2 changed files with 147 additions and 2 deletions

View File

@ -211,6 +211,7 @@ namespace {
class GCOVLines : public GCOVRecord {
public:
void addLine(uint32_t Line) {
assert(Line != 0 && "Line zero is not a valid real line number.");
Lines.push_back(Line);
}
@ -453,10 +454,10 @@ static bool functionHasLines(Function *F) {
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
for (BasicBlock::iterator I = BB->begin(), IE = BB->end();
I != IE; ++I) {
if (isa<DbgInfoIntrinsic>(I)) continue;
const DebugLoc &Loc = I->getDebugLoc();
if (Loc.isUnknown()) continue;
if (Loc.getLine() != 0)
return true;
return true;
}
}
return false;
@ -515,6 +516,7 @@ void GCOVProfiler::emitProfileNotes() {
uint32_t Line = 0;
for (BasicBlock::iterator I = BB->begin(), IE = BB->end();
I != IE; ++I) {
if (isa<DbgInfoIntrinsic>(I)) continue;
const DebugLoc &Loc = I->getDebugLoc();
if (Loc.isUnknown()) continue;
if (Line == Loc.getLine()) continue;