r177004 - Update GCOVProfiling pass creation for API change in r177002. No functionality change.

Nick Lewycky nicholas at mxc.ca
Wed Mar 13 22:14:01 PDT 2013


Author: nicholas
Date: Thu Mar 14 00:14:01 2013
New Revision: 177004

URL: http://llvm.org/viewvc/llvm-project?rev=177004&view=rev
Log:
Update GCOVProfiling pass creation for API change in r177002. No functionality change.

Modified:
    cfe/trunk/lib/CodeGen/BackendUtil.cpp
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=177004&r1=177003&r2=177004&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Mar 14 00:14:01 2013
@@ -303,13 +303,18 @@ void EmitAssemblyHelper::CreatePasses(Ta
   PassManager *MPM = getPerModulePasses(TM);
 
   if (CodeGenOpts.EmitGcovArcs || CodeGenOpts.EmitGcovNotes) {
-    MPM->add(createGCOVProfilerPass(CodeGenOpts.EmitGcovNotes,
-                                    CodeGenOpts.EmitGcovArcs,
-                                    CodeGenOpts.CoverageVersion,
-                                    CodeGenOpts.CoverageExtraChecksum,
-                                    CodeGenOpts.DisableRedZone,
-                                    CodeGenOpts.CoverageFunctionNamesInData));
-
+    // Not using 'GCOVOptions::getDefault' allows us to avoid exiting if
+    // LLVM's -default-gcov-version flag is set to something invalid.
+    GCOVOptions Options;
+    Options.EmitNotes = CodeGenOpts.EmitGcovNotes;
+    Options.EmitData = CodeGenOpts.EmitGcovArcs;
+    memcpy(Options.Version, CodeGenOpts.CoverageVersion, 4);
+    Options.UseCfgChecksum = CodeGenOpts.CoverageExtraChecksum;
+    Options.NoRedZone = CodeGenOpts.DisableRedZone;
+    // FIXME: the clang flag name is backwards.
+    Options.FunctionNamesInData =
+        !CodeGenOpts.CoverageFunctionNamesInData;
+    MPM->add(createGCOVProfilerPass(Options));
     if (CodeGenOpts.getDebugInfo() == CodeGenOptions::NoDebugInfo)
       MPM->add(createStripSymbolsPass(true));
   }

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=177004&r1=177003&r2=177004&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Mar 14 00:14:01 2013
@@ -394,10 +394,7 @@ static bool ParseCodeGenArgs(CodeGenOpti
             << Args.getLastArg(OPT_coverage_version_EQ)->getAsString(Args)
             << CoverageVersion;
       } else {
-        Opts.CoverageVersion[0] = CoverageVersion[3];
-        Opts.CoverageVersion[1] = CoverageVersion[2];
-        Opts.CoverageVersion[2] = CoverageVersion[1];
-        Opts.CoverageVersion[3] = CoverageVersion[0];
+        memcpy(Opts.CoverageVersion, CoverageVersion.data(), 4);
       }
     }
   }





More information about the cfe-commits mailing list