Index: lib/Sema/SemaDeclAttr.cpp =================================================================== --- lib/Sema/SemaDeclAttr.cpp +++ lib/Sema/SemaDeclAttr.cpp @@ -7370,7 +7370,8 @@ bool DiagnoseUnguardedAvailability::VisitTypeLoc(TypeLoc Ty) { const Type *TyPtr = Ty.getTypePtr(); - SourceRange Range{Ty.getBeginLoc(), Ty.getEndLoc()}; + SourceRange Range(StmtStack.back()->getLocStart(), + StmtStack.back()->getLocEnd()); if (const TagType *TT = dyn_cast(TyPtr)) { TagDecl *TD = TT->getDecl(); Index: test/SemaObjC/unguarded-availability.m =================================================================== --- test/SemaObjC/unguarded-availability.m +++ test/SemaObjC/unguarded-availability.m @@ -135,6 +135,17 @@ func_10_12(); }; +AVAILABLE_10_12 +__attribute__((objc_root_class)) +@interface InterWithProp // expected-note 2 {{marked partial here}} +@property int x; +@end + +void test_property(void) { + int y = InterWithProp.x; // expected-warning{{'InterWithProp' is only available on macOS 10.12 or newer}} expected-note{{@available}} + InterWithProp.x = y; // expected-warning{{'InterWithProp' is only available on macOS 10.12 or newer}} expected-note{{@available}} +} + #ifdef OBJCPP int f(char) AVAILABLE_10_12;