[C++11] More 'nullptr' conversion or in some cases just using a boolean check instead of comparing to nullptr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205831 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper
2014-04-09 06:08:46 +00:00
parent 8a0d1c8f06
commit ec0f0bc6af
80 changed files with 763 additions and 735 deletions

View File

@ -95,7 +95,7 @@ Constant *Module::getOrInsertFunction(StringRef Name,
AttributeSet AttributeList) {
// See if we have a definition for the specified function already.
GlobalValue *F = getNamedValue(Name);
if (F == 0) {
if (!F) {
// Nope, add it
Function *New = Function::Create(Ty, GlobalVariable::ExternalLinkage, Name);
if (!New->isIntrinsic()) // Intrinsics get attrs set on construction
@ -183,7 +183,7 @@ GlobalVariable *Module::getGlobalVariable(StringRef Name, bool AllowLocal) {
dyn_cast_or_null<GlobalVariable>(getNamedValue(Name)))
if (AllowLocal || !Result->hasLocalLinkage())
return Result;
return 0;
return nullptr;
}
/// getOrInsertGlobal - Look up the specified global in the module symbol table.
@ -195,11 +195,11 @@ GlobalVariable *Module::getGlobalVariable(StringRef Name, bool AllowLocal) {
Constant *Module::getOrInsertGlobal(StringRef Name, Type *Ty) {
// See if we have a definition for the specified global already.
GlobalVariable *GV = dyn_cast_or_null<GlobalVariable>(getNamedValue(Name));
if (GV == 0) {
if (!GV) {
// Nope, add it
GlobalVariable *New =
new GlobalVariable(*this, Ty, false, GlobalVariable::ExternalLinkage,
0, Name);
nullptr, Name);
return New; // Return the new declaration.
}
@ -284,7 +284,7 @@ Value *Module::getModuleFlag(StringRef Key) const {
if (Key == MFE.Key->getString())
return MFE.Val;
}
return 0;
return nullptr;
}
/// getModuleFlagsMetadata - Returns the NamedMDNode in the module that
@ -350,7 +350,7 @@ void Module::setDataLayout(const DataLayout *Other) {
const DataLayout *Module::getDataLayout() const {
if (DataLayoutStr.empty())
return 0;
return nullptr;
return &DL;
}