Revert "[Tooling] [0/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>"
This reverts commit rL326201
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¬
llvm-svn: 326204
diff --git a/clang/lib/Tooling/Tooling.cpp b/clang/lib/Tooling/Tooling.cpp
index 82abede..7ae2950 100644
--- a/clang/lib/Tooling/Tooling.cpp
+++ b/clang/lib/Tooling/Tooling.cpp
@@ -104,12 +104,12 @@
return Invocation;
}
-bool runToolOnCode(std::unique_ptr<FrontendAction> ToolAction,
- const Twine &Code, const Twine &FileName,
+bool runToolOnCode(clang::FrontendAction *ToolAction, const Twine &Code,
+ const Twine &FileName,
std::shared_ptr<PCHContainerOperations> PCHContainerOps) {
- return runToolOnCodeWithArgs(std::move(ToolAction), Code,
- std::vector<std::string>(), FileName,
- "clang-tool", std::move(PCHContainerOps));
+ return runToolOnCodeWithArgs(ToolAction, Code, std::vector<std::string>(),
+ FileName, "clang-tool",
+ std::move(PCHContainerOps));
}
static std::vector<std::string>
@@ -125,7 +125,7 @@
}
bool runToolOnCodeWithArgs(
- std::unique_ptr<FrontendAction> ToolAction, const Twine &Code,
+ clang::FrontendAction *ToolAction, const Twine &Code,
const std::vector<std::string> &Args, const Twine &FileName,
const Twine &ToolName,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
@@ -143,7 +143,8 @@
ArgumentsAdjuster Adjuster = getClangStripDependencyFileAdjuster();
ToolInvocation Invocation(
getSyntaxOnlyToolArgs(ToolName, Adjuster(Args, FileNameRef), FileNameRef),
- std::move(ToolAction), Files.get(), std::move(PCHContainerOps));
+ ToolAction, Files.get(),
+ std::move(PCHContainerOps));
SmallString<1024> CodeStorage;
InMemoryFileSystem->addFile(FileNameRef, 0,
@@ -203,18 +204,15 @@
namespace {
class SingleFrontendActionFactory : public FrontendActionFactory {
- std::unique_ptr<clang::FrontendAction> Action;
+ FrontendAction *Action;
public:
- SingleFrontendActionFactory(std::unique_ptr<clang::FrontendAction> Action)
- : Action(std::move(Action)) {}
+ SingleFrontendActionFactory(FrontendAction *Action) : Action(Action) {}
- std::unique_ptr<clang::FrontendAction> create() override {
- return std::move(Action);
- }
+ FrontendAction *create() override { return Action; }
};
-} // namespace
+}
ToolInvocation::ToolInvocation(
std::vector<std::string> CommandLine, ToolAction *Action,
@@ -224,13 +222,12 @@
DiagConsumer(nullptr) {}
ToolInvocation::ToolInvocation(
- std::vector<std::string> CommandLine,
- std::unique_ptr<FrontendAction> FAction, FileManager *Files,
- std::shared_ptr<PCHContainerOperations> PCHContainerOps)
+ std::vector<std::string> CommandLine, FrontendAction *FAction,
+ FileManager *Files, std::shared_ptr<PCHContainerOperations> PCHContainerOps)
: CommandLine(std::move(CommandLine)),
- Action(new SingleFrontendActionFactory(std::move(FAction))),
- OwnsAction(true), Files(Files),
- PCHContainerOps(std::move(PCHContainerOps)), DiagConsumer(nullptr) {}
+ Action(new SingleFrontendActionFactory(FAction)), OwnsAction(true),
+ Files(Files), PCHContainerOps(std::move(PCHContainerOps)),
+ DiagConsumer(nullptr) {}
ToolInvocation::~ToolInvocation() {
if (OwnsAction)