summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/ClangTidy.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-07-17 22:33:56 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-07-17 22:33:56 +0000
commit5bae2c87d5946ee72ad31d88033ed5ecbd01ada2 (patch)
treee7876c555e6c3bfe26bbc36aaea347370ac63311 /clang-tools-extra/clang-tidy/ClangTidy.cpp
parentbbe75b99f0b7fbcff52b6fcc126884c16b84797f (diff)
downloadbcm5719-llvm-5bae2c87d5946ee72ad31d88033ed5ecbd01ada2.tar.gz
bcm5719-llvm-5bae2c87d5946ee72ad31d88033ed5ecbd01ada2.zip
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. llvm-svn: 213324
Diffstat (limited to 'clang-tools-extra/clang-tidy/ClangTidy.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/ClangTidy.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp
index 3445fb5d622..98a5c6183fc 100644
--- a/clang-tools-extra/clang-tidy/ClangTidy.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp
@@ -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::ClangTidyASTConsumerFactory(
}
}
-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::CreateASTConsumer(
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::CreateASTConsumer(
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(ClangTidyOptionsProvider *OptionsProvider,
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);
}
OpenPOWER on IntegriCloud