search for: matchfinder

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

2020 Sep 27
3
How to add a new clang-tidy module
...ICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "M011Check.h" +#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 Match...
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
2013 Apr 25
0
[LLVMdev] Template and GC root
...are manually identified by explicit calls to a specific C++ function. Then when C++ code is converted to LLVM IR, an optimization pass is applied to replace all calls to this specific C++ function by calls to llvm.gcroot intrinsic. The process I am using know relies on Clang PluginASTAction and MatchFinder. Whenever a GC root variable is matched as function parameter or local variable, then I generate a C++ function call (with the help of Clang Rewriter) to identify the GC root. This works quite good in general, except for template methods. In some cases the same method can be called with GC root...