From e8ba8d78a258ec992d3521eebdae8324db777b14 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Thu, 21 Apr 2011 23:44:07 +0000 Subject: 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129956 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/CodeGenModule.cpp') diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 603e8c196b..e73a0cffdb 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -64,7 +64,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO, ABI(createCXXABI(*this)), Types(C, M, TD, getTargetCodeGenInfo().getABIInfo(), ABI), TBAA(0), - VTables(*this), Runtime(0), + VTables(*this), Runtime(0), DebugInfo(0), CFConstantStringClassRef(0), ConstantStringClassRef(0), VMContext(M.getContext()), NSConcreteGlobalBlockDecl(0), NSConcreteStackBlockDecl(0), @@ -80,8 +80,11 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO, TBAA = new CodeGenTBAA(Context, VMContext, getLangOptions(), ABI.getMangleContext()); - // If debug info generation is enabled, create the CGDebugInfo object. - DebugInfo = CodeGenOpts.DebugInfo ? new CGDebugInfo(*this) : 0; + // If debug info or coverage generation is enabled, create the CGDebugInfo + // object. + if (CodeGenOpts.DebugInfo || CodeGenOpts.EmitGcovArcs || + CodeGenOpts.EmitGcovNotes) + DebugInfo = new CGDebugInfo(*this); Block.GlobalUniqueCount = 0; -- cgit v1.2.3-18-g5258