Switching from NULL to nullptr in src/rustllvm.
This commit is contained in:
parent
c72d859e4f
commit
72ebc02f13
@ -22,11 +22,11 @@ struct RustArchiveMember {
|
||||
Archive::Child child;
|
||||
|
||||
RustArchiveMember()
|
||||
: filename(NULL), name(NULL),
|
||||
: filename(nullptr), name(nullptr),
|
||||
#if LLVM_VERSION_GE(3, 8)
|
||||
child(NULL, NULL, NULL)
|
||||
child(nullptr, nullptr, nullptr)
|
||||
#else
|
||||
child(NULL, NULL)
|
||||
child(nullptr, nullptr)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
@ -118,7 +118,7 @@ LLVMRustArchiveIteratorNew(LLVMRustArchiveRef ra) {
|
||||
if (rai->err) {
|
||||
LLVMRustSetLastError(toString(std::move(rai->err)).c_str());
|
||||
delete rai;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
rai->end = ar->child_end();
|
||||
@ -183,12 +183,12 @@ LLVMRustArchiveChildName(LLVMRustArchiveChildConstRef child, size_t *size) {
|
||||
// in the future, and in the mean time this tells LLVM that the error was
|
||||
// not ignored and that it shouldn't abort the process.
|
||||
LLVMRustSetLastError(toString(name_or_err.takeError()).c_str());
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
ErrorOr<StringRef> name_or_err = child->getName();
|
||||
if (name_or_err.getError())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
StringRef name = name_or_err.get();
|
||||
*size = name.size();
|
||||
@ -202,13 +202,13 @@ extern "C" const char *LLVMRustArchiveChildData(LLVMRustArchiveChildRef child,
|
||||
Expected<StringRef> buf_or_err = child->getBuffer();
|
||||
if (!buf_or_err) {
|
||||
LLVMRustSetLastError(toString(buf_or_err.takeError()).c_str());
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
ErrorOr<StringRef> buf_or_err = child->getBuffer();
|
||||
if (buf_or_err.getError()) {
|
||||
LLVMRustSetLastError(buf_or_err.getError().message().c_str());
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
buf = buf_or_err.get();
|
||||
|
@ -83,7 +83,7 @@ extern "C" LLVMPassRef LLVMRustFindAndCreatePass(const char *PassName) {
|
||||
if (PI) {
|
||||
return wrap(PI->createPass());
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" LLVMRustPassKind LLVMRustPassKind(LLVMPassRef rust_pass) {
|
||||
@ -317,9 +317,9 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
|
||||
Triple Trip(Triple::normalize(triple));
|
||||
const llvm::Target *TheTarget =
|
||||
TargetRegistry::lookupTarget(Trip.getTriple(), Error);
|
||||
if (TheTarget == NULL) {
|
||||
if (TheTarget == nullptr) {
|
||||
LLVMRustSetLastError(Error.c_str());
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
StringRef real_cpu = cpu;
|
||||
@ -549,7 +549,7 @@ extern "C" void LLVMRustMarkAllFunctionsNounwind(LLVMModuleRef M) {
|
||||
++GV) {
|
||||
GV->setDoesNotThrow();
|
||||
Function *F = dyn_cast<Function>(GV);
|
||||
if (F == NULL)
|
||||
if (F == nullptr)
|
||||
continue;
|
||||
|
||||
for (Function::iterator B = F->begin(), BE = F->end(); B != BE; ++B) {
|
||||
|
@ -66,7 +66,7 @@ LLVMRustCreateMemoryBufferWithContentsOfFile(const char *Path) {
|
||||
|
||||
extern "C" char *LLVMRustGetLastError(void) {
|
||||
char *ret = LastError;
|
||||
LastError = NULL;
|
||||
LastError = nullptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -319,7 +319,7 @@ inline Metadata **unwrap(LLVMRustMetadataRef *Vals) {
|
||||
}
|
||||
|
||||
template <typename DIT> DIT *unwrapDIptr(LLVMRustMetadataRef ref) {
|
||||
return (DIT *)(ref ? unwrap<MDNode>(ref) : NULL);
|
||||
return (DIT *)(ref ? unwrap<MDNode>(ref) : nullptr);
|
||||
}
|
||||
|
||||
#define DIDescriptor DIScope
|
||||
@ -574,7 +574,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateStaticVariable(
|
||||
LLVMRustDIBuilderRef Builder, LLVMRustMetadataRef Context, const char *Name,
|
||||
const char *LinkageName, LLVMRustMetadataRef File, unsigned LineNo,
|
||||
LLVMRustMetadataRef Ty, bool isLocalToUnit, LLVMValueRef Val,
|
||||
LLVMRustMetadataRef Decl = NULL, uint64_t AlignInBits = 0) {
|
||||
LLVMRustMetadataRef Decl = nullptr, uint64_t AlignInBits = 0) {
|
||||
Constant *InitVal = cast<Constant>(unwrap(Val));
|
||||
|
||||
#if LLVM_VERSION_GE(4, 0)
|
||||
@ -1012,14 +1012,14 @@ extern "C" LLVMValueRef LLVMRustBuildCleanupPad(LLVMBuilderRef Builder,
|
||||
const char *Name) {
|
||||
#if LLVM_VERSION_GE(3, 8)
|
||||
Value **Args = unwrap(LLArgs);
|
||||
if (ParentPad == NULL) {
|
||||
if (ParentPad == nullptr) {
|
||||
Type *Ty = Type::getTokenTy(unwrap(Builder)->getContext());
|
||||
ParentPad = wrap(Constant::getNullValue(Ty));
|
||||
}
|
||||
return wrap(unwrap(Builder)->CreateCleanupPad(
|
||||
unwrap(ParentPad), ArrayRef<Value *>(Args, ArgCnt), Name));
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1030,7 +1030,7 @@ extern "C" LLVMValueRef LLVMRustBuildCleanupRet(LLVMBuilderRef Builder,
|
||||
CleanupPadInst *Inst = cast<CleanupPadInst>(unwrap(CleanupPad));
|
||||
return wrap(unwrap(Builder)->CreateCleanupRet(Inst, unwrap(UnwindBB)));
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1042,7 +1042,7 @@ LLVMRustBuildCatchPad(LLVMBuilderRef Builder, LLVMValueRef ParentPad,
|
||||
return wrap(unwrap(Builder)->CreateCatchPad(
|
||||
unwrap(ParentPad), ArrayRef<Value *>(Args, ArgCnt), Name));
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1053,7 +1053,7 @@ extern "C" LLVMValueRef LLVMRustBuildCatchRet(LLVMBuilderRef Builder,
|
||||
return wrap(unwrap(Builder)->CreateCatchRet(cast<CatchPadInst>(unwrap(Pad)),
|
||||
unwrap(BB)));
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1063,14 +1063,14 @@ extern "C" LLVMValueRef LLVMRustBuildCatchSwitch(LLVMBuilderRef Builder,
|
||||
unsigned NumHandlers,
|
||||
const char *Name) {
|
||||
#if LLVM_VERSION_GE(3, 8)
|
||||
if (ParentPad == NULL) {
|
||||
if (ParentPad == nullptr) {
|
||||
Type *Ty = Type::getTokenTy(unwrap(Builder)->getContext());
|
||||
ParentPad = wrap(Constant::getNullValue(Ty));
|
||||
}
|
||||
return wrap(unwrap(Builder)->CreateCatchSwitch(unwrap(ParentPad), unwrap(BB),
|
||||
NumHandlers, Name));
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1126,7 +1126,7 @@ LLVMRustBuildInvoke(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *Args,
|
||||
extern "C" void *LLVMRustBuildOperandBundleDef(const char *Name,
|
||||
LLVMValueRef *Inputs,
|
||||
unsigned NumInputs) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustFreeOperandBundleDef(void *Bundle) {}
|
||||
|
Loading…
Reference in New Issue
Block a user