[cfe-commits] [PATCH] Modifying BoundNodes to store bindings as void* pointers and use getNodeAs instead of getDeclAs and getStmtAs.
Michael Diamond
reviews at llvm-reviews.chandlerc.com
Fri Aug 24 11:49:43 PDT 2012
Trying again to fix the diffs. arc is pretty buggy.
Hi klimek,
http://llvm-reviews.chandlerc.com/D25
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D25?vs=69&id=70#differential-review-toc
Files:
google3/third_party/llvm/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
google3/third_party/llvm/llvm/tools/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
Index: google3/third_party/llvm/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
===================================================================
--- google3/third_party/llvm/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ google3/third_party/llvm/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -61,14 +61,17 @@
class BoundNodesTreeBuilder;
/// \brief Macro for adding a base type to get_base_type.
-#define GET_BASE_TYPE(BaseType) \
- typename llvm::conditional<llvm::is_base_of<BaseType, T>::value, BaseType
+#define GET_BASE_TYPE(BaseType, NextBaseType) \
+ typename llvm::conditional<llvm::is_base_of<BaseType, T>::value, BaseType, \
+ NextBaseType>::type
/// \brief Meta-template to get base class of a node.
template <typename T>
struct get_base_type {
- typedef GET_BASE_TYPE(Decl), GET_BASE_TYPE(Stmt), GET_BASE_TYPE(QualType),
- void>::type>::type>::type type;
+ typedef GET_BASE_TYPE(Decl,
+ GET_BASE_TYPE(Stmt,
+ GET_BASE_TYPE(QualType,
+ void))) type;
};
/// \brief Indicates the base type of a bound AST node.
@@ -101,21 +104,21 @@
/// \brief Macro for adding a template specialization of NodeBaseTypeUtil.
#define NODE_BASE_TYPE_UTIL(BaseType) \
-template <> \
-struct NodeBaseTypeUtil<BaseType> { \
- static NodeBaseType getNodeBaseType() { \
- return NT_##BaseType; \
- } \
-\
- template <typename T> \
- static const T *castNode(const NodeBaseType &ActualBaseType, \
- const void *Node) { \
- if (ActualBaseType == NT_##BaseType) { \
- return llvm::dyn_cast<T>(static_cast<const BaseType*>(Node)); \
- } else { \
- return NULL; \
- } \
- } \
+template <> \
+struct NodeBaseTypeUtil<BaseType> { \
+ static NodeBaseType getNodeBaseType() { \
+ return NT_##BaseType; \
+ } \
+ \
+ template <typename T> \
+ static const T *castNode(const NodeBaseType &ActualBaseType, \
+ const void *Node) { \
+ if (ActualBaseType == NT_##BaseType) { \
+ return llvm::dyn_cast<T>(static_cast<const BaseType*>(Node)); \
+ } else { \
+ return NULL; \
+ } \
+ } \
}
/// \brief Template specialization of NodeBaseTypeUtil. See main definition.
@@ -134,10 +137,6 @@
/// \brief Internal version of BoundNodes. Holds all the bound nodes.
class BoundNodesMap {
public:
- BoundNodesMap();
-
- BoundNodesMap(const BoundNodesMap &Other);
-
/// \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.
template <typename T>
Index: google3/third_party/llvm/llvm/tools/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
===================================================================
--- google3/third_party/llvm/llvm/tools/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
+++ google3/third_party/llvm/llvm/tools/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -18,12 +18,6 @@
namespace ast_matchers {
namespace internal {
-BoundNodesMap::BoundNodesMap() {}
-
-BoundNodesMap::BoundNodesMap(const BoundNodesMap &Other) {
- NodeMap = Other.NodeMap;
-}
-
void BoundNodesMap::copyTo(BoundNodesTreeBuilder *Builder) const {
for (IDToNodeMap::const_iterator It = NodeMap.begin();
It != NodeMap.end();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25.4.patch
Type: text/x-patch
Size: 3972 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120824/bc46ad86/attachment.bin>
More information about the cfe-commits
mailing list