mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 03:24:09 +00:00
[C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206252 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -64,17 +64,17 @@ const char* LTOCodeGenerator::getVersionString() {
|
||||
|
||||
LTOCodeGenerator::LTOCodeGenerator()
|
||||
: Context(getGlobalContext()), Linker(new Module("ld-temp.o", Context)),
|
||||
TargetMach(NULL), EmitDwarfDebugInfo(false), ScopeRestrictionsDone(false),
|
||||
CodeModel(LTO_CODEGEN_PIC_MODEL_DEFAULT), NativeObjectFile(NULL),
|
||||
DiagHandler(NULL), DiagContext(NULL) {
|
||||
TargetMach(nullptr), EmitDwarfDebugInfo(false),
|
||||
ScopeRestrictionsDone(false), CodeModel(LTO_CODEGEN_PIC_MODEL_DEFAULT),
|
||||
NativeObjectFile(nullptr), DiagHandler(nullptr), DiagContext(nullptr) {
|
||||
initializeLTOPasses();
|
||||
}
|
||||
|
||||
LTOCodeGenerator::~LTOCodeGenerator() {
|
||||
delete TargetMach;
|
||||
delete NativeObjectFile;
|
||||
TargetMach = NULL;
|
||||
NativeObjectFile = NULL;
|
||||
TargetMach = nullptr;
|
||||
NativeObjectFile = nullptr;
|
||||
|
||||
Linker.deleteModule();
|
||||
|
||||
@ -245,7 +245,7 @@ const void* LTOCodeGenerator::compile(size_t* length,
|
||||
const char *name;
|
||||
if (!compile_to_file(&name, disableOpt, disableInline, disableGVNLoadPRE,
|
||||
errMsg))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
// remove old buffer if compile() called twice
|
||||
delete NativeObjectFile;
|
||||
@ -255,7 +255,7 @@ const void* LTOCodeGenerator::compile(size_t* length,
|
||||
if (error_code ec = MemoryBuffer::getFile(name, BuffPtr, -1, false)) {
|
||||
errMsg = ec.message();
|
||||
sys::fs::remove(NativeObjectPath);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
NativeObjectFile = BuffPtr.release();
|
||||
|
||||
@ -263,14 +263,14 @@ const void* LTOCodeGenerator::compile(size_t* length,
|
||||
sys::fs::remove(NativeObjectPath);
|
||||
|
||||
// return buffer, unless error
|
||||
if (NativeObjectFile == NULL)
|
||||
return NULL;
|
||||
if (!NativeObjectFile)
|
||||
return nullptr;
|
||||
*length = NativeObjectFile->getBufferSize();
|
||||
return NativeObjectFile->getBufferStart();
|
||||
}
|
||||
|
||||
bool LTOCodeGenerator::determineTarget(std::string &errMsg) {
|
||||
if (TargetMach != NULL)
|
||||
if (TargetMach)
|
||||
return true;
|
||||
|
||||
std::string TripleStr = Linker.getModule()->getTargetTriple();
|
||||
@ -280,7 +280,7 @@ bool LTOCodeGenerator::determineTarget(std::string &errMsg) {
|
||||
|
||||
// create target machine from info for merged modules
|
||||
const Target *march = TargetRegistry::lookupTarget(TripleStr, errMsg);
|
||||
if (march == NULL)
|
||||
if (!march)
|
||||
return false;
|
||||
|
||||
// The relocation model is actually a static member of TargetMachine and
|
||||
@ -355,7 +355,7 @@ applyRestriction(GlobalValue &GV,
|
||||
|
||||
static void findUsedValues(GlobalVariable *LLVMUsed,
|
||||
SmallPtrSet<GlobalValue*, 8> &UsedValues) {
|
||||
if (LLVMUsed == 0) return;
|
||||
if (!LLVMUsed) return;
|
||||
|
||||
ConstantArray *Inits = cast<ConstantArray>(LLVMUsed->getInitializer());
|
||||
for (unsigned i = 0, e = Inits->getNumOperands(); i != e; ++i)
|
||||
@ -579,7 +579,7 @@ LTOCodeGenerator::setDiagnosticHandler(lto_diagnostic_handler_t DiagHandler,
|
||||
this->DiagHandler = DiagHandler;
|
||||
this->DiagContext = Ctxt;
|
||||
if (!DiagHandler)
|
||||
return Context.setDiagnosticHandler(NULL, NULL);
|
||||
return Context.setDiagnosticHandler(nullptr, nullptr);
|
||||
// Register the LTOCodeGenerator stub in the LLVMContext to forward the
|
||||
// diagnostic to the external DiagHandler.
|
||||
Context.setDiagnosticHandler(LTOCodeGenerator::DiagnosticHandler, this);
|
||||
|
Reference in New Issue
Block a user