[clang-tools-extra] r326203 - Revert "[Tooling] [1/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>"

Roman Lebedev via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 27 07:54:41 PST 2018


Author: lebedevri
Date: Tue Feb 27 07:54:41 2018
New Revision: 326203

URL: http://llvm.org/viewvc/llvm-project?rev=326203&view=rev
Log:
Revert "[Tooling] [1/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>"

This reverts commit rL326202

This broke gcc4.8 builds, compiler just segfaults:
http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/14909
http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/22673

Modified:
    clang-tools-extra/trunk/clang-move/ClangMove.h
    clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
    clang-tools-extra/trunk/clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp
    clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbolsAction.h
    clang-tools-extra/trunk/modularize/CoverageChecker.cpp
    clang-tools-extra/trunk/modularize/Modularize.cpp
    clang-tools-extra/trunk/pp-trace/PPTrace.cpp
    clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h
    clang-tools-extra/trunk/unittests/clangd/SymbolCollectorTests.cpp

Modified: clang-tools-extra/trunk/clang-move/ClangMove.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.h?rev=326203&r1=326202&r2=326203&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-move/ClangMove.h (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.h Tue Feb 27 07:54:41 2018
@@ -217,8 +217,8 @@ public:
                          DeclarationReporter *const Reporter = nullptr)
       : Context(Context), Reporter(Reporter) {}
 
-  std::unique_ptr<clang::FrontendAction> create() override {
-    return llvm::make_unique<ClangMoveAction>(Context, Reporter);
+  clang::FrontendAction *create() override {
+    return new ClangMoveAction(Context, Reporter);
   }
 
 private:

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=326203&r1=326202&r2=326203&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Tue Feb 27 07:54:41 2018
@@ -527,9 +527,7 @@ void runClangTidy(clang::tidy::ClangTidy
   class ActionFactory : public FrontendActionFactory {
   public:
     ActionFactory(ClangTidyContext &Context) : ConsumerFactory(Context) {}
-    std::unique_ptr<clang::FrontendAction> create() override {
-      return llvm::make_unique<Action>(&ConsumerFactory);
-    }
+    FrontendAction *create() override { return new Action(&ConsumerFactory); }
 
   private:
     class Action : public ASTFrontendAction {

Modified: clang-tools-extra/trunk/clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp?rev=326203&r1=326202&r2=326203&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp (original)
+++ clang-tools-extra/trunk/clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp Tue Feb 27 07:54:41 2018
@@ -53,7 +53,7 @@ class SymbolIndexActionFactory : public
 public:
   SymbolIndexActionFactory(tooling::ExecutionContext *Ctx) : Ctx(Ctx) {}
 
-  std::unique_ptr<clang::FrontendAction> create() override {
+  clang::FrontendAction *create() override {
     // Wraps the index action and reports collected symbols to the execution
     // context at the end of each translation unit.
     class WrappedIndexAction : public WrapperFrontendAction {
@@ -102,8 +102,7 @@ public:
     auto Includes = llvm::make_unique<CanonicalIncludes>();
     addSystemHeadersMapping(Includes.get());
     CollectorOpts.Includes = Includes.get();
-
-    return llvm::make_unique<WrappedIndexAction>(
+    return new WrappedIndexAction(
         std::make_shared<SymbolCollector>(std::move(CollectorOpts)),
         std::move(Includes), IndexOpts, Ctx);
   }

Modified: clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbolsAction.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbolsAction.h?rev=326203&r1=326202&r2=326203&view=diff
==============================================================================
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbolsAction.h (original)
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbolsAction.h Tue Feb 27 07:54:41 2018
@@ -48,8 +48,8 @@ public:
       const HeaderMapCollector::RegexHeaderMap *RegexHeaderMap = nullptr)
       : Reporter(Reporter), RegexHeaderMap(RegexHeaderMap) {}
 
-  std::unique_ptr<clang::FrontendAction> create() override {
-    return llvm::make_unique<FindAllSymbolsAction>(Reporter, RegexHeaderMap);
+  clang::FrontendAction *create() override {
+    return new FindAllSymbolsAction(Reporter, RegexHeaderMap);
   }
 
 private:

Modified: clang-tools-extra/trunk/modularize/CoverageChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/CoverageChecker.cpp?rev=326203&r1=326202&r2=326203&view=diff
==============================================================================
--- clang-tools-extra/trunk/modularize/CoverageChecker.cpp (original)
+++ clang-tools-extra/trunk/modularize/CoverageChecker.cpp Tue Feb 27 07:54:41 2018
@@ -129,8 +129,8 @@ public:
   CoverageCheckerFrontendActionFactory(CoverageChecker &Checker)
     : Checker(Checker) {}
 
-  std::unique_ptr<clang::FrontendAction> create() override {
-    return llvm::make_unique<CoverageCheckerAction>(Checker);
+  CoverageCheckerAction *create() override {
+    return new CoverageCheckerAction(Checker);
   }
 
 private:

Modified: clang-tools-extra/trunk/modularize/Modularize.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/Modularize.cpp?rev=326203&r1=326202&r2=326203&view=diff
==============================================================================
--- clang-tools-extra/trunk/modularize/Modularize.cpp (original)
+++ clang-tools-extra/trunk/modularize/Modularize.cpp Tue Feb 27 07:54:41 2018
@@ -722,9 +722,8 @@ public:
       : Entities(Entities), PPTracker(preprocessorTracker),
         HadErrors(HadErrors) {}
 
-  std::unique_ptr<clang::FrontendAction> create() override {
-    return llvm::make_unique<CollectEntitiesAction>(Entities, PPTracker,
-                                                    HadErrors);
+  CollectEntitiesAction *create() override {
+    return new CollectEntitiesAction(Entities, PPTracker, HadErrors);
   }
 
 private:
@@ -803,8 +802,8 @@ class CompileCheckFrontendActionFactory
 public:
   CompileCheckFrontendActionFactory() {}
 
-  std::unique_ptr<clang::FrontendAction> create() override {
-    return llvm::make_unique<CompileCheckAction>();
+  CompileCheckAction *create() override {
+    return new CompileCheckAction();
   }
 };
 

Modified: clang-tools-extra/trunk/pp-trace/PPTrace.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/pp-trace/PPTrace.cpp?rev=326203&r1=326202&r2=326203&view=diff
==============================================================================
--- clang-tools-extra/trunk/pp-trace/PPTrace.cpp (original)
+++ clang-tools-extra/trunk/pp-trace/PPTrace.cpp Tue Feb 27 07:54:41 2018
@@ -139,8 +139,8 @@ public:
                                std::vector<CallbackCall> &CallbackCalls)
       : Ignore(Ignore), CallbackCalls(CallbackCalls) {}
 
-  std::unique_ptr<clang::FrontendAction> create() override {
-    return llvm::make_unique<PPTraceAction>(Ignore, CallbackCalls);
+  PPTraceAction *create() override {
+    return new PPTraceAction(Ignore, CallbackCalls);
   }
 
 private:

Modified: clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h?rev=326203&r1=326202&r2=326203&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h (original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h Tue Feb 27 07:54:41 2018
@@ -107,8 +107,7 @@ runCheckOnCode(StringRef Code, std::vect
   SmallVector<std::unique_ptr<ClangTidyCheck>, 1> Checks;
   CheckFactory<CheckList...>::createChecks(&Context, Checks);
   tooling::ToolInvocation Invocation(
-      Args, llvm::make_unique<TestClangTidyAction>(Checks, Finder, Context),
-      Files.get());
+      Args, new TestClangTidyAction(Checks, Finder, Context), Files.get());
   InMemoryFileSystem->addFile(Filename, 0,
                               llvm::MemoryBuffer::getMemBuffer(Code));
   for (const auto &FileContent : PathsToContent) {

Modified: clang-tools-extra/trunk/unittests/clangd/SymbolCollectorTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/SymbolCollectorTests.cpp?rev=326203&r1=326202&r2=326203&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/SymbolCollectorTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/SymbolCollectorTests.cpp Tue Feb 27 07:54:41 2018
@@ -69,7 +69,7 @@ public:
                            CommentHandler *PragmaHandler)
       : COpts(std::move(COpts)), PragmaHandler(PragmaHandler) {}
 
-  std::unique_ptr<clang::FrontendAction> create() override {
+  clang::FrontendAction *create() override {
     class WrappedIndexAction : public WrapperFrontendAction {
     public:
       WrappedIndexAction(std::shared_ptr<SymbolCollector> C,
@@ -95,9 +95,8 @@ public:
         index::IndexingOptions::SystemSymbolFilterKind::All;
     IndexOpts.IndexFunctionLocals = false;
     Collector = std::make_shared<SymbolCollector>(COpts);
-
-    return llvm::make_unique<WrappedIndexAction>(
-        Collector, std::move(IndexOpts), PragmaHandler);
+    return new WrappedIndexAction(Collector, std::move(IndexOpts),
+                                  PragmaHandler);
   }
 
   std::shared_ptr<SymbolCollector> Collector;




More information about the cfe-commits mailing list