mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-27 02:31:09 +00:00
[C++] Use 'nullptr'. Tools edition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207176 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ac16f0e024
commit
573faecacf
@ -70,8 +70,8 @@ BugDriver::BugDriver(const char *toolname, bool find_bugs,
|
|||||||
unsigned timeout, unsigned memlimit, bool use_valgrind,
|
unsigned timeout, unsigned memlimit, bool use_valgrind,
|
||||||
LLVMContext& ctxt)
|
LLVMContext& ctxt)
|
||||||
: Context(ctxt), ToolName(toolname), ReferenceOutputFile(OutputFile),
|
: Context(ctxt), ToolName(toolname), ReferenceOutputFile(OutputFile),
|
||||||
Program(0), Interpreter(0), SafeInterpreter(0), gcc(0),
|
Program(nullptr), Interpreter(nullptr), SafeInterpreter(nullptr),
|
||||||
run_find_bugs(find_bugs), Timeout(timeout),
|
gcc(nullptr), run_find_bugs(find_bugs), Timeout(timeout),
|
||||||
MemoryLimit(memlimit), UseValgrind(use_valgrind) {}
|
MemoryLimit(memlimit), UseValgrind(use_valgrind) {}
|
||||||
|
|
||||||
BugDriver::~BugDriver() {
|
BugDriver::~BugDriver() {
|
||||||
@ -117,13 +117,13 @@ bool BugDriver::addSources(const std::vector<std::string> &Filenames) {
|
|||||||
|
|
||||||
// Load the first input file.
|
// Load the first input file.
|
||||||
Program = ParseInputFile(Filenames[0], Context);
|
Program = ParseInputFile(Filenames[0], Context);
|
||||||
if (Program == 0) return true;
|
if (!Program) return true;
|
||||||
|
|
||||||
outs() << "Read input file : '" << Filenames[0] << "'\n";
|
outs() << "Read input file : '" << Filenames[0] << "'\n";
|
||||||
|
|
||||||
for (unsigned i = 1, e = Filenames.size(); i != e; ++i) {
|
for (unsigned i = 1, e = Filenames.size(); i != e; ++i) {
|
||||||
std::unique_ptr<Module> M(ParseInputFile(Filenames[i], Context));
|
std::unique_ptr<Module> M(ParseInputFile(Filenames[i], Context));
|
||||||
if (M.get() == 0) return true;
|
if (!M.get()) return true;
|
||||||
|
|
||||||
outs() << "Linking in input file: '" << Filenames[i] << "'\n";
|
outs() << "Linking in input file: '" << Filenames[i] << "'\n";
|
||||||
std::string ErrorMessage;
|
std::string ErrorMessage;
|
||||||
|
@ -63,7 +63,7 @@ ReducePassList::doTest(std::vector<std::string> &Prefix,
|
|||||||
std::vector<std::string> &Suffix,
|
std::vector<std::string> &Suffix,
|
||||||
std::string &Error) {
|
std::string &Error) {
|
||||||
std::string PrefixOutput;
|
std::string PrefixOutput;
|
||||||
Module *OrigProgram = 0;
|
Module *OrigProgram = nullptr;
|
||||||
if (!Prefix.empty()) {
|
if (!Prefix.empty()) {
|
||||||
outs() << "Checking to see if these passes crash: "
|
outs() << "Checking to see if these passes crash: "
|
||||||
<< getPassesString(Prefix) << ": ";
|
<< getPassesString(Prefix) << ": ";
|
||||||
@ -73,7 +73,7 @@ ReducePassList::doTest(std::vector<std::string> &Prefix,
|
|||||||
OrigProgram = BD.Program;
|
OrigProgram = BD.Program;
|
||||||
|
|
||||||
BD.Program = ParseInputFile(PrefixOutput, BD.getContext());
|
BD.Program = ParseInputFile(PrefixOutput, BD.getContext());
|
||||||
if (BD.Program == 0) {
|
if (BD.Program == nullptr) {
|
||||||
errs() << BD.getToolName() << ": Error reading bitcode file '"
|
errs() << BD.getToolName() << ": Error reading bitcode file '"
|
||||||
<< PrefixOutput << "'!\n";
|
<< PrefixOutput << "'!\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -149,7 +149,7 @@ ReduceCrashingGlobalVariables::TestGlobalVariables(
|
|||||||
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
|
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
if (I->hasInitializer() && !GVSet.count(I)) {
|
if (I->hasInitializer() && !GVSet.count(I)) {
|
||||||
I->setInitializer(0);
|
I->setInitializer(nullptr);
|
||||||
I->setLinkage(GlobalValue::ExternalLinkage);
|
I->setLinkage(GlobalValue::ExternalLinkage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,7 +447,7 @@ static bool DebugACrash(BugDriver &BD,
|
|||||||
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
|
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
if (I->hasInitializer()) {
|
if (I->hasInitializer()) {
|
||||||
I->setInitializer(0);
|
I->setInitializer(nullptr);
|
||||||
I->setLinkage(GlobalValue::ExternalLinkage);
|
I->setLinkage(GlobalValue::ExternalLinkage);
|
||||||
DeletedInit = true;
|
DeletedInit = true;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ bool BugDriver::initializeExecutionEnvironment() {
|
|||||||
|
|
||||||
// Create an instance of the AbstractInterpreter interface as specified on
|
// Create an instance of the AbstractInterpreter interface as specified on
|
||||||
// the command line
|
// the command line
|
||||||
SafeInterpreter = 0;
|
SafeInterpreter = nullptr;
|
||||||
std::string Message;
|
std::string Message;
|
||||||
|
|
||||||
switch (InterpreterSel) {
|
switch (InterpreterSel) {
|
||||||
@ -256,7 +256,7 @@ bool BugDriver::initializeExecutionEnvironment() {
|
|||||||
if (!gcc) { outs() << Message << "\nExiting.\n"; exit(1); }
|
if (!gcc) { outs() << Message << "\nExiting.\n"; exit(1); }
|
||||||
|
|
||||||
// If there was an error creating the selected interpreter, quit with error.
|
// If there was an error creating the selected interpreter, quit with error.
|
||||||
return Interpreter == 0;
|
return Interpreter == nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// compileProgram - Try to compile the specified module, returning false and
|
/// compileProgram - Try to compile the specified module, returning false and
|
||||||
@ -298,7 +298,7 @@ std::string BugDriver::executeProgram(const Module *Program,
|
|||||||
const std::string &SharedObj,
|
const std::string &SharedObj,
|
||||||
AbstractInterpreter *AI,
|
AbstractInterpreter *AI,
|
||||||
std::string *Error) const {
|
std::string *Error) const {
|
||||||
if (AI == 0) AI = Interpreter;
|
if (!AI) AI = Interpreter;
|
||||||
assert(AI && "Interpreter should have been created already!");
|
assert(AI && "Interpreter should have been created already!");
|
||||||
bool CreatedBitcode = false;
|
bool CreatedBitcode = false;
|
||||||
if (BitcodeFile.empty()) {
|
if (BitcodeFile.empty()) {
|
||||||
@ -445,7 +445,7 @@ bool BugDriver::diffProgram(const Module *Program,
|
|||||||
std::string *ErrMsg) const {
|
std::string *ErrMsg) const {
|
||||||
// Execute the program, generating an output file...
|
// Execute the program, generating an output file...
|
||||||
std::string Output(
|
std::string Output(
|
||||||
executeProgram(Program, "", BitcodeFile, SharedObject, 0, ErrMsg));
|
executeProgram(Program, "", BitcodeFile, SharedObject, nullptr, ErrMsg));
|
||||||
if (!ErrMsg->empty())
|
if (!ErrMsg->empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ namespace {
|
|||||||
|
|
||||||
Function* globalInitUsesExternalBA(GlobalVariable* GV) {
|
Function* globalInitUsesExternalBA(GlobalVariable* GV) {
|
||||||
if (!GV->hasInitializer())
|
if (!GV->hasInitializer())
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
Constant *I = GV->getInitializer();
|
Constant *I = GV->getInitializer();
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ namespace {
|
|||||||
Todo.push_back(C);
|
Todo.push_back(C);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ Module *BugDriver::performFinalCleanups(Module *M, bool MayModifySemantics) {
|
|||||||
CleanupPasses.push_back("deadargelim");
|
CleanupPasses.push_back("deadargelim");
|
||||||
|
|
||||||
Module *New = runPassesOn(M, CleanupPasses);
|
Module *New = runPassesOn(M, CleanupPasses);
|
||||||
if (New == 0) {
|
if (!New) {
|
||||||
errs() << "Final cleanups failed. Sorry. :( Please report a bug!\n";
|
errs() << "Final cleanups failed. Sorry. :( Please report a bug!\n";
|
||||||
return M;
|
return M;
|
||||||
}
|
}
|
||||||
@ -167,11 +167,11 @@ Module *BugDriver::ExtractLoop(Module *M) {
|
|||||||
LoopExtractPasses.push_back("loop-extract-single");
|
LoopExtractPasses.push_back("loop-extract-single");
|
||||||
|
|
||||||
Module *NewM = runPassesOn(M, LoopExtractPasses);
|
Module *NewM = runPassesOn(M, LoopExtractPasses);
|
||||||
if (NewM == 0) {
|
if (!NewM) {
|
||||||
outs() << "*** Loop extraction failed: ";
|
outs() << "*** Loop extraction failed: ";
|
||||||
EmitProgressBitcode(M, "loopextraction", true);
|
EmitProgressBitcode(M, "loopextraction", true);
|
||||||
outs() << "*** Sorry. :( Please report a bug!\n";
|
outs() << "*** Sorry. :( Please report a bug!\n";
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if we created any new functions. If not, no loops were
|
// Check to see if we created any new functions. If not, no loops were
|
||||||
@ -180,7 +180,7 @@ Module *BugDriver::ExtractLoop(Module *M) {
|
|||||||
static unsigned NumExtracted = 32;
|
static unsigned NumExtracted = 32;
|
||||||
if (M->size() == NewM->size() || --NumExtracted == 0) {
|
if (M->size() == NewM->size() || --NumExtracted == 0) {
|
||||||
delete NewM;
|
delete NewM;
|
||||||
return 0;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
assert(M->size() < NewM->size() && "Loop extract removed functions?");
|
assert(M->size() < NewM->size() && "Loop extract removed functions?");
|
||||||
Module::iterator MI = NewM->begin();
|
Module::iterator MI = NewM->begin();
|
||||||
@ -337,10 +337,10 @@ llvm::SplitFunctionsOutOfModule(Module *M,
|
|||||||
<< "' and from test function '" << TestFn->getName() << "'.\n";
|
<< "' and from test function '" << TestFn->getName() << "'.\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
I->setInitializer(0); // Delete the initializer to make it external
|
I->setInitializer(nullptr); // Delete the initializer to make it external
|
||||||
} else {
|
} else {
|
||||||
// If we keep it in the safe module, then delete it in the test module
|
// If we keep it in the safe module, then delete it in the test module
|
||||||
GV->setInitializer(0);
|
GV->setInitializer(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const
|
|||||||
outs() << "*** Basic Block extraction failed!\n";
|
outs() << "*** Basic Block extraction failed!\n";
|
||||||
errs() << "Error creating temporary file: " << EC.message() << "\n";
|
errs() << "Error creating temporary file: " << EC.message() << "\n";
|
||||||
EmitProgressBitcode(M, "basicblockextractfail", true);
|
EmitProgressBitcode(M, "basicblockextractfail", true);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
sys::RemoveFileOnSignal(Filename);
|
sys::RemoveFileOnSignal(Filename);
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const
|
|||||||
errs() << "Error writing list of blocks to not extract\n";
|
errs() << "Error writing list of blocks to not extract\n";
|
||||||
EmitProgressBitcode(M, "basicblockextractfail", true);
|
EmitProgressBitcode(M, "basicblockextractfail", true);
|
||||||
BlocksToNotExtractFile.os().clear_error();
|
BlocksToNotExtractFile.os().clear_error();
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
BlocksToNotExtractFile.keep();
|
BlocksToNotExtractFile.keep();
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const
|
|||||||
|
|
||||||
sys::fs::remove(Filename.c_str());
|
sys::fs::remove(Filename.c_str());
|
||||||
|
|
||||||
if (Ret == 0) {
|
if (!Ret) {
|
||||||
outs() << "*** Basic Block extraction failed, please report a bug!\n";
|
outs() << "*** Basic Block extraction failed, please report a bug!\n";
|
||||||
EmitProgressBitcode(M, "basicblockextractfail", true);
|
EmitProgressBitcode(M, "basicblockextractfail", true);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ bool BugDriver::runManyPasses(const std::vector<std::string> &AllPasses,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
srand(time(NULL));
|
srand(time(nullptr));
|
||||||
|
|
||||||
unsigned num = 1;
|
unsigned num = 1;
|
||||||
while(1) {
|
while(1) {
|
||||||
|
@ -235,7 +235,7 @@ static Module *TestMergedProgram(const BugDriver &BD, Module *M1, Module *M2,
|
|||||||
if (!Error.empty()) {
|
if (!Error.empty()) {
|
||||||
// Delete the linked module
|
// Delete the linked module
|
||||||
delete M1;
|
delete M1;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return M1;
|
return M1;
|
||||||
}
|
}
|
||||||
@ -592,7 +592,7 @@ static bool ExtractBlocks(BugDriver &BD,
|
|||||||
MiscompiledFunctions,
|
MiscompiledFunctions,
|
||||||
VMap);
|
VMap);
|
||||||
Module *Extracted = BD.ExtractMappedBlocksFromModule(Blocks, ToExtract);
|
Module *Extracted = BD.ExtractMappedBlocksFromModule(Blocks, ToExtract);
|
||||||
if (Extracted == 0) {
|
if (!Extracted) {
|
||||||
// Weird, extraction should have worked.
|
// Weird, extraction should have worked.
|
||||||
errs() << "Nondeterministic problem extracting blocks??\n";
|
errs() << "Nondeterministic problem extracting blocks??\n";
|
||||||
delete ProgClone;
|
delete ProgClone;
|
||||||
@ -845,7 +845,7 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test,
|
|||||||
Safe->getOrInsertFunction("getPointerToNamedFunction",
|
Safe->getOrInsertFunction("getPointerToNamedFunction",
|
||||||
Type::getInt8PtrTy(Safe->getContext()),
|
Type::getInt8PtrTy(Safe->getContext()),
|
||||||
Type::getInt8PtrTy(Safe->getContext()),
|
Type::getInt8PtrTy(Safe->getContext()),
|
||||||
(Type *)0);
|
(Type *)nullptr);
|
||||||
|
|
||||||
// Use the function we just added to get addresses of functions we need.
|
// Use the function we just added to get addresses of functions we need.
|
||||||
for (Module::iterator F = Safe->begin(), E = Safe->end(); F != E; ++F) {
|
for (Module::iterator F = Safe->begin(), E = Safe->end(); F != E; ++F) {
|
||||||
|
@ -196,7 +196,7 @@ bool BugDriver::runPasses(Module *Program,
|
|||||||
Args.push_back(InputFilename.c_str());
|
Args.push_back(InputFilename.c_str());
|
||||||
for (unsigned i = 0; i < NumExtraArgs; ++i)
|
for (unsigned i = 0; i < NumExtraArgs; ++i)
|
||||||
Args.push_back(*ExtraArgs);
|
Args.push_back(*ExtraArgs);
|
||||||
Args.push_back(0);
|
Args.push_back(nullptr);
|
||||||
|
|
||||||
DEBUG(errs() << "\nAbout to run:\t";
|
DEBUG(errs() << "\nAbout to run:\t";
|
||||||
for (unsigned i = 0, e = Args.size()-1; i != e; ++i)
|
for (unsigned i = 0, e = Args.size()-1; i != e; ++i)
|
||||||
@ -212,12 +212,12 @@ bool BugDriver::runPasses(Module *Program,
|
|||||||
|
|
||||||
// Redirect stdout and stderr to nowhere if SilencePasses is given
|
// Redirect stdout and stderr to nowhere if SilencePasses is given
|
||||||
StringRef Nowhere;
|
StringRef Nowhere;
|
||||||
const StringRef *Redirects[3] = {0, &Nowhere, &Nowhere};
|
const StringRef *Redirects[3] = {nullptr, &Nowhere, &Nowhere};
|
||||||
|
|
||||||
std::string ErrMsg;
|
std::string ErrMsg;
|
||||||
int result = sys::ExecuteAndWait(Prog, Args.data(), 0,
|
int result = sys::ExecuteAndWait(Prog, Args.data(), nullptr,
|
||||||
(SilencePasses ? Redirects : 0), Timeout,
|
(SilencePasses ? Redirects : nullptr),
|
||||||
MemoryLimit, &ErrMsg);
|
Timeout, MemoryLimit, &ErrMsg);
|
||||||
|
|
||||||
// If we are supposed to delete the bitcode file or if the passes crashed,
|
// If we are supposed to delete the bitcode file or if the passes crashed,
|
||||||
// remove it now. This may fail if the file was never created, but that's ok.
|
// remove it now. This may fail if the file was never created, but that's ok.
|
||||||
@ -264,11 +264,11 @@ Module *BugDriver::runPassesOn(Module *M,
|
|||||||
EmitProgressBitcode(M, "pass-error", false);
|
EmitProgressBitcode(M, "pass-error", false);
|
||||||
exit(debugOptimizerCrash());
|
exit(debugOptimizerCrash());
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Module *Ret = ParseInputFile(BitcodeResult, Context);
|
Module *Ret = ParseInputFile(BitcodeResult, Context);
|
||||||
if (Ret == 0) {
|
if (!Ret) {
|
||||||
errs() << getToolName() << ": Error reading bitcode file '"
|
errs() << getToolName() << ": Error reading bitcode file '"
|
||||||
<< BitcodeResult << "'!\n";
|
<< BitcodeResult << "'!\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -62,7 +62,7 @@ static int RunProgramWithTimeout(StringRef ProgramPath,
|
|||||||
StringRef StdErrFile,
|
StringRef StdErrFile,
|
||||||
unsigned NumSeconds = 0,
|
unsigned NumSeconds = 0,
|
||||||
unsigned MemoryLimit = 0,
|
unsigned MemoryLimit = 0,
|
||||||
std::string *ErrMsg = 0) {
|
std::string *ErrMsg = nullptr) {
|
||||||
const StringRef *Redirects[3] = { &StdInFile, &StdOutFile, &StdErrFile };
|
const StringRef *Redirects[3] = { &StdInFile, &StdOutFile, &StdErrFile };
|
||||||
|
|
||||||
#if 0 // For debug purposes
|
#if 0 // For debug purposes
|
||||||
@ -74,7 +74,7 @@ static int RunProgramWithTimeout(StringRef ProgramPath,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return sys::ExecuteAndWait(ProgramPath, Args, 0, Redirects,
|
return sys::ExecuteAndWait(ProgramPath, Args, nullptr, Redirects,
|
||||||
NumSeconds, MemoryLimit, ErrMsg);
|
NumSeconds, MemoryLimit, ErrMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ static int RunProgramRemotelyWithTimeout(StringRef RemoteClientPath,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Run the program remotely with the remote client
|
// Run the program remotely with the remote client
|
||||||
int ReturnCode = sys::ExecuteAndWait(RemoteClientPath, Args, 0,
|
int ReturnCode = sys::ExecuteAndWait(RemoteClientPath, Args, nullptr,
|
||||||
Redirects, NumSeconds, MemoryLimit);
|
Redirects, NumSeconds, MemoryLimit);
|
||||||
|
|
||||||
// Has the remote client fail?
|
// Has the remote client fail?
|
||||||
@ -219,7 +219,7 @@ int LLI::ExecuteProgram(const std::string &Bitcode,
|
|||||||
// Add optional parameters to the running program from Argv
|
// Add optional parameters to the running program from Argv
|
||||||
for (unsigned i=0, e = Args.size(); i != e; ++i)
|
for (unsigned i=0, e = Args.size(); i != e; ++i)
|
||||||
LLIArgs.push_back(Args[i].c_str());
|
LLIArgs.push_back(Args[i].c_str());
|
||||||
LLIArgs.push_back(0);
|
LLIArgs.push_back(nullptr);
|
||||||
|
|
||||||
outs() << "<lli>"; outs().flush();
|
outs() << "<lli>"; outs().flush();
|
||||||
DEBUG(errs() << "\nAbout to run:\t";
|
DEBUG(errs() << "\nAbout to run:\t";
|
||||||
@ -277,7 +277,7 @@ AbstractInterpreter *AbstractInterpreter::createLLI(const char *Argv0,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Message = "Cannot find `lli' in executable directory!\n";
|
Message = "Cannot find `lli' in executable directory!\n";
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===---------------------------------------------------------------------===//
|
//===---------------------------------------------------------------------===//
|
||||||
@ -328,7 +328,7 @@ void CustomCompiler::compileProgram(const std::string &Bitcode,
|
|||||||
for (std::size_t i = 0; i < CompilerArgs.size(); ++i)
|
for (std::size_t i = 0; i < CompilerArgs.size(); ++i)
|
||||||
ProgramArgs.push_back(CompilerArgs.at(i).c_str());
|
ProgramArgs.push_back(CompilerArgs.at(i).c_str());
|
||||||
ProgramArgs.push_back(Bitcode.c_str());
|
ProgramArgs.push_back(Bitcode.c_str());
|
||||||
ProgramArgs.push_back(0);
|
ProgramArgs.push_back(nullptr);
|
||||||
|
|
||||||
// Add optional parameters to the running program from Argv
|
// Add optional parameters to the running program from Argv
|
||||||
for (unsigned i = 0, e = CompilerArgs.size(); i != e; ++i)
|
for (unsigned i = 0, e = CompilerArgs.size(); i != e; ++i)
|
||||||
@ -385,7 +385,7 @@ int CustomExecutor::ExecuteProgram(const std::string &Bitcode,
|
|||||||
for (std::size_t i = 0; i < ExecutorArgs.size(); ++i)
|
for (std::size_t i = 0; i < ExecutorArgs.size(); ++i)
|
||||||
ProgramArgs.push_back(ExecutorArgs.at(i).c_str());
|
ProgramArgs.push_back(ExecutorArgs.at(i).c_str());
|
||||||
ProgramArgs.push_back(Bitcode.c_str());
|
ProgramArgs.push_back(Bitcode.c_str());
|
||||||
ProgramArgs.push_back(0);
|
ProgramArgs.push_back(nullptr);
|
||||||
|
|
||||||
// Add optional parameters to the running program from Argv
|
// Add optional parameters to the running program from Argv
|
||||||
for (unsigned i = 0, e = Args.size(); i != e; ++i)
|
for (unsigned i = 0, e = Args.size(); i != e; ++i)
|
||||||
@ -448,7 +448,7 @@ AbstractInterpreter *AbstractInterpreter::createCustomCompiler(
|
|||||||
std::vector<std::string> Args;
|
std::vector<std::string> Args;
|
||||||
lexCommand(Message, CompileCommandLine, CmdPath, Args);
|
lexCommand(Message, CompileCommandLine, CmdPath, Args);
|
||||||
if (CmdPath.empty())
|
if (CmdPath.empty())
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return new CustomCompiler(CmdPath, Args);
|
return new CustomCompiler(CmdPath, Args);
|
||||||
}
|
}
|
||||||
@ -464,7 +464,7 @@ AbstractInterpreter *AbstractInterpreter::createCustomExecutor(
|
|||||||
std::vector<std::string> Args;
|
std::vector<std::string> Args;
|
||||||
lexCommand(Message, ExecCommandLine, CmdPath, Args);
|
lexCommand(Message, ExecCommandLine, CmdPath, Args);
|
||||||
if (CmdPath.empty())
|
if (CmdPath.empty())
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return new CustomExecutor(CmdPath, Args);
|
return new CustomExecutor(CmdPath, Args);
|
||||||
}
|
}
|
||||||
@ -499,7 +499,7 @@ GCC::FileType LLC::OutputCode(const std::string &Bitcode,
|
|||||||
if (UseIntegratedAssembler)
|
if (UseIntegratedAssembler)
|
||||||
LLCArgs.push_back("-filetype=obj");
|
LLCArgs.push_back("-filetype=obj");
|
||||||
|
|
||||||
LLCArgs.push_back (0);
|
LLCArgs.push_back (nullptr);
|
||||||
|
|
||||||
outs() << (UseIntegratedAssembler ? "<llc-ia>" : "<llc>");
|
outs() << (UseIntegratedAssembler ? "<llc-ia>" : "<llc>");
|
||||||
outs().flush();
|
outs().flush();
|
||||||
@ -559,7 +559,7 @@ LLC *AbstractInterpreter::createLLC(const char *Argv0,
|
|||||||
PrependMainExecutablePath("llc", Argv0, (void *)(intptr_t) & createLLC);
|
PrependMainExecutablePath("llc", Argv0, (void *)(intptr_t) & createLLC);
|
||||||
if (LLCPath.empty()) {
|
if (LLCPath.empty()) {
|
||||||
Message = "Cannot find `llc' in executable directory!\n";
|
Message = "Cannot find `llc' in executable directory!\n";
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
GCC *gcc = GCC::create(Message, GCCBinary, GCCArgs);
|
GCC *gcc = GCC::create(Message, GCCBinary, GCCArgs);
|
||||||
@ -625,7 +625,7 @@ int JIT::ExecuteProgram(const std::string &Bitcode,
|
|||||||
// Add optional parameters to the running program from Argv
|
// Add optional parameters to the running program from Argv
|
||||||
for (unsigned i=0, e = Args.size(); i != e; ++i)
|
for (unsigned i=0, e = Args.size(); i != e; ++i)
|
||||||
JITArgs.push_back(Args[i].c_str());
|
JITArgs.push_back(Args[i].c_str());
|
||||||
JITArgs.push_back(0);
|
JITArgs.push_back(nullptr);
|
||||||
|
|
||||||
outs() << "<jit>"; outs().flush();
|
outs() << "<jit>"; outs().flush();
|
||||||
DEBUG(errs() << "\nAbout to run:\t";
|
DEBUG(errs() << "\nAbout to run:\t";
|
||||||
@ -651,7 +651,7 @@ AbstractInterpreter *AbstractInterpreter::createJIT(const char *Argv0,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Message = "Cannot find `lli' in executable directory!\n";
|
Message = "Cannot find `lli' in executable directory!\n";
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===---------------------------------------------------------------------===//
|
//===---------------------------------------------------------------------===//
|
||||||
@ -737,7 +737,7 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
|
|||||||
#endif
|
#endif
|
||||||
if (TargetTriple.getArch() == Triple::sparc)
|
if (TargetTriple.getArch() == Triple::sparc)
|
||||||
GCCArgs.push_back("-mcpu=v9");
|
GCCArgs.push_back("-mcpu=v9");
|
||||||
GCCArgs.push_back(0); // NULL terminator
|
GCCArgs.push_back(nullptr); // NULL terminator
|
||||||
|
|
||||||
outs() << "<gcc>"; outs().flush();
|
outs() << "<gcc>"; outs().flush();
|
||||||
DEBUG(errs() << "\nAbout to run:\t";
|
DEBUG(errs() << "\nAbout to run:\t";
|
||||||
@ -786,7 +786,7 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
|
|||||||
// Add optional parameters to the running program from Argv
|
// Add optional parameters to the running program from Argv
|
||||||
for (unsigned i = 0, e = Args.size(); i != e; ++i)
|
for (unsigned i = 0, e = Args.size(); i != e; ++i)
|
||||||
ProgramArgs.push_back(Args[i].c_str());
|
ProgramArgs.push_back(Args[i].c_str());
|
||||||
ProgramArgs.push_back(0); // NULL terminator
|
ProgramArgs.push_back(nullptr); // NULL terminator
|
||||||
|
|
||||||
// Now that we have a binary, run it!
|
// Now that we have a binary, run it!
|
||||||
outs() << "<program>"; outs().flush();
|
outs() << "<program>"; outs().flush();
|
||||||
@ -885,7 +885,7 @@ int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType,
|
|||||||
// command line, so this should be safe.
|
// command line, so this should be safe.
|
||||||
for (unsigned i = 0, e = ArgsForGCC.size(); i != e; ++i)
|
for (unsigned i = 0, e = ArgsForGCC.size(); i != e; ++i)
|
||||||
GCCArgs.push_back(ArgsForGCC[i].c_str());
|
GCCArgs.push_back(ArgsForGCC[i].c_str());
|
||||||
GCCArgs.push_back(0); // NULL terminator
|
GCCArgs.push_back(nullptr); // NULL terminator
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -910,7 +910,7 @@ GCC *GCC::create(std::string &Message,
|
|||||||
std::string GCCPath = sys::FindProgramByName(GCCBinary);
|
std::string GCCPath = sys::FindProgramByName(GCCBinary);
|
||||||
if (GCCPath.empty()) {
|
if (GCCPath.empty()) {
|
||||||
Message = "Cannot find `"+ GCCBinary +"' in PATH!\n";
|
Message = "Cannot find `"+ GCCBinary +"' in PATH!\n";
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string RemoteClientPath;
|
std::string RemoteClientPath;
|
||||||
|
@ -99,7 +99,7 @@ namespace {
|
|||||||
class AddToDriver : public FunctionPassManager {
|
class AddToDriver : public FunctionPassManager {
|
||||||
BugDriver &D;
|
BugDriver &D;
|
||||||
public:
|
public:
|
||||||
AddToDriver(BugDriver &_D) : FunctionPassManager(0), D(_D) {}
|
AddToDriver(BugDriver &_D) : FunctionPassManager(nullptr), D(_D) {}
|
||||||
|
|
||||||
void add(Pass *P) override {
|
void add(Pass *P) override {
|
||||||
const void *ID = P->getPassID();
|
const void *ID = P->getPassID();
|
||||||
|
@ -157,7 +157,7 @@ static tool_output_file *GetOutputStream(const char *TargetName,
|
|||||||
if (!error.empty()) {
|
if (!error.empty()) {
|
||||||
errs() << error << '\n';
|
errs() << error << '\n';
|
||||||
delete FDOut;
|
delete FDOut;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FDOut;
|
return FDOut;
|
||||||
@ -207,7 +207,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
|
|||||||
// Load the module to be compiled...
|
// Load the module to be compiled...
|
||||||
SMDiagnostic Err;
|
SMDiagnostic Err;
|
||||||
std::unique_ptr<Module> M;
|
std::unique_ptr<Module> M;
|
||||||
Module *mod = 0;
|
Module *mod = nullptr;
|
||||||
Triple TheTriple;
|
Triple TheTriple;
|
||||||
|
|
||||||
bool SkipModule = MCPU == "help" ||
|
bool SkipModule = MCPU == "help" ||
|
||||||
@ -223,7 +223,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
|
|||||||
if (!SkipModule) {
|
if (!SkipModule) {
|
||||||
M.reset(ParseIRFile(InputFilename, Err, Context));
|
M.reset(ParseIRFile(InputFilename, Err, Context));
|
||||||
mod = M.get();
|
mod = M.get();
|
||||||
if (mod == 0) {
|
if (mod == nullptr) {
|
||||||
Err.print(argv[0], errs());
|
Err.print(argv[0], errs());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -321,8 +321,8 @@ static int compileModule(char **argv, LLVMContext &Context) {
|
|||||||
{
|
{
|
||||||
formatted_raw_ostream FOS(Out->os());
|
formatted_raw_ostream FOS(Out->os());
|
||||||
|
|
||||||
AnalysisID StartAfterID = 0;
|
AnalysisID StartAfterID = nullptr;
|
||||||
AnalysisID StopAfterID = 0;
|
AnalysisID StopAfterID = nullptr;
|
||||||
const PassRegistry *PR = PassRegistry::getPassRegistry();
|
const PassRegistry *PR = PassRegistry::getPassRegistry();
|
||||||
if (!StartAfter.empty()) {
|
if (!StartAfter.empty()) {
|
||||||
const PassInfo *PI = PR->getPassInfo(StartAfter);
|
const PassInfo *PI = PR->getPassInfo(StartAfter);
|
||||||
|
@ -179,16 +179,16 @@ void RemoteMemoryManager::setPoisonMemory(bool poison) { llvm_unreachable("Unexp
|
|||||||
void RemoteMemoryManager::AllocateGOT() { llvm_unreachable("Unexpected!"); }
|
void RemoteMemoryManager::AllocateGOT() { llvm_unreachable("Unexpected!"); }
|
||||||
uint8_t *RemoteMemoryManager::getGOTBase() const {
|
uint8_t *RemoteMemoryManager::getGOTBase() const {
|
||||||
llvm_unreachable("Unexpected!");
|
llvm_unreachable("Unexpected!");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
uint8_t *RemoteMemoryManager::startFunctionBody(const Function *F, uintptr_t &ActualSize){
|
uint8_t *RemoteMemoryManager::startFunctionBody(const Function *F, uintptr_t &ActualSize){
|
||||||
llvm_unreachable("Unexpected!");
|
llvm_unreachable("Unexpected!");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
uint8_t *RemoteMemoryManager::allocateStub(const GlobalValue* F, unsigned StubSize,
|
uint8_t *RemoteMemoryManager::allocateStub(const GlobalValue* F, unsigned StubSize,
|
||||||
unsigned Alignment) {
|
unsigned Alignment) {
|
||||||
llvm_unreachable("Unexpected!");
|
llvm_unreachable("Unexpected!");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
void RemoteMemoryManager::endFunctionBody(const Function *F, uint8_t *FunctionStart,
|
void RemoteMemoryManager::endFunctionBody(const Function *F, uint8_t *FunctionStart,
|
||||||
uint8_t *FunctionEnd) {
|
uint8_t *FunctionEnd) {
|
||||||
@ -196,11 +196,11 @@ void RemoteMemoryManager::endFunctionBody(const Function *F, uint8_t *FunctionSt
|
|||||||
}
|
}
|
||||||
uint8_t *RemoteMemoryManager::allocateSpace(intptr_t Size, unsigned Alignment) {
|
uint8_t *RemoteMemoryManager::allocateSpace(intptr_t Size, unsigned Alignment) {
|
||||||
llvm_unreachable("Unexpected!");
|
llvm_unreachable("Unexpected!");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
uint8_t *RemoteMemoryManager::allocateGlobal(uintptr_t Size, unsigned Alignment) {
|
uint8_t *RemoteMemoryManager::allocateGlobal(uintptr_t Size, unsigned Alignment) {
|
||||||
llvm_unreachable("Unexpected!");
|
llvm_unreachable("Unexpected!");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
void RemoteMemoryManager::deallocateFunctionBody(void *Body) {
|
void RemoteMemoryManager::deallocateFunctionBody(void *Body) {
|
||||||
llvm_unreachable("Unexpected!");
|
llvm_unreachable("Unexpected!");
|
||||||
|
@ -30,9 +30,9 @@ using namespace llvm;
|
|||||||
|
|
||||||
bool RemoteTarget::allocateSpace(size_t Size, unsigned Alignment,
|
bool RemoteTarget::allocateSpace(size_t Size, unsigned Alignment,
|
||||||
uint64_t &Address) {
|
uint64_t &Address) {
|
||||||
sys::MemoryBlock *Prev = Allocations.size() ? &Allocations.back() : NULL;
|
sys::MemoryBlock *Prev = Allocations.size() ? &Allocations.back() : nullptr;
|
||||||
sys::MemoryBlock Mem = sys::Memory::AllocateRWX(Size, Prev, &ErrorMsg);
|
sys::MemoryBlock Mem = sys::Memory::AllocateRWX(Size, Prev, &ErrorMsg);
|
||||||
if (Mem.base() == NULL)
|
if (Mem.base() == nullptr)
|
||||||
return false;
|
return false;
|
||||||
if ((uintptr_t)Mem.base() % Alignment) {
|
if ((uintptr_t)Mem.base() % Alignment) {
|
||||||
ErrorMsg = "unable to allocate sufficiently aligned memory";
|
ErrorMsg = "unable to allocate sufficiently aligned memory";
|
||||||
|
@ -283,13 +283,13 @@ public:
|
|||||||
const std::string ModuleID = M->getModuleIdentifier();
|
const std::string ModuleID = M->getModuleIdentifier();
|
||||||
std::string CacheName;
|
std::string CacheName;
|
||||||
if (!getCacheFilename(ModuleID, CacheName))
|
if (!getCacheFilename(ModuleID, CacheName))
|
||||||
return NULL;
|
return nullptr;
|
||||||
// Load the object from the cache filename
|
// Load the object from the cache filename
|
||||||
std::unique_ptr<MemoryBuffer> IRObjectBuffer;
|
std::unique_ptr<MemoryBuffer> IRObjectBuffer;
|
||||||
MemoryBuffer::getFile(CacheName.c_str(), IRObjectBuffer, -1, false);
|
MemoryBuffer::getFile(CacheName.c_str(), IRObjectBuffer, -1, false);
|
||||||
// If the file isn't there, that's OK.
|
// If the file isn't there, that's OK.
|
||||||
if (!IRObjectBuffer)
|
if (!IRObjectBuffer)
|
||||||
return NULL;
|
return nullptr;
|
||||||
// MCJIT will want to write into this buffer, and we don't want that
|
// MCJIT will want to write into this buffer, and we don't want that
|
||||||
// because the file has probably just been mmapped. Instead we make
|
// because the file has probably just been mmapped. Instead we make
|
||||||
// a copy. The filed-based buffer will be released when it goes
|
// a copy. The filed-based buffer will be released when it goes
|
||||||
@ -320,8 +320,8 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static ExecutionEngine *EE = 0;
|
static ExecutionEngine *EE = nullptr;
|
||||||
static LLIObjectCache *CacheManager = 0;
|
static LLIObjectCache *CacheManager = nullptr;
|
||||||
|
|
||||||
static void do_shutdown() {
|
static void do_shutdown() {
|
||||||
// Cygwin-1.5 invokes DLL's dtors before atexit handler.
|
// Cygwin-1.5 invokes DLL's dtors before atexit handler.
|
||||||
@ -450,7 +450,7 @@ int main(int argc, char **argv, char * const *envp) {
|
|||||||
Mod->setTargetTriple(Triple::normalize(TargetTriple));
|
Mod->setTargetTriple(Triple::normalize(TargetTriple));
|
||||||
|
|
||||||
// Enable MCJIT if desired.
|
// Enable MCJIT if desired.
|
||||||
RTDyldMemoryManager *RTDyldMM = 0;
|
RTDyldMemoryManager *RTDyldMM = nullptr;
|
||||||
if (UseMCJIT && !ForceInterpreter) {
|
if (UseMCJIT && !ForceInterpreter) {
|
||||||
builder.setUseMCJIT(true);
|
builder.setUseMCJIT(true);
|
||||||
if (RemoteMCJIT)
|
if (RemoteMCJIT)
|
||||||
@ -463,7 +463,7 @@ int main(int argc, char **argv, char * const *envp) {
|
|||||||
errs() << "error: Remote process execution requires -use-mcjit\n";
|
errs() << "error: Remote process execution requires -use-mcjit\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
builder.setJITMemoryManager(ForceInterpreter ? 0 :
|
builder.setJITMemoryManager(ForceInterpreter ? nullptr :
|
||||||
JITMemoryManager::CreateDefaultMemManager());
|
JITMemoryManager::CreateDefaultMemManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -856,7 +856,7 @@ static void performWriteOperation(ArchiveOperation Operation,
|
|||||||
Output.keep();
|
Output.keep();
|
||||||
Out.close();
|
Out.close();
|
||||||
sys::fs::rename(TemporaryOutput, ArchiveName);
|
sys::fs::rename(TemporaryOutput, ArchiveName);
|
||||||
TemporaryOutput = NULL;
|
TemporaryOutput = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void createSymbolTable(object::Archive *OldArchive) {
|
static void createSymbolTable(object::Archive *OldArchive) {
|
||||||
@ -969,6 +969,6 @@ static int performOperation(ArchiveOperation Operation) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
performOperation(Operation, NULL);
|
performOperation(Operation, nullptr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ int main(int argc, char **argv) {
|
|||||||
// Parse the file now...
|
// Parse the file now...
|
||||||
SMDiagnostic Err;
|
SMDiagnostic Err;
|
||||||
std::unique_ptr<Module> M(ParseAssemblyFile(InputFilename, Err, Context));
|
std::unique_ptr<Module> M(ParseAssemblyFile(InputFilename, Err, Context));
|
||||||
if (M.get() == 0) {
|
if (!M.get()) {
|
||||||
Err.print(argv[0], errs());
|
Err.print(argv[0], errs());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ static const char *GetBlockName(unsigned BlockID,
|
|||||||
if (BlockID < bitc::FIRST_APPLICATION_BLOCKID) {
|
if (BlockID < bitc::FIRST_APPLICATION_BLOCKID) {
|
||||||
if (BlockID == bitc::BLOCKINFO_BLOCK_ID)
|
if (BlockID == bitc::BLOCKINFO_BLOCK_ID)
|
||||||
return "BLOCKINFO_BLOCK";
|
return "BLOCKINFO_BLOCK";
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if we have a blockinfo record for this block, with a name.
|
// Check to see if we have a blockinfo record for this block, with a name.
|
||||||
@ -95,10 +95,10 @@ static const char *GetBlockName(unsigned BlockID,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (CurStreamType != LLVMIRBitstream) return 0;
|
if (CurStreamType != LLVMIRBitstream) return nullptr;
|
||||||
|
|
||||||
switch (BlockID) {
|
switch (BlockID) {
|
||||||
default: return 0;
|
default: return nullptr;
|
||||||
case bitc::MODULE_BLOCK_ID: return "MODULE_BLOCK";
|
case bitc::MODULE_BLOCK_ID: return "MODULE_BLOCK";
|
||||||
case bitc::PARAMATTR_BLOCK_ID: return "PARAMATTR_BLOCK";
|
case bitc::PARAMATTR_BLOCK_ID: return "PARAMATTR_BLOCK";
|
||||||
case bitc::PARAMATTR_GROUP_BLOCK_ID: return "PARAMATTR_GROUP_BLOCK_ID";
|
case bitc::PARAMATTR_GROUP_BLOCK_ID: return "PARAMATTR_GROUP_BLOCK_ID";
|
||||||
@ -120,13 +120,13 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID,
|
|||||||
if (BlockID < bitc::FIRST_APPLICATION_BLOCKID) {
|
if (BlockID < bitc::FIRST_APPLICATION_BLOCKID) {
|
||||||
if (BlockID == bitc::BLOCKINFO_BLOCK_ID) {
|
if (BlockID == bitc::BLOCKINFO_BLOCK_ID) {
|
||||||
switch (CodeID) {
|
switch (CodeID) {
|
||||||
default: return 0;
|
default: return nullptr;
|
||||||
case bitc::BLOCKINFO_CODE_SETBID: return "SETBID";
|
case bitc::BLOCKINFO_CODE_SETBID: return "SETBID";
|
||||||
case bitc::BLOCKINFO_CODE_BLOCKNAME: return "BLOCKNAME";
|
case bitc::BLOCKINFO_CODE_BLOCKNAME: return "BLOCKNAME";
|
||||||
case bitc::BLOCKINFO_CODE_SETRECORDNAME: return "SETRECORDNAME";
|
case bitc::BLOCKINFO_CODE_SETRECORDNAME: return "SETRECORDNAME";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if we have a blockinfo record for this record, with a name.
|
// Check to see if we have a blockinfo record for this record, with a name.
|
||||||
@ -138,13 +138,13 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (CurStreamType != LLVMIRBitstream) return 0;
|
if (CurStreamType != LLVMIRBitstream) return nullptr;
|
||||||
|
|
||||||
switch (BlockID) {
|
switch (BlockID) {
|
||||||
default: return 0;
|
default: return nullptr;
|
||||||
case bitc::MODULE_BLOCK_ID:
|
case bitc::MODULE_BLOCK_ID:
|
||||||
switch (CodeID) {
|
switch (CodeID) {
|
||||||
default: return 0;
|
default: return nullptr;
|
||||||
case bitc::MODULE_CODE_VERSION: return "VERSION";
|
case bitc::MODULE_CODE_VERSION: return "VERSION";
|
||||||
case bitc::MODULE_CODE_TRIPLE: return "TRIPLE";
|
case bitc::MODULE_CODE_TRIPLE: return "TRIPLE";
|
||||||
case bitc::MODULE_CODE_DATALAYOUT: return "DATALAYOUT";
|
case bitc::MODULE_CODE_DATALAYOUT: return "DATALAYOUT";
|
||||||
@ -159,14 +159,14 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID,
|
|||||||
}
|
}
|
||||||
case bitc::PARAMATTR_BLOCK_ID:
|
case bitc::PARAMATTR_BLOCK_ID:
|
||||||
switch (CodeID) {
|
switch (CodeID) {
|
||||||
default: return 0;
|
default: return nullptr;
|
||||||
case bitc::PARAMATTR_CODE_ENTRY_OLD: return "ENTRY";
|
case bitc::PARAMATTR_CODE_ENTRY_OLD: return "ENTRY";
|
||||||
case bitc::PARAMATTR_CODE_ENTRY: return "ENTRY";
|
case bitc::PARAMATTR_CODE_ENTRY: return "ENTRY";
|
||||||
case bitc::PARAMATTR_GRP_CODE_ENTRY: return "ENTRY";
|
case bitc::PARAMATTR_GRP_CODE_ENTRY: return "ENTRY";
|
||||||
}
|
}
|
||||||
case bitc::TYPE_BLOCK_ID_NEW:
|
case bitc::TYPE_BLOCK_ID_NEW:
|
||||||
switch (CodeID) {
|
switch (CodeID) {
|
||||||
default: return 0;
|
default: return nullptr;
|
||||||
case bitc::TYPE_CODE_NUMENTRY: return "NUMENTRY";
|
case bitc::TYPE_CODE_NUMENTRY: return "NUMENTRY";
|
||||||
case bitc::TYPE_CODE_VOID: return "VOID";
|
case bitc::TYPE_CODE_VOID: return "VOID";
|
||||||
case bitc::TYPE_CODE_FLOAT: return "FLOAT";
|
case bitc::TYPE_CODE_FLOAT: return "FLOAT";
|
||||||
@ -189,7 +189,7 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID,
|
|||||||
|
|
||||||
case bitc::CONSTANTS_BLOCK_ID:
|
case bitc::CONSTANTS_BLOCK_ID:
|
||||||
switch (CodeID) {
|
switch (CodeID) {
|
||||||
default: return 0;
|
default: return nullptr;
|
||||||
case bitc::CST_CODE_SETTYPE: return "SETTYPE";
|
case bitc::CST_CODE_SETTYPE: return "SETTYPE";
|
||||||
case bitc::CST_CODE_NULL: return "NULL";
|
case bitc::CST_CODE_NULL: return "NULL";
|
||||||
case bitc::CST_CODE_UNDEF: return "UNDEF";
|
case bitc::CST_CODE_UNDEF: return "UNDEF";
|
||||||
@ -215,7 +215,7 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID,
|
|||||||
}
|
}
|
||||||
case bitc::FUNCTION_BLOCK_ID:
|
case bitc::FUNCTION_BLOCK_ID:
|
||||||
switch (CodeID) {
|
switch (CodeID) {
|
||||||
default: return 0;
|
default: return nullptr;
|
||||||
case bitc::FUNC_CODE_DECLAREBLOCKS: return "DECLAREBLOCKS";
|
case bitc::FUNC_CODE_DECLAREBLOCKS: return "DECLAREBLOCKS";
|
||||||
|
|
||||||
case bitc::FUNC_CODE_INST_BINOP: return "INST_BINOP";
|
case bitc::FUNC_CODE_INST_BINOP: return "INST_BINOP";
|
||||||
@ -249,18 +249,18 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID,
|
|||||||
}
|
}
|
||||||
case bitc::VALUE_SYMTAB_BLOCK_ID:
|
case bitc::VALUE_SYMTAB_BLOCK_ID:
|
||||||
switch (CodeID) {
|
switch (CodeID) {
|
||||||
default: return 0;
|
default: return nullptr;
|
||||||
case bitc::VST_CODE_ENTRY: return "ENTRY";
|
case bitc::VST_CODE_ENTRY: return "ENTRY";
|
||||||
case bitc::VST_CODE_BBENTRY: return "BBENTRY";
|
case bitc::VST_CODE_BBENTRY: return "BBENTRY";
|
||||||
}
|
}
|
||||||
case bitc::METADATA_ATTACHMENT_ID:
|
case bitc::METADATA_ATTACHMENT_ID:
|
||||||
switch(CodeID) {
|
switch(CodeID) {
|
||||||
default:return 0;
|
default:return nullptr;
|
||||||
case bitc::METADATA_ATTACHMENT: return "METADATA_ATTACHMENT";
|
case bitc::METADATA_ATTACHMENT: return "METADATA_ATTACHMENT";
|
||||||
}
|
}
|
||||||
case bitc::METADATA_BLOCK_ID:
|
case bitc::METADATA_BLOCK_ID:
|
||||||
switch(CodeID) {
|
switch(CodeID) {
|
||||||
default:return 0;
|
default:return nullptr;
|
||||||
case bitc::METADATA_STRING: return "METADATA_STRING";
|
case bitc::METADATA_STRING: return "METADATA_STRING";
|
||||||
case bitc::METADATA_NAME: return "METADATA_NAME";
|
case bitc::METADATA_NAME: return "METADATA_NAME";
|
||||||
case bitc::METADATA_KIND: return "METADATA_KIND";
|
case bitc::METADATA_KIND: return "METADATA_KIND";
|
||||||
@ -270,7 +270,7 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID,
|
|||||||
}
|
}
|
||||||
case bitc::USELIST_BLOCK_ID:
|
case bitc::USELIST_BLOCK_ID:
|
||||||
switch(CodeID) {
|
switch(CodeID) {
|
||||||
default:return 0;
|
default:return nullptr;
|
||||||
case bitc::USELIST_CODE_ENTRY: return "USELIST_CODE_ENTRY";
|
case bitc::USELIST_CODE_ENTRY: return "USELIST_CODE_ENTRY";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -345,7 +345,7 @@ static bool ParseBlock(BitstreamCursor &Stream, unsigned BlockID,
|
|||||||
if (Stream.EnterSubBlock(BlockID, &NumWords))
|
if (Stream.EnterSubBlock(BlockID, &NumWords))
|
||||||
return Error("Malformed block record");
|
return Error("Malformed block record");
|
||||||
|
|
||||||
const char *BlockName = 0;
|
const char *BlockName = nullptr;
|
||||||
if (Dump) {
|
if (Dump) {
|
||||||
outs() << Indent << "<";
|
outs() << Indent << "<";
|
||||||
if ((BlockName = GetBlockName(BlockID, *Stream.getBitStreamReader())))
|
if ((BlockName = GetBlockName(BlockID, *Stream.getBitStreamReader())))
|
||||||
|
@ -35,11 +35,11 @@ void DiffLogBuilder::addMatch(Instruction *L, Instruction *R) {
|
|||||||
}
|
}
|
||||||
void DiffLogBuilder::addLeft(Instruction *L) {
|
void DiffLogBuilder::addLeft(Instruction *L) {
|
||||||
// HACK: VS 2010 has a bug in the stdlib that requires this.
|
// HACK: VS 2010 has a bug in the stdlib that requires this.
|
||||||
Diff.push_back(DiffRecord(L, DiffRecord::second_type(0)));
|
Diff.push_back(DiffRecord(L, DiffRecord::second_type(nullptr)));
|
||||||
}
|
}
|
||||||
void DiffLogBuilder::addRight(Instruction *R) {
|
void DiffLogBuilder::addRight(Instruction *R) {
|
||||||
// HACK: VS 2010 has a bug in the stdlib that requires this.
|
// HACK: VS 2010 has a bug in the stdlib that requires this.
|
||||||
Diff.push_back(DiffRecord(DiffRecord::first_type(0), R));
|
Diff.push_back(DiffRecord(DiffRecord::first_type(nullptr), R));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned DiffLogBuilder::getNumLines() const { return Diff.size(); }
|
unsigned DiffLogBuilder::getNumLines() const { return Diff.size(); }
|
||||||
|
@ -135,7 +135,7 @@ int main(int argc, char **argv) {
|
|||||||
DisplayFilename = InputFilename;
|
DisplayFilename = InputFilename;
|
||||||
M.reset(getStreamedBitcodeModule(DisplayFilename, streamer, Context,
|
M.reset(getStreamedBitcodeModule(DisplayFilename, streamer, Context,
|
||||||
&ErrorMessage));
|
&ErrorMessage));
|
||||||
if(M.get() != 0) {
|
if(M.get()) {
|
||||||
if (error_code EC = M->materializeAllPermanently()) {
|
if (error_code EC = M->materializeAllPermanently()) {
|
||||||
ErrorMessage = EC.message();
|
ErrorMessage = EC.message();
|
||||||
M.reset();
|
M.reset();
|
||||||
@ -143,7 +143,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (M.get() == 0) {
|
if (!M.get()) {
|
||||||
errs() << argv[0] << ": ";
|
errs() << argv[0] << ": ";
|
||||||
if (ErrorMessage.size())
|
if (ErrorMessage.size())
|
||||||
errs() << ErrorMessage << "\n";
|
errs() << ErrorMessage << "\n";
|
||||||
|
@ -103,7 +103,7 @@ int main(int argc, char **argv) {
|
|||||||
std::unique_ptr<Module> M;
|
std::unique_ptr<Module> M;
|
||||||
M.reset(getLazyIRFileModule(InputFilename, Err, Context));
|
M.reset(getLazyIRFileModule(InputFilename, Err, Context));
|
||||||
|
|
||||||
if (M.get() == 0) {
|
if (!M.get()) {
|
||||||
Err.print(argv[0], errs());
|
Err.print(argv[0], errs());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -61,13 +61,13 @@ static inline Module *LoadFile(const char *argv0, const std::string &FN,
|
|||||||
LLVMContext& Context) {
|
LLVMContext& Context) {
|
||||||
SMDiagnostic Err;
|
SMDiagnostic Err;
|
||||||
if (Verbose) errs() << "Loading '" << FN << "'\n";
|
if (Verbose) errs() << "Loading '" << FN << "'\n";
|
||||||
Module* Result = 0;
|
Module* Result = nullptr;
|
||||||
|
|
||||||
Result = ParseIRFile(FN, Err, Context);
|
Result = ParseIRFile(FN, Err, Context);
|
||||||
if (Result) return Result; // Load successful!
|
if (Result) return Result; // Load successful!
|
||||||
|
|
||||||
Err.print(argv0, errs());
|
Err.print(argv0, errs());
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
@ -84,7 +84,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
std::unique_ptr<Module> Composite(
|
std::unique_ptr<Module> Composite(
|
||||||
LoadFile(argv[0], InputFilenames[BaseArg], Context));
|
LoadFile(argv[0], InputFilenames[BaseArg], Context));
|
||||||
if (Composite.get() == 0) {
|
if (!Composite.get()) {
|
||||||
errs() << argv[0] << ": error loading file '"
|
errs() << argv[0] << ": error loading file '"
|
||||||
<< InputFilenames[BaseArg] << "'\n";
|
<< InputFilenames[BaseArg] << "'\n";
|
||||||
return 1;
|
return 1;
|
||||||
@ -93,7 +93,7 @@ int main(int argc, char **argv) {
|
|||||||
Linker L(Composite.get(), SuppressWarnings);
|
Linker L(Composite.get(), SuppressWarnings);
|
||||||
for (unsigned i = BaseArg+1; i < InputFilenames.size(); ++i) {
|
for (unsigned i = BaseArg+1; i < InputFilenames.size(); ++i) {
|
||||||
std::unique_ptr<Module> M(LoadFile(argv[0], InputFilenames[i], Context));
|
std::unique_ptr<Module> M(LoadFile(argv[0], InputFilenames[i], Context));
|
||||||
if (M.get() == 0) {
|
if (!M.get()) {
|
||||||
errs() << argv[0] << ": error loading file '" <<InputFilenames[i]<< "'\n";
|
errs() << argv[0] << ": error loading file '" <<InputFilenames[i]<< "'\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ int main(int argc, char **argv) {
|
|||||||
std::string ErrorInfo;
|
std::string ErrorInfo;
|
||||||
const void *Code = CodeGen.compile(&len, DisableOpt, DisableInline,
|
const void *Code = CodeGen.compile(&len, DisableOpt, DisableInline,
|
||||||
DisableGVNLoadPRE, ErrorInfo);
|
DisableGVNLoadPRE, ErrorInfo);
|
||||||
if (Code == NULL) {
|
if (!Code) {
|
||||||
errs() << argv[0]
|
errs() << argv[0]
|
||||||
<< ": error compiling the code: " << ErrorInfo << "\n";
|
<< ": error compiling the code: " << ErrorInfo << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
@ -165,7 +165,7 @@ int main(int argc, char **argv) {
|
|||||||
FileStream.write(reinterpret_cast<const char *>(Code), len);
|
FileStream.write(reinterpret_cast<const char *>(Code), len);
|
||||||
} else {
|
} else {
|
||||||
std::string ErrorInfo;
|
std::string ErrorInfo;
|
||||||
const char *OutputName = NULL;
|
const char *OutputName = nullptr;
|
||||||
if (!CodeGen.compile_to_file(&OutputName, DisableOpt, DisableInline,
|
if (!CodeGen.compile_to_file(&OutputName, DisableOpt, DisableInline,
|
||||||
DisableGVNLoadPRE, ErrorInfo)) {
|
DisableGVNLoadPRE, ErrorInfo)) {
|
||||||
errs() << argv[0]
|
errs() << argv[0]
|
||||||
|
@ -175,7 +175,7 @@ int Disassembler::disassemble(const Target &T,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up the MCContext for creating symbols and MCExpr's.
|
// Set up the MCContext for creating symbols and MCExpr's.
|
||||||
MCContext Ctx(MAI.get(), MRI.get(), 0);
|
MCContext Ctx(MAI.get(), MRI.get(), nullptr);
|
||||||
|
|
||||||
std::unique_ptr<const MCDisassembler> DisAsm(
|
std::unique_ptr<const MCDisassembler> DisAsm(
|
||||||
T.createMCDisassembler(STI, Ctx));
|
T.createMCDisassembler(STI, Ctx));
|
||||||
|
@ -198,7 +198,7 @@ static const Target *GetTarget(const char *ProgName) {
|
|||||||
Error);
|
Error);
|
||||||
if (!TheTarget) {
|
if (!TheTarget) {
|
||||||
errs() << ProgName << ": " << Error;
|
errs() << ProgName << ": " << Error;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the triple name and return the found target.
|
// Update the triple name and return the found target.
|
||||||
@ -216,7 +216,7 @@ static tool_output_file *GetOutputStream() {
|
|||||||
if (!Err.empty()) {
|
if (!Err.empty()) {
|
||||||
errs() << Err << '\n';
|
errs() << Err << '\n';
|
||||||
delete Out;
|
delete Out;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Out;
|
return Out;
|
||||||
@ -435,12 +435,12 @@ int main(int argc, char **argv) {
|
|||||||
std::unique_ptr<MCSubtargetInfo> STI(
|
std::unique_ptr<MCSubtargetInfo> STI(
|
||||||
TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));
|
TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));
|
||||||
|
|
||||||
MCInstPrinter *IP = NULL;
|
MCInstPrinter *IP = nullptr;
|
||||||
if (FileType == OFT_AssemblyFile) {
|
if (FileType == OFT_AssemblyFile) {
|
||||||
IP =
|
IP =
|
||||||
TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *MCII, *MRI, *STI);
|
TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *MCII, *MRI, *STI);
|
||||||
MCCodeEmitter *CE = 0;
|
MCCodeEmitter *CE = nullptr;
|
||||||
MCAsmBackend *MAB = 0;
|
MCAsmBackend *MAB = nullptr;
|
||||||
if (ShowEncoding) {
|
if (ShowEncoding) {
|
||||||
CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx);
|
CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx);
|
||||||
MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU);
|
MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU);
|
||||||
|
@ -65,7 +65,7 @@ static const Target *GetTarget(const MachOObjectFile *MachOObj) {
|
|||||||
|
|
||||||
errs() << "llvm-objdump: error: unable to get target for '" << TripleName
|
errs() << "llvm-objdump: error: unable to get target for '" << TripleName
|
||||||
<< "', see --version and --triple.\n";
|
<< "', see --version and --triple.\n";
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SymbolSorter {
|
struct SymbolSorter {
|
||||||
@ -226,7 +226,7 @@ static void DisassembleInputMachO2(StringRef Filename,
|
|||||||
TheTarget->createMCAsmInfo(*MRI, TripleName));
|
TheTarget->createMCAsmInfo(*MRI, TripleName));
|
||||||
std::unique_ptr<const MCSubtargetInfo> STI(
|
std::unique_ptr<const MCSubtargetInfo> STI(
|
||||||
TheTarget->createMCSubtargetInfo(TripleName, "", ""));
|
TheTarget->createMCSubtargetInfo(TripleName, "", ""));
|
||||||
MCContext Ctx(AsmInfo.get(), MRI.get(), 0);
|
MCContext Ctx(AsmInfo.get(), MRI.get(), nullptr);
|
||||||
std::unique_ptr<const MCDisassembler> DisAsm(
|
std::unique_ptr<const MCDisassembler> DisAsm(
|
||||||
TheTarget->createMCDisassembler(*STI, Ctx));
|
TheTarget->createMCDisassembler(*STI, Ctx));
|
||||||
int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
|
int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
|
||||||
|
@ -157,7 +157,7 @@ bool llvm::error(error_code EC) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Target *getTarget(const ObjectFile *Obj = NULL) {
|
static const Target *getTarget(const ObjectFile *Obj = nullptr) {
|
||||||
// Figure out the target triple.
|
// Figure out the target triple.
|
||||||
llvm::Triple TheTriple("unknown-unknown-unknown");
|
llvm::Triple TheTriple("unknown-unknown-unknown");
|
||||||
if (TripleName.empty()) {
|
if (TripleName.empty()) {
|
||||||
@ -183,7 +183,7 @@ static const Target *getTarget(const ObjectFile *Obj = NULL) {
|
|||||||
Error);
|
Error);
|
||||||
if (!TheTarget) {
|
if (!TheTarget) {
|
||||||
errs() << ToolName << ": " << Error;
|
errs() << ToolName << ": " << Error;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the triple name and return the found target.
|
// Update the triple name and return the found target.
|
||||||
|
@ -156,7 +156,7 @@ int main(int argc, const char *argv[]) {
|
|||||||
|
|
||||||
StringRef ProgName(sys::path::filename(argv[0]));
|
StringRef ProgName(sys::path::filename(argv[0]));
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
int (*func)(int, const char *[]) = 0;
|
int (*func)(int, const char *[]) = nullptr;
|
||||||
|
|
||||||
if (strcmp(argv[1], "merge") == 0)
|
if (strcmp(argv[1], "merge") == 0)
|
||||||
func = merge_main;
|
func = merge_main;
|
||||||
|
@ -126,7 +126,7 @@ void ARMAttributeParser::CPU_arch(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ void ARMAttributeParser::ARM_ISA_use(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ void ARMAttributeParser::THUMB_ISA_use(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ void ARMAttributeParser::FP_arch(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ void ARMAttributeParser::WMMX_arch(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ void ARMAttributeParser::Advanced_SIMD_arch(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ void ARMAttributeParser::PCS_config(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ void ARMAttributeParser::ABI_PCS_R9_use(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ void ARMAttributeParser::ABI_PCS_RW_data(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ void ARMAttributeParser::ABI_PCS_RO_data(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ void ARMAttributeParser::ABI_PCS_GOT_use(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ void ARMAttributeParser::ABI_PCS_wchar_t(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ void ARMAttributeParser::ABI_FP_rounding(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ void ARMAttributeParser::ABI_FP_denormal(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ void ARMAttributeParser::ABI_FP_exceptions(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ void ARMAttributeParser::ABI_FP_user_exceptions(AttrType Tag,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ void ARMAttributeParser::ABI_FP_number_model(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ void ARMAttributeParser::ABI_enum_size(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ void ARMAttributeParser::ABI_HardFP_use(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ void ARMAttributeParser::ABI_VFP_args(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ void ARMAttributeParser::ABI_WMMX_args(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ void ARMAttributeParser::ABI_optimization_goals(AttrType Tag,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,7 +433,7 @@ void ARMAttributeParser::ABI_FP_optimization_goals(AttrType Tag,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ void ARMAttributeParser::CPU_unaligned_access(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,7 +475,7 @@ void ARMAttributeParser::FP_HP_extension(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,7 +485,7 @@ void ARMAttributeParser::ABI_FP_16bit_format(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,7 +495,7 @@ void ARMAttributeParser::MPextension_use(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,7 +507,7 @@ void ARMAttributeParser::DIV_use(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ void ARMAttributeParser::T2EE_use(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,7 +530,7 @@ void ARMAttributeParser::Virtualization_use(AttrType Tag, const uint8_t *Data,
|
|||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc =
|
StringRef ValueDesc =
|
||||||
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
(Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,7 +534,7 @@ void COFFDumper::printDataDirectory(uint32_t Index, const std::string &FieldName
|
|||||||
|
|
||||||
void COFFDumper::printFileHeaders() {
|
void COFFDumper::printFileHeaders() {
|
||||||
// Print COFF header
|
// Print COFF header
|
||||||
const coff_file_header *COFFHeader = 0;
|
const coff_file_header *COFFHeader = nullptr;
|
||||||
if (error(Obj->getCOFFHeader(COFFHeader)))
|
if (error(Obj->getCOFFHeader(COFFHeader)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -557,13 +557,13 @@ void COFFDumper::printFileHeaders() {
|
|||||||
|
|
||||||
// Print PE header. This header does not exist if this is an object file and
|
// Print PE header. This header does not exist if this is an object file and
|
||||||
// not an executable.
|
// not an executable.
|
||||||
const pe32_header *PEHeader = 0;
|
const pe32_header *PEHeader = nullptr;
|
||||||
if (error(Obj->getPE32Header(PEHeader)))
|
if (error(Obj->getPE32Header(PEHeader)))
|
||||||
return;
|
return;
|
||||||
if (PEHeader)
|
if (PEHeader)
|
||||||
printPEHeader<pe32_header>(PEHeader);
|
printPEHeader<pe32_header>(PEHeader);
|
||||||
|
|
||||||
const pe32plus_header *PEPlusHeader = 0;
|
const pe32plus_header *PEPlusHeader = nullptr;
|
||||||
if (error(Obj->getPE32PlusHeader(PEPlusHeader)))
|
if (error(Obj->getPE32PlusHeader(PEPlusHeader)))
|
||||||
return;
|
return;
|
||||||
if (PEPlusHeader)
|
if (PEPlusHeader)
|
||||||
@ -693,7 +693,7 @@ void COFFDumper::printCodeViewLineTables(const SectionRef &Section) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case COFF::DEBUG_STRING_TABLE_SUBSECTION:
|
case COFF::DEBUG_STRING_TABLE_SUBSECTION:
|
||||||
if (PayloadSize == 0 || StringTable.data() != 0 ||
|
if (PayloadSize == 0 || StringTable.data() != nullptr ||
|
||||||
Contents.back() != '\0') {
|
Contents.back() != '\0') {
|
||||||
// Empty or duplicate or non-null-terminated subsection.
|
// Empty or duplicate or non-null-terminated subsection.
|
||||||
error(object_error::parse_failed);
|
error(object_error::parse_failed);
|
||||||
@ -705,7 +705,8 @@ void COFFDumper::printCodeViewLineTables(const SectionRef &Section) {
|
|||||||
// Holds the translation table from file indices
|
// Holds the translation table from file indices
|
||||||
// to offsets in the string table.
|
// to offsets in the string table.
|
||||||
|
|
||||||
if (PayloadSize == 0 || FileIndexToStringOffsetTable.data() != 0) {
|
if (PayloadSize == 0 ||
|
||||||
|
FileIndexToStringOffsetTable.data() != nullptr) {
|
||||||
// Empty or duplicate subsection.
|
// Empty or duplicate subsection.
|
||||||
error(object_error::parse_failed);
|
error(object_error::parse_failed);
|
||||||
return;
|
return;
|
||||||
@ -1090,7 +1091,7 @@ void COFFDumper::printRuntimeFunction(
|
|||||||
W.printString("UnwindInfoAddress",
|
W.printString("UnwindInfoAddress",
|
||||||
formatSymbol(Rels, OffsetInSection + 8, RTF.UnwindInfoOffset));
|
formatSymbol(Rels, OffsetInSection + 8, RTF.UnwindInfoOffset));
|
||||||
|
|
||||||
const coff_section* XData = 0;
|
const coff_section* XData = nullptr;
|
||||||
uint64_t UnwindInfoOffset = 0;
|
uint64_t UnwindInfoOffset = 0;
|
||||||
if (error(getSection(Rels, OffsetInSection + 8, &XData, &UnwindInfoOffset)))
|
if (error(getSection(Rels, OffsetInSection + 8, &XData, &UnwindInfoOffset)))
|
||||||
return;
|
return;
|
||||||
|
@ -652,7 +652,8 @@ void ELFDumper<ELFT>::printSymbol(typename ELFO::Elf_Sym_Iter Symbol) {
|
|||||||
std::string FullSymbolName(SymbolName);
|
std::string FullSymbolName(SymbolName);
|
||||||
if (Symbol.isDynamic()) {
|
if (Symbol.isDynamic()) {
|
||||||
bool IsDefault;
|
bool IsDefault;
|
||||||
ErrorOr<StringRef> Version = Obj->getSymbolVersion(0, &*Symbol, IsDefault);
|
ErrorOr<StringRef> Version = Obj->getSymbolVersion(nullptr, &*Symbol,
|
||||||
|
IsDefault);
|
||||||
if (Version) {
|
if (Version) {
|
||||||
FullSymbolName += (IsDefault ? "@@" : "@");
|
FullSymbolName += (IsDefault ? "@@" : "@");
|
||||||
FullSymbolName += *Version;
|
FullSymbolName += *Version;
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
|
|
||||||
void *getPointerToNamedFunction(const std::string &Name,
|
void *getPointerToNamedFunction(const std::string &Name,
|
||||||
bool AbortOnFailure = true) override {
|
bool AbortOnFailure = true) override {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool finalizeMemory(std::string *ErrMsg) override { return false; }
|
bool finalizeMemory(std::string *ErrMsg) override { return false; }
|
||||||
@ -85,7 +85,7 @@ uint8_t *TrivialMemoryManager::allocateCodeSection(uintptr_t Size,
|
|||||||
unsigned Alignment,
|
unsigned Alignment,
|
||||||
unsigned SectionID,
|
unsigned SectionID,
|
||||||
StringRef SectionName) {
|
StringRef SectionName) {
|
||||||
sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, 0, 0);
|
sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, nullptr, nullptr);
|
||||||
FunctionMemory.push_back(MB);
|
FunctionMemory.push_back(MB);
|
||||||
return (uint8_t*)MB.base();
|
return (uint8_t*)MB.base();
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ uint8_t *TrivialMemoryManager::allocateDataSection(uintptr_t Size,
|
|||||||
unsigned SectionID,
|
unsigned SectionID,
|
||||||
StringRef SectionName,
|
StringRef SectionName,
|
||||||
bool IsReadOnly) {
|
bool IsReadOnly) {
|
||||||
sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, 0, 0);
|
sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, nullptr, nullptr);
|
||||||
DataMemory.push_back(MB);
|
DataMemory.push_back(MB);
|
||||||
return (uint8_t*)MB.base();
|
return (uint8_t*)MB.base();
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ static int executeInput() {
|
|||||||
|
|
||||||
// Get the address of the entry point (_main by default).
|
// Get the address of the entry point (_main by default).
|
||||||
void *MainAddress = Dyld.getSymbolAddress(EntryPoint);
|
void *MainAddress = Dyld.getSymbolAddress(EntryPoint);
|
||||||
if (MainAddress == 0)
|
if (!MainAddress)
|
||||||
return Error("no definition for '" + EntryPoint + "'");
|
return Error("no definition for '" + EntryPoint + "'");
|
||||||
|
|
||||||
// Invalidate the instruction cache for each loaded function.
|
// Invalidate the instruction cache for each loaded function.
|
||||||
@ -234,7 +234,7 @@ static int executeInput() {
|
|||||||
const char **Argv = new const char*[2];
|
const char **Argv = new const char*[2];
|
||||||
// Use the name of the first input object module as argv[0] for the target.
|
// Use the name of the first input object module as argv[0] for the target.
|
||||||
Argv[0] = InputFileList[0].c_str();
|
Argv[0] = InputFileList[0].c_str();
|
||||||
Argv[1] = 0;
|
Argv[1] = nullptr;
|
||||||
return Main(1, Argv);
|
return Main(1, Argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ static void PrintObjectSectionSizes(ObjectFile *Obj) {
|
|||||||
std::string fmtbuf;
|
std::string fmtbuf;
|
||||||
raw_string_ostream fmt(fmtbuf);
|
raw_string_ostream fmt(fmtbuf);
|
||||||
|
|
||||||
const char *radix_fmt = 0;
|
const char *radix_fmt = nullptr;
|
||||||
switch (Radix) {
|
switch (Radix) {
|
||||||
case octal:
|
case octal:
|
||||||
radix_fmt = PRIo64;
|
radix_fmt = PRIo64;
|
||||||
|
@ -245,7 +245,7 @@ protected:
|
|||||||
|
|
||||||
/// Pick a random scalar type.
|
/// Pick a random scalar type.
|
||||||
Type *pickScalarType() {
|
Type *pickScalarType() {
|
||||||
Type *t = 0;
|
Type *t = nullptr;
|
||||||
do {
|
do {
|
||||||
switch (Ran->Rand() % 30) {
|
switch (Ran->Rand() % 30) {
|
||||||
case 0: t = Type::getInt1Ty(Context); break;
|
case 0: t = Type::getInt1Ty(Context); break;
|
||||||
@ -271,7 +271,7 @@ protected:
|
|||||||
case 29: if (GenX86MMX) t = Type::getX86_MMXTy(Context); break;
|
case 29: if (GenX86MMX) t = Type::getX86_MMXTy(Context); break;
|
||||||
default: llvm_unreachable("Invalid scalar value");
|
default: llvm_unreachable("Invalid scalar value");
|
||||||
}
|
}
|
||||||
} while (t == 0);
|
} while (t == nullptr);
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ const char LLVMSymbolizer::kBadString[] = "??";
|
|||||||
std::string LLVMSymbolizer::symbolizeCode(const std::string &ModuleName,
|
std::string LLVMSymbolizer::symbolizeCode(const std::string &ModuleName,
|
||||||
uint64_t ModuleOffset) {
|
uint64_t ModuleOffset) {
|
||||||
ModuleInfo *Info = getOrCreateModuleInfo(ModuleName);
|
ModuleInfo *Info = getOrCreateModuleInfo(ModuleName);
|
||||||
if (Info == 0)
|
if (!Info)
|
||||||
return printDILineInfo(DILineInfo());
|
return printDILineInfo(DILineInfo());
|
||||||
if (Opts.PrintInlining) {
|
if (Opts.PrintInlining) {
|
||||||
DIInliningInfo InlinedContext =
|
DIInliningInfo InlinedContext =
|
||||||
@ -232,7 +232,7 @@ static bool findDebugBinary(const std::string &OrigPath,
|
|||||||
std::string &Result) {
|
std::string &Result) {
|
||||||
std::string OrigRealPath = OrigPath;
|
std::string OrigRealPath = OrigPath;
|
||||||
#if defined(HAVE_REALPATH)
|
#if defined(HAVE_REALPATH)
|
||||||
if (char *RP = realpath(OrigPath.c_str(), NULL)) {
|
if (char *RP = realpath(OrigPath.c_str(), nullptr)) {
|
||||||
OrigRealPath = RP;
|
OrigRealPath = RP;
|
||||||
free(RP);
|
free(RP);
|
||||||
}
|
}
|
||||||
@ -298,8 +298,8 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
|||||||
BinaryMapTy::iterator I = BinaryForPath.find(Path);
|
BinaryMapTy::iterator I = BinaryForPath.find(Path);
|
||||||
if (I != BinaryForPath.end())
|
if (I != BinaryForPath.end())
|
||||||
return I->second;
|
return I->second;
|
||||||
Binary *Bin = 0;
|
Binary *Bin = nullptr;
|
||||||
Binary *DbgBin = 0;
|
Binary *DbgBin = nullptr;
|
||||||
ErrorOr<Binary *> BinaryOrErr = createBinary(Path);
|
ErrorOr<Binary *> BinaryOrErr = createBinary(Path);
|
||||||
if (!error(BinaryOrErr.getError())) {
|
if (!error(BinaryOrErr.getError())) {
|
||||||
std::unique_ptr<Binary> ParsedBinary(BinaryOrErr.get());
|
std::unique_ptr<Binary> ParsedBinary(BinaryOrErr.get());
|
||||||
@ -319,7 +319,7 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Try to locate the debug binary using .gnu_debuglink section.
|
// Try to locate the debug binary using .gnu_debuglink section.
|
||||||
if (DbgBin == 0) {
|
if (!DbgBin) {
|
||||||
std::string DebuglinkName;
|
std::string DebuglinkName;
|
||||||
uint32_t CRCHash;
|
uint32_t CRCHash;
|
||||||
std::string DebugBinaryPath;
|
std::string DebugBinaryPath;
|
||||||
@ -333,7 +333,7 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DbgBin == 0)
|
if (!DbgBin)
|
||||||
DbgBin = Bin;
|
DbgBin = Bin;
|
||||||
BinaryPair Res = std::make_pair(Bin, DbgBin);
|
BinaryPair Res = std::make_pair(Bin, DbgBin);
|
||||||
BinaryForPath[Path] = Res;
|
BinaryForPath[Path] = Res;
|
||||||
@ -342,9 +342,9 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
|||||||
|
|
||||||
ObjectFile *
|
ObjectFile *
|
||||||
LLVMSymbolizer::getObjectFileFromBinary(Binary *Bin, const std::string &ArchName) {
|
LLVMSymbolizer::getObjectFileFromBinary(Binary *Bin, const std::string &ArchName) {
|
||||||
if (Bin == 0)
|
if (!Bin)
|
||||||
return 0;
|
return nullptr;
|
||||||
ObjectFile *Res = 0;
|
ObjectFile *Res = nullptr;
|
||||||
if (MachOUniversalBinary *UB = dyn_cast<MachOUniversalBinary>(Bin)) {
|
if (MachOUniversalBinary *UB = dyn_cast<MachOUniversalBinary>(Bin)) {
|
||||||
ObjectFileForArchMapTy::iterator I = ObjectFileForArch.find(
|
ObjectFileForArchMapTy::iterator I = ObjectFileForArch.find(
|
||||||
std::make_pair(UB, ArchName));
|
std::make_pair(UB, ArchName));
|
||||||
@ -382,10 +382,10 @@ LLVMSymbolizer::getOrCreateModuleInfo(const std::string &ModuleName) {
|
|||||||
ObjectFile *Obj = getObjectFileFromBinary(Binaries.first, ArchName);
|
ObjectFile *Obj = getObjectFileFromBinary(Binaries.first, ArchName);
|
||||||
ObjectFile *DbgObj = getObjectFileFromBinary(Binaries.second, ArchName);
|
ObjectFile *DbgObj = getObjectFileFromBinary(Binaries.second, ArchName);
|
||||||
|
|
||||||
if (Obj == 0) {
|
if (!Obj) {
|
||||||
// Failed to find valid object file.
|
// Failed to find valid object file.
|
||||||
Modules.insert(make_pair(ModuleName, (ModuleInfo *)0));
|
Modules.insert(make_pair(ModuleName, (ModuleInfo *)nullptr));
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
DIContext *Context = DIContext::getDWARFContext(DbgObj);
|
DIContext *Context = DIContext::getDWARFContext(DbgObj);
|
||||||
assert(Context);
|
assert(Context);
|
||||||
@ -427,7 +427,7 @@ std::string LLVMSymbolizer::DemangleName(const std::string &Name) {
|
|||||||
if (Name.substr(0, 2) != "_Z")
|
if (Name.substr(0, 2) != "_Z")
|
||||||
return Name;
|
return Name;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
char *DemangledName = __cxa_demangle(Name.c_str(), 0, 0, &status);
|
char *DemangledName = __cxa_demangle(Name.c_str(), nullptr, nullptr, &status);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
return Name;
|
return Name;
|
||||||
std::string Result = DemangledName;
|
std::string Result = DemangledName;
|
||||||
|
@ -85,7 +85,7 @@ static bool parseCommand(bool &IsData, std::string &ModuleName,
|
|||||||
char quote = *pos;
|
char quote = *pos;
|
||||||
pos++;
|
pos++;
|
||||||
char *end = strchr(pos, quote);
|
char *end = strchr(pos, quote);
|
||||||
if (end == 0)
|
if (!end)
|
||||||
return false;
|
return false;
|
||||||
ModuleName = std::string(pos, end - pos);
|
ModuleName = std::string(pos, end - pos);
|
||||||
pos = end + 1;
|
pos = end + 1;
|
||||||
|
@ -39,7 +39,7 @@ namespace {
|
|||||||
CFGSCC() : FunctionPass(ID) {}
|
CFGSCC() : FunctionPass(ID) {}
|
||||||
bool runOnFunction(Function& func) override;
|
bool runOnFunction(Function& func) override;
|
||||||
|
|
||||||
void print(raw_ostream &O, const Module* = 0) const override { }
|
void print(raw_ostream &O, const Module* = nullptr) const override { }
|
||||||
|
|
||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
AU.setPreservesAll();
|
AU.setPreservesAll();
|
||||||
@ -53,7 +53,7 @@ namespace {
|
|||||||
// run - Print out SCCs in the call graph for the specified module.
|
// run - Print out SCCs in the call graph for the specified module.
|
||||||
bool runOnModule(Module &M) override;
|
bool runOnModule(Module &M) override;
|
||||||
|
|
||||||
void print(raw_ostream &O, const Module* = 0) const override { }
|
void print(raw_ostream &O, const Module* = nullptr) const override { }
|
||||||
|
|
||||||
// getAnalysisUsage - This pass requires the CallGraph.
|
// getAnalysisUsage - This pass requires the CallGraph.
|
||||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||||
|
@ -295,7 +295,7 @@ static TargetMachine* GetTargetMachine(Triple TheTriple) {
|
|||||||
Error);
|
Error);
|
||||||
// Some modules don't specify a triple, and this is okay.
|
// Some modules don't specify a triple, and this is okay.
|
||||||
if (!TheTarget) {
|
if (!TheTarget) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Package up features to be passed to target/subtarget
|
// Package up features to be passed to target/subtarget
|
||||||
@ -373,7 +373,7 @@ int main(int argc, char **argv) {
|
|||||||
std::unique_ptr<Module> M;
|
std::unique_ptr<Module> M;
|
||||||
M.reset(ParseIRFile(InputFilename, Err, Context));
|
M.reset(ParseIRFile(InputFilename, Err, Context));
|
||||||
|
|
||||||
if (M.get() == 0) {
|
if (!M.get()) {
|
||||||
Err.print(argv[0], errs());
|
Err.print(argv[0], errs());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -453,7 +453,7 @@ int main(int argc, char **argv) {
|
|||||||
Passes.add(new DataLayoutPass(M.get()));
|
Passes.add(new DataLayoutPass(M.get()));
|
||||||
|
|
||||||
Triple ModuleTriple(M->getTargetTriple());
|
Triple ModuleTriple(M->getTargetTriple());
|
||||||
TargetMachine *Machine = 0;
|
TargetMachine *Machine = nullptr;
|
||||||
if (ModuleTriple.getArch())
|
if (ModuleTriple.getArch())
|
||||||
Machine = GetTargetMachine(Triple(ModuleTriple));
|
Machine = GetTargetMachine(Triple(ModuleTriple));
|
||||||
std::unique_ptr<TargetMachine> TM(Machine);
|
std::unique_ptr<TargetMachine> TM(Machine);
|
||||||
@ -537,7 +537,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const PassInfo *PassInf = PassList[i];
|
const PassInfo *PassInf = PassList[i];
|
||||||
Pass *P = 0;
|
Pass *P = nullptr;
|
||||||
if (PassInf->getTargetMachineCtor())
|
if (PassInf->getTargetMachineCtor())
|
||||||
P = PassInf->getTargetMachineCtor()(TM.get());
|
P = PassInf->getTargetMachineCtor()(TM.get());
|
||||||
else if (PassInf->getNormalCtor())
|
else if (PassInf->getNormalCtor())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user