forked from OSchip/llvm-project
[GCOV] Function counters are wrong when on one line
Summary: After commit https://reviews.llvm.org/rL344228, the function definitions have a counter but when on one line the counter is wrong (e.g. void foo() { }) I added a test in: https://reviews.llvm.org/D53601 Reviewers: marco-c Reviewed By: marco-c Subscribers: llvm-commits, sylvestre.ledru Differential Revision: https://reviews.llvm.org/D53600 llvm-svn: 345624
This commit is contained in:
parent
eedd2ccd02
commit
38d50545fe
|
@ -572,9 +572,8 @@ void GCOVProfiler::emitProfileNotes() {
|
||||||
|
|
||||||
// Add the function line number to the lines of the entry block
|
// Add the function line number to the lines of the entry block
|
||||||
// to have a counter for the function definition.
|
// to have a counter for the function definition.
|
||||||
Func.getBlock(&EntryBlock)
|
uint32_t Line = SP->getLine();
|
||||||
.getFile(SP->getFilename())
|
Func.getBlock(&EntryBlock).getFile(SP->getFilename()).addLine(Line);
|
||||||
.addLine(SP->getLine());
|
|
||||||
|
|
||||||
for (auto &BB : F) {
|
for (auto &BB : F) {
|
||||||
GCOVBlock &Block = Func.getBlock(&BB);
|
GCOVBlock &Block = Func.getBlock(&BB);
|
||||||
|
@ -587,7 +586,6 @@ void GCOVProfiler::emitProfileNotes() {
|
||||||
Block.addEdge(Func.getReturnBlock());
|
Block.addEdge(Func.getReturnBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Line = 0;
|
|
||||||
for (auto &I : BB) {
|
for (auto &I : BB) {
|
||||||
// Debug intrinsic locations correspond to the location of the
|
// Debug intrinsic locations correspond to the location of the
|
||||||
// declaration, not necessarily any statements or expressions.
|
// declaration, not necessarily any statements or expressions.
|
||||||
|
@ -609,6 +607,7 @@ void GCOVProfiler::emitProfileNotes() {
|
||||||
GCOVLines &Lines = Block.getFile(SP->getFilename());
|
GCOVLines &Lines = Block.getFile(SP->getFilename());
|
||||||
Lines.addLine(Loc.getLine());
|
Lines.addLine(Loc.getLine());
|
||||||
}
|
}
|
||||||
|
Line = 0;
|
||||||
}
|
}
|
||||||
EdgeDestinations += Func.getEdgeDestinations();
|
EdgeDestinations += Func.getEdgeDestinations();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue