diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-08-20 21:47:29 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-08-20 21:47:29 +0000 |
commit | 98caebcbd84081b56f459524427596908af127bf (patch) | |
tree | f7659973640746f7b7555fd17d6005b6e8a21adb /lib/AST/TypeLoc.cpp | |
parent | 6eed53ab5d3c252224d1df79d930d6ee04193195 (diff) | |
download | clang-98caebcbd84081b56f459524427596908af127bf.tar.gz |
Model type attributes as regular Attrs.
Specifically, AttributedType now tracks a regular attr::Kind rather than
having its own parallel Kind enumeration, and AttributedTypeLoc now
holds an Attr* instead of holding an ad-hoc collection of Attr fields.
Differential Revision: https://reviews.llvm.org/D50526
This reinstates r339623, reverted in r339638, with a fix to not fail
template instantiation if we instantiate a QualType with no associated
type source information and we encounter an AttributedType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340215 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/TypeLoc.cpp')
-rw-r--r-- | lib/AST/TypeLoc.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/AST/TypeLoc.cpp b/lib/AST/TypeLoc.cpp index e4fd6f106e..b6dc679bbf 100644 --- a/lib/AST/TypeLoc.cpp +++ b/lib/AST/TypeLoc.cpp @@ -404,11 +404,11 @@ TypeLoc TypeLoc::IgnoreParensImpl(TypeLoc TL) { } SourceLocation TypeLoc::findNullabilityLoc() const { - if (auto attributedLoc = getAs<AttributedTypeLoc>()) { - if (attributedLoc.getAttrKind() == AttributedType::attr_nullable || - attributedLoc.getAttrKind() == AttributedType::attr_nonnull || - attributedLoc.getAttrKind() == AttributedType::attr_null_unspecified) - return attributedLoc.getAttrNameLoc(); + if (auto ATL = getAs<AttributedTypeLoc>()) { + const Attr *A = ATL.getAttr(); + if (A && (isa<TypeNullableAttr>(A) || isa<TypeNonNullAttr>(A) || + isa<TypeNullUnspecifiedAttr>(A))) + return A->getLocation(); } return {}; |