diff options
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 5976c2c9f34..cbac36b7bff 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -137,7 +137,7 @@ DiagnoseAvailabilityOfDecl(Sema &S, NamedDecl *D, SourceLocation Loc, const ObjCPropertyDecl *ObjCPDecl = nullptr; if (Result == AR_Deprecated || Result == AR_Unavailable || - AR_NotYetIntroduced) { + Result == AR_NotYetIntroduced) { if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) { if (const ObjCPropertyDecl *PD = MD->findPropertyDecl()) { AvailabilityResult PDeclResult = PD->getAvailability(nullptr); @@ -159,11 +159,20 @@ DiagnoseAvailabilityOfDecl(Sema &S, NamedDecl *D, SourceLocation Loc, break; case AR_NotYetIntroduced: { + // With nopartial, the compiler will emit delayed error just like how + // "deprecated, unavailable" are handled. + AvailabilityAttr *AA = D->getAttr<AvailabilityAttr>(); + if (AA && AA->getNopartial() && + S.getCurContextAvailability() != AR_NotYetIntroduced) + S.EmitAvailabilityWarning(Sema::AD_NotYetIntroduced, + D, Message, Loc, UnknownObjCClass, ObjCPDecl, + ObjCPropertyAccess); + // Don't do this for enums, they can't be redeclared. if (isa<EnumConstantDecl>(D) || isa<EnumDecl>(D)) break; - bool Warn = !D->getAttr<AvailabilityAttr>()->isInherited(); + bool Warn = !AA->isInherited(); // Objective-C method declarations in categories are not modelled as // redeclarations, so manually look for a redeclaration in a category // if necessary. |