[clang-tools-extra] r213324 - Revert "unique_ptr-ify ownership of ASTConsumers"
David Blaikie
dblaikie at gmail.com
Thu Jul 17 15:33:56 PDT 2014
Author: dblaikie
Date: Thu Jul 17 17:33:56 2014
New Revision: 213324
URL: http://llvm.org/viewvc/llvm-project?rev=213324&view=rev
Log:
Revert "unique_ptr-ify ownership of ASTConsumers"
This reverts commit r213308.
Reverting to have some on-list discussion/confirmation about the ongoing
direction of smart pointer usage in the LLVM project.
Modified:
clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp
clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
clang-tools-extra/trunk/clang-tidy/ClangTidy.h
clang-tools-extra/trunk/modularize/Modularize.cpp
clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp
clang-tools-extra/trunk/pp-trace/PPTrace.cpp
clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp
Modified: clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp?rev=213324&r1=213323&r2=213324&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp (original)
+++ clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp Thu Jul 17 17:33:56 2014
@@ -49,8 +49,7 @@ private:
FactoryAdaptor(MatchFinder &Finder, Transform &Owner)
: Finder(Finder), Owner(Owner) {}
- std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &,
- StringRef) {
+ ASTConsumer *CreateASTConsumer(CompilerInstance &, StringRef) {
return Finder.newASTConsumer();
}
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=213324&r1=213323&r2=213324&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Thu Jul 17 17:33:56 2014
@@ -179,10 +179,10 @@ private:
class ClangTidyASTConsumer : public MultiplexConsumer {
public:
- ClangTidyASTConsumer(std::vector<std::unique_ptr<ASTConsumer>> Consumers,
+ ClangTidyASTConsumer(const SmallVectorImpl<ASTConsumer *> &Consumers,
std::unique_ptr<ast_matchers::MatchFinder> Finder,
std::vector<std::unique_ptr<ClangTidyCheck>> Checks)
- : MultiplexConsumer(std::move(Consumers)), Finder(std::move(Finder)),
+ : MultiplexConsumer(Consumers), Finder(std::move(Finder)),
Checks(std::move(Checks)) {}
private:
@@ -203,8 +203,8 @@ ClangTidyASTConsumerFactory::ClangTidyAS
}
}
-std::unique_ptr<clang::ASTConsumer>
-ClangTidyASTConsumerFactory::CreateASTConsumer(
+
+clang::ASTConsumer *ClangTidyASTConsumerFactory::CreateASTConsumer(
clang::CompilerInstance &Compiler, StringRef File) {
// FIXME: Move this to a separate method, so that CreateASTConsumer doesn't
// modify Compiler.
@@ -224,7 +224,7 @@ ClangTidyASTConsumerFactory::CreateASTCo
Check->registerPPCallbacks(Compiler);
}
- std::vector<std::unique_ptr<ASTConsumer>> Consumers;
+ SmallVector<ASTConsumer *, 2> Consumers;
if (!Checks.empty())
Consumers.push_back(Finder->newASTConsumer());
@@ -240,16 +240,15 @@ ClangTidyASTConsumerFactory::CreateASTCo
AnalyzerOptions->AnalysisDiagOpt = PD_NONE;
AnalyzerOptions->AnalyzeNestedBlocks = true;
AnalyzerOptions->eagerlyAssumeBinOpBifurcation = true;
- std::unique_ptr<ento::AnalysisASTConsumer> AnalysisConsumer =
- ento::CreateAnalysisConsumer(
- Compiler.getPreprocessor(), Compiler.getFrontendOpts().OutputFile,
- AnalyzerOptions, Compiler.getFrontendOpts().Plugins);
+ ento::AnalysisASTConsumer *AnalysisConsumer = ento::CreateAnalysisConsumer(
+ Compiler.getPreprocessor(), Compiler.getFrontendOpts().OutputFile,
+ AnalyzerOptions, Compiler.getFrontendOpts().Plugins);
AnalysisConsumer->AddDiagnosticConsumer(
new AnalyzerDiagnosticConsumer(Context));
- Consumers.push_back(std::move(AnalysisConsumer));
+ Consumers.push_back(AnalysisConsumer);
}
- return llvm::make_unique<ClangTidyASTConsumer>(
- std::move(Consumers), std::move(Finder), std::move(Checks));
+ return new ClangTidyASTConsumer(Consumers, std::move(Finder),
+ std::move(Checks));
}
std::vector<std::string>
@@ -340,8 +339,8 @@ ClangTidyStats runClangTidy(ClangTidyOpt
class Action : public ASTFrontendAction {
public:
Action(ClangTidyASTConsumerFactory *Factory) : Factory(Factory) {}
- std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &Compiler,
- StringRef File) override {
+ ASTConsumer *CreateASTConsumer(CompilerInstance &Compiler,
+ StringRef File) override {
return Factory->CreateASTConsumer(Compiler, File);
}
Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.h?rev=213324&r1=213323&r2=213324&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.h Thu Jul 17 17:33:56 2014
@@ -99,8 +99,8 @@ public:
ClangTidyASTConsumerFactory(ClangTidyContext &Context);
/// \brief Returns an ASTConsumer that runs the specified clang-tidy checks.
- std::unique_ptr<clang::ASTConsumer>
- CreateASTConsumer(clang::CompilerInstance &Compiler, StringRef File);
+ clang::ASTConsumer *CreateASTConsumer(clang::CompilerInstance &Compiler,
+ StringRef File);
/// \brief Get the list of enabled checks.
std::vector<std::string> getCheckNames(ChecksFilter &Filter);
Modified: clang-tools-extra/trunk/modularize/Modularize.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/Modularize.cpp?rev=213324&r1=213323&r2=213324&view=diff
==============================================================================
--- clang-tools-extra/trunk/modularize/Modularize.cpp (original)
+++ clang-tools-extra/trunk/modularize/Modularize.cpp Thu Jul 17 17:33:56 2014
@@ -652,10 +652,10 @@ public:
HadErrors(HadErrors) {}
protected:
- std::unique_ptr<clang::ASTConsumer>
- CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override {
- return llvm::make_unique<CollectEntitiesConsumer>(
- Entities, PPTracker, CI.getPreprocessor(), InFile, HadErrors);
+ virtual clang::ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+ StringRef InFile) {
+ return new CollectEntitiesConsumer(Entities, PPTracker,
+ CI.getPreprocessor(), InFile, HadErrors);
}
private:
Modified: clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp?rev=213324&r1=213323&r2=213324&view=diff
==============================================================================
--- clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp (original)
+++ clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp Thu Jul 17 17:33:56 2014
@@ -178,10 +178,9 @@ public:
ModuleMapCheckerAction(ModuleMapChecker &Checker) : Checker(Checker) {}
protected:
- std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
- StringRef InFile) override {
- return llvm::make_unique<ModuleMapCheckerConsumer>(Checker,
- CI.getPreprocessor());
+ virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+ StringRef InFile) {
+ return new ModuleMapCheckerConsumer(Checker, CI.getPreprocessor());
}
private:
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=213324&r1=213323&r2=213324&view=diff
==============================================================================
--- clang-tools-extra/trunk/pp-trace/PPTrace.cpp (original)
+++ clang-tools-extra/trunk/pp-trace/PPTrace.cpp Thu Jul 17 17:33:56 2014
@@ -120,10 +120,9 @@ public:
: Ignore(Ignore), CallbackCalls(CallbackCalls) {}
protected:
- std::unique_ptr<clang::ASTConsumer>
- CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override {
- return llvm::make_unique<PPTraceConsumer>(Ignore, CallbackCalls,
- CI.getPreprocessor());
+ virtual clang::ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+ StringRef InFile) {
+ return new PPTraceConsumer(Ignore, CallbackCalls, CI.getPreprocessor());
}
private:
Modified: clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp?rev=213324&r1=213323&r2=213324&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp Thu Jul 17 17:33:56 2014
@@ -93,8 +93,8 @@ public:
};
struct ConsumerFactory {
- std::unique_ptr<ASTConsumer> newASTConsumer() {
- return llvm::make_unique<TimePassingASTConsumer>(&Called);
+ ASTConsumer *newASTConsumer() {
+ return new TimePassingASTConsumer(&Called);
}
bool Called;
};
More information about the cfe-commits
mailing list