From c0a4f459e50521676bead07a7b868a82e2f0fc55 Mon Sep 17 00:00:00 2001 From: Leonard Chan Date: Mon, 20 May 2019 22:42:19 +0000 Subject: [Sema] Fix for build on some iOS programs. Nullability attributes weren't being stripped for AttributedTypes that were wrapped in a MacroQualifiedType. This fix adds a check for this type and a test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361205 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/Type.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/AST/Type.cpp') diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 590e534fbd..101c5184a5 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -3929,7 +3929,11 @@ AttributedType::getImmediateNullability() const { } Optional AttributedType::stripOuterNullability(QualType &T) { - if (auto attributed = dyn_cast(T.getTypePtr())) { + QualType AttrTy = T; + if (auto MacroTy = dyn_cast(T)) + AttrTy = MacroTy->getUnderlyingType(); + + if (auto attributed = dyn_cast(AttrTy)) { if (auto nullability = attributed->getImmediateNullability()) { T = attributed->getModifiedType(); return nullability; -- cgit v1.2.1