Author: leonardchan Date: Mon May 20 15:42:19 2019 New Revision: 361205 URL: http://llvm.org/viewvc/llvm-project?rev=361205&view=rev Log: [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. Added: cfe/trunk/test/SemaObjC/nullability_macro.m Modified: cfe/trunk/lib/AST/Type.cpp Modified: cfe/trunk/lib/AST/Type.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=361205&r1=361204&r2=361205&view=diff ============================================================================== --- cfe/trunk/lib/AST/Type.cpp (original) +++ cfe/trunk/lib/AST/Type.cpp Mon May 20 15:42:19 2019 @@ -3929,7 +3929,11 @@ AttributedType::getImmediateNullability( } 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; Added: cfe/trunk/test/SemaObjC/nullability_macro.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/nullability_macro.m?rev=361205&view=auto ============================================================================== --- cfe/trunk/test/SemaObjC/nullability_macro.m (added) +++ cfe/trunk/test/SemaObjC/nullability_macro.m Mon May 20 15:42:19 2019 @@ -0,0 +1,16 @@ +// Test that nullability attributes still get merged even though they are +// wrapped with a MacroQualifiedType. This should just compile with no errors. +// RUN: %clang_cc1 %s -Wno-objc-root-class -fsyntax-only -verify +#define UI_APPEARANCE_SELECTOR __attribute__((annotate("ui_appearance_selector"))) + +@class UIColor; + +@interface Test +@property(null_resettable, nonatomic, strong)Â UIColor *onTintColor UI_APPEARANCE_SELECTOR; // expected-warning{{treating Unicode character as whitespace}} +@end + +@implementation Test +- (void)setOnTintColor:(nullable UIColor *)onTintColor { +} + +@end _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits