32 SmallVector<ast_matchers::dynamic::DynTypedMatcher> Matchers{};
34 llvm::StringRef QueryStringRef{V.
Query};
35 while (!QueryStringRef.empty()) {
39 const auto &MatchQuery = llvm::cast<query::MatchQuery>(*Q);
40 Matchers.push_back(MatchQuery.Matcher);
44 const auto &LetQuery = llvm::cast<query::LetQuery>(*Q);
45 LetQuery.run(llvm::errs(), QS);
49 const auto &NoOpQuery = llvm::cast<query::NoOpQuery>(*Q);
50 NoOpQuery.run(llvm::errs(), QS);
54 const auto &InvalidQuery = llvm::cast<query::InvalidQuery>(*Q);
65 Context,
"unsupported query kind 'DisableOutputKind'", V.
Name);
70 Context,
"unsupported query kind 'EnableOutputKind'", V.
Name);
80 Context,
"unsupported query kind 'SetTraversalKind'", V.
Name);
97 QueryStringRef = Q->RemainingContent;
127 auto Emit = [
this](
const DiagMaps &DiagMaps,
const std::string &BindName,
128 const DynTypedNode &Node, DiagnosticIDs::Level Level) {
129 DiagMaps::const_iterator DiagMapIt = DiagMaps.find(Level);
130 if (DiagMapIt == DiagMaps.end())
132 const BindNameMapToDiagMessage &BindNameMap = DiagMapIt->second;
133 BindNameMapToDiagMessage::const_iterator BindNameMapIt =
134 BindNameMap.find(BindName);
135 if (BindNameMapIt == BindNameMap.end())
137 for (
const std::string &Message : BindNameMapIt->second)
138 diag(Node.getSourceRange().getBegin(), Message, Level);
140 for (
const auto &[Name, Node] : Result.Nodes.getMap())
141 Emit(Diags, Name, Node, DiagnosticIDs::Warning);
143 for (
const auto &[Name, Node] : Result.Nodes.getMap())
144 Emit(Diags, Name, Node, DiagnosticIDs::Note);
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
DiagnosticBuilder configurationDiag(StringRef Message, DiagnosticIDs::Level Level=DiagnosticIDs::Warning)
Report any errors to do with reading the configuration using this method.