Skip to content

Commit

Permalink
[GCOV] Skip artificial functions from being emitted
Browse files Browse the repository at this point in the history
This is a patch to support  D66328, which was reverted until this lands.

Enable a compiler-rt test that used to fail previously with D66328.

Differential Revision: https://reviews.llvm.org/D67283
  • Loading branch information
aganea committed Nov 15, 2019
1 parent e06f3e0 commit 478ad94
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// RUN: %clangxx_asan -coverage -O0 %s -o %t
// RUN: %env_asan_opts=check_initialization_order=1 %run %t 2>&1 | FileCheck %s

// We don't really support running tests using profile runtime on Windows.
// UNSUPPORTED: windows-msvc

#include <stdio.h>
int foo() { return 1; }
int XXX = foo();
Expand Down
5 changes: 4 additions & 1 deletion llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,10 @@ void GCOVProfiler::emitProfileNotes() {
// to have a counter for the function definition.
uint32_t Line = SP->getLine();
auto Filename = getFilename(SP);
Func.getBlock(&EntryBlock).getFile(Filename).addLine(Line);

// Artificial functions such as global initializers
if (!SP->isArtificial())
Func.getBlock(&EntryBlock).getFile(Filename).addLine(Line);

for (auto &BB : F) {
GCOVBlock &Block = Func.getBlock(&BB);
Expand Down

0 comments on commit 478ad94

Please sign in to comment.