diff options
author | Craig Topper <craig.topper@gmail.com> | 2014-04-15 06:32:26 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2014-04-15 06:32:26 +0000 |
commit | 0b6cb7104b15504cd41f48cc2babcbcee70775f3 (patch) | |
tree | 48f97597536aa35e8e2b80b8e25e049821ca7e13 /lib/Linker | |
parent | eb19b8f58b12532e736051fee46dcf2115a4888d (diff) | |
download | llvm-0b6cb7104b15504cd41f48cc2babcbcee70775f3.tar.gz llvm-0b6cb7104b15504cd41f48cc2babcbcee70775f3.tar.bz2 llvm-0b6cb7104b15504cd41f48cc2babcbcee70775f3.tar.xz |
[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
Diffstat (limited to 'lib/Linker')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index c6476ce7b8..581e8217de 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -439,16 +439,16 @@ namespace { // If the source has no name it can't link. If it has local linkage, // there is no name match-up going on. if (!SrcGV->hasName() || SrcGV->hasLocalLinkage()) - return 0; + return nullptr; // Otherwise see if we have a match in the destination module's symtab. GlobalValue *DGV = DstM->getNamedValue(SrcGV->getName()); - if (DGV == 0) return 0; + if (!DGV) return nullptr; // If we found a global with the same name in the dest module, but it has // internal linkage, we are really not doing any linkage here. if (DGV->hasLocalLinkage()) - return 0; + return nullptr; // Otherwise, we do in fact link to the destination global. return DGV; @@ -518,7 +518,7 @@ static bool isLessConstraining(GlobalValue::VisibilityTypes a, Value *ValueMaterializerTy::materializeValueFor(Value *V) { Function *SF = dyn_cast<Function>(V); if (!SF) - return NULL; + return nullptr; Function *DF = Function::Create(TypeMap.get(SF->getFunctionType()), SF->getLinkage(), SF->getName(), DstM); @@ -612,7 +612,7 @@ void ModuleLinker::computeTypeMapping() { for (Module::global_iterator I = SrcM->global_begin(), E = SrcM->global_end(); I != E; ++I) { GlobalValue *DGV = getLinkedToGlobal(I); - if (DGV == 0) continue; + if (!DGV) continue; if (!DGV->hasAppendingLinkage() || !I->hasAppendingLinkage()) { TypeMap.addTypeMapping(DGV->getType(), I->getType()); @@ -723,7 +723,7 @@ bool ModuleLinker::linkAppendingVarProto(GlobalVariable *DstGV, // Create the new global variable. GlobalVariable *NG = new GlobalVariable(*DstGV->getParent(), NewType, SrcGV->isConstant(), - DstGV->getLinkage(), /*init*/0, /*name*/"", DstGV, + DstGV->getLinkage(), /*init*/nullptr, /*name*/"", DstGV, DstGV->getThreadLocalMode(), DstGV->getType()->getAddressSpace()); @@ -800,8 +800,8 @@ bool ModuleLinker::linkGlobalProto(GlobalVariable *SGV) { // initializer will be filled in later by LinkGlobalInits. GlobalVariable *NewDGV = new GlobalVariable(*DstM, TypeMap.get(SGV->getType()->getElementType()), - SGV->isConstant(), SGV->getLinkage(), /*init*/0, - SGV->getName(), /*insertbefore*/0, + SGV->isConstant(), SGV->getLinkage(), /*init*/nullptr, + SGV->getName(), /*insertbefore*/nullptr, SGV->getThreadLocalMode(), SGV->getType()->getAddressSpace()); // Propagate alignment, visibility and section info. @@ -913,7 +913,7 @@ bool ModuleLinker::linkAliasProto(GlobalAlias *SGA) { // bring over SGA. GlobalAlias *NewDA = new GlobalAlias(TypeMap.get(SGA->getType()), SGA->getLinkage(), SGA->getName(), - /*aliasee*/0, DstM); + /*aliasee*/nullptr, DstM); copyGVAttributes(NewDA, SGA); if (NewVisibility) NewDA->setVisibility(*NewVisibility); @@ -997,7 +997,7 @@ void ModuleLinker::linkFunctionBody(Function *Dst, Function *Src) { } else { // Clone the body of the function into the dest function. SmallVector<ReturnInst*, 8> Returns; // Ignore returns. - CloneFunctionInto(Dst, Src, ValueMap, false, Returns, "", NULL, + CloneFunctionInto(Dst, Src, ValueMap, false, Returns, "", nullptr, &TypeMap, &ValMaterializer); } @@ -1369,7 +1369,7 @@ Linker::~Linker() { void Linker::deleteModule() { delete Composite; - Composite = NULL; + Composite = nullptr; } bool Linker::linkInModule(Module *Src, unsigned Mode, std::string *ErrorMsg) { @@ -1406,7 +1406,7 @@ LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src, LLVMLinkerMode Mode, char **OutMessages) { std::string Messages; LLVMBool Result = Linker::LinkModules(unwrap(Dest), unwrap(Src), - Mode, OutMessages? &Messages : 0); + Mode, OutMessages? &Messages : nullptr); if (OutMessages) *OutMessages = strdup(Messages.c_str()); return Result; |