[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
Mon Aug 27 14:10:01 PDT 2012



================
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);
+/// @}
----------------
Michael Diamond wrote:
> Daniel Jasper wrote:
> > 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?
> Unfortunately, no. We require NodeBaseType in the definition of NodeBaseTypeUtil. I've added a comment to the enum to update both get _base_type and the list of specializations.
But you could define NodeBaseUtilType before the enum if you define NodeBaseTypeUtil::getNodeBaseType() out of line below the NODE_BASE_TYPE_UTIL macro invocations.

So I am suggesting the order:

#define GET_BASE_TYPE...
struct NodeBaseTypeUtil {	
  ... static NodeBaseType getNodeBaseType(); ...
};
#define NODE_BASE_TYPE_UTIL...
enum NodeBaseType {...};
struct get_base_type {...};
NODE_BASE_TYPE_UTIL(Decl);...

NodeBaseType NodeBaseTypeUtil::getNodeBaseType() {
  ...
}

Not feeling strongly, though..


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



More information about the cfe-commits mailing list