search for: addmatcher

Displaying 3 results from an estimated 3 matches for "addmatcher".

2016 Sep 21
4
Creating a clang-tidy const position check
I'm in the process of writing a clang-tidy check that concerns the position of the "const" keyword. The check should either enforce "T const" or "const T", based on a flag. Naturally, this should extend to all sorts of variations and qualifiers, e.g., X<const T&, Y const*> const&. My approach is to first find the right AST matcher expression to flag
2017 Jul 27
2
Are there some strong naming conventions in TableGen?
...is is the root of the dag we're matching, we emit a redundant opcode // check to ensure that this gets folded into the normal top-level // OpcodeSwitch. if (N == Pattern.getSrcPattern()) { const SDNodeInfo &NI = CGP.getSDNodeInfo(CGP.getSDNodeNamed("imm")); AddMatcher(new CheckOpcodeMatcher(NI)); } return AddMatcher(new CheckIntegerMatcher(II->getValue())); } ------------------------------------------------------------------------------------------------- This code seems to retrieve some Node definition based on a naming convention related to the &...
2020 Sep 27
3
How to add a new clang-tidy module
...+#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" + +using namespace clang::ast_matchers; + +namespace clang { +namespace tidy { +namespace misra { + +void M011Check::registerMatchers(MatchFinder *Finder) { + // FIXME: Add matchers. + Finder->addMatcher(functionDecl().bind("x"), this); +} + +void M011Check::check(const MatchFinder::MatchResult &Result) { + // FIXME: Add callback implementation. + const auto *MatchedDecl = Result.Nodes.getNodeAs<FunctionDecl>("x"); + if (!MatchedDecl->getIdentifier() || MatchedDe...