summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGabor Horvath <xazax.hun@gmail.com>2016-05-04 11:59:39 +0000
committerGabor Horvath <xazax.hun@gmail.com>2016-05-04 11:59:39 +0000
commit0820d77473e88902818ec579b2d0dd115ba803e4 (patch)
tree4b4c58ca68278d421ce4ae12496ebd22dcfbb467 /lib
parent6eab9724157636a70be55321345cbaa9fe607d98 (diff)
downloadclang-0820d77473e88902818ec579b2d0dd115ba803e4.tar.gz
[ASTMatchers] New matcher forFunction
Summary: Matcher proposed in the review of checker misc-assign-operator (name pending). Its goal is to find the direct enclosing function declaration of a statement and run the inner matcher on it. Two version is attached in this patch (thus it will not compile), to be decided which approach to take. The second one always chooses one single parent while the first one does a depth-first search upwards (thus a height-first search) and returns the first positive match of the inner matcher (thus it always returns zero or one matches, not more). Further questions: is it enough to implement it in-place, or ASTMatchersInternals or maybe ASTMatchFinder should be involved? Reviewers: sbenza Subscribers: aaron.ballman, klimek, o.gyorgy, xazax.hun, cfe-commits Differential Revision: http://reviews.llvm.org/D19357 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268490 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/ASTMatchers/Dynamic/Registry.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/ASTMatchers/Dynamic/Registry.cpp b/lib/ASTMatchers/Dynamic/Registry.cpp
index 9fd43332b7..e43960241d 100644
--- a/lib/ASTMatchers/Dynamic/Registry.cpp
+++ b/lib/ASTMatchers/Dynamic/Registry.cpp
@@ -184,6 +184,7 @@ RegistryMaps::RegistryMaps() {
REGISTER_MATCHER(forEachDescendant);
REGISTER_MATCHER(forEachSwitchCase);
REGISTER_MATCHER(forField);
+ REGISTER_MATCHER(forFunction);
REGISTER_MATCHER(forStmt);
REGISTER_MATCHER(friendDecl);
REGISTER_MATCHER(functionDecl);