[PATCH] Introduce BoundNodes::getMap.

Peter Collingbourne peter at pcc.me.uk
Sun Nov 3 22:29:32 PST 2013


Hi klimek,

The purpose of this function is to allow clients of the dynamic AST matcher
to enumerate each binding.

http://llvm-reviews.chandlerc.com/D2095

Files:
  include/clang/ASTMatchers/ASTMatchers.h
  include/clang/ASTMatchers/ASTMatchersInternal.h

Index: include/clang/ASTMatchers/ASTMatchers.h
===================================================================
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -86,6 +86,12 @@
   }
   /// @}
 
+  typedef internal::BoundNodesMap::IDToNodeMap IDToNodeMap;
+
+  const IDToNodeMap &getMap() const {
+    return MyBoundNodes.getMap();
+  }
+
 private:
   /// \brief Create BoundNodes from a pre-filled map of bindings.
   BoundNodes(internal::BoundNodesMap &MyBoundNodes)
Index: include/clang/ASTMatchers/ASTMatchersInternal.h
===================================================================
--- include/clang/ASTMatchers/ASTMatchersInternal.h
+++ include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -98,14 +98,18 @@
     return NodeMap < Other.NodeMap;
   }
 
-private:
   /// \brief A map from IDs to the bound nodes.
   ///
   /// Note that we're using std::map here, as for memoization:
   /// - we need a comparison operator
   /// - we need an assignment operator
   typedef std::map<std::string, ast_type_traits::DynTypedNode> IDToNodeMap;
 
+  const IDToNodeMap &getMap() const {
+    return NodeMap;
+  }
+
+private:
   IDToNodeMap NodeMap;
 };
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2095.1.patch
Type: text/x-patch
Size: 1199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131103/b344b537/attachment.bin>


More information about the cfe-commits mailing list