22 #include "clang/AST/ASTConsumer.h" 23 #include "clang/AST/ASTContext.h" 24 #include "clang/AST/Decl.h" 25 #include "clang/ASTMatchers/ASTMatchFinder.h" 26 #include "clang/Config/config.h" 27 #include "clang/Format/Format.h" 28 #include "clang/Frontend/ASTConsumers.h" 29 #include "clang/Frontend/CompilerInstance.h" 30 #include "clang/Frontend/FrontendActions.h" 31 #include "clang/Frontend/FrontendDiagnostic.h" 32 #include "clang/Frontend/MultiplexConsumer.h" 33 #include "clang/Frontend/TextDiagnosticPrinter.h" 34 #include "clang/Lex/PPCallbacks.h" 35 #include "clang/Lex/Preprocessor.h" 36 #include "clang/Lex/PreprocessorOptions.h" 37 #include "clang/Rewrite/Frontend/FixItRewriter.h" 38 #include "clang/Rewrite/Frontend/FrontendActions.h" 39 #include "clang/Tooling/Core/Diagnostic.h" 40 #include "clang/Tooling/DiagnosticsYaml.h" 41 #include "clang/Tooling/Refactoring.h" 42 #include "clang/Tooling/ReplacementsYaml.h" 43 #include "clang/Tooling/Tooling.h" 44 #include "llvm/Support/Process.h" 45 #include "llvm/Support/Signals.h" 49 #if CLANG_ENABLE_STATIC_ANALYZER 50 #include "clang/Analysis/PathDiagnostic.h" 51 #include "clang/StaticAnalyzer/Frontend/AnalysisConsumer.h" 52 #endif // CLANG_ENABLE_STATIC_ANALYZER 65 #if CLANG_ENABLE_STATIC_ANALYZER 66 static const char *AnalyzerCheckNamePrefix =
"clang-analyzer-";
68 class AnalyzerDiagnosticConsumer :
public ento::PathDiagnosticConsumer {
70 AnalyzerDiagnosticConsumer(ClangTidyContext &Context) : Context(Context) {}
72 void FlushDiagnosticsImpl(std::vector<const ento::PathDiagnostic *> &Diags,
73 FilesMade *filesMade)
override {
74 for (
const ento::PathDiagnostic *PD : Diags) {
75 SmallString<64> CheckName(AnalyzerCheckNamePrefix);
76 CheckName += PD->getCheckerName();
77 Context.diag(CheckName, PD->getLocation().asLocation(),
78 PD->getShortDescription())
79 << PD->path.back()->getRanges();
81 for (
const auto &DiagPiece :
82 PD->path.flatten(
true)) {
83 Context.diag(CheckName, DiagPiece->getLocation().asLocation(),
84 DiagPiece->getString(), DiagnosticIDs::Note)
85 << DiagPiece->getRanges();
90 StringRef getName()
const override {
return "ClangTidyDiags"; }
91 bool supportsLogicalOpControlFlow()
const override {
return true; }
92 bool supportsCrossFileDiagnostics()
const override {
return true; }
95 ClangTidyContext &Context;
97 #endif // CLANG_ENABLE_STATIC_ANALYZER 101 ErrorReporter(ClangTidyContext &Context,
bool ApplyFixes,
102 llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS)
103 :
Files(FileSystemOptions(), BaseFS), DiagOpts(new DiagnosticOptions()),
104 DiagPrinter(new TextDiagnosticPrinter(
llvm::outs(), &*DiagOpts)),
105 Diags(IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs), &*DiagOpts,
107 SourceMgr(Diags,
Files), Context(Context), ApplyFixes(ApplyFixes),
109 DiagOpts->ShowColors = llvm::sys::Process::StandardOutHasColors();
110 DiagPrinter->BeginSourceFile(LangOpts);
113 SourceManager &getSourceManager() {
return SourceMgr; }
115 void reportDiagnostic(
const ClangTidyError &Error) {
116 const tooling::DiagnosticMessage &
Message = Error.Message;
117 SourceLocation
Loc = getLocation(Message.FilePath, Message.FileOffset);
120 SmallVector<std::pair<SourceLocation, bool>, 4> FixLocations;
122 auto Level =
static_cast<DiagnosticsEngine::Level
>(Error.DiagLevel);
123 std::string
Name = Error.DiagnosticName;
124 if (Error.IsWarningAsError) {
125 Name +=
",-warnings-as-errors";
126 Level = DiagnosticsEngine::Error;
129 auto Diag = Diags.Report(Loc, Diags.getCustomDiagID(Level,
"%0 [%1]"))
130 << Message.Message << Name;
132 const llvm::StringMap<Replacements> *ChosenFix = selectFirstFix(Error);
133 if (ApplyFixes && ChosenFix) {
134 for (
const auto &FileAndReplacements : *ChosenFix) {
135 for (
const auto &Repl : FileAndReplacements.second) {
137 bool CanBeApplied =
false;
138 if (!Repl.isApplicable())
140 SourceLocation FixLoc;
141 SmallString<128> FixAbsoluteFilePath = Repl.getFilePath();
142 Files.makeAbsolutePath(FixAbsoluteFilePath);
143 tooling::Replacement R(FixAbsoluteFilePath, Repl.getOffset(),
144 Repl.getLength(), Repl.getReplacementText());
145 Replacements &Replacements = FileReplacements[R.getFilePath()];
146 llvm::Error Err = Replacements.add(R);
149 llvm::errs() <<
"Trying to resolve conflict: " 152 Replacements.getShiftedCodePosition(R.getOffset());
153 unsigned NewLength = Replacements.getShiftedCodePosition(
154 R.getOffset() + R.getLength()) -
156 if (NewLength == R.getLength()) {
157 R = Replacement(R.getFilePath(), NewOffset, NewLength,
158 R.getReplacementText());
159 Replacements = Replacements.merge(tooling::Replacements(R));
164 <<
"Can't resolve conflict, skipping the replacement.\n";
170 FixLoc = getLocation(FixAbsoluteFilePath, Repl.getOffset());
171 FixLocations.push_back(std::make_pair(FixLoc, CanBeApplied));
175 reportFix(Diag, Error.Message.Fix);
177 for (
auto Fix : FixLocations) {
178 Diags.Report(
Fix.first,
Fix.second ? diag::note_fixit_applied
179 : diag::note_fixit_failed);
181 for (
const auto &Note : Error.Notes)
186 if (ApplyFixes && TotalFixes > 0) {
187 Rewriter Rewrite(SourceMgr, LangOpts);
188 for (
const auto &FileAndReplacements : FileReplacements) {
189 StringRef File = FileAndReplacements.first();
190 llvm::ErrorOr<std::unique_ptr<MemoryBuffer>> Buffer =
191 SourceMgr.getFileManager().getBufferForFile(File);
193 llvm::errs() <<
"Can't get buffer for file " << File <<
": " 194 << Buffer.getError().message() <<
"\n";
198 StringRef
Code = Buffer.get()->getBuffer();
199 auto Style = format::getStyle(
200 *Context.getOptionsForFile(File).FormatStyle, File,
"none");
205 llvm::Expected<tooling::Replacements> Replacements =
206 format::cleanupAroundReplacements(Code, FileAndReplacements.second,
212 if (llvm::Expected<tooling::Replacements> FormattedReplacements =
213 format::formatReplacements(Code, *Replacements, *Style)) {
214 Replacements = std::move(FormattedReplacements);
216 llvm_unreachable(
"!Replacements");
219 <<
". Skipping formatting.\n";
221 if (!tooling::applyAllReplacements(Replacements.get(), Rewrite)) {
222 llvm::errs() <<
"Can't apply replacements for file " << File <<
"\n";
225 if (Rewrite.overwriteChangedFiles()) {
226 llvm::errs() <<
"clang-tidy failed to apply suggested fixes.\n";
228 llvm::errs() <<
"clang-tidy applied " << AppliedFixes <<
" of " 229 << TotalFixes <<
" suggested fixes.\n";
237 SourceLocation getLocation(StringRef FilePath,
unsigned Offset) {
238 if (FilePath.empty())
239 return SourceLocation();
241 auto File = SourceMgr.getFileManager().getFile(FilePath);
243 return SourceLocation();
245 FileID ID = SourceMgr.getOrCreateFileID(*File, SrcMgr::C_User);
246 return SourceMgr.getLocForStartOfFile(ID).getLocWithOffset(Offset);
249 void reportFix(
const DiagnosticBuilder &Diag,
250 const llvm::StringMap<Replacements> &
Fix) {
251 for (
const auto &FileAndReplacements : Fix) {
252 for (
const auto &Repl : FileAndReplacements.second) {
253 if (!Repl.isApplicable())
255 SmallString<128> FixAbsoluteFilePath = Repl.getFilePath();
256 Files.makeAbsolutePath(FixAbsoluteFilePath);
257 SourceLocation FixLoc =
258 getLocation(FixAbsoluteFilePath, Repl.getOffset());
259 SourceLocation FixEndLoc = FixLoc.getLocWithOffset(Repl.getLength());
263 CharSourceRange
Range =
264 CharSourceRange::getCharRange(SourceRange(FixLoc, FixEndLoc));
265 Diag << FixItHint::CreateReplacement(Range, Repl.getReplacementText());
270 void reportNote(
const tooling::DiagnosticMessage &Message) {
271 SourceLocation Loc = getLocation(Message.FilePath, Message.FileOffset);
273 Diags.Report(Loc, Diags.getCustomDiagID(DiagnosticsEngine::Note,
"%0"))
275 reportFix(Diag, Message.Fix);
279 LangOptions LangOpts;
280 IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
282 DiagnosticsEngine Diags;
283 SourceManager SourceMgr;
284 llvm::StringMap<Replacements> FileReplacements;
285 ClangTidyContext &Context;
288 unsigned AppliedFixes;
294 ClangTidyASTConsumer(std::vector<std::unique_ptr<ASTConsumer>> Consumers,
295 std::unique_ptr<ClangTidyProfiling> Profiling,
296 std::unique_ptr<ast_matchers::MatchFinder> Finder,
297 std::vector<std::unique_ptr<ClangTidyCheck>>
Checks)
299 Profiling(std::move(Profiling)), Finder(std::move(Finder)),
305 std::unique_ptr<ClangTidyProfiling> Profiling;
306 std::unique_ptr<ast_matchers::MatchFinder> Finder;
307 std::vector<std::unique_ptr<ClangTidyCheck>>
Checks;
312 ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory(
314 IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFS)
315 : Context(Context), OverlayFS(OverlayFS),
317 for (ClangTidyModuleRegistry::entry
E : ClangTidyModuleRegistry::entries()) {
318 std::unique_ptr<ClangTidyModule> Module =
E.instantiate();
319 Module->addCheckFactories(*CheckFactories);
323 #if CLANG_ENABLE_STATIC_ANALYZER 325 AnalyzerOptionsRef AnalyzerOptions) {
326 StringRef AnalyzerPrefix(AnalyzerCheckNamePrefix);
328 StringRef OptName(Opt.first);
329 if (!OptName.startswith(AnalyzerPrefix))
331 AnalyzerOptions->Config[OptName.substr(AnalyzerPrefix.size())] = Opt.second;
335 typedef std::vector<std::pair<std::string, bool>> CheckersList;
337 static CheckersList getAnalyzerCheckersAndPackages(
ClangTidyContext &Context,
338 bool IncludeExperimental) {
341 const auto &RegisteredCheckers =
342 AnalyzerOptions::getRegisteredCheckers(IncludeExperimental);
343 bool AnalyzerChecksEnabled =
false;
344 for (StringRef CheckName : RegisteredCheckers) {
345 std::string ClangTidyCheckName((AnalyzerCheckNamePrefix + CheckName).str());
346 AnalyzerChecksEnabled |= Context.
isCheckEnabled(ClangTidyCheckName);
349 if (!AnalyzerChecksEnabled)
357 for (StringRef CheckName : RegisteredCheckers) {
358 std::string ClangTidyCheckName((AnalyzerCheckNamePrefix + CheckName).str());
360 if (CheckName.startswith(
"core") ||
362 List.emplace_back(CheckName,
true);
367 #endif // CLANG_ENABLE_STATIC_ANALYZER 369 std::unique_ptr<clang::ASTConsumer>
371 clang::CompilerInstance &Compiler, StringRef File) {
374 SourceManager *SM = &Compiler.getSourceManager();
379 auto WorkingDir = Compiler.getSourceManager()
381 .getVirtualFileSystem()
382 .getCurrentWorkingDirectory();
386 std::vector<std::unique_ptr<ClangTidyCheck>>
Checks =
387 CheckFactories->createChecks(&Context);
389 ast_matchers::MatchFinder::MatchFinderOptions FinderOptions;
391 std::unique_ptr<ClangTidyProfiling> Profiling;
393 Profiling = std::make_unique<ClangTidyProfiling>(
395 FinderOptions.CheckProfiling.emplace(Profiling->Records);
398 std::unique_ptr<ast_matchers::MatchFinder> Finder(
399 new ast_matchers::MatchFinder(std::move(FinderOptions)));
401 Preprocessor *
PP = &Compiler.getPreprocessor();
402 Preprocessor *ModuleExpanderPP =
PP;
404 if (Context.
getLangOpts().Modules && OverlayFS !=
nullptr) {
405 auto ModuleExpander = std::make_unique<ExpandModularHeadersPPCallbacks>(
406 &Compiler, OverlayFS);
407 ModuleExpanderPP = ModuleExpander->getPreprocessor();
408 PP->addPPCallbacks(std::move(ModuleExpander));
411 for (
auto &Check : Checks) {
412 Check->registerMatchers(&*Finder);
413 Check->registerPPCallbacks(*SM, PP, ModuleExpanderPP);
416 std::vector<std::unique_ptr<ASTConsumer>> Consumers;
418 Consumers.push_back(Finder->newASTConsumer());
420 #if CLANG_ENABLE_STATIC_ANALYZER 421 AnalyzerOptionsRef AnalyzerOptions = Compiler.getAnalyzerOpts();
422 AnalyzerOptions->CheckersAndPackages = getAnalyzerCheckersAndPackages(
424 if (!AnalyzerOptions->CheckersAndPackages.empty()) {
425 setStaticAnalyzerCheckerOpts(Context.
getOptions(), AnalyzerOptions);
426 AnalyzerOptions->AnalysisStoreOpt = RegionStoreModel;
427 AnalyzerOptions->AnalysisDiagOpt = PD_NONE;
428 AnalyzerOptions->AnalyzeNestedBlocks =
true;
429 AnalyzerOptions->eagerlyAssumeBinOpBifurcation =
true;
430 std::unique_ptr<ento::AnalysisASTConsumer> AnalysisConsumer =
431 ento::CreateAnalysisConsumer(Compiler);
432 AnalysisConsumer->AddDiagnosticConsumer(
433 new AnalyzerDiagnosticConsumer(Context));
434 Consumers.push_back(std::move(AnalysisConsumer));
436 #endif // CLANG_ENABLE_STATIC_ANALYZER 437 return std::make_unique<ClangTidyASTConsumer>(
438 std::move(Consumers), std::move(Profiling), std::move(Finder),
443 std::vector<std::string> CheckNames;
444 for (
const auto &CheckFactory : *CheckFactories) {
446 CheckNames.push_back(CheckFactory.first);
449 #if CLANG_ENABLE_STATIC_ANALYZER 450 for (
const auto &AnalyzerCheck : getAnalyzerCheckersAndPackages(
452 CheckNames.push_back(AnalyzerCheckNamePrefix + AnalyzerCheck.first);
453 #endif // CLANG_ENABLE_STATIC_ANALYZER 455 std::sort(CheckNames.begin(), CheckNames.end());
461 std::vector<std::unique_ptr<ClangTidyCheck>>
Checks =
462 CheckFactories->createChecks(&Context);
463 for (
const auto &Check : Checks)
464 Check->storeOptions(Options);
468 std::vector<std::string>
474 AllowEnablingAnalyzerAlphaCheckers);
485 AllowEnablingAnalyzerAlphaCheckers);
490 std::vector<ClangTidyError>
492 const CompilationDatabase &Compilations,
493 ArrayRef<std::string> InputFiles,
494 llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> BaseFS,
496 ClangTool Tool(Compilations, InputFiles,
497 std::make_shared<PCHContainerOperations>(), BaseFS);
500 ArgumentsAdjuster PerFileExtraArgumentsInserter =
501 [&Context](
const CommandLineArguments &Args, StringRef
Filename) {
503 CommandLineArguments AdjustedArgs = Args;
505 auto I = AdjustedArgs.begin();
506 if (I != AdjustedArgs.end() && !StringRef(*I).startswith(
"-"))
512 AdjustedArgs.insert(AdjustedArgs.end(), Opts.
ExtraArgs->begin(),
517 Tool.appendArgumentsAdjuster(PerFileExtraArgumentsInserter);
518 Tool.appendArgumentsAdjuster(getStripPluginsAdjuster());
523 DiagnosticsEngine DE(
new DiagnosticIDs(),
new DiagnosticOptions(),
524 &DiagConsumer,
false);
526 Tool.setDiagnosticConsumer(&DiagConsumer);
528 class ActionFactory :
public FrontendActionFactory {
531 IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> BaseFS)
532 : ConsumerFactory(Context, BaseFS) {}
533 std::unique_ptr<FrontendAction> create()
override {
534 return std::make_unique<Action>(&ConsumerFactory);
537 bool runInvocation(std::shared_ptr<CompilerInvocation> Invocation,
539 std::shared_ptr<PCHContainerOperations> PCHContainerOps,
542 Invocation->getPreprocessorOpts().SetUpStaticAnalyzer =
true;
543 return FrontendActionFactory::runInvocation(
544 Invocation, Files, PCHContainerOps, DiagConsumer);
548 class Action :
public ASTFrontendAction {
552 StringRef File)
override {
563 ActionFactory Factory(Context, BaseFS);
565 return DiagConsumer.
take();
570 unsigned &WarningsAsErrorsCount,
571 llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS) {
572 ErrorReporter Reporter(Context, Fix, BaseFS);
573 llvm::vfs::FileSystem &FileSystem =
574 Reporter.getSourceManager().getFileManager().getVirtualFileSystem();
575 auto InitialWorkingDir = FileSystem.getCurrentWorkingDirectory();
576 if (!InitialWorkingDir)
577 llvm::report_fatal_error(
"Cannot get current working path.");
580 if (!Error.BuildDirectory.empty()) {
585 FileSystem.setCurrentWorkingDirectory(Error.BuildDirectory);
587 Reporter.reportDiagnostic(Error);
589 FileSystem.setCurrentWorkingDirectory(InitialWorkingDir.get());
592 WarningsAsErrorsCount += Reporter.getWarningsAsErrorsCount();
596 const std::vector<ClangTidyError> &Errors,
598 TranslationUnitDiagnostics TUD;
599 TUD.MainSourceFile = MainFilePath;
600 for (
const auto &Error : Errors) {
601 tooling::Diagnostic Diag = Error;
602 TUD.Diagnostics.insert(TUD.Diagnostics.end(), Diag);
605 yaml::Output YAML(OS);
SourceLocation Loc
'#' location in the include directive
std::vector< std::string > getCheckNames()
Get the list of enabled checks.
llvm::Optional< ArgList > ExtraArgs
Add extra compilation arguments to the end of the list.
Some operations such as code completion produce a set of candidates.
bool canEnableAnalyzerAlphaCheckers() const
If the experimental alpha checkers from the static analyzer can be enabled.
ClangTidyOptions::OptionMap getCheckOptions()
Get the union of options from all checks.
bool isCheckEnabled(StringRef CheckName) const
Returns true if the check is enabled for the CurrentFile.
bool getEnableProfiling() const
static cl::opt< std::string > StoreCheckProfile("store-check-profile", cl::desc(R"(
By default reports are printed in tabulated
format to stderr. When this option is passed,
these per-TU profiles are instead stored as JSON.
)"), cl::value_desc("prefix"), cl::cat(ClangTidyCategory))
constexpr llvm::StringLiteral Message
static llvm::StringRef toString(SpecialMemberFunctionsCheck::SpecialMemberFunctionKind K)
Contains options for clang-tidy.
A collection of ClangTidyCheckFactory instances.
OptionMap CheckOptions
Key-value mapping used to store check-specific options.
std::vector< ClangTidyError > runClangTidy(clang::tidy::ClangTidyContext &Context, const CompilationDatabase &Compilations, ArrayRef< std::string > InputFiles, llvm::IntrusiveRefCntPtr< llvm::vfs::OverlayFileSystem > BaseFS, bool EnableCheckProfile, llvm::StringRef StoreCheckProfile)
void handleErrors(llvm::ArrayRef< ClangTidyError > Errors, ClangTidyContext &Context, bool Fix, unsigned &WarningsAsErrorsCount, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > BaseFS)
Displays the found Errors to the users.
llvm::Optional< ArgList > ExtraArgsBefore
Add extra compilation arguments to the start of the list.
void setCurrentFile(StringRef File)
Should be called when starting to process new translation unit.
std::string Filename
Filename as a string.
static cl::opt< bool > AllowEnablingAnalyzerAlphaCheckers("allow-enabling-analyzer-alpha-checkers", cl::init(false), cl::Hidden, cl::cat(ClangTidyCategory))
This option allows enabling the experimental alpha checkers from the static analyzer.
std::vector< ClangTidyError > take()
llvm::unique_function< void()> Action
llvm::Optional< ClangTidyProfiling::StorageParams > getProfileStorageParams() const
const LangOptions & getLangOpts() const
Gets the language options from the AST context.
ClangTidyOptions getOptionsForFile(StringRef File) const
Returns options for File.
const ClangTidyOptions & getOptions() const
Returns options for CurrentFile.
void setASTContext(ASTContext *Context)
Sets ASTContext for the current translation unit.
static cl::opt< std::string > WarningsAsErrors("warnings-as-errors", cl::desc(R"(
Upgrades warnings to errors. Same format as
'-checks'.
This option's value is appended to the value of
the 'WarningsAsErrors' option in .clang-tidy
file, if any.
)"), cl::init(""), cl::cat(ClangTidyCategory))
A diagnostic consumer that turns each Diagnostic into a SourceManager-independent ClangTidyError...
static constexpr llvm::StringLiteral Name
std::map< std::string, std::string > OptionMap
void setProfileStoragePrefix(StringRef ProfilePrefix)
Control storage of profile date.
static cl::opt< bool > EnableCheckProfile("enable-check-profile", cl::desc(R"(
Enable per-check timing profiles, and print a
report to stderr.
)"), cl::init(false), cl::cat(ClangTidyCategory))
void setSourceManager(SourceManager *SourceMgr)
Sets the SourceManager of the used DiagnosticsEngine.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
void setDiagnosticsEngine(DiagnosticsEngine *DiagEngine)
Sets the DiagnosticsEngine that diag() will emit diagnostics to.
void exportReplacements(const llvm::StringRef MainFilePath, const std::vector< ClangTidyError > &Errors, raw_ostream &OS)
CharSourceRange Range
SourceRange for the file name.
A detected error complete with information to display diagnostic and automatic fix.
static cl::opt< std::string > Checks("checks", cl::desc(R"(
Comma-separated list of globs with optional '-'
prefix. Globs are processed in order of
appearance in the list. Globs without '-'
prefix add checks with matching names to the
set, globs with the '-' prefix remove checks
with matching names from the set of enabled
checks. This option's value is appended to the
value of the 'Checks' option in .clang-tidy
file, if any.
)"), cl::init(""), cl::cat(ClangTidyCategory))
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
llvm::Registry< ClangTidyModule > ClangTidyModuleRegistry
std::unique_ptr< clang::ASTConsumer > CreateASTConsumer(clang::CompilerInstance &Compiler, StringRef File)
Returns an ASTConsumer that runs the specified clang-tidy checks.
IgnoreDiagnostics DiagConsumer
static cl::opt< bool > Fix("fix", cl::desc(R"(
Apply suggested fixes. Without -fix-errors
clang-tidy will bail out if any compilation
errors were found.
)"), cl::init(false), cl::cat(ClangTidyCategory))
void setCurrentBuildDirectory(StringRef BuildDirectory)
Should be called when starting to process new translation unit.
void setEnableProfiling(bool Profile)
Control profile collection in clang-tidy.
llvm::StringMap< std::string > Files