Skip to content

Commit aa9c00f

Browse files
committed
[AST] Make ASTNode pointer-like
1 parent 3022812 commit aa9c00f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

include/swift/AST/ASTNode.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,19 @@ namespace llvm {
107107
return LHS.getOpaqueValue() == RHS.getOpaqueValue();
108108
}
109109
};
110+
111+
// A ASTNode is "pointer like".
112+
template <>
113+
struct PointerLikeTypeTraits<ASTNode> {
114+
public:
115+
static inline void *getAsVoidPointer(ASTNode N) {
116+
return (void *)N.getOpaqueValue();
117+
}
118+
static inline ASTNode getFromVoidPointer(void *P) {
119+
return ASTNode::getFromOpaqueValue(P);
120+
}
121+
enum { NumLowBitsAvailable = swift::TypeAlignInBits };
122+
};
110123
}
111124

112125
#endif // LLVM_SWIFT_AST_AST_NODE_H

0 commit comments

Comments
 (0)