Skip to content

Commit c2d80cd

Browse files
committed
[AccessPath] Gave PathNode pointer-like traits.
1 parent cc56e13 commit c2d80cd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

include/swift/SIL/MemAccessUtils.h

+12
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,18 @@ template <> struct DenseMapInfo<swift::AccessPathWithBase> {
12671267
}
12681268
};
12691269

1270+
// Allow AccessPath::PathNode to be used as a pointer-like template argument.
1271+
template<>
1272+
struct PointerLikeTypeTraits<swift::AccessPath::PathNode> {
1273+
static inline void *getAsVoidPointer(swift::AccessPath::PathNode node) {
1274+
return (void *)node.node;
1275+
}
1276+
static inline swift::AccessPath::PathNode getFromVoidPointer(void *pointer) {
1277+
return swift::AccessPath::PathNode((swift::IndexTrieNode *)pointer);
1278+
}
1279+
enum { NumLowBitsAvailable =
1280+
PointerLikeTypeTraits<swift::IndexTrieNode *>::NumLowBitsAvailable };
1281+
};
12701282
} // end namespace llvm
12711283

12721284
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)