[ASTMatchers] New matcher forFunction
authorGabor Horvath <xazax.hun@gmail.com>
Wed, 4 May 2016 11:59:39 +0000 (11:59 +0000)
committerGabor Horvath <xazax.hun@gmail.com>
Wed, 4 May 2016 11:59:39 +0000 (11:59 +0000)
commit1b3f8db8b6effddf363affce4f66da241d2234ff
tree57e0867526ea9c13606283e065ebe38b7b48fa32
parentb7a29675fcd1802e06e3f03231fd53650f784822
[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/docs/LibASTMatchersReference.html
clang/include/clang/ASTMatchers/ASTMatchers.h
clang/lib/ASTMatchers/Dynamic/Registry.cpp
clang/unittests/ASTMatchers/ASTMatchersTest.cpp