Support type::Attributed in Clang Parser (#496)

This commit is contained in:
Jon Haslam 2024-04-23 18:11:58 +01:00 committed by GitHub
parent 3513f9580a
commit 8e5cdf8d04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -112,6 +112,8 @@ Type& ClangTypeParser::enumerateType(const clang::Type& ty) {
case clang::Type::MemberPointer: case clang::Type::MemberPointer:
return enumerateMemberPointer( return enumerateMemberPointer(
llvm::cast<const clang::MemberPointerType>(ty)); llvm::cast<const clang::MemberPointerType>(ty));
case clang::Type::Attributed:
return enumerateAttributed(llvm::cast<const clang::AttributedType>(ty));
default: default:
throw std::logic_error(std::string("unsupported TypeClass `") + throw std::logic_error(std::string("unsupported TypeClass `") +
@ -395,6 +397,10 @@ Type& ClangTypeParser::enumerateMemberPointer(
return makeType<Primitive>(ty, Primitive::Kind::StubbedPointer); return makeType<Primitive>(ty, Primitive::Kind::StubbedPointer);
} }
Type& ClangTypeParser::enumerateAttributed(const clang::AttributedType& ty) {
return enumerateType(*ty.getEquivalentType());
}
Type& ClangTypeParser::enumerateSubstTemplateTypeParm( Type& ClangTypeParser::enumerateSubstTemplateTypeParm(
const clang::SubstTemplateTypeParmType& ty) { const clang::SubstTemplateTypeParmType& ty) {
// Clang wraps any type that was substituted from e.g. `T` in this type. It // Clang wraps any type that was substituted from e.g. `T` in this type. It

View File

@ -22,6 +22,7 @@
#include "oi/type_graph/TypeGraph.h" #include "oi/type_graph/TypeGraph.h"
namespace clang { namespace clang {
class AttributedType;
class ASTContext; class ASTContext;
class BuiltinType; class BuiltinType;
class ConstantArrayType; class ConstantArrayType;
@ -108,6 +109,7 @@ class ClangTypeParser {
Typedef& enumerateUsing(const clang::UsingType&); Typedef& enumerateUsing(const clang::UsingType&);
Type& enumerateUnaryTransformType(const clang::UnaryTransformType&); Type& enumerateUnaryTransformType(const clang::UnaryTransformType&);
Type& enumerateDecltypeType(const clang::DecltypeType&); Type& enumerateDecltypeType(const clang::DecltypeType&);
Type& enumerateAttributed(const clang::AttributedType&);
Array& enumerateArray(const clang::ConstantArrayType&); Array& enumerateArray(const clang::ConstantArrayType&);
Enum& enumerateEnum(const clang::EnumType&); Enum& enumerateEnum(const clang::EnumType&);