[cfe-commits] [PATCH] Modifying BoundNodes to store bindings as void* pointers and use getNodeAs instead of getDeclAs and getStmtAs.

Daniel Jasper reviews at llvm-reviews.chandlerc.com
Sun Aug 26 18:23:46 PDT 2012


  I think, this slightly changes the behavior for existing code. Until now, AFAIK you can bind a Stmt and a Decl to the same name (e.g. I suspect "match" might be a name that somebody might have reused). I think it is a good thing to forbid it! Manuel, do you see any problems with that? We should make a note in the commit message.

  I like the design, but we should leave the final decision to Manuel.


================
Comment at: google3/third_party/llvm/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:88
@@ +87,3 @@
+/// We use template specialization on the node base type to enable us to
+/// get at the appropriate NodeBaseType objects and do approrpiate static_casts.
+template <typename BaseType>
----------------
nit: appropriate static_casts (-r)

================
Comment at: google3/third_party/llvm/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:71
@@ +70,3 @@
+struct get_base_type {
+  typedef GET_BASE_TYPE(Decl,
+          GET_BASE_TYPE(Stmt,
----------------
First I thought that these recursive macros are bad, but on second thought, I kind of like it :-).

================
Comment at: google3/third_party/llvm/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:126-128
@@ +125,5 @@
+/// @{
+NODE_BASE_TYPE_UTIL(Decl);
+NODE_BASE_TYPE_UTIL(Stmt);
+NODE_BASE_TYPE_UTIL(QualType);
+/// @}
----------------
It is very important that this list is in sync with the enum declaring NT_*. Ideally, we would not need both, but if we do, could we put the right next to each other in the code?

================
Comment at: google3/third_party/llvm/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:147
@@ +146,3 @@
+
+  /// \brief Returns the AST node bound to \c ID.
+  /// Returns NULL if there was no node bound to \c ID or if there is a node but
----------------
You'll need a blank comment line so doxygen understands where \brief ends.

================
Comment at: google3/third_party/llvm/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:140
@@ +139,3 @@
+public:
+  /// \brief Adds \c Node to the map with key \c ID.
+  /// The node's base type should be in NodeBaseType or it will be unaccessible.
----------------
You'll need a blank comment line so doxygen understands where \brief ends.

================
Comment at: google3/third_party/llvm/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:86
@@ +85,3 @@
+
+/// \brief Utility to manipulate nodes of a given base type.
+/// We use template specialization on the node base type to enable us to
----------------
You'll need a blank comment line so doxygen understands where \brief ends.

================
Comment at: google3/third_party/llvm/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:77
@@ +76,3 @@
+
+/// \brief Indicates the base type of a bound AST node.
+/// Used for storing nodes as void*.
----------------
You'll need a blank comment line so doxygen understands where \brief ends.


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



More information about the cfe-commits mailing list