]> granicus.if.org Git - clang/commitdiff
Revert "unique_ptr-ify ownership of ASTConsumers"
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 17 Jul 2014 22:34:12 +0000 (22:34 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 17 Jul 2014 22:34:12 +0000 (22:34 +0000)
This reverts commit r213307.

Reverting to have some on-list discussion/confirmation about the ongoing
direction of smart pointer usage in the LLVM project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213325 91177308-0d34-0410-b5e6-96231b3b80d8

42 files changed:
examples/PrintFunctionNames/PrintFunctionNames.cpp
include/clang/ARCMigrate/ARCMTActions.h
include/clang/ASTMatchers/ASTMatchFinder.h
include/clang/CodeGen/CodeGenAction.h
include/clang/Frontend/ASTConsumers.h
include/clang/Frontend/CompilerInstance.h
include/clang/Frontend/FrontendAction.h
include/clang/Frontend/FrontendActions.h
include/clang/Frontend/MultiplexConsumer.h
include/clang/Rewrite/Frontend/ASTConsumers.h
include/clang/Rewrite/Frontend/FrontendActions.h
include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h
include/clang/StaticAnalyzer/Frontend/FrontendActions.h
include/clang/Tooling/Tooling.h
lib/ARCMigrate/ARCMT.cpp
lib/ARCMigrate/ObjCMT.cpp
lib/ASTMatchers/ASTMatchFinder.cpp
lib/CodeGen/CodeGenAction.cpp
lib/Frontend/ASTConsumers.cpp
lib/Frontend/ASTMerge.cpp
lib/Frontend/ASTUnit.cpp
lib/Frontend/ChainedIncludesSource.cpp
lib/Frontend/CompilerInstance.cpp
lib/Frontend/FrontendAction.cpp
lib/Frontend/FrontendActions.cpp
lib/Frontend/MultiplexConsumer.cpp
lib/Frontend/Rewrite/FrontendActions.cpp
lib/Frontend/Rewrite/HTMLPrint.cpp
lib/Frontend/Rewrite/RewriteModernObjC.cpp
lib/Frontend/Rewrite/RewriteObjC.cpp
lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
lib/StaticAnalyzer/Frontend/FrontendActions.cpp
tools/clang-check/ClangCheck.cpp
tools/libclang/Indexing.cpp
unittests/AST/EvaluateAsRValueTest.cpp
unittests/AST/ExternalASTSourceTest.cpp
unittests/AST/NamedDeclPrinterTest.cpp
unittests/Frontend/FrontendActionTest.cpp
unittests/Sema/ExternalSemaSourceTest.cpp
unittests/Tooling/RefactoringTest.cpp
unittests/Tooling/TestVisitor.h
unittests/Tooling/ToolingTest.cpp

index e8a361dbee9a2bd26c70e70f997f01cedf8d2a1c..3f18cd45e56463749d3bb5dbdfc48aff5631bf2b 100644 (file)
@@ -36,9 +36,8 @@ public:
 
 class PrintFunctionNamesAction : public PluginASTAction {
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 llvm::StringRef) {
-    return llvm::make_unique<PrintFunctionsConsumer>();
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI, llvm::StringRef) {
+    return new PrintFunctionsConsumer();
   }
 
   bool ParseArgs(const CompilerInstance &CI,
index 0f45ccc0f4bbd63fb12c5543baef91a9005c118b..b3e74b996678b8ce3f682bd2f5b03ab5a9c36f9c 100644 (file)
@@ -37,8 +37,8 @@ class MigrateSourceAction : public ASTFrontendAction {
   FileRemapper Remapper;
 protected:
   bool BeginInvocation(CompilerInstance &CI) override;
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 };
 
 class MigrateAction : public WrapperFrontendAction {
@@ -65,8 +65,8 @@ public:
                     unsigned migrateAction);
 
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
   bool BeginInvocation(CompilerInstance &CI) override;
 };
 
index 9e8b7b5216886c9bc54d4e24bf31bc48bdc2399c..8af0546db57b70a96016d2abc5adc0b6fdcc6e1c 100644 (file)
@@ -148,7 +148,7 @@ public:
                          MatchCallback *Action);
 
   /// \brief Creates a clang ASTConsumer that finds all matches.
-  std::unique_ptr<clang::ASTConsumer> newASTConsumer();
+  clang::ASTConsumer *newASTConsumer();
 
   /// \brief Calls the registered callbacks on all matches on the given \p Node.
   ///
index 4619b48378ac75da3557a0525808dc449da64bb6..37819c780d5d6cca622700e382545ce3b4ad168d 100644 (file)
@@ -37,8 +37,8 @@ protected:
 
   bool hasIRSupport() const override;
 
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 
   void ExecuteAction() override;
 
index 4afcb0c28ac1a5a8c726d1f27f7482937dc59f47..366c499b67f55fef278d4b291595590b38dec016 100644 (file)
@@ -16,8 +16,6 @@
 
 #include "clang/Basic/LLVM.h"
 
-#include <memory>
-
 namespace clang {
 
 class ASTConsumer;
@@ -32,26 +30,24 @@ class TargetOptions;
 // original C code.  The output is intended to be in a format such that
 // clang could re-parse the output back into the same AST, but the
 // implementation is still incomplete.
-std::unique_ptr<ASTConsumer> CreateASTPrinter(raw_ostream *OS,
-                                              StringRef FilterString);
+ASTConsumer *CreateASTPrinter(raw_ostream *OS, StringRef FilterString);
 
 // AST dumper: dumps the raw AST in human-readable form to stderr; this is
 // intended for debugging.
-std::unique_ptr<ASTConsumer> CreateASTDumper(StringRef FilterString,
-                                             bool DumpLookups = false);
+ASTConsumer *CreateASTDumper(StringRef FilterString, bool DumpLookups = false);
 
 // AST Decl node lister: prints qualified names of all filterable AST Decl
 // nodes.
-std::unique_ptr<ASTConsumer> CreateASTDeclNodeLister();
+ASTConsumer *CreateASTDeclNodeLister();
 
 // Graphical AST viewer: for each function definition, creates a graph of
 // the AST and displays it with the graph viewer "dotty".  Also outputs
 // function declarations to stderr.
-std::unique_ptr<ASTConsumer> CreateASTViewer();
+ASTConsumer *CreateASTViewer();
 
 // DeclContext printer: prints out the DeclContext tree in human-readable form
 // to stderr; this is intended for debugging.
-std::unique_ptr<ASTConsumer> CreateDeclContextPrinter();
+ASTConsumer *CreateDeclContextPrinter();
 
 } // end clang namespace
 
index 9082d572f86a7a63d40f10d2ac7fa2d9eb7f2688..44e91026acb53d7e8067765e4520b739d395e962 100644 (file)
@@ -14,7 +14,6 @@
 #include "clang/Basic/SourceManager.h"
 #include "clang/Frontend/CompilerInvocation.h"
 #include "clang/Frontend/Utils.h"
-#include "clang/AST/ASTConsumer.h"
 #include "clang/Lex/ModuleLoader.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
@@ -444,11 +443,11 @@ public:
 
   /// takeASTConsumer - Remove the current AST consumer and give ownership to
   /// the caller.
-  std::unique_ptr<ASTConsumer> takeASTConsumer() { return std::move(Consumer); }
+  ASTConsumer *takeASTConsumer() { return Consumer.release(); }
 
   /// setASTConsumer - Replace the current AST consumer; the compiler instance
   /// takes ownership of \p Value.
-  void setASTConsumer(std::unique_ptr<ASTConsumer> Value);
+  void setASTConsumer(ASTConsumer *Value);
 
   /// }
   /// @name Semantic analysis
index 990a293ed7c455d7a5c79ad4ce2dd0e7c9630256..9ac9d2828f6a9f620f87d48feb500fe19a02c75e 100644 (file)
@@ -41,8 +41,8 @@ class FrontendAction {
   friend class WrapperFrontendAction;
 
 private:
-  std::unique_ptr<ASTConsumer> CreateWrappedASTConsumer(CompilerInstance &CI,
-                                                        StringRef InFile);
+  ASTConsumer* CreateWrappedASTConsumer(CompilerInstance &CI,
+                                        StringRef InFile);
 
 protected:
   /// @name Implementation Action Interface
@@ -61,8 +61,8 @@ protected:
   /// getCurrentFile().
   ///
   /// \return The new AST consumer, or null on failure.
-  virtual std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                         StringRef InFile) = 0;
+  virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                         StringRef InFile) = 0;
 
   /// \brief Callback before starting processing a single input, giving the
   /// opportunity to modify the CompilerInvocation or do some other action
@@ -227,10 +227,11 @@ public:
 
 class PluginASTAction : public ASTFrontendAction {
   virtual void anchor();
-public:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override = 0;
+protected:
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override = 0;
 
+public:
   /// \brief Parse the given plugin command line arguments.
   ///
   /// \param CI - The compiler instance, for use in reporting diagnostics.
@@ -246,8 +247,8 @@ class PreprocessorFrontendAction : public FrontendAction {
 protected:
   /// \brief Provide a default implementation which returns aborts;
   /// this method should never be called by FrontendAction clients.
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 
 public:
   bool usesPreprocessorOnly() const override { return true; }
@@ -263,8 +264,8 @@ class WrapperFrontendAction : public FrontendAction {
   std::unique_ptr<FrontendAction> WrappedAction;
 
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
   bool BeginInvocation(CompilerInstance &CI) override;
   bool BeginSourceFileAction(CompilerInstance &CI, StringRef Filename) override;
   void ExecuteAction() override;
index 850f87c073c5fed2e1dad81e81d8989de85af08b..84cc82cfbe2f825b637ade664a4571de2a5ec356 100644 (file)
@@ -26,8 +26,8 @@ class FileEntry;
 class InitOnlyAction : public FrontendAction {
   void ExecuteAction() override;
 
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 
 public:
   // Don't claim to only use the preprocessor, we want to follow the AST path,
@@ -41,38 +41,38 @@ public:
 
 class ASTPrintAction : public ASTFrontendAction {
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 };
 
 class ASTDumpAction : public ASTFrontendAction {
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 };
 
 class ASTDeclListAction : public ASTFrontendAction {
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 };
 
 class ASTViewAction : public ASTFrontendAction {
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 };
 
 class DeclContextPrintAction : public ASTFrontendAction {
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 };
 
 class GeneratePCHAction : public ASTFrontendAction {
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 
   TranslationUnitKind getTranslationUnitKind() override {
     return TU_Prefix;
@@ -98,8 +98,8 @@ class GenerateModuleAction : public ASTFrontendAction {
   bool IsSystem;
   
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 
   TranslationUnitKind getTranslationUnitKind() override {
     return TU_Module;
@@ -128,8 +128,8 @@ public:
 
 class SyntaxOnlyAction : public ASTFrontendAction {
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                         StringRef InFile) override;
 
 public:
   bool hasCodeCompletionSupport() const override { return true; }
@@ -139,8 +139,8 @@ public:
 /// basic debugging and discovery.
 class DumpModuleInfoAction : public ASTFrontendAction {
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
   void ExecuteAction() override;
 
 public:
@@ -152,8 +152,8 @@ public:
 
 class VerifyPCHAction : public ASTFrontendAction {
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 
   void ExecuteAction() override;
 
@@ -177,8 +177,8 @@ class ASTMergeAction : public FrontendAction {
   std::vector<std::string> ASTFiles;
 
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 
   bool BeginSourceFileAction(CompilerInstance &CI,
                              StringRef Filename) override;
@@ -200,8 +200,7 @@ public:
 class PrintPreambleAction : public FrontendAction {
 protected:
   void ExecuteAction() override;
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &,
-                                                 StringRef) override {
+  ASTConsumer *CreateASTConsumer(CompilerInstance &, StringRef) override {
     return nullptr;
   }
 
index 8c414e7d46cb2ba604ec6e4e2bbf706cbc298fa8..4d31104cce18dc18105143bf5dc123a23885a154 100644 (file)
@@ -29,7 +29,7 @@ class MultiplexASTDeserializationListener;
 class MultiplexConsumer : public SemaConsumer {
 public:
   // Takes ownership of the pointers in C.
-  MultiplexConsumer(std::vector<std::unique_ptr<ASTConsumer>> C);
+  MultiplexConsumer(ArrayRef<ASTConsumer*> C);
   ~MultiplexConsumer();
 
   // ASTConsumer
@@ -59,7 +59,7 @@ public:
   void ForgetSema() override;
 
 private:
-  std::vector<std::unique_ptr<ASTConsumer>> Consumers; // Owns these.
+  std::vector<ASTConsumer*> Consumers;  // Owns these.
   std::unique_ptr<MultiplexASTMutationListener> MutationListener;
   std::unique_ptr<MultiplexASTDeserializationListener> DeserializationListener;
 };
index 9ea96cd4238ed46e849c707fc7afd24c183aab8b..584af3fa18b0523f4e0680c74a0a1a84ae9b5142 100644 (file)
@@ -15,8 +15,6 @@
 #define REWRITE_ASTCONSUMERS_H
 
 #include "clang/Basic/LLVM.h"
-
-#include <memory>
 #include <string>
 
 namespace clang {
@@ -28,21 +26,23 @@ class Preprocessor;
 
 // ObjC rewriter: attempts to rewrite ObjC constructs into pure C code.
 // This is considered experimental, and only works with Apple's ObjC runtime.
-std::unique_ptr<ASTConsumer>
-CreateObjCRewriter(const std::string &InFile, raw_ostream *OS,
-                   DiagnosticsEngine &Diags, const LangOptions &LOpts,
-                   bool SilenceRewriteMacroWarning);
-std::unique_ptr<ASTConsumer>
-CreateModernObjCRewriter(const std::string &InFile, raw_ostream *OS,
-                         DiagnosticsEngine &Diags, const LangOptions &LOpts,
-                         bool SilenceRewriteMacroWarning, bool LineInfo);
+ASTConsumer *CreateObjCRewriter(const std::string &InFile,
+                                raw_ostream *OS,
+                                DiagnosticsEngine &Diags,
+                                const LangOptions &LOpts,
+                                bool SilenceRewriteMacroWarning);
+ASTConsumer *CreateModernObjCRewriter(const std::string &InFile,
+                                raw_ostream *OS,
+                                DiagnosticsEngine &Diags,
+                                const LangOptions &LOpts,
+                                bool SilenceRewriteMacroWarning,
+                                bool LineInfo);
 
 /// CreateHTMLPrinter - Create an AST consumer which rewrites source code to
 /// HTML with syntax highlighting suitable for viewing in a web-browser.
-std::unique_ptr<ASTConsumer> CreateHTMLPrinter(raw_ostream *OS,
-                                               Preprocessor &PP,
-                                               bool SyntaxHighlight = true,
-                                               bool HighlightMacros = true);
+ASTConsumer *CreateHTMLPrinter(raw_ostream *OS, Preprocessor &PP,
+                               bool SyntaxHighlight = true,
+                               bool HighlightMacros = true);
 
 } // end clang namespace
 
index eca3650d8fbf70ee8b08e66fd2972d5c62e09b80..fc792707487d6a90c1c01eee59334cf5514d6834 100644 (file)
@@ -22,8 +22,8 @@ class FixItOptions;
 
 class HTMLPrintAction : public ASTFrontendAction {
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 };
 
 class FixItAction : public ASTFrontendAction {
@@ -31,8 +31,8 @@ protected:
   std::unique_ptr<FixItRewriter> Rewriter;
   std::unique_ptr<FixItOptions> FixItOpts;
 
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 
   bool BeginSourceFileAction(CompilerInstance &CI,
                              StringRef Filename) override;
@@ -59,8 +59,8 @@ protected:
 
 class RewriteObjCAction : public ASTFrontendAction {
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 };
 
 class RewriteMacrosAction : public PreprocessorFrontendAction {
index 6067dfdb6a361b22bc8397c05059ab5b9066cd20..30e5d3dd9a2bd94d88cfb4c9df1433416d9990aa 100644 (file)
@@ -37,9 +37,10 @@ public:
 /// CreateAnalysisConsumer - Creates an ASTConsumer to run various code
 /// analysis passes.  (The set of analyses run is controlled by command-line
 /// options.)
-std::unique_ptr<AnalysisASTConsumer>
-CreateAnalysisConsumer(const Preprocessor &pp, const std::string &output,
-                       AnalyzerOptionsRef opts, ArrayRef<std::string> plugins);
+AnalysisASTConsumer *CreateAnalysisConsumer(const Preprocessor &pp,
+                                            const std::string &output,
+                                            AnalyzerOptionsRef opts,
+                                            ArrayRef<std::string> plugins);
 
 } // end GR namespace
 
index 921d67e0853a66ebc0a424a9736bfbebd6d37314..21ecfc234fbeb670077921caa45e8728a2d54a01 100644 (file)
@@ -22,8 +22,8 @@ namespace ento {
 
 class AnalysisAction : public ASTFrontendAction {
 protected:
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
 };
 
 void printCheckerHelp(raw_ostream &OS, ArrayRef<std::string> plugins);
index fb9178abcc44b8951f420a14d61921dc43ab66c9..769acd325367aa77517d3cd0d203dccc62da0779 100644 (file)
@@ -30,7 +30,6 @@
 #ifndef LLVM_CLANG_TOOLING_TOOLING_H
 #define LLVM_CLANG_TOOLING_TOOLING_H
 
-#include "clang/AST/ASTConsumer.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/LLVM.h"
@@ -336,8 +335,8 @@ inline std::unique_ptr<FrontendActionFactory> newFrontendActionFactory(
                              SourceFileCallbacks *Callbacks)
         : ConsumerFactory(ConsumerFactory), Callbacks(Callbacks) {}
 
-      std::unique_ptr<clang::ASTConsumer>
-      CreateASTConsumer(clang::CompilerInstance &, StringRef) override {
+      clang::ASTConsumer *CreateASTConsumer(clang::CompilerInstance &,
+                                            StringRef) override {
         return ConsumerFactory->newASTConsumer();
       }
 
index 524c8d9cae8dd510ee5b39a0d351707777decb58..8a13b2ee4f1d04c7d5da7f06ab4422a5aa8e316e 100644 (file)
@@ -446,11 +446,11 @@ public:
   ARCMTMacroTrackerAction(std::vector<SourceLocation> &ARCMTMacroLocs)
     : ARCMTMacroLocs(ARCMTMacroLocs) { }
 
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override {
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override {
     CI.getPreprocessor().addPPCallbacks(
                               new ARCMTMacroTrackerPPCallbacks(ARCMTMacroLocs));
-    return llvm::make_unique<ASTConsumer>();
+    return new ASTConsumer();
   }
 };
 
index 565381c44614e152d2581aa813bb4b5b09ad2e0f..1a2055e9c452a5eb3803aea00b1ebb84dd69bd29 100644 (file)
@@ -185,17 +185,23 @@ ObjCMigrateAction::ObjCMigrateAction(FrontendAction *WrappedAction,
     MigrateDir = "."; // user current directory if none is given.
 }
 
-std::unique_ptr<ASTConsumer>
-ObjCMigrateAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
+ASTConsumer *ObjCMigrateAction::CreateASTConsumer(CompilerInstance &CI,
+                                                  StringRef InFile) {
   PPConditionalDirectiveRecord *
     PPRec = new PPConditionalDirectiveRecord(CompInst->getSourceManager());
   CompInst->getPreprocessor().addPPCallbacks(PPRec);
-  std::vector<std::unique_ptr<ASTConsumer>> Consumers;
-  Consumers.push_back(WrapperFrontendAction::CreateASTConsumer(CI, InFile));
-  Consumers.push_back(llvm::make_unique<ObjCMigrateASTConsumer>(
-      MigrateDir, ObjCMigAction, Remapper, CompInst->getFileManager(), PPRec,
-      CompInst->getPreprocessor(), false, ArrayRef<std::string>()));
-  return llvm::make_unique<MultiplexConsumer>(std::move(Consumers));
+  ASTConsumer *
+    WrappedConsumer = WrapperFrontendAction::CreateASTConsumer(CI, InFile);
+  ASTConsumer *MTConsumer = new ObjCMigrateASTConsumer(MigrateDir,
+                                                       ObjCMigAction,
+                                                       Remapper,
+                                                    CompInst->getFileManager(),
+                                                       PPRec,
+                                                       CompInst->getPreprocessor(),
+                                                       false,
+                                                       ArrayRef<std::string>());
+  ASTConsumer *Consumers[] = { MTConsumer, WrappedConsumer };
+  return new MultiplexConsumer(Consumers);
 }
 
 bool ObjCMigrateAction::BeginInvocation(CompilerInstance &CI) {
@@ -1859,8 +1865,8 @@ static std::vector<std::string> getWhiteListFilenames(StringRef DirPath) {
   return Filenames;
 }
 
-std::unique_ptr<ASTConsumer>
-MigrateSourceAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
+ASTConsumer *MigrateSourceAction::CreateASTConsumer(CompilerInstance &CI,
+                                                  StringRef InFile) {
   PPConditionalDirectiveRecord *
     PPRec = new PPConditionalDirectiveRecord(CI.getSourceManager());
   unsigned ObjCMTAction = CI.getFrontendOpts().ObjCMTAction;
@@ -1877,10 +1883,14 @@ MigrateSourceAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
   CI.getPreprocessor().addPPCallbacks(PPRec);
   std::vector<std::string> WhiteList =
     getWhiteListFilenames(CI.getFrontendOpts().ObjCMTWhiteListPath);
-  return llvm::make_unique<ObjCMigrateASTConsumer>(
-      CI.getFrontendOpts().OutputFile, ObjCMTAction, Remapper,
-      CI.getFileManager(), PPRec, CI.getPreprocessor(),
-      /*isOutputFile=*/true, WhiteList);
+  return new ObjCMigrateASTConsumer(CI.getFrontendOpts().OutputFile,
+                                    ObjCMTAction,
+                                    Remapper,
+                                    CI.getFileManager(),
+                                    PPRec,
+                                    CI.getPreprocessor(),
+                                    /*isOutputFile=*/true,
+                                    WhiteList);
 }
 
 namespace {
index 50531f4e2745d6a3faa5b5835534d29997c567a8..23708e2ff0c77acbdf24034fe97d09e3ec9e377e 100644 (file)
@@ -823,8 +823,8 @@ bool MatchFinder::addDynamicMatcher(const internal::DynTypedMatcher &NodeMatch,
   return false;
 }
 
-std::unique_ptr<ASTConsumer> MatchFinder::newASTConsumer() {
-  return llvm::make_unique<internal::MatchASTConsumer>(this, ParsingDone);
+ASTConsumer *MatchFinder::newASTConsumer() {
+  return new internal::MatchASTConsumer(this, ParsingDone);
 }
 
 void MatchFinder::match(const clang::ast_type_traits::DynTypedNode &Node,
index 0c949492685e2c103f1c059dd220cbfcadda0461..559c2ef4badb758870f6e996e7f6fad37bb1b40a 100644 (file)
@@ -590,8 +590,8 @@ static raw_ostream *GetOutputStream(CompilerInstance &CI,
   llvm_unreachable("Invalid action!");
 }
 
-std::unique_ptr<ASTConsumer>
-CodeGenAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
+ASTConsumer *CodeGenAction::CreateASTConsumer(CompilerInstance &CI,
+                                              StringRef InFile) {
   BackendAction BA = static_cast<BackendAction>(Act);
   std::unique_ptr<raw_ostream> OS(GetOutputStream(CI, InFile, BA));
   if (BA != Backend_EmitNothing && !OS)
@@ -623,12 +623,11 @@ CodeGenAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
     LinkModuleToUse = ModuleOrErr.get();
   }
 
-  auto Result = llvm::make_unique<BackendConsumer>(
-      BA, CI.getDiagnostics(), CI.getCodeGenOpts(), CI.getTargetOpts(),
-      CI.getLangOpts(), (bool)CI.getFrontendOpts().ShowTimers, InFile,
-      LinkModuleToUse, OS.release(), *VMContext);
-  BEConsumer = Result.get();
-  return std::move(Result);
+  BEConsumer = new BackendConsumer(BA, CI.getDiagnostics(), CI.getCodeGenOpts(),
+                                   CI.getTargetOpts(), CI.getLangOpts(),
+                                   CI.getFrontendOpts().ShowTimers, InFile,
+                                   LinkModuleToUse, OS.release(), *VMContext);
+  return BEConsumer;
 }
 
 void CodeGenAction::ExecuteAction() {
index d836ed42d6b1b14eeb2860d103ed82c5e75ebcd9..54a6d474c18ab4710e36e382eae6adc77ef17888 100644 (file)
@@ -118,19 +118,17 @@ namespace {
   };
 } // end anonymous namespace
 
-std::unique_ptr<ASTConsumer> clang::CreateASTPrinter(raw_ostream *Out,
-                                                     StringRef FilterString) {
-  return llvm::make_unique<ASTPrinter>(Out, /*Dump=*/false, FilterString);
+ASTConsumer *clang::CreateASTPrinter(raw_ostream *Out,
+                                     StringRef FilterString) {
+  return new ASTPrinter(Out, /*Dump=*/ false, FilterString);
 }
 
-std::unique_ptr<ASTConsumer> clang::CreateASTDumper(StringRef FilterString,
-                                                    bool DumpLookups) {
-  return llvm::make_unique<ASTPrinter>(nullptr, /*Dump=*/true, FilterString,
-                                       DumpLookups);
+ASTConsumer *clang::CreateASTDumper(StringRef FilterString, bool DumpLookups) {
+  return new ASTPrinter(nullptr, /*Dump=*/true, FilterString, DumpLookups);
 }
 
-std::unique_ptr<ASTConsumer> clang::CreateASTDeclNodeLister() {
-  return llvm::make_unique<ASTDeclNodeLister>(nullptr);
+ASTConsumer *clang::CreateASTDeclNodeLister() {
+  return new ASTDeclNodeLister(nullptr);
 }
 
 //===----------------------------------------------------------------------===//
@@ -166,9 +164,8 @@ void ASTViewer::HandleTopLevelSingleDecl(Decl *D) {
   }
 }
 
-std::unique_ptr<ASTConsumer> clang::CreateASTViewer() {
-  return llvm::make_unique<ASTViewer>();
-}
+
+ASTConsumer *clang::CreateASTViewer() { return new ASTViewer(); }
 
 //===----------------------------------------------------------------------===//
 /// DeclContextPrinter - Decl and DeclContext Visualization
@@ -478,6 +475,6 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC,
     }
   }
 }
-std::unique_ptr<ASTConsumer> clang::CreateDeclContextPrinter() {
-  return llvm::make_unique<DeclContextPrinter>();
+ASTConsumer *clang::CreateDeclContextPrinter() {
+  return new DeclContextPrinter();
 }
index 57ccd398d5c50539ece6a1c140e6a82eff400288..ff6434c56945f0c9be43e7724361a6207aed6ec8 100644 (file)
@@ -16,8 +16,8 @@
 
 using namespace clang;
 
-std::unique_ptr<ASTConsumer>
-ASTMergeAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
+ASTConsumer *ASTMergeAction::CreateASTConsumer(CompilerInstance &CI,
+                                               StringRef InFile) {
   return AdaptedAction->CreateASTConsumer(CI, InFile);
 }
 
index 0497a5e998d68189784d84f6e82518ff7e2a42d1..fc44d9f1b4c08863ea2160b9c5fe960192ee7d3e 100644 (file)
@@ -891,12 +891,12 @@ class TopLevelDeclTrackerAction : public ASTFrontendAction {
 public:
   ASTUnit &Unit;
 
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override {
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override {
     CI.getPreprocessor().addPPCallbacks(
      new MacroDefinitionTrackerPPCallbacks(Unit.getCurrentTopLevelHashValue()));
-    return llvm::make_unique<TopLevelDeclTrackerConsumer>(
-        Unit, Unit.getCurrentTopLevelHashValue());
+    return new TopLevelDeclTrackerConsumer(Unit, 
+                                           Unit.getCurrentTopLevelHashValue());
   }
 
 public:
@@ -916,8 +916,8 @@ public:
   explicit PrecompilePreambleAction(ASTUnit &Unit)
       : Unit(Unit), HasEmittedPreamblePCH(false) {}
 
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override;
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override;
   bool hasEmittedPreamblePCH() const { return HasEmittedPreamblePCH; }
   void setHasEmittedPreamblePCH() { HasEmittedPreamblePCH = true; }
   bool shouldEraseOutputFiles() override { return !hasEmittedPreamblePCH(); }
@@ -979,9 +979,8 @@ public:
 
 }
 
-std::unique_ptr<ASTConsumer>
-PrecompilePreambleAction::CreateASTConsumer(CompilerInstance &CI,
-                                            StringRef InFile) {
+ASTConsumer *PrecompilePreambleAction::CreateASTConsumer(CompilerInstance &CI,
+                                                         StringRef InFile) {
   std::string Sysroot;
   std::string OutputFile;
   raw_ostream *OS = nullptr;
@@ -994,8 +993,8 @@ PrecompilePreambleAction::CreateASTConsumer(CompilerInstance &CI,
 
   CI.getPreprocessor().addPPCallbacks(new MacroDefinitionTrackerPPCallbacks(
       Unit.getCurrentTopLevelHashValue()));
-  return llvm::make_unique<PrecompilePreambleConsumer>(
-      Unit, this, CI.getPreprocessor(), Sysroot, OS);
+  return new PrecompilePreambleConsumer(Unit, this, CI.getPreprocessor(),
+                                        Sysroot, OS);
 }
 
 static bool isNonDriverDiag(const StoredDiagnostic &StoredDiag) {
@@ -1690,7 +1689,7 @@ void ASTUnit::transferASTDataFromCompilerInstance(CompilerInstance &CI) {
   assert(CI.hasInvocation() && "missing invocation");
   LangOpts = CI.getInvocation().LangOpts;
   TheSema.reset(CI.takeSema());
-  Consumer = CI.takeASTConsumer();
+  Consumer.reset(CI.takeASTConsumer());
   if (CI.hasASTContext())
     Ctx = &CI.getASTContext();
   if (CI.hasPreprocessor())
@@ -1864,13 +1863,12 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocationAction(
   if (Persistent && !TrackerAct) {
     Clang->getPreprocessor().addPPCallbacks(
      new MacroDefinitionTrackerPPCallbacks(AST->getCurrentTopLevelHashValue()));
-    std::vector<std::unique_ptr<ASTConsumer>> Consumers;
+    std::vector<ASTConsumer*> Consumers;
     if (Clang->hasASTConsumer())
       Consumers.push_back(Clang->takeASTConsumer());
-    Consumers.push_back(llvm::make_unique<TopLevelDeclTrackerConsumer>(
-        *AST, AST->getCurrentTopLevelHashValue()));
-    Clang->setASTConsumer(
-        llvm::make_unique<MultiplexConsumer>(std::move(Consumers)));
+    Consumers.push_back(new TopLevelDeclTrackerConsumer(*AST,
+                                           AST->getCurrentTopLevelHashValue()));
+    Clang->setASTConsumer(new MultiplexConsumer(Consumers));
   }
   if (!Act->Execute()) {
     AST->transferASTDataFromCompilerInstance(*Clang);
index 6b14e2505f86ccdf00372519c9a231e5743c4caa..e6e73ac963fb892fe557d5b268e0685b48c5711a 100644 (file)
@@ -158,12 +158,12 @@ IntrusiveRefCntPtr<ExternalSemaSource> clang::createChainedIncludesSource(
 
     SmallVector<char, 256> serialAST;
     llvm::raw_svector_ostream OS(serialAST);
-    auto consumer =
-        llvm::make_unique<PCHGenerator>(Clang->getPreprocessor(), "-", nullptr,
-                                        /*isysroot=*/"", &OS);
+    std::unique_ptr<ASTConsumer> consumer;
+    consumer.reset(new PCHGenerator(Clang->getPreprocessor(), "-", nullptr,
+                                    /*isysroot=*/"", &OS));
     Clang->getASTContext().setASTMutationListener(
                                             consumer->GetASTMutationListener());
-    Clang->setASTConsumer(std::move(consumer));
+    Clang->setASTConsumer(consumer.release());
     Clang->createSema(TU_Prefix, nullptr);
 
     if (firstInclude) {
index 7e4ffb188747582434c7b44ae529291cbfd77fc9..7cea9e4efc031bc1f27f4d9aa365976b9be3c3c9 100644 (file)
@@ -101,8 +101,8 @@ void CompilerInstance::setSema(Sema *S) {
   TheSema.reset(S);
 }
 
-void CompilerInstance::setASTConsumer(std::unique_ptr<ASTConsumer> Value) {
-  Consumer = std::move(Value);
+void CompilerInstance::setASTConsumer(ASTConsumer *Value) {
+  Consumer.reset(Value);
 }
 
 void CompilerInstance::setCodeCompletionConsumer(CodeCompleteConsumer *Value) {
index 3535276e6e97a9debc322bfa0fe6b5593ac637d0..791017924d69e26f0da9f02f46acca121b52a1e2 100644 (file)
@@ -134,10 +134,9 @@ void FrontendAction::setCurrentInput(const FrontendInputFile &CurrentInput,
   CurrentASTUnit.reset(AST);
 }
 
-std::unique_ptr<ASTConsumer>
-FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
-                                         StringRef InFile) {
-  std::unique_ptr<ASTConsumer> Consumer = CreateASTConsumer(CI, InFile);
+ASTConsumer* FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
+                                                      StringRef InFile) {
+  ASTConsumer* Consumer = CreateASTConsumer(CI, InFile);
   if (!Consumer)
     return nullptr;
 
@@ -146,8 +145,7 @@ FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
 
   // Make sure the non-plugin consumer is first, so that plugins can't
   // modifiy the AST.
-  std::vector<std::unique_ptr<ASTConsumer>> Consumers;
-  Consumers.push_back(std::move(Consumer));
+  std::vector<ASTConsumer*> Consumers(1, Consumer);
 
   for (size_t i = 0, e = CI.getFrontendOpts().AddPluginActions.size();
        i != e; ++i) { 
@@ -157,15 +155,16 @@ FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
         it = FrontendPluginRegistry::begin(),
         ie = FrontendPluginRegistry::end();
         it != ie; ++it) {
-      if (it->getName() != CI.getFrontendOpts().AddPluginActions[i])
-        continue;
-      std::unique_ptr<PluginASTAction> P = it->instantiate();
-      if (P->ParseArgs(CI, CI.getFrontendOpts().AddPluginArgs[i]))
-        Consumers.push_back(P->CreateASTConsumer(CI, InFile));
+      if (it->getName() == CI.getFrontendOpts().AddPluginActions[i]) {
+        std::unique_ptr<PluginASTAction> P(it->instantiate());
+        FrontendAction* c = P.get();
+        if (P->ParseArgs(CI, CI.getFrontendOpts().AddPluginArgs[i]))
+          Consumers.push_back(c->CreateASTConsumer(CI, InFile));
+      }
     }
   }
 
-  return llvm::make_unique<MultiplexConsumer>(std::move(Consumers));
+  return new MultiplexConsumer(Consumers);
 }
 
 bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
@@ -308,8 +307,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
   if (!usesPreprocessorOnly()) {
     CI.createASTContext();
 
-    std::unique_ptr<ASTConsumer> Consumer =
-        CreateWrappedASTConsumer(CI, InputFile);
+    std::unique_ptr<ASTConsumer> Consumer(
+        CreateWrappedASTConsumer(CI, InputFile));
     if (!Consumer)
       goto failure;
 
@@ -350,7 +349,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
         goto failure;
     }
 
-    CI.setASTConsumer(std::move(Consumer));
+    CI.setASTConsumer(Consumer.release());
     if (!CI.hasASTConsumer())
       goto failure;
   }
@@ -445,7 +444,7 @@ void FrontendAction::EndSourceFile() {
       CI.resetAndLeakSema();
       CI.resetAndLeakASTContext();
     }
-    BuryPointer(CI.takeASTConsumer().get());
+    BuryPointer(CI.takeASTConsumer());
   } else {
     if (!isCurrentFileAST()) {
       CI.setSema(nullptr);
@@ -517,15 +516,14 @@ void ASTFrontendAction::ExecuteAction() {
 
 void PluginASTAction::anchor() { }
 
-std::unique_ptr<ASTConsumer>
+ASTConsumer *
 PreprocessorFrontendAction::CreateASTConsumer(CompilerInstance &CI,
                                               StringRef InFile) {
   llvm_unreachable("Invalid CreateASTConsumer on preprocessor action!");
 }
 
-std::unique_ptr<ASTConsumer>
-WrapperFrontendAction::CreateASTConsumer(CompilerInstance &CI,
-                                         StringRef InFile) {
+ASTConsumer *WrapperFrontendAction::CreateASTConsumer(CompilerInstance &CI,
+                                                      StringRef InFile) {
   return WrappedAction->CreateASTConsumer(CI, InFile);
 }
 bool WrapperFrontendAction::BeginInvocation(CompilerInstance &CI) {
index ba1637677f601de79bb43f788174e2968ee638a4..ef6bfec0f1b0e10ef275f6c492d6861211249df3 100644 (file)
@@ -33,9 +33,9 @@ using namespace clang;
 // Custom Actions
 //===----------------------------------------------------------------------===//
 
-std::unique_ptr<ASTConsumer>
-InitOnlyAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
-  return llvm::make_unique<ASTConsumer>();
+ASTConsumer *InitOnlyAction::CreateASTConsumer(CompilerInstance &CI,
+                                               StringRef InFile) {
+  return new ASTConsumer();
 }
 
 void InitOnlyAction::ExecuteAction() {
@@ -45,37 +45,36 @@ void InitOnlyAction::ExecuteAction() {
 // AST Consumer Actions
 //===----------------------------------------------------------------------===//
 
-std::unique_ptr<ASTConsumer>
-ASTPrintAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
+ASTConsumer *ASTPrintAction::CreateASTConsumer(CompilerInstance &CI,
+                                               StringRef InFile) {
   if (raw_ostream *OS = CI.createDefaultOutputFile(false, InFile))
     return CreateASTPrinter(OS, CI.getFrontendOpts().ASTDumpFilter);
   return nullptr;
 }
 
-std::unique_ptr<ASTConsumer>
-ASTDumpAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
+ASTConsumer *ASTDumpAction::CreateASTConsumer(CompilerInstance &CI,
+                                              StringRef InFile) {
   return CreateASTDumper(CI.getFrontendOpts().ASTDumpFilter,
                          CI.getFrontendOpts().ASTDumpLookups);
 }
 
-std::unique_ptr<ASTConsumer>
-ASTDeclListAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
+ASTConsumer *ASTDeclListAction::CreateASTConsumer(CompilerInstance &CI,
+                                                  StringRef InFile) {
   return CreateASTDeclNodeLister();
 }
 
-std::unique_ptr<ASTConsumer>
-ASTViewAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
+ASTConsumer *ASTViewAction::CreateASTConsumer(CompilerInstance &CI,
+                                              StringRef InFile) {
   return CreateASTViewer();
 }
 
-std::unique_ptr<ASTConsumer>
-DeclContextPrintAction::CreateASTConsumer(CompilerInstance &CI,
-                                          StringRef InFile) {
+ASTConsumer *DeclContextPrintAction::CreateASTConsumer(CompilerInstance &CI,
+                                                       StringRef InFile) {
   return CreateDeclContextPrinter();
 }
 
-std::unique_ptr<ASTConsumer>
-GeneratePCHAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
+ASTConsumer *GeneratePCHAction::CreateASTConsumer(CompilerInstance &CI,
+                                                  StringRef InFile) {
   std::string Sysroot;
   std::string OutputFile;
   raw_ostream *OS = nullptr;
@@ -84,8 +83,8 @@ GeneratePCHAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
 
   if (!CI.getFrontendOpts().RelocatablePCH)
     Sysroot.clear();
-  return llvm::make_unique<PCHGenerator>(CI.getPreprocessor(), OutputFile,
-                                         nullptr, Sysroot, OS);
+  return new PCHGenerator(CI.getPreprocessor(), OutputFile, nullptr, Sysroot,
+                          OS);
 }
 
 bool GeneratePCHAction::ComputeASTConsumerArguments(CompilerInstance &CI,
@@ -112,17 +111,16 @@ bool GeneratePCHAction::ComputeASTConsumerArguments(CompilerInstance &CI,
   return false;
 }
 
-std::unique_ptr<ASTConsumer>
-GenerateModuleAction::CreateASTConsumer(CompilerInstance &CI,
-                                        StringRef InFile) {
+ASTConsumer *GenerateModuleAction::CreateASTConsumer(CompilerInstance &CI,
+                                                     StringRef InFile) {
   std::string Sysroot;
   std::string OutputFile;
   raw_ostream *OS = nullptr;
   if (ComputeASTConsumerArguments(CI, InFile, Sysroot, OutputFile, OS))
     return nullptr;
 
-  return llvm::make_unique<PCHGenerator>(CI.getPreprocessor(), OutputFile,
-                                         Module, Sysroot, OS);
+  return new PCHGenerator(CI.getPreprocessor(), OutputFile, Module, 
+                          Sysroot, OS);
 }
 
 static SmallVectorImpl<char> &
@@ -365,20 +363,19 @@ bool GenerateModuleAction::ComputeASTConsumerArguments(CompilerInstance &CI,
   return false;
 }
 
-std::unique_ptr<ASTConsumer>
-SyntaxOnlyAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
-  return llvm::make_unique<ASTConsumer>();
+ASTConsumer *SyntaxOnlyAction::CreateASTConsumer(CompilerInstance &CI,
+                                                 StringRef InFile) {
+  return new ASTConsumer();
 }
 
-std::unique_ptr<ASTConsumer>
-DumpModuleInfoAction::CreateASTConsumer(CompilerInstance &CI,
-                                        StringRef InFile) {
-  return llvm::make_unique<ASTConsumer>();
+ASTConsumer *DumpModuleInfoAction::CreateASTConsumer(CompilerInstance &CI,
+                                                     StringRef InFile) {
+  return new ASTConsumer();
 }
 
-std::unique_ptr<ASTConsumer>
-VerifyPCHAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
-  return llvm::make_unique<ASTConsumer>();
+ASTConsumer *VerifyPCHAction::CreateASTConsumer(CompilerInstance &CI,
+                                                StringRef InFile) {
+  return new ASTConsumer();
 }
 
 void VerifyPCHAction::ExecuteAction() {
index 2930cb3952cabd7abd5a74667ada4d5d6fac76d3..0e933a3f165f229b814a0e29636bbcc285736f30 100644 (file)
@@ -183,113 +183,118 @@ void MultiplexASTMutationListener::DeclarationMarkedUsed(const Decl *D) {
 
 }  // end namespace clang
 
-MultiplexConsumer::MultiplexConsumer(
-    std::vector<std::unique_ptr<ASTConsumer>> C)
-    : Consumers(std::move(C)), MutationListener(), DeserializationListener() {
+MultiplexConsumer::MultiplexConsumer(ArrayRef<ASTConsumer *> C)
+    : Consumers(C.begin(), C.end()), MutationListener(),
+      DeserializationListener() {
   // Collect the mutation listeners and deserialization listeners of all
   // children, and create a multiplex listener each if so.
   std::vector<ASTMutationListener*> mutationListeners;
   std::vector<ASTDeserializationListener*> serializationListeners;
-  for (auto &Consumer : Consumers) {
-    if (auto *mutationListener = Consumer->GetASTMutationListener())
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i) {
+    ASTMutationListener* mutationListener =
+        Consumers[i]->GetASTMutationListener();
+    if (mutationListener)
       mutationListeners.push_back(mutationListener);
-    if (auto *serializationListener = Consumer->GetASTDeserializationListener())
+    ASTDeserializationListener* serializationListener =
+        Consumers[i]->GetASTDeserializationListener();
+    if (serializationListener)
       serializationListeners.push_back(serializationListener);
   }
-  if (!mutationListeners.empty()) {
-    MutationListener =
-        llvm::make_unique<MultiplexASTMutationListener>(mutationListeners);
+  if (mutationListeners.size()) {
+    MutationListener.reset(new MultiplexASTMutationListener(mutationListeners));
   }
-  if (!serializationListeners.empty()) {
-    DeserializationListener =
-        llvm::make_unique<MultiplexASTDeserializationListener>(
-            serializationListeners);
+  if (serializationListeners.size()) {
+    DeserializationListener.reset(
+        new MultiplexASTDeserializationListener(serializationListeners));
   }
 }
 
-MultiplexConsumer::~MultiplexConsumer() {}
+MultiplexConsumer::~MultiplexConsumer() {
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    delete Consumers[i];
+}
 
 void MultiplexConsumer::Initialize(ASTContext &Context) {
-  for (auto &Consumer : Consumers)
-    Consumer->Initialize(Context);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->Initialize(Context);
 }
 
 bool MultiplexConsumer::HandleTopLevelDecl(DeclGroupRef D) {
   bool Continue = true;
-  for (auto &Consumer : Consumers)
-    Continue = Continue && Consumer->HandleTopLevelDecl(D);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Continue = Continue && Consumers[i]->HandleTopLevelDecl(D);
   return Continue;
 }
 
 void MultiplexConsumer::HandleInlineMethodDefinition(CXXMethodDecl *D) {
-  for (auto &Consumer : Consumers)
-    Consumer->HandleInlineMethodDefinition(D);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleInlineMethodDefinition(D);
 }
 
-void MultiplexConsumer::HandleCXXStaticMemberVarInstantiation(VarDecl *VD) {
-  for (auto &Consumer : Consumers)
-    Consumer->HandleCXXStaticMemberVarInstantiation(VD);
+void  MultiplexConsumer::HandleCXXStaticMemberVarInstantiation(VarDecl *VD) {
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleCXXStaticMemberVarInstantiation(VD);
 }
 
 void MultiplexConsumer::HandleInterestingDecl(DeclGroupRef D) {
-  for (auto &Consumer : Consumers)
-    Consumer->HandleInterestingDecl(D);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleInterestingDecl(D);
 }
 
 void MultiplexConsumer::HandleTranslationUnit(ASTContext &Ctx) {
-  for (auto &Consumer : Consumers)
-    Consumer->HandleTranslationUnit(Ctx);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleTranslationUnit(Ctx);
 }
 
 void MultiplexConsumer::HandleTagDeclDefinition(TagDecl *D) {
-  for (auto &Consumer : Consumers)
-    Consumer->HandleTagDeclDefinition(D);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleTagDeclDefinition(D);
 }
 
 void MultiplexConsumer::HandleTagDeclRequiredDefinition(const TagDecl *D) {
-  for (auto &Consumer : Consumers)
-    Consumer->HandleTagDeclRequiredDefinition(D);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleTagDeclRequiredDefinition(D);
 }
 
 void MultiplexConsumer::HandleCXXImplicitFunctionInstantiation(FunctionDecl *D){
-  for (auto &Consumer : Consumers)
-    Consumer->HandleCXXImplicitFunctionInstantiation(D);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleCXXImplicitFunctionInstantiation(D);
 }
 
 void MultiplexConsumer::HandleTopLevelDeclInObjCContainer(DeclGroupRef D) {
-  for (auto &Consumer : Consumers)
-    Consumer->HandleTopLevelDeclInObjCContainer(D);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleTopLevelDeclInObjCContainer(D);
 }
 
 void MultiplexConsumer::HandleImplicitImportDecl(ImportDecl *D) {
-  for (auto &Consumer : Consumers)
-    Consumer->HandleImplicitImportDecl(D);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleImplicitImportDecl(D);
 }
 
 void MultiplexConsumer::HandleLinkerOptionPragma(llvm::StringRef Opts) {
-  for (auto &Consumer : Consumers)
-    Consumer->HandleLinkerOptionPragma(Opts);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleLinkerOptionPragma(Opts);
 }
 
 void MultiplexConsumer::HandleDetectMismatch(llvm::StringRef Name, llvm::StringRef Value) {
-  for (auto &Consumer : Consumers)
-    Consumer->HandleDetectMismatch(Name, Value);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleDetectMismatch(Name, Value);
 }
 
 void MultiplexConsumer::HandleDependentLibrary(llvm::StringRef Lib) {
-  for (auto &Consumer : Consumers)
-    Consumer->HandleDependentLibrary(Lib);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleDependentLibrary(Lib);
 }
 
 void MultiplexConsumer::CompleteTentativeDefinition(VarDecl *D) {
-  for (auto &Consumer : Consumers)
-    Consumer->CompleteTentativeDefinition(D);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->CompleteTentativeDefinition(D);
 }
 
 void MultiplexConsumer::HandleVTable(
     CXXRecordDecl *RD, bool DefinitionRequired) {
-  for (auto &Consumer : Consumers)
-    Consumer->HandleVTable(RD, DefinitionRequired);
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->HandleVTable(RD, DefinitionRequired);
 }
 
 ASTMutationListener *MultiplexConsumer::GetASTMutationListener() {
@@ -301,18 +306,18 @@ ASTDeserializationListener *MultiplexConsumer::GetASTDeserializationListener() {
 }
 
 void MultiplexConsumer::PrintStats() {
-  for (auto &Consumer : Consumers)
-    Consumer->PrintStats();
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    Consumers[i]->PrintStats();
 }
 
 void MultiplexConsumer::InitializeSema(Sema &S) {
-  for (auto &Consumer : Consumers)
-    if (SemaConsumer *SC = dyn_cast<SemaConsumer>(Consumer.get()))
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    if (SemaConsumer *SC = dyn_cast<SemaConsumer>(Consumers[i]))
       SC->InitializeSema(S);
 }
 
 void MultiplexConsumer::ForgetSema() {
-  for (auto &Consumer : Consumers)
-    if (SemaConsumer *SC = dyn_cast<SemaConsumer>(Consumer.get()))
+  for (size_t i = 0, e = Consumers.size(); i != e; ++i)
+    if (SemaConsumer *SC = dyn_cast<SemaConsumer>(Consumers[i]))
       SC->ForgetSema();
 }
index 1b5eb2855beaf0022d66c9c515d4d6e3623c5054..59fef736f16a0119b9d01581dddca1c15e5cf57f 100644 (file)
@@ -30,8 +30,8 @@ using namespace clang;
 // AST Consumer Actions
 //===----------------------------------------------------------------------===//
 
-std::unique_ptr<ASTConsumer>
-HTMLPrintAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
+ASTConsumer *HTMLPrintAction::CreateASTConsumer(CompilerInstance &CI,
+                                                StringRef InFile) {
   if (raw_ostream *OS = CI.createDefaultOutputFile(false, InFile))
     return CreateHTMLPrinter(OS, CI.getPreprocessor());
   return nullptr;
@@ -40,9 +40,9 @@ HTMLPrintAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
 FixItAction::FixItAction() {}
 FixItAction::~FixItAction() {}
 
-std::unique_ptr<ASTConsumer>
-FixItAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
-  return llvm::make_unique<ASTConsumer>();
+ASTConsumer *FixItAction::CreateASTConsumer(CompilerInstance &CI,
+                                            StringRef InFile) {
+  return new ASTConsumer();
 }
 
 namespace {
@@ -148,8 +148,8 @@ bool FixItRecompile::BeginInvocation(CompilerInstance &CI) {
 
 #ifdef CLANG_ENABLE_OBJC_REWRITER
 
-std::unique_ptr<ASTConsumer>
-RewriteObjCAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
+ASTConsumer *RewriteObjCAction::CreateASTConsumer(CompilerInstance &CI,
+                                                  StringRef InFile) {
   if (raw_ostream *OS = CI.createDefaultOutputFile(false, InFile, "cpp")) {
     if (CI.getLangOpts().ObjCRuntime.isNonFragile())
       return CreateModernObjCRewriter(InFile, OS,
index 22ccfe6936b7ad6a8fa9d4657c676708b91cfe53..64da05fdde61be2e72fc24e2090285ca9784cbe5 100644 (file)
@@ -47,12 +47,11 @@ namespace {
   };
 }
 
-std::unique_ptr<ASTConsumer> clang::CreateHTMLPrinter(raw_ostream *OS,
-                                                      Preprocessor &PP,
-                                                      bool SyntaxHighlight,
-                                                      bool HighlightMacros) {
-  return llvm::make_unique<HTMLPrinter>(OS, PP, SyntaxHighlight,
-                                        HighlightMacros);
+ASTConsumer* clang::CreateHTMLPrinter(raw_ostream *OS,
+                                      Preprocessor &PP,
+                                      bool SyntaxHighlight,
+                                      bool HighlightMacros) {
+  return new HTMLPrinter(OS, PP, SyntaxHighlight, HighlightMacros);
 }
 
 void HTMLPrinter::Initialize(ASTContext &context) {
index c97fa979f6056e6cb47e20aaf5d664cf25b82dad..3e18a8b415a3580cc85f5bb0768bb5a550c8c649 100644 (file)
@@ -675,11 +675,14 @@ RewriteModernObjC::RewriteModernObjC(std::string inFile, raw_ostream* OS,
                "for @try/@finally (code may not execute properly)");
 }
 
-std::unique_ptr<ASTConsumer> clang::CreateModernObjCRewriter(
-    const std::string &InFile, raw_ostream *OS, DiagnosticsEngine &Diags,
-    const LangOptions &LOpts, bool SilenceRewriteMacroWarning, bool LineInfo) {
-  return llvm::make_unique<RewriteModernObjC>(
-      InFile, OS, Diags, LOpts, SilenceRewriteMacroWarning, LineInfo);
+ASTConsumer *clang::CreateModernObjCRewriter(const std::string& InFile,
+                                       raw_ostream* OS,
+                                       DiagnosticsEngine &Diags,
+                                       const LangOptions &LOpts,
+                                       bool SilenceRewriteMacroWarning,
+                                       bool LineInfo) {
+    return new RewriteModernObjC(InFile, OS, Diags, LOpts,
+                                 SilenceRewriteMacroWarning, LineInfo);
 }
 
 void RewriteModernObjC::InitializeCommon(ASTContext &context) {
index 8d48d9e7b69fec50a04dab4075406a453f348d0d..7a721771759ab66595f46e8f063dc26a171c1016 100644 (file)
@@ -600,12 +600,12 @@ RewriteObjC::RewriteObjC(std::string inFile, raw_ostream* OS,
                "for @try/@finally (code may not execute properly)");
 }
 
-std::unique_ptr<ASTConsumer>
-clang::CreateObjCRewriter(const std::string &InFile, raw_ostream *OS,
-                          DiagnosticsEngine &Diags, const LangOptions &LOpts,
-                          bool SilenceRewriteMacroWarning) {
-  return llvm::make_unique<RewriteObjCFragileABI>(InFile, OS, Diags, LOpts,
-                                                  SilenceRewriteMacroWarning);
+ASTConsumer *clang::CreateObjCRewriter(const std::string& InFile,
+                                       raw_ostream* OS,
+                                       DiagnosticsEngine &Diags,
+                                       const LangOptions &LOpts,
+                                       bool SilenceRewriteMacroWarning) {
+  return new RewriteObjCFragileABI(InFile, OS, Diags, LOpts, SilenceRewriteMacroWarning);
 }
 
 void RewriteObjC::InitializeCommon(ASTContext &context) {
index 23199ee33589a12126a9d6303e06ef3b12bd60a6..12e514b322b4e9f822c316b7aa62990ef932896a 100644 (file)
@@ -687,14 +687,14 @@ void AnalysisConsumer::RunPathSensitiveChecks(Decl *D,
 // AnalysisConsumer creation.
 //===----------------------------------------------------------------------===//
 
-std::unique_ptr<AnalysisASTConsumer>
+AnalysisASTConsumer *
 ento::CreateAnalysisConsumer(const Preprocessor &pp, const std::string &outDir,
                              AnalyzerOptionsRef opts,
                              ArrayRef<std::string> plugins) {
   // Disable the effects of '-Werror' when using the AnalysisConsumer.
   pp.getDiagnostics().setWarningsAsErrors(false);
 
-  return llvm::make_unique<AnalysisConsumer>(pp, outDir, opts, plugins);
+  return new AnalysisConsumer(pp, outDir, opts, plugins);
 }
 
 //===----------------------------------------------------------------------===//
index 567102b7656d8b753e2c5f4dfeac3083ef63eeb8..aa38077326324365f3b9ad3084cce72e398a94f0 100644 (file)
@@ -13,8 +13,8 @@
 using namespace clang;
 using namespace ento;
 
-std::unique_ptr<ASTConsumer>
-AnalysisAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
+ASTConsumer *AnalysisAction::CreateASTConsumer(CompilerInstance &CI,
+                                               StringRef InFile) {
   return CreateAnalysisConsumer(CI.getPreprocessor(),
                                 CI.getFrontendOpts().OutputFile,
                                 CI.getAnalyzerOpts(),
index df3b4e0d9509d3065725f6c8d0059d6565b6c9d9..cc8d43cec221163de8f7f7f89af3516e2624c841 100644 (file)
@@ -28,7 +28,6 @@
 #include "llvm/Option/OptTable.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Signals.h"
-#include "llvm/ADT/STLExtras.h"
 
 using namespace clang::driver;
 using namespace clang::tooling;
@@ -180,14 +179,14 @@ private:
 namespace clang_check {
 class ClangCheckActionFactory {
 public:
-  std::unique_ptr<clang::ASTConsumer> newASTConsumer() {
+  clang::ASTConsumer *newASTConsumer() {
     if (ASTList)
       return clang::CreateASTDeclNodeLister();
     if (ASTDump)
       return clang::CreateASTDumper(ASTDumpFilter);
     if (ASTPrint)
       return clang::CreateASTPrinter(&llvm::outs(), ASTDumpFilter);
-    return llvm::make_unique<clang::ASTConsumer>();
+    return new clang::ASTConsumer();
   }
 };
 }
index f347f9f345479abee86bf6b8b67b3391b87ca656..58af61811bf528b3d03f6ff2262a36bd27c4046c 100644 (file)
@@ -414,8 +414,8 @@ public:
     : IndexCtx(clientData, indexCallbacks, indexOptions, cxTU),
       CXTU(cxTU), SKData(skData) { }
 
-  std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef InFile) override {
+  ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                 StringRef InFile) override {
     PreprocessorOptions &PPOpts = CI.getPreprocessorOpts();
 
     if (!PPOpts.ImplicitPCHInclude.empty()) {
@@ -429,12 +429,13 @@ public:
     IndexCtx.setPreprocessor(PP);
 
     if (SKData) {
-      auto *PPRec = new PPConditionalDirectiveRecord(PP.getSourceManager());
+      PPConditionalDirectiveRecord *
+        PPRec = new PPConditionalDirectiveRecord(PP.getSourceManager());
       PP.addPPCallbacks(PPRec);
-      SKCtrl = llvm::make_unique<TUSkipBodyControl>(*SKData, *PPRec, PP);
+      SKCtrl.reset(new TUSkipBodyControl(*SKData, *PPRec, PP));
     }
 
-    return llvm::make_unique<IndexingConsumer>(IndexCtx, SKCtrl.get());
+    return new IndexingConsumer(IndexCtx, SKCtrl.get());
   }
 
   void EndSourceFileAction() override {
index b5f9b32740f52bed4c01aa7ae1d40a82034ed8aa..9120c936ed1209fa0e39b7d84919cc941e3502fe 100644 (file)
@@ -59,10 +59,9 @@ class EvaluateConstantInitializersVisitor
 
 class EvaluateConstantInitializersAction : public clang::ASTFrontendAction {
  public:
-   std::unique_ptr<clang::ASTConsumer>
-   CreateASTConsumer(clang::CompilerInstance &Compiler,
-                     llvm::StringRef FilePath) override {
-     return llvm::make_unique<Consumer>();
+  clang::ASTConsumer *CreateASTConsumer(clang::CompilerInstance &Compiler,
+                                        llvm::StringRef FilePath) override {
+    return new Consumer;
   }
 
  private:
index 6a5db6c1dd3781bee74da946d3327d036928789b..5cc2defe20fa8f0fb514af0ba33b8ff63b27f49b 100644 (file)
@@ -35,9 +35,9 @@ private:
     return ASTFrontendAction::ExecuteAction();
   }
 
-  virtual std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                         StringRef InFile) {
-    return llvm::make_unique<ASTConsumer>();
+  virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                         StringRef InFile) {
+    return new ASTConsumer;
   }
 
   IntrusiveRefCntPtr<ExternalASTSource> Source;
index f8fb98454bd7ec7ca1645dcf4667baf19b05e6e0..4823b44862e510695bffac467dfd1fa6b55f914d 100644 (file)
@@ -68,8 +68,8 @@ PrintedNamedDeclMatches(StringRef Code, const std::vector<std::string> &Args,
   PrintMatch Printer(SuppressUnwrittenScope);
   MatchFinder Finder;
   Finder.addMatcher(NodeMatch, &Printer);
-  std::unique_ptr<FrontendActionFactory> Factory =
-      newFrontendActionFactory(&Finder);
+  std::unique_ptr<FrontendActionFactory> Factory(
+      newFrontendActionFactory(&Finder));
 
   if (!runToolOnCodeWithArgs(Factory->create(), Code, Args, FileName))
     return testing::AssertionFailure()
index 48bc07286e9158b7bbb6a67178c52716451f8edd..e39d00f6af3de2a18ea57e27feab1277cf2b320d 100644 (file)
@@ -38,9 +38,9 @@ public:
     return ASTFrontendAction::BeginSourceFileAction(ci, filename);
   }
 
-  virtual std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                         StringRef InFile) {
-    return llvm::make_unique<Visitor>(decl_names);
+  virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+                                         StringRef InFile) {
+    return new Visitor(decl_names);
   }
 
 private:
index 4291b76e7d4c01388cfabe8b1d41e6e138e9d249..bc0d632cfdb5949bd96323ab5e12b4716998bc1f 100644 (file)
@@ -140,10 +140,10 @@ class ExternalSemaSourceInstaller : public clang::ASTFrontendAction {
   std::unique_ptr<DiagnosticConsumer> OwnedClient;
 
 protected:
-  virtual std::unique_ptr<clang::ASTConsumer>
+  virtual clang::ASTConsumer *
   CreateASTConsumer(clang::CompilerInstance &Compiler,
                     llvm::StringRef /* dummy */) {
-    return llvm::make_unique<clang::ASTConsumer>();
+    return new clang::ASTConsumer();
   }
 
   virtual void ExecuteAction() {
index 3e067dd3f99d076a7e049818975c9ab3a90ea16c..ddb974ac9f4ada2e496f06b5345c9a0b36a4b2e0 100644 (file)
@@ -299,12 +299,11 @@ private:
   public:
     TestAction(TestVisitor *Visitor) : Visitor(Visitor) {}
 
-    virtual std::unique_ptr<clang::ASTConsumer>
-    CreateASTConsumer(clang::CompilerInstance &compiler,
-                      llvm::StringRef dummy) {
+    virtual clang::ASTConsumer* CreateASTConsumer(
+        clang::CompilerInstance& compiler, llvm::StringRef dummy) {
       Visitor->SM = &compiler.getSourceManager();
       /// TestConsumer will be deleted by the framework calling us.
-      return llvm::make_unique<FindConsumer>(Visitor);
+      return new FindConsumer(Visitor);
     }
 
   private:
index 23ea754d39a2aba8941a4ba3b0c31d4734e68795..205a0aa16eb6eb950decbc8b63c26d25fda87bce 100644 (file)
@@ -95,10 +95,10 @@ protected:
   public:
     TestAction(TestVisitor *Visitor) : Visitor(Visitor) {}
 
-    virtual std::unique_ptr<clang::ASTConsumer>
-    CreateASTConsumer(CompilerInstance &, llvm::StringRef dummy) {
+    virtual clang::ASTConsumer* CreateASTConsumer(
+        CompilerInstance&, llvm::StringRef dummy) {
       /// TestConsumer will be deleted by the framework calling us.
-      return llvm::make_unique<FindConsumer>(Visitor);
+      return new FindConsumer(Visitor);
     }
 
   protected:
index 85ab942387b3dd92c03f0ec1effb2f24c5eaa332..9aede044f6954fe931461ab896aa4b57df2b5200 100644 (file)
@@ -28,20 +28,20 @@ namespace {
 /// Takes an ast consumer and returns it from CreateASTConsumer. This only
 /// works with single translation unit compilations.
 class TestAction : public clang::ASTFrontendAction {
-public:
+ public:
   /// Takes ownership of TestConsumer.
-  explicit TestAction(std::unique_ptr<clang::ASTConsumer> TestConsumer)
-      : TestConsumer(std::move(TestConsumer)) {}
+  explicit TestAction(clang::ASTConsumer *TestConsumer)
+      : TestConsumer(TestConsumer) {}
 
-protected:
-  virtual std::unique_ptr<clang::ASTConsumer>
-  CreateASTConsumer(clang::CompilerInstance &compiler, StringRef dummy) {
+ protected:
+  virtual clang::ASTConsumer* CreateASTConsumer(
+      clang::CompilerInstance& compiler, StringRef dummy) {
     /// TestConsumer will be deleted by the framework calling us.
-    return std::move(TestConsumer);
+    return TestConsumer;
   }
 
-private:
-  std::unique_ptr<clang::ASTConsumer> TestConsumer;
+ private:
+  clang::ASTConsumer * const TestConsumer;
 };
 
 class FindTopLevelDeclConsumer : public clang::ASTConsumer {
@@ -59,10 +59,8 @@ class FindTopLevelDeclConsumer : public clang::ASTConsumer {
 
 TEST(runToolOnCode, FindsNoTopLevelDeclOnEmptyCode) {
   bool FoundTopLevelDecl = false;
-  EXPECT_TRUE(
-      runToolOnCode(new TestAction(llvm::make_unique<FindTopLevelDeclConsumer>(
-                        &FoundTopLevelDecl)),
-                    ""));
+  EXPECT_TRUE(runToolOnCode(
+      new TestAction(new FindTopLevelDeclConsumer(&FoundTopLevelDecl)), ""));
   EXPECT_FALSE(FoundTopLevelDecl);
 }
 
@@ -99,17 +97,13 @@ bool FindClassDeclX(ASTUnit *AST) {
 
 TEST(runToolOnCode, FindsClassDecl) {
   bool FoundClassDeclX = false;
-  EXPECT_TRUE(
-      runToolOnCode(new TestAction(llvm::make_unique<FindClassDeclXConsumer>(
-                        &FoundClassDeclX)),
-                    "class X;"));
+  EXPECT_TRUE(runToolOnCode(new TestAction(
+      new FindClassDeclXConsumer(&FoundClassDeclX)), "class X;"));
   EXPECT_TRUE(FoundClassDeclX);
 
   FoundClassDeclX = false;
-  EXPECT_TRUE(
-      runToolOnCode(new TestAction(llvm::make_unique<FindClassDeclXConsumer>(
-                        &FoundClassDeclX)),
-                    "class Y;"));
+  EXPECT_TRUE(runToolOnCode(new TestAction(
+      new FindClassDeclXConsumer(&FoundClassDeclX)), "class Y;"));
   EXPECT_FALSE(FoundClassDeclX);
 }
 
@@ -131,8 +125,8 @@ TEST(newFrontendActionFactory, CreatesFrontendActionFactoryFromType) {
 }
 
 struct IndependentFrontendActionCreator {
-  std::unique_ptr<ASTConsumer> newASTConsumer() {
-    return llvm::make_unique<FindTopLevelDeclConsumer>(nullptr);
+  ASTConsumer *newASTConsumer() {
+    return new FindTopLevelDeclConsumer(nullptr);
   }
 };
 
@@ -191,8 +185,8 @@ struct VerifyEndCallback : public SourceFileCallbacks {
   virtual void handleEndSource() {
     ++EndCalled;
   }
-  std::unique_ptr<ASTConsumer> newASTConsumer() {
-    return llvm::make_unique<FindTopLevelDeclConsumer>(&Matched);
+  ASTConsumer *newASTConsumer() {
+    return new FindTopLevelDeclConsumer(&Matched);
   }
   unsigned BeginCalled;
   unsigned EndCalled;
@@ -231,10 +225,10 @@ struct SkipBodyConsumer : public clang::ASTConsumer {
 };
 
 struct SkipBodyAction : public clang::ASTFrontendAction {
-  virtual std::unique_ptr<ASTConsumer>
-  CreateASTConsumer(CompilerInstance &Compiler, StringRef) {
+  virtual ASTConsumer *CreateASTConsumer(CompilerInstance &Compiler,
+                                         StringRef) {
     Compiler.getFrontendOpts().SkipFunctionBodies = true;
-    return llvm::make_unique<SkipBodyConsumer>();
+    return new SkipBodyConsumer;
   }
 };