public:
ErrorReporter(ClangTidyContext &Context, bool ApplyFixes,
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS)
- : Files(FileSystemOptions(), BaseFS), DiagOpts(new DiagnosticOptions()),
+ : Files(FileSystemOptions(), std::move(BaseFS)),
+ DiagOpts(new DiagnosticOptions()),
DiagPrinter(new TextDiagnosticPrinter(llvm::outs(), &*DiagOpts)),
Diags(IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs), &*DiagOpts,
DiagPrinter),
ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory(
ClangTidyContext &Context,
IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFS)
- : Context(Context), OverlayFS(OverlayFS),
+ : Context(Context), OverlayFS(std::move(OverlayFS)),
CheckFactories(new ClangTidyCheckFactories) {
for (ClangTidyModuleRegistry::entry E : ClangTidyModuleRegistry::entries()) {
std::unique_ptr<ClangTidyModule> Module = E.instantiate();
}
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER
-static void setStaticAnalyzerCheckerOpts(const ClangTidyOptions &Opts,
- AnalyzerOptionsRef AnalyzerOptions) {
+static void
+setStaticAnalyzerCheckerOpts(const ClangTidyOptions &Opts,
+ clang::AnalyzerOptions &AnalyzerOptions) {
StringRef AnalyzerPrefix(AnalyzerCheckNamePrefix);
for (const auto &Opt : Opts.CheckOptions) {
StringRef OptName(Opt.getKey());
if (!OptName.consume_front(AnalyzerPrefix))
continue;
// Analyzer options are always local options so we can ignore priority.
- AnalyzerOptions->Config[OptName] = Opt.getValue().Value;
+ AnalyzerOptions.Config[OptName] = Opt.getValue().Value;
}
}
AnalyzerOptions->CheckersAndPackages = getAnalyzerCheckersAndPackages(
Context, Context.canEnableAnalyzerAlphaCheckers());
if (!AnalyzerOptions->CheckersAndPackages.empty()) {
- setStaticAnalyzerCheckerOpts(Context.getOptions(), AnalyzerOptions);
+ setStaticAnalyzerCheckerOpts(Context.getOptions(), *AnalyzerOptions);
AnalyzerOptions->AnalysisStoreOpt = RegionStoreModel;
AnalyzerOptions->AnalysisDiagOpt = PD_NONE;
AnalyzerOptions->AnalyzeNestedBlocks = true;
public:
ActionFactory(ClangTidyContext &Context,
IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> BaseFS)
- : ConsumerFactory(Context, BaseFS) {}
+ : ConsumerFactory(Context, std::move(BaseFS)) {}
std::unique_ptr<FrontendAction> create() override {
return std::make_unique<Action>(&ConsumerFactory);
}
ClangTidyASTConsumerFactory ConsumerFactory;
};
- ActionFactory Factory(Context, BaseFS);
+ ActionFactory Factory(Context, std::move(BaseFS));
Tool.run(&Factory);
return DiagConsumer.take();
}
ClangTidyContext &Context, bool Fix,
unsigned &WarningsAsErrorsCount,
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS) {
- ErrorReporter Reporter(Context, Fix, BaseFS);
+ ErrorReporter Reporter(Context, Fix, std::move(BaseFS));
llvm::vfs::FileSystem &FileSystem =
Reporter.getSourceManager().getFileManager().getVirtualFileSystem();
auto InitialWorkingDir = FileSystem.getCurrentWorkingDirectory();