Skip to content

Commit

Permalink
Support type::Attributed in Clang Parser (#496)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyroguru authored Apr 23, 2024
1 parent 3513f95 commit 8e5cdf8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions oi/type_graph/ClangTypeParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ Type& ClangTypeParser::enumerateType(const clang::Type& ty) {
case clang::Type::MemberPointer:
return enumerateMemberPointer(
llvm::cast<const clang::MemberPointerType>(ty));
case clang::Type::Attributed:
return enumerateAttributed(llvm::cast<const clang::AttributedType>(ty));

default:
throw std::logic_error(std::string("unsupported TypeClass `") +
Expand Down Expand Up @@ -395,6 +397,10 @@ Type& ClangTypeParser::enumerateMemberPointer(
return makeType<Primitive>(ty, Primitive::Kind::StubbedPointer);
}

Type& ClangTypeParser::enumerateAttributed(const clang::AttributedType& ty) {
return enumerateType(*ty.getEquivalentType());
}

Type& ClangTypeParser::enumerateSubstTemplateTypeParm(
const clang::SubstTemplateTypeParmType& ty) {
// Clang wraps any type that was substituted from e.g. `T` in this type. It
Expand Down
2 changes: 2 additions & 0 deletions oi/type_graph/ClangTypeParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "oi/type_graph/TypeGraph.h"

namespace clang {
class AttributedType;
class ASTContext;
class BuiltinType;
class ConstantArrayType;
Expand Down Expand Up @@ -108,6 +109,7 @@ class ClangTypeParser {
Typedef& enumerateUsing(const clang::UsingType&);
Type& enumerateUnaryTransformType(const clang::UnaryTransformType&);
Type& enumerateDecltypeType(const clang::DecltypeType&);
Type& enumerateAttributed(const clang::AttributedType&);

Array& enumerateArray(const clang::ConstantArrayType&);
Enum& enumerateEnum(const clang::EnumType&);
Expand Down

0 comments on commit 8e5cdf8

Please sign in to comment.