diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-10 13:14:31 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-10 13:14:31 +0000 |
commit | bfd25d4d8a8592eb8f453bef558f9a675676c142 (patch) | |
tree | eb389b68601b5935e6f9eabb40155c4df5dd964e /clang/lib/Frontend/FrontendActions.cpp | |
parent | fe47a98c18f1211659ad1c8e78503823e462ab08 (diff) | |
download | bcm5719-llvm-bfd25d4d8a8592eb8f453bef558f9a675676c142.tar.gz bcm5719-llvm-bfd25d4d8a8592eb8f453bef558f9a675676c142.zip |
Return a pointer instead of having a pointer outparam and a bool return.
llvm-svn: 234592
Diffstat (limited to 'clang/lib/Frontend/FrontendActions.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendActions.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index e76eff029b1..622ca8241c2 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -118,8 +118,9 @@ GenerateModuleAction::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; return llvm::make_unique<PCHGenerator>(CI.getPreprocessor(), OutputFile, @@ -355,11 +356,9 @@ bool GenerateModuleAction::BeginSourceFileAction(CompilerInstance &CI, return true; } -bool GenerateModuleAction::ComputeASTConsumerArguments(CompilerInstance &CI, - StringRef InFile, - std::string &Sysroot, - std::string &OutputFile, - raw_ostream *&OS) { +raw_ostream *GenerateModuleAction::ComputeASTConsumerArguments( + CompilerInstance &CI, StringRef InFile, std::string &Sysroot, + std::string &OutputFile) { // If no output file was provided, figure out where this module would go // in the module cache. if (CI.getFrontendOpts().OutputFile.empty()) { @@ -368,19 +367,20 @@ bool GenerateModuleAction::ComputeASTConsumerArguments(CompilerInstance &CI, HS.getModuleFileName(CI.getLangOpts().CurrentModule, ModuleMapForUniquing->getName()); } - + // 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, - /*CreateMissingDirectories=*/true); + raw_ostream *OS = + CI.createOutputFile(CI.getFrontendOpts().OutputFile, /*Binary=*/true, + /*RemoveFileOnSignal=*/false, InFile, + /*Extension=*/"", /*useTemporary=*/true, + /*CreateMissingDirectories=*/true); if (!OS) - return true; - + return nullptr; + OutputFile = CI.getFrontendOpts().OutputFile; - return false; + return OS; } std::unique_ptr<ASTConsumer> |