aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/BackendUtil.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-04-21 23:44:07 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-04-21 23:44:07 +0000
commit207bce31e15e63ebc5fcde0f7d2f8db0a99a89a2 (patch)
tree67fd0c79fd80cc3291be876dcdb13d8bb6eca39d /clang/lib/CodeGen/BackendUtil.cpp
parent6aea59268a51d2fb2cc7bdc47f9e65e343aeb2a1 (diff)
downloadllvm-207bce31e15e63ebc5fcde0f7d2f8db0a99a89a2.zip
llvm-207bce31e15e63ebc5fcde0f7d2f8db0a99a89a2.tar.gz
llvm-207bce31e15e63ebc5fcde0f7d2f8db0a99a89a2.tar.bz2
Wire up the -ftest-coverage and -fprofile-arcs flags to .gcno file emission (at
compile time) and .gcda emission (at runtime). --coverage enables both. This does not yet add the profile_rt library to the link step if -fprofile-arcs is enabled when linking. llvm-svn: 129956
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r--clang/lib/CodeGen/BackendUtil.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index f3d79cb..9bd4bfd 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -30,6 +30,7 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetRegistry.h"
+#include "llvm/Transforms/Instrumentation.h"
using namespace clang;
using namespace llvm;
@@ -152,6 +153,13 @@ void EmitAssemblyHelper::CreatePasses() {
TLI->disableAllFunctions();
MPM->add(TLI);
+ if (CodeGenOpts.EmitGcovArcs || CodeGenOpts.EmitGcovNotes) {
+ MPM->add(createGCOVProfilerPass(CodeGenOpts.EmitGcovNotes,
+ CodeGenOpts.EmitGcovArcs));
+ if (!CodeGenOpts.DebugInfo)
+ MPM->add(createStripSymbolsPass(true));
+ }
+
// For now we always create per module passes.
llvm::createStandardModulePasses(MPM, OptLevel,
CodeGenOpts.OptimizeSize,