aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/TypeLoc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST/TypeLoc.cpp')
-rw-r--r--lib/AST/TypeLoc.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/AST/TypeLoc.cpp b/lib/AST/TypeLoc.cpp
index e4fd6f106e33..b7b2f188d716 100644
--- a/lib/AST/TypeLoc.cpp
+++ b/lib/AST/TypeLoc.cpp
@@ -384,6 +384,9 @@ TypeSpecifierType BuiltinTypeLoc::getWrittenTypeSpec() const {
#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
case BuiltinType::Id:
#include "clang/Basic/OpenCLImageTypes.def"
+#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
+ case BuiltinType::Id:
+#include "clang/Basic/OpenCLExtensionTypes.def"
case BuiltinType::OCLSampler:
case BuiltinType::OCLEvent:
case BuiltinType::OCLClkEvent:
@@ -404,11 +407,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 {};