Refactor GCOV's six constructor arguments into a struct with a getter that

constructs default arguments. It can now take default arguments from
cl::opt'ions. Add a new -default-gcov-version=... option, and actually test it!

Sink the reverse-order of the version into GCOVProfiling, hiding it from our
users.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177002 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky
2013-03-14 05:13:26 +00:00
parent c14f1c4587
commit a204ef3168
4 changed files with 113 additions and 49 deletions

View File

@@ -31,12 +31,32 @@ ModulePass *createOptimalEdgeProfilerPass();
ModulePass *createPathProfilerPass();
// Insert GCOV profiling instrumentation
static const char DefaultGCovVersion[4] = {'*', '2', '0', '4'};
ModulePass *createGCOVProfilerPass(bool EmitNotes = true, bool EmitData = true,
const char (&Version)[4] =DefaultGCovVersion,
bool UseExtraChecksum = false,
bool NoRedZone = false,
bool NoFunctionNamesInData = false);
struct GCOVOptions {
static GCOVOptions getDefault();
// Specify whether to emit .gcno files.
bool EmitNotes;
// Specify whether to modify the program to emit .gcda files when run.
bool EmitData;
// A four-byte version string. The meaning of a version string is described in
// gcc's gcov-io.h
char Version[4];
// Emit a "cfg checksum" that follows the "line number checksum" of a
// function. This affects both .gcno and .gcda files.
bool UseCfgChecksum;
// Add the 'noredzone' attribute to added runtime library calls.
bool NoRedZone;
// Emit the name of the function in the .gcda files. This is redundant, as
// the function identifier can be used to find the name from the .gcno file.
bool FunctionNamesInData;
};
ModulePass *createGCOVProfilerPass(const GCOVOptions &Options =
GCOVOptions::getDefault());
// Insert AddressSanitizer (address sanity checking) instrumentation
FunctionPass *createAddressSanitizerFunctionPass(
@@ -54,7 +74,6 @@ FunctionPass *createMemorySanitizerPass(bool TrackOrigins = false,
// Insert ThreadSanitizer (race detection) instrumentation
FunctionPass *createThreadSanitizerPass(StringRef BlacklistFile = StringRef());
// BoundsChecking - This pass instruments the code to perform run-time bounds
// checking on loads, stores, and other memory intrinsics.
FunctionPass *createBoundsCheckingPass();