ClangTypeParser: handle clang::MemberPointer (#493)

This commit is contained in:
Jon Haslam 2024-04-16 12:53:36 +01:00 committed by GitHub
parent 7e71dc6192
commit 472a7366ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -109,6 +109,9 @@ Type& ClangTypeParser::enumerateType(const clang::Type& ty) {
return enumerateArray(llvm::cast<const clang::ConstantArrayType>(ty));
case clang::Type::Enum:
return enumerateEnum(llvm::cast<const clang::EnumType>(ty));
case clang::Type::MemberPointer:
return enumerateMemberPointer(
llvm::cast<const clang::MemberPointerType>(ty));
default:
throw std::logic_error(std::string("unsupported TypeClass `") +
@ -385,6 +388,12 @@ Type& ClangTypeParser::enumeratePointer(const clang::PointerType& ty) {
return makeType<Reference>(ty, t);
}
Type& ClangTypeParser::enumerateMemberPointer(
const clang::MemberPointerType& ty) {
// TODO: chase anything not a function pointer (same as regular pointers).
return makeType<Primitive>(ty, Primitive::Kind::StubbedPointer);
}
Type& ClangTypeParser::enumerateSubstTemplateTypeParm(
const clang::SubstTemplateTypeParmType& ty) {
// Clang wraps any type that was substituted from e.g. `T` in this type. It

View File

@ -29,6 +29,7 @@ class DecltypeType;
class ElaboratedType;
class EnumType;
class LValueReferenceType;
class MemberPointerType;
class PointerType;
class RecordType;
class Sema;
@ -97,6 +98,7 @@ class ClangTypeParser {
Type& enumerateClass(const clang::RecordType&);
Type& enumerateReference(const clang::LValueReferenceType&);
Type& enumeratePointer(const clang::PointerType&);
Type& enumerateMemberPointer(const clang::MemberPointerType&);
Type& enumerateSubstTemplateTypeParm(const clang::SubstTemplateTypeParmType&);
Primitive& enumeratePrimitive(const clang::BuiltinType&);
Type& enumerateElaboratedType(const clang::ElaboratedType&);