DeclarationReporter *const Reporter = nullptr)
: Context(Context), Reporter(Reporter) {}
- clang::FrontendAction *create() override {
- return new ClangMoveAction(Context, Reporter);
+ std::unique_ptr<clang::FrontendAction> create() override {
+ return llvm::make_unique<ClangMoveAction>(Context, Reporter);
}
private:
class ActionFactory : public FrontendActionFactory {
public:
ActionFactory(ClangTidyContext &Context) : ConsumerFactory(Context) {}
- FrontendAction *create() override { return new Action(&ConsumerFactory); }
+ std::unique_ptr<clang::FrontendAction> create() override {
+ return llvm::make_unique<Action>(&ConsumerFactory);
+ }
private:
class Action : public ASTFrontendAction {
public:
SymbolIndexActionFactory(tooling::ExecutionContext *Ctx) : Ctx(Ctx) {}
- clang::FrontendAction *create() override {
+ std::unique_ptr<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 {
auto Includes = llvm::make_unique<CanonicalIncludes>();
addSystemHeadersMapping(Includes.get());
CollectorOpts.Includes = Includes.get();
- return new WrappedIndexAction(
+
+ return llvm::make_unique<WrappedIndexAction>(
std::make_shared<SymbolCollector>(std::move(CollectorOpts)),
std::move(Includes), IndexOpts, Ctx);
}
const HeaderMapCollector::RegexHeaderMap *RegexHeaderMap = nullptr)
: Reporter(Reporter), RegexHeaderMap(RegexHeaderMap) {}
- clang::FrontendAction *create() override {
- return new FindAllSymbolsAction(Reporter, RegexHeaderMap);
+ std::unique_ptr<clang::FrontendAction> create() override {
+ return llvm::make_unique<FindAllSymbolsAction>(Reporter, RegexHeaderMap);
}
private:
CoverageCheckerFrontendActionFactory(CoverageChecker &Checker)
: Checker(Checker) {}
- CoverageCheckerAction *create() override {
- return new CoverageCheckerAction(Checker);
+ std::unique_ptr<clang::FrontendAction> create() override {
+ return llvm::make_unique<CoverageCheckerAction>(Checker);
}
private:
: Entities(Entities), PPTracker(preprocessorTracker),
HadErrors(HadErrors) {}
- CollectEntitiesAction *create() override {
- return new CollectEntitiesAction(Entities, PPTracker, HadErrors);
+ std::unique_ptr<clang::FrontendAction> create() override {
+ return llvm::make_unique<CollectEntitiesAction>(Entities, PPTracker,
+ HadErrors);
}
private:
public:
CompileCheckFrontendActionFactory() {}
- CompileCheckAction *create() override {
- return new CompileCheckAction();
+ std::unique_ptr<clang::FrontendAction> create() override {
+ return llvm::make_unique<CompileCheckAction>();
}
};
std::vector<CallbackCall> &CallbackCalls)
: Ignore(Ignore), CallbackCalls(CallbackCalls) {}
- PPTraceAction *create() override {
- return new PPTraceAction(Ignore, CallbackCalls);
+ std::unique_ptr<clang::FrontendAction> create() override {
+ return llvm::make_unique<PPTraceAction>(Ignore, CallbackCalls);
}
private:
SmallVector<std::unique_ptr<ClangTidyCheck>, 1> Checks;
CheckFactory<CheckList...>::createChecks(&Context, Checks);
tooling::ToolInvocation Invocation(
- Args, new TestClangTidyAction(Checks, Finder, Context), Files.get());
+ Args, llvm::make_unique<TestClangTidyAction>(Checks, Finder, Context),
+ Files.get());
InMemoryFileSystem->addFile(Filename, 0,
llvm::MemoryBuffer::getMemBuffer(Code));
for (const auto &FileContent : PathsToContent) {
CommentHandler *PragmaHandler)
: COpts(std::move(COpts)), PragmaHandler(PragmaHandler) {}
- clang::FrontendAction *create() override {
+ std::unique_ptr<clang::FrontendAction> create() override {
class WrappedIndexAction : public WrapperFrontendAction {
public:
WrappedIndexAction(std::shared_ptr<SymbolCollector> C,
index::IndexingOptions::SystemSymbolFilterKind::All;
IndexOpts.IndexFunctionLocals = false;
Collector = std::make_shared<SymbolCollector>(COpts);
- return new WrappedIndexAction(Collector, std::move(IndexOpts),
- PragmaHandler);
+
+ return llvm::make_unique<WrappedIndexAction>(
+ Collector, std::move(IndexOpts), PragmaHandler);
}
std::shared_ptr<SymbolCollector> Collector;