diff options
| author | 2017-01-14 19:55:43 +0000 | |
|---|---|---|
| committer | 2017-01-14 19:55:43 +0000 | |
| commit | bd3306aecb3a15e8967143b8cdbbccf2b1b19b74 (patch) | |
| tree | 309a8132b44564b9e634c0da6815187ce8eab27c /gnu/llvm/tools/clang/lib/Frontend/Rewrite/FrontendActions.cpp | |
| parent | killp -a should not kill the window if only one pane. (diff) | |
| download | wireguard-openbsd-bd3306aecb3a15e8967143b8cdbbccf2b1b19b74.tar.xz wireguard-openbsd-bd3306aecb3a15e8967143b8cdbbccf2b1b19b74.zip | |
Import LLVM 3.9.1 including clang and lld.
Diffstat (limited to 'gnu/llvm/tools/clang/lib/Frontend/Rewrite/FrontendActions.cpp')
| -rw-r--r-- | gnu/llvm/tools/clang/lib/Frontend/Rewrite/FrontendActions.cpp | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/gnu/llvm/tools/clang/lib/Frontend/Rewrite/FrontendActions.cpp b/gnu/llvm/tools/clang/lib/Frontend/Rewrite/FrontendActions.cpp index 8cf8adf37ed..13d410e2138 100644 --- a/gnu/llvm/tools/clang/lib/Frontend/Rewrite/FrontendActions.cpp +++ b/gnu/llvm/tools/clang/lib/Frontend/Rewrite/FrontendActions.cpp @@ -23,6 +23,7 @@ #include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" #include <memory> +#include <utility> using namespace clang; @@ -32,8 +33,9 @@ using namespace clang; std::unique_ptr<ASTConsumer> HTMLPrintAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) { - if (raw_ostream *OS = CI.createDefaultOutputFile(false, InFile)) - return CreateHTMLPrinter(OS, CI.getPreprocessor()); + if (std::unique_ptr<raw_ostream> OS = + CI.createDefaultOutputFile(false, InFile)) + return CreateHTMLPrinter(std::move(OS), CI.getPreprocessor()); return nullptr; } @@ -60,8 +62,8 @@ class FixItActionSuffixInserter : public FixItOptions { public: FixItActionSuffixInserter(std::string NewSuffix, bool FixWhatYouCan) - : NewSuffix(NewSuffix) { - this->FixWhatYouCan = FixWhatYouCan; + : NewSuffix(std::move(NewSuffix)) { + this->FixWhatYouCan = FixWhatYouCan; } std::string RewriteFilename(const std::string &Filename, int &fd) override { @@ -151,15 +153,15 @@ bool FixItRecompile::BeginInvocation(CompilerInstance &CI) { std::unique_ptr<ASTConsumer> RewriteObjCAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) { - if (raw_ostream *OS = CI.createDefaultOutputFile(false, InFile, "cpp")) { + if (std::unique_ptr<raw_ostream> OS = + CI.createDefaultOutputFile(false, InFile, "cpp")) { if (CI.getLangOpts().ObjCRuntime.isNonFragile()) - return CreateModernObjCRewriter(InFile, OS, - CI.getDiagnostics(), CI.getLangOpts(), - CI.getDiagnosticOpts().NoRewriteMacros, - (CI.getCodeGenOpts().getDebugInfo() != - CodeGenOptions::NoDebugInfo)); - return CreateObjCRewriter(InFile, OS, - CI.getDiagnostics(), CI.getLangOpts(), + return CreateModernObjCRewriter( + InFile, std::move(OS), CI.getDiagnostics(), CI.getLangOpts(), + CI.getDiagnosticOpts().NoRewriteMacros, + (CI.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo)); + return CreateObjCRewriter(InFile, std::move(OS), CI.getDiagnostics(), + CI.getLangOpts(), CI.getDiagnosticOpts().NoRewriteMacros); } return nullptr; @@ -173,25 +175,28 @@ RewriteObjCAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) { void RewriteMacrosAction::ExecuteAction() { CompilerInstance &CI = getCompilerInstance(); - raw_ostream *OS = CI.createDefaultOutputFile(true, getCurrentFile()); + std::unique_ptr<raw_ostream> OS = + CI.createDefaultOutputFile(true, getCurrentFile()); if (!OS) return; - RewriteMacrosInInput(CI.getPreprocessor(), OS); + RewriteMacrosInInput(CI.getPreprocessor(), OS.get()); } void RewriteTestAction::ExecuteAction() { CompilerInstance &CI = getCompilerInstance(); - raw_ostream *OS = CI.createDefaultOutputFile(false, getCurrentFile()); + std::unique_ptr<raw_ostream> OS = + CI.createDefaultOutputFile(false, getCurrentFile()); if (!OS) return; - DoRewriteTest(CI.getPreprocessor(), OS); + DoRewriteTest(CI.getPreprocessor(), OS.get()); } void RewriteIncludesAction::ExecuteAction() { CompilerInstance &CI = getCompilerInstance(); - raw_ostream *OS = CI.createDefaultOutputFile(true, getCurrentFile()); + std::unique_ptr<raw_ostream> OS = + CI.createDefaultOutputFile(true, getCurrentFile()); if (!OS) return; - RewriteIncludesInInput(CI.getPreprocessor(), OS, + RewriteIncludesInInput(CI.getPreprocessor(), OS.get(), CI.getPreprocessorOutputOpts()); } |
