Skip to content

Commit 472a736

Browse files
authored
ClangTypeParser: handle clang::MemberPointer (#493)
1 parent 7e71dc6 commit 472a736

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

oi/type_graph/ClangTypeParser.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ Type& ClangTypeParser::enumerateType(const clang::Type& ty) {
109109
return enumerateArray(llvm::cast<const clang::ConstantArrayType>(ty));
110110
case clang::Type::Enum:
111111
return enumerateEnum(llvm::cast<const clang::EnumType>(ty));
112+
case clang::Type::MemberPointer:
113+
return enumerateMemberPointer(
114+
llvm::cast<const clang::MemberPointerType>(ty));
112115

113116
default:
114117
throw std::logic_error(std::string("unsupported TypeClass `") +
@@ -385,6 +388,12 @@ Type& ClangTypeParser::enumeratePointer(const clang::PointerType& ty) {
385388
return makeType<Reference>(ty, t);
386389
}
387390

391+
Type& ClangTypeParser::enumerateMemberPointer(
392+
const clang::MemberPointerType& ty) {
393+
// TODO: chase anything not a function pointer (same as regular pointers).
394+
return makeType<Primitive>(ty, Primitive::Kind::StubbedPointer);
395+
}
396+
388397
Type& ClangTypeParser::enumerateSubstTemplateTypeParm(
389398
const clang::SubstTemplateTypeParmType& ty) {
390399
// Clang wraps any type that was substituted from e.g. `T` in this type. It

oi/type_graph/ClangTypeParser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class DecltypeType;
2929
class ElaboratedType;
3030
class EnumType;
3131
class LValueReferenceType;
32+
class MemberPointerType;
3233
class PointerType;
3334
class RecordType;
3435
class Sema;
@@ -97,6 +98,7 @@ class ClangTypeParser {
9798
Type& enumerateClass(const clang::RecordType&);
9899
Type& enumerateReference(const clang::LValueReferenceType&);
99100
Type& enumeratePointer(const clang::PointerType&);
101+
Type& enumerateMemberPointer(const clang::MemberPointerType&);
100102
Type& enumerateSubstTemplateTypeParm(const clang::SubstTemplateTypeParmType&);
101103
Primitive& enumeratePrimitive(const clang::BuiltinType&);
102104
Type& enumerateElaboratedType(const clang::ElaboratedType&);

0 commit comments

Comments
 (0)