diff options
author | Leonard Chan <leonardchan@google.com> | 2019-05-20 22:42:19 +0000 |
---|---|---|
committer | Leonard Chan <leonardchan@google.com> | 2019-05-20 22:42:19 +0000 |
commit | c0a4f459e50521676bead07a7b868a82e2f0fc55 (patch) | |
tree | 1b7c6765b8d03ae1e2568006eeecb949098dcfe9 /lib/AST/Type.cpp | |
parent | 1d083f849b0e7fade414f89bb871b73a1bfefa3a (diff) | |
download | clang-c0a4f459e50521676bead07a7b868a82e2f0fc55.tar.gz |
[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
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r-- | lib/AST/Type.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
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<NullabilityKind> AttributedType::stripOuterNullability(QualType &T) { - if (auto attributed = dyn_cast<AttributedType>(T.getTypePtr())) { + QualType AttrTy = T; + if (auto MacroTy = dyn_cast<MacroQualifiedType>(T)) + AttrTy = MacroTy->getUnderlyingType(); + + if (auto attributed = dyn_cast<AttributedType>(AttrTy)) { if (auto nullability = attributed->getImmediateNullability()) { T = attributed->getModifiedType(); return nullability; |