[C++11] Use 'nullptr'. Tooling edition.
llvm-svn: 209192
This commit is contained in:
@@ -75,7 +75,7 @@ static const llvm::opt::ArgStringList *getCC1Arguments(
|
||||
Jobs.Print(error_stream, "; ", true);
|
||||
Diagnostics->Report(clang::diag::err_fe_expected_compiler_job)
|
||||
<< error_stream.str();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// The one job we find should be to invoke clang again.
|
||||
@@ -83,7 +83,7 @@ static const llvm::opt::ArgStringList *getCC1Arguments(
|
||||
cast<clang::driver::Command>(*Jobs.begin());
|
||||
if (StringRef(Cmd->getCreator().getName()) != "clang") {
|
||||
Diagnostics->Report(clang::diag::err_fe_expected_clang_command);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &Cmd->getArguments();
|
||||
@@ -171,7 +171,7 @@ ToolInvocation::ToolInvocation(std::vector<std::string> CommandLine,
|
||||
Action(Action),
|
||||
OwnsAction(false),
|
||||
Files(Files),
|
||||
DiagConsumer(NULL) {}
|
||||
DiagConsumer(nullptr) {}
|
||||
|
||||
ToolInvocation::ToolInvocation(std::vector<std::string> CommandLine,
|
||||
FrontendAction *FAction, FileManager *Files)
|
||||
@@ -179,7 +179,7 @@ ToolInvocation::ToolInvocation(std::vector<std::string> CommandLine,
|
||||
Action(new SingleFrontendActionFactory(FAction)),
|
||||
OwnsAction(true),
|
||||
Files(Files),
|
||||
DiagConsumer(NULL) {}
|
||||
DiagConsumer(nullptr) {}
|
||||
|
||||
ToolInvocation::~ToolInvocation() {
|
||||
if (OwnsAction)
|
||||
@@ -216,7 +216,7 @@ bool ToolInvocation::run() {
|
||||
Driver->BuildCompilation(llvm::makeArrayRef(Argv)));
|
||||
const llvm::opt::ArgStringList *const CC1Args = getCC1Arguments(
|
||||
&Diagnostics, Compilation.get());
|
||||
if (CC1Args == NULL) {
|
||||
if (!CC1Args) {
|
||||
return false;
|
||||
}
|
||||
std::unique_ptr<clang::CompilerInvocation> Invocation(
|
||||
@@ -271,7 +271,7 @@ bool FrontendActionFactory::runInvocation(CompilerInvocation *Invocation,
|
||||
|
||||
ClangTool::ClangTool(const CompilationDatabase &Compilations,
|
||||
ArrayRef<std::string> SourcePaths)
|
||||
: Files(new FileManager(FileSystemOptions())), DiagConsumer(NULL) {
|
||||
: Files(new FileManager(FileSystemOptions())), DiagConsumer(nullptr) {
|
||||
ArgsAdjusters.push_back(new ClangStripOutputAdjuster());
|
||||
ArgsAdjusters.push_back(new ClangSyntaxOnlyAdjuster());
|
||||
for (const auto &SourcePath : SourcePaths) {
|
||||
@@ -410,13 +410,14 @@ buildASTFromCodeWithArgs(const Twine &Code,
|
||||
|
||||
std::vector<std::unique_ptr<ASTUnit>> ASTs;
|
||||
ASTBuilderAction Action(ASTs);
|
||||
ToolInvocation Invocation(getSyntaxOnlyToolArgs(Args, FileNameRef), &Action, 0);
|
||||
ToolInvocation Invocation(getSyntaxOnlyToolArgs(Args, FileNameRef), &Action,
|
||||
nullptr);
|
||||
|
||||
SmallString<1024> CodeStorage;
|
||||
Invocation.mapVirtualFile(FileNameRef,
|
||||
Code.toNullTerminatedStringRef(CodeStorage));
|
||||
if (!Invocation.run())
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
assert(ASTs.size() == 1);
|
||||
return std::move(ASTs[0]);
|
||||
|
||||
Reference in New Issue
Block a user