aaron.ballman added inline comments.

================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:3118
@@ -3119,1 +3117,3 @@
+/// \brief Matches a 'for', 'while', 'do while' statement or a function
+/// declaration that has a given body.
 ///
----------------
s/declaration/definition.

================
Comment at: include/clang/ASTMatchers/ASTMatchersInternal.h:1590
@@ +1589,3 @@
+struct GetBodyMatcher {
+static const Stmt *get(const Ty &Node) {
+  return Node.getBody();
----------------
Indentation here is incorrect, you should run clang-format over the patch.

================
Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:342
@@ -341,1 +341,3 @@
 
+template <>
+const Stmt *GetBodyMatcher<FunctionDecl>::get(const FunctionDecl &Node) {
----------------
The specialization should live in the header file, not the source file.

================
Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:344
@@ +343,3 @@
+const Stmt *GetBodyMatcher<FunctionDecl>::get(const FunctionDecl &Node) {
+  return Node.isThisDeclarationADefinition() ? Node.getBody() : NULL;
+}
----------------
I would use `Node.doesThisDeclarationHaveABody()` instead; otherwise this will 
match definitions that are explicitly deleted, which isn't particularly useful.


http://reviews.llvm.org/D16215



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to