[C++11] Use 'nullptr'. Frontend edition.
llvm-svn: 209389
This commit is contained in:
@@ -52,7 +52,7 @@ using namespace clang;
|
||||
|
||||
CompilerInstance::CompilerInstance(bool BuildingModule)
|
||||
: ModuleLoader(BuildingModule),
|
||||
Invocation(new CompilerInvocation()), ModuleManager(0),
|
||||
Invocation(new CompilerInvocation()), ModuleManager(nullptr),
|
||||
BuildGlobalModuleIndex(false), HaveFullGlobalModuleIndex(false),
|
||||
ModuleBuildFailed(false) {
|
||||
}
|
||||
@@ -229,7 +229,7 @@ void CompilerInstance::createPreprocessor(TranslationUnitKind TUKind) {
|
||||
const PreprocessorOptions &PPOpts = getPreprocessorOpts();
|
||||
|
||||
// Create a PTH manager if we are using some form of a token cache.
|
||||
PTHManager *PTHMgr = 0;
|
||||
PTHManager *PTHMgr = nullptr;
|
||||
if (!PPOpts.TokenCache.empty())
|
||||
PTHMgr = PTHManager::Create(PPOpts.TokenCache, getDiagnostics());
|
||||
|
||||
@@ -364,7 +364,7 @@ ExternalASTSource *CompilerInstance::createPCHExternalASTSource(
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Code Completion
|
||||
@@ -399,14 +399,14 @@ void CompilerInstance::createCodeCompletionConsumer() {
|
||||
return;
|
||||
} else if (EnableCodeCompletion(getPreprocessor(), Loc.FileName,
|
||||
Loc.Line, Loc.Column)) {
|
||||
setCodeCompletionConsumer(0);
|
||||
setCodeCompletionConsumer(nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CompletionConsumer->isOutputBinary() &&
|
||||
llvm::sys::ChangeStdoutToBinary()) {
|
||||
getPreprocessor().getDiagnostics().Report(diag::err_fe_stdout_binary);
|
||||
setCodeCompletionConsumer(0);
|
||||
setCodeCompletionConsumer(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ CompilerInstance::createCodeCompletionConsumer(Preprocessor &PP,
|
||||
const CodeCompleteOptions &Opts,
|
||||
raw_ostream &OS) {
|
||||
if (EnableCodeCompletion(PP, Filename, Line, Column))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
// Set up the creation routine for code-completion.
|
||||
return new PrintingCodeCompleteConsumer(Opts, OS);
|
||||
@@ -496,7 +496,7 @@ CompilerInstance::createOutputFile(StringRef OutputPath,
|
||||
if (!OS) {
|
||||
getDiagnostics().Report(diag::err_fe_unable_to_open_output)
|
||||
<< OutputPath << Error;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Add the output file -- but don't try to remove "-", since this means we are
|
||||
@@ -546,7 +546,7 @@ CompilerInstance::createOutputFile(StringRef OutputPath,
|
||||
if (llvm::sys::fs::exists(Status)) {
|
||||
// Fail early if we can't write to the final destination.
|
||||
if (!llvm::sys::fs::can_write(OutputPath))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
// Don't use a temporary if the output is a special file. This handles
|
||||
// things like '-o /dev/null'
|
||||
@@ -589,7 +589,7 @@ CompilerInstance::createOutputFile(StringRef OutputPath,
|
||||
OSFile.c_str(), Error,
|
||||
(Binary ? llvm::sys::fs::F_None : llvm::sys::fs::F_Text)));
|
||||
if (!Error.empty())
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Make sure the out stream file gets removed if we crash.
|
||||
@@ -1034,7 +1034,7 @@ static void pruneModuleCache(const HeaderSearchOptions &HSOpts) {
|
||||
// Check whether the time stamp is older than our pruning interval.
|
||||
// If not, do nothing.
|
||||
time_t TimeStampModTime = StatBuf.st_mtime;
|
||||
time_t CurrentTime = time(0);
|
||||
time_t CurrentTime = time(nullptr);
|
||||
if (CurrentTime - TimeStampModTime <= time_t(HSOpts.ModuleCachePruneInterval))
|
||||
return;
|
||||
|
||||
@@ -1149,7 +1149,7 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
|
||||
return LastModuleImportResult;
|
||||
}
|
||||
|
||||
clang::Module *Module = 0;
|
||||
clang::Module *Module = nullptr;
|
||||
|
||||
// If we don't already have information on this module, load the module now.
|
||||
llvm::DenseMap<const IdentifierInfo *, clang::Module *>::iterator Known
|
||||
@@ -1247,7 +1247,7 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
|
||||
|
||||
if (getPreprocessorOpts().FailedModules)
|
||||
getPreprocessorOpts().FailedModules->addFailed(ModuleName);
|
||||
KnownModules[Path[0].first] = 0;
|
||||
KnownModules[Path[0].first] = nullptr;
|
||||
ModuleBuildFailed = true;
|
||||
return ModuleLoadResult();
|
||||
}
|
||||
@@ -1262,13 +1262,13 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
|
||||
ModuleLoader::HadFatalFailure = true;
|
||||
// FIXME: The ASTReader will already have complained, but can we showhorn
|
||||
// that diagnostic information into a more useful form?
|
||||
KnownModules[Path[0].first] = 0;
|
||||
KnownModules[Path[0].first] = nullptr;
|
||||
return ModuleLoadResult();
|
||||
|
||||
case ASTReader::Failure:
|
||||
ModuleLoader::HadFatalFailure = true;
|
||||
// Already complained, but note now that we failed.
|
||||
KnownModules[Path[0].first] = 0;
|
||||
KnownModules[Path[0].first] = nullptr;
|
||||
ModuleBuildFailed = true;
|
||||
return ModuleLoadResult();
|
||||
}
|
||||
@@ -1348,8 +1348,8 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
|
||||
getDiagnostics().Report(ImportLoc, diag::warn_missing_submodule)
|
||||
<< Module->getFullModuleName()
|
||||
<< SourceRange(Path.front().second, Path.back().second);
|
||||
|
||||
return ModuleLoadResult(0, true);
|
||||
|
||||
return ModuleLoadResult(nullptr, true);
|
||||
}
|
||||
|
||||
// Check whether this module is available.
|
||||
@@ -1413,7 +1413,7 @@ GlobalModuleIndex *CompilerInstance::loadGlobalModuleIndex(
|
||||
createModuleManager();
|
||||
// Can't do anything if we don't have the module manager.
|
||||
if (!ModuleManager)
|
||||
return 0;
|
||||
return nullptr;
|
||||
// Get an existing global index. This loads it if not already
|
||||
// loaded.
|
||||
ModuleManager->loadGlobalIndex();
|
||||
|
||||
Reference in New Issue
Block a user