diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-10 12:54:53 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-10 12:54:53 +0000 |
commit | 47de1495656b67780461da7858dd7e90a961f79c (patch) | |
tree | 17de5afd938fdc4cde4460fede70913e55c724ac /clang/lib | |
parent | 9b88fed3237bc6c6d7bd2d382ccbe2bb2ca441d6 (diff) | |
download | bcm5719-llvm-47de1495656b67780461da7858dd7e90a961f79c.tar.gz bcm5719-llvm-47de1495656b67780461da7858dd7e90a961f79c.zip |
Return a pointer instead of having a pointer outparam and a bool return.
llvm-svn: 234590
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Frontend/FrontendActions.cpp | 26 |
2 files changed, 16 insertions, 16 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 692edc40a45..7226344b754 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -966,9 +966,9 @@ PrecompilePreambleAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) { std::string Sysroot; std::string OutputFile; - raw_ostream *OS = nullptr; - if (GeneratePCHAction::ComputeASTConsumerArguments(CI, InFile, Sysroot, - OutputFile, OS)) + raw_ostream *OS = GeneratePCHAction::ComputeASTConsumerArguments( + CI, InFile, Sysroot, OutputFile); + if (!OS) return nullptr; if (!CI.getFrontendOpts().RelocatablePCH) diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index bc119297aef..e76eff029b1 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -79,8 +79,9 @@ std::unique_ptr<ASTConsumer> GeneratePCHAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) { std::string Sysroot; std::string OutputFile; - raw_ostream *OS = nullptr; - if (ComputeASTConsumerArguments(CI, InFile, Sysroot, OutputFile, OS)) + raw_ostream *OS = + ComputeASTConsumerArguments(CI, InFile, Sysroot, OutputFile); + if (!OS) return nullptr; if (!CI.getFrontendOpts().RelocatablePCH) @@ -89,28 +90,27 @@ GeneratePCHAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) { nullptr, Sysroot, OS); } -bool GeneratePCHAction::ComputeASTConsumerArguments(CompilerInstance &CI, - StringRef InFile, - std::string &Sysroot, - std::string &OutputFile, - raw_ostream *&OS) { +raw_ostream *GeneratePCHAction::ComputeASTConsumerArguments( + CompilerInstance &CI, StringRef InFile, std::string &Sysroot, + std::string &OutputFile) { Sysroot = CI.getHeaderSearchOpts().Sysroot; if (CI.getFrontendOpts().RelocatablePCH && Sysroot.empty()) { CI.getDiagnostics().Report(diag::err_relocatable_without_isysroot); - return true; + return nullptr; } // We use createOutputFile here because this is exposed via libclang, and we // must disable the RemoveFileOnSignal behavior. // We use a temporary to avoid race conditions. - OS = CI.createOutputFile(CI.getFrontendOpts().OutputFile, /*Binary=*/true, - /*RemoveFileOnSignal=*/false, InFile, - /*Extension=*/"", /*useTemporary=*/true); + raw_ostream *OS = + CI.createOutputFile(CI.getFrontendOpts().OutputFile, /*Binary=*/true, + /*RemoveFileOnSignal=*/false, InFile, + /*Extension=*/"", /*useTemporary=*/true); if (!OS) - return true; + return nullptr; OutputFile = CI.getFrontendOpts().OutputFile; - return false; + return OS; } std::unique_ptr<ASTConsumer> |