From 1b3f8db8b6effddf363affce4f66da241d2234ff Mon Sep 17 00:00:00 2001 From: Gabor Horvath Date: Wed, 4 May 2016 11:59:39 +0000 Subject: [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 llvm-svn: 268490 --- clang/lib/ASTMatchers/Dynamic/Registry.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'clang/lib') diff --git a/clang/lib/ASTMatchers/Dynamic/Registry.cpp b/clang/lib/ASTMatchers/Dynamic/Registry.cpp index 9fd43332b7f..e43960241d7 100644 --- a/clang/lib/ASTMatchers/Dynamic/Registry.cpp +++ b/clang/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); -- cgit v1.2.3