aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChris Wailes <chriswailes@google.com>2014-08-13 15:40:00 -0700
committerStephen Hines <srhines@google.com>2014-08-20 18:15:48 -0700
commit900c6c1f08f7c572125d7d39abe0f0f9eafbfa14 (patch)
tree22cca36b96db74d83980c5a3b68902dbcb1803a9 /tools
parentdef585e3621d073fe2f2b747cd1f0556d62c6656 (diff)
downloadlibbcc-900c6c1f08f7c572125d7d39abe0f0f9eafbfa14.tar.gz
Replace NULL macros with nullptr literals.
Change-Id: Id2311cda59dd42c74b3ed54d3ff6cfd509012738
Diffstat (limited to 'tools')
-rw-r--r--tools/bcc/Main.cpp8
-rw-r--r--tools/bcc_compat/Main.cpp20
2 files changed, 14 insertions, 14 deletions
diff --git a/tools/bcc/Main.cpp b/tools/bcc/Main.cpp
index d6ea138..959f9e6 100644
--- a/tools/bcc/Main.cpp
+++ b/tools/bcc/Main.cpp
@@ -117,10 +117,10 @@ void BCCVersionPrinter() {
static inline
bool ConfigCompiler(RSCompilerDriver &pRSCD) {
RSCompiler *RSC = pRSCD.getCompiler();
- CompilerConfig *config = NULL;
+ CompilerConfig *config = nullptr;
config = new (std::nothrow) CompilerConfig(OptTargetTriple);
- if (config == NULL) {
+ if (config == nullptr) {
llvm::errs() << "Out of memory when create the compiler configuration!\n";
return false;
}
@@ -187,12 +187,12 @@ int main(int argc, char **argv) {
// is present. It is only present if passed via "-load libFOO.so".
RSCompilerDriverInit_t rscdi = (RSCompilerDriverInit_t)
dlsym(RTLD_DEFAULT, STR(RS_COMPILER_DRIVER_INIT_FN));
- if (rscdi != NULL) {
+ if (rscdi != nullptr) {
rscdi(&RSCD);
}
bool built = RSCD.build(context, OptOutputPath.c_str(), OptOutputFilename.c_str(), bitcode,
- bitcodeSize, commandLine.c_str(), OptBCLibFilename.c_str(), NULL,
+ bitcodeSize, commandLine.c_str(), OptBCLibFilename.c_str(), nullptr,
OptEmitLLVM);
if (!built) {
diff --git a/tools/bcc_compat/Main.cpp b/tools/bcc_compat/Main.cpp
index 98a67fa..de2d9d4 100644
--- a/tools/bcc_compat/Main.cpp
+++ b/tools/bcc_compat/Main.cpp
@@ -117,31 +117,31 @@ void BCCVersionPrinter() {
RSScript *PrepareRSScript(BCCContext &pContext,
const llvm::cl::list<std::string> &pBitcodeFiles) {
- RSScript *result = NULL;
+ RSScript *result = nullptr;
for (unsigned i = 0; i < pBitcodeFiles.size(); i++) {
const std::string &input_bitcode = pBitcodeFiles[i];
Source *source = Source::CreateFromFile(pContext, input_bitcode);
- if (source == NULL) {
+ if (source == nullptr) {
llvm::errs() << "Failed to load llvm module from file `" << input_bitcode
<< "'!\n";
- return NULL;
+ return nullptr;
}
- if (result != NULL) {
+ if (result != nullptr) {
if (!result->mergeSource(*source, /* pPreserveSource */false)) {
llvm::errs() << "Failed to merge the llvm module `" << input_bitcode
<< "' to compile!\n";
delete source;
- return NULL;
+ return nullptr;
}
} else {
result = new (std::nothrow) RSScript(*source);
- if (result == NULL) {
+ if (result == nullptr) {
llvm::errs() << "Out of memory when create script for file `"
<< input_bitcode << "'!\n";
delete source;
- return NULL;
+ return nullptr;
}
}
}
@@ -152,10 +152,10 @@ RSScript *PrepareRSScript(BCCContext &pContext,
static inline
bool ConfigCompiler(RSCompilerDriver &pCompilerDriver) {
RSCompiler *compiler = pCompilerDriver.getCompiler();
- CompilerConfig *config = NULL;
+ CompilerConfig *config = nullptr;
config = new (std::nothrow) CompilerConfig(OptTargetTriple);
- if (config == NULL) {
+ if (config == nullptr) {
llvm::errs() << "Out of memory when create the compiler configuration!\n";
return false;
}
@@ -267,7 +267,7 @@ int main(int argc, char **argv) {
return EXIT_FAILURE;
}
- RSScript *s = NULL;
+ RSScript *s = nullptr;
s = PrepareRSScript(context, OptInputFilenames);
if (!rscd.buildForCompatLib(*s, OutputFilename.c_str(), OptRuntimePath.c_str())) {
fprintf(stderr, "Failed to compile script!");