Skip to content

Commit 8e5cdf8

Browse files
authored
Support type::Attributed in Clang Parser (#496)
1 parent 3513f95 commit 8e5cdf8

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

oi/type_graph/ClangTypeParser.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ Type& ClangTypeParser::enumerateType(const clang::Type& ty) {
112112
case clang::Type::MemberPointer:
113113
return enumerateMemberPointer(
114114
llvm::cast<const clang::MemberPointerType>(ty));
115+
case clang::Type::Attributed:
116+
return enumerateAttributed(llvm::cast<const clang::AttributedType>(ty));
115117

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

400+
Type& ClangTypeParser::enumerateAttributed(const clang::AttributedType& ty) {
401+
return enumerateType(*ty.getEquivalentType());
402+
}
403+
398404
Type& ClangTypeParser::enumerateSubstTemplateTypeParm(
399405
const clang::SubstTemplateTypeParmType& ty) {
400406
// 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
@@ -22,6 +22,7 @@
2222
#include "oi/type_graph/TypeGraph.h"
2323

2424
namespace clang {
25+
class AttributedType;
2526
class ASTContext;
2627
class BuiltinType;
2728
class ConstantArrayType;
@@ -108,6 +109,7 @@ class ClangTypeParser {
108109
Typedef& enumerateUsing(const clang::UsingType&);
109110
Type& enumerateUnaryTransformType(const clang::UnaryTransformType&);
110111
Type& enumerateDecltypeType(const clang::DecltypeType&);
112+
Type& enumerateAttributed(const clang::AttributedType&);
111113

112114
Array& enumerateArray(const clang::ConstantArrayType&);
113115
Enum& enumerateEnum(const clang::EnumType&);

0 commit comments

Comments
 (0)