mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-02 07:30:52 +00:00
Add const to compileProgram and to the various test functions in CrashDebugger.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110306 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
59d5145d7d
commit
248d1c65f1
@ -165,7 +165,7 @@ public:
|
|||||||
/// setting Error if an error occurs. This is used for code generation
|
/// setting Error if an error occurs. This is used for code generation
|
||||||
/// crash testing.
|
/// crash testing.
|
||||||
///
|
///
|
||||||
void compileProgram(Module *M, std::string *Error);
|
void compileProgram(Module *M, std::string *Error) const;
|
||||||
|
|
||||||
/// executeProgram - This method runs "Program", capturing the output of the
|
/// executeProgram - This method runs "Program", capturing the output of the
|
||||||
/// program to a file. A recommended filename may be optionally specified.
|
/// program to a file. A recommended filename may be optionally specified.
|
||||||
|
@ -106,10 +106,10 @@ namespace {
|
|||||||
///
|
///
|
||||||
class ReduceCrashingGlobalVariables : public ListReducer<GlobalVariable*> {
|
class ReduceCrashingGlobalVariables : public ListReducer<GlobalVariable*> {
|
||||||
BugDriver &BD;
|
BugDriver &BD;
|
||||||
bool (*TestFn)(BugDriver &, Module *);
|
bool (*TestFn)(const BugDriver &, Module *);
|
||||||
public:
|
public:
|
||||||
ReduceCrashingGlobalVariables(BugDriver &bd,
|
ReduceCrashingGlobalVariables(BugDriver &bd,
|
||||||
bool (*testFn)(BugDriver &, Module *))
|
bool (*testFn)(const BugDriver &, Module *))
|
||||||
: BD(bd), TestFn(testFn) {}
|
: BD(bd), TestFn(testFn) {}
|
||||||
|
|
||||||
virtual TestResult doTest(std::vector<GlobalVariable*> &Prefix,
|
virtual TestResult doTest(std::vector<GlobalVariable*> &Prefix,
|
||||||
@ -176,10 +176,10 @@ namespace llvm {
|
|||||||
///
|
///
|
||||||
class ReduceCrashingFunctions : public ListReducer<Function*> {
|
class ReduceCrashingFunctions : public ListReducer<Function*> {
|
||||||
BugDriver &BD;
|
BugDriver &BD;
|
||||||
bool (*TestFn)(BugDriver &, Module *);
|
bool (*TestFn)(const BugDriver &, Module *);
|
||||||
public:
|
public:
|
||||||
ReduceCrashingFunctions(BugDriver &bd,
|
ReduceCrashingFunctions(BugDriver &bd,
|
||||||
bool (*testFn)(BugDriver &, Module *))
|
bool (*testFn)(const BugDriver &, Module *))
|
||||||
: BD(bd), TestFn(testFn) {}
|
: BD(bd), TestFn(testFn) {}
|
||||||
|
|
||||||
virtual TestResult doTest(std::vector<Function*> &Prefix,
|
virtual TestResult doTest(std::vector<Function*> &Prefix,
|
||||||
@ -249,9 +249,10 @@ namespace {
|
|||||||
///
|
///
|
||||||
class ReduceCrashingBlocks : public ListReducer<const BasicBlock*> {
|
class ReduceCrashingBlocks : public ListReducer<const BasicBlock*> {
|
||||||
BugDriver &BD;
|
BugDriver &BD;
|
||||||
bool (*TestFn)(BugDriver &, Module *);
|
bool (*TestFn)(const BugDriver &, Module *);
|
||||||
public:
|
public:
|
||||||
ReduceCrashingBlocks(BugDriver &bd, bool (*testFn)(BugDriver &, Module *))
|
ReduceCrashingBlocks(BugDriver &bd,
|
||||||
|
bool (*testFn)(const BugDriver &, Module *))
|
||||||
: BD(bd), TestFn(testFn) {}
|
: BD(bd), TestFn(testFn) {}
|
||||||
|
|
||||||
virtual TestResult doTest(std::vector<const BasicBlock*> &Prefix,
|
virtual TestResult doTest(std::vector<const BasicBlock*> &Prefix,
|
||||||
@ -348,10 +349,10 @@ namespace {
|
|||||||
///
|
///
|
||||||
class ReduceCrashingInstructions : public ListReducer<const Instruction*> {
|
class ReduceCrashingInstructions : public ListReducer<const Instruction*> {
|
||||||
BugDriver &BD;
|
BugDriver &BD;
|
||||||
bool (*TestFn)(BugDriver &, Module *);
|
bool (*TestFn)(const BugDriver &, Module *);
|
||||||
public:
|
public:
|
||||||
ReduceCrashingInstructions(BugDriver &bd, bool (*testFn)(BugDriver &,
|
ReduceCrashingInstructions(BugDriver &bd,
|
||||||
Module *))
|
bool (*testFn)(const BugDriver &, Module *))
|
||||||
: BD(bd), TestFn(testFn) {}
|
: BD(bd), TestFn(testFn) {}
|
||||||
|
|
||||||
virtual TestResult doTest(std::vector<const Instruction*> &Prefix,
|
virtual TestResult doTest(std::vector<const Instruction*> &Prefix,
|
||||||
@ -422,7 +423,8 @@ bool ReduceCrashingInstructions::TestInsts(std::vector<const Instruction*>
|
|||||||
/// DebugACrash - Given a predicate that determines whether a component crashes
|
/// DebugACrash - Given a predicate that determines whether a component crashes
|
||||||
/// on a program, try to destructively reduce the program while still keeping
|
/// on a program, try to destructively reduce the program while still keeping
|
||||||
/// the predicate true.
|
/// the predicate true.
|
||||||
static bool DebugACrash(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *),
|
static bool DebugACrash(BugDriver &BD,
|
||||||
|
bool (*TestFn)(const BugDriver &, Module *),
|
||||||
std::string &Error) {
|
std::string &Error) {
|
||||||
// See if we can get away with nuking some of the global variable initializers
|
// See if we can get away with nuking some of the global variable initializers
|
||||||
// in the program...
|
// in the program...
|
||||||
@ -607,7 +609,7 @@ ExitLoops:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool TestForOptimizerCrash(BugDriver &BD, Module *M) {
|
static bool TestForOptimizerCrash(const BugDriver &BD, Module *M) {
|
||||||
return BD.runPasses(M);
|
return BD.runPasses(M);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -635,7 +637,7 @@ bool BugDriver::debugOptimizerCrash(const std::string &ID) {
|
|||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool TestForCodeGenCrash(BugDriver &BD, Module *M) {
|
static bool TestForCodeGenCrash(const BugDriver &BD, Module *M) {
|
||||||
std::string Error;
|
std::string Error;
|
||||||
BD.compileProgram(M, &Error);
|
BD.compileProgram(M, &Error);
|
||||||
if (!Error.empty()) {
|
if (!Error.empty()) {
|
||||||
|
@ -293,7 +293,7 @@ bool BugDriver::initializeExecutionEnvironment() {
|
|||||||
/// setting Error if an error occurs. This is used for code generation
|
/// setting Error if an error occurs. This is used for code generation
|
||||||
/// crash testing.
|
/// crash testing.
|
||||||
///
|
///
|
||||||
void BugDriver::compileProgram(Module *M, std::string *Error) {
|
void BugDriver::compileProgram(Module *M, std::string *Error) const {
|
||||||
// Emit the program to a bitcode file...
|
// Emit the program to a bitcode file...
|
||||||
sys::Path BitcodeFile (OutputPrefix + "-test-program.bc");
|
sys::Path BitcodeFile (OutputPrefix + "-test-program.bc");
|
||||||
std::string ErrMsg;
|
std::string ErrMsg;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user