]> granicus.if.org Git - clang/blobdiff - include/clang/ASTMatchers/ASTMatchFinder.h
Header guard canonicalization, clang part.
[clang] / include / clang / ASTMatchers / ASTMatchFinder.h
index 8af0546db57b70a96016d2abc5adc0b6fdcc6e1c..75525ad1d62eccb1b8780ed9951bed05958fa16a 100644 (file)
@@ -38,8 +38,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_AST_MATCHERS_AST_MATCH_FINDER_H
-#define LLVM_CLANG_AST_MATCHERS_AST_MATCH_FINDER_H
+#ifndef LLVM_CLANG_ASTMATCHERS_ASTMATCHFINDER_H
+#define LLVM_CLANG_ASTMATCHERS_ASTMATCHFINDER_H
 
 #include "clang/ASTMatchers/ASTMatchers.h"
 
@@ -148,7 +148,7 @@ public:
                          MatchCallback *Action);
 
   /// \brief Creates a clang ASTConsumer that finds all matches.
-  clang::ASTConsumer *newASTConsumer();
+  std::unique_ptr<clang::ASTConsumer> newASTConsumer();
 
   /// \brief Calls the registered callbacks on all matches on the given \p Node.
   ///
@@ -210,16 +210,14 @@ match(MatcherT Matcher, const ast_type_traits::DynTypedNode &Node,
 ///
 /// This is useful in combanation with \c match():
 /// \code
-///   Decl *D = selectFirst<Decl>("id", match(Matcher.bind("id"),
-///                                           Node, Context));
+///   const Decl *D = selectFirst<Decl>("id", match(Matcher.bind("id"),
+///                                                 Node, Context));
 /// \endcode
 template <typename NodeT>
-NodeT *
+const NodeT *
 selectFirst(StringRef BoundTo, const SmallVectorImpl<BoundNodes> &Results) {
-  for (SmallVectorImpl<BoundNodes>::const_iterator I = Results.begin(),
-                                                   E = Results.end();
-       I != E; ++I) {
-    if (NodeT *Node = I->getNodeAs<NodeT>(BoundTo))
+  for (const BoundNodes &N : Results) {
+    if (const NodeT *Node = N.getNodeAs<NodeT>(BoundTo))
       return Node;
   }
   return nullptr;
@@ -255,4 +253,4 @@ match(MatcherT Matcher, const NodeT &Node, ASTContext &Context) {
 } // end namespace ast_matchers
 } // end namespace clang
 
-#endif // LLVM_CLANG_AST_MATCHERS_AST_MATCH_FINDER_H
+#endif