diff options
author | Manman Ren <manman.ren@gmail.com> | 2016-02-22 04:47:24 +0000 |
---|---|---|
committer | Manman Ren <manman.ren@gmail.com> | 2016-02-22 04:47:24 +0000 |
commit | d8039df5231cb23fe332e70ecb6f064179ec0352 (patch) | |
tree | d0399039d694dde88d0c9c3c61480797f145091f /clang/lib/Sema | |
parent | e59c8af7059f2ba1d65ea421a8ba4a739ed80372 (diff) | |
download | bcm5719-llvm-d8039df5231cb23fe332e70ecb6f064179ec0352.tar.gz bcm5719-llvm-d8039df5231cb23fe332e70ecb6f064179ec0352.zip |
Addressing review comments for r261163.
Use "strict" instead of "nopartial". Also make strictly not-introduced
share the same diagnostics as Obsolete and Unavailable.
rdar://23791325
llvm-svn: 261512
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/DelayedDiagnostic.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 40 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 7 |
4 files changed, 14 insertions, 39 deletions
diff --git a/clang/lib/Sema/DelayedDiagnostic.cpp b/clang/lib/Sema/DelayedDiagnostic.cpp index 853f5980545..ceea04f276c 100644 --- a/clang/lib/Sema/DelayedDiagnostic.cpp +++ b/clang/lib/Sema/DelayedDiagnostic.cpp @@ -35,9 +35,6 @@ DelayedDiagnostic::makeAvailability(Sema::AvailabilityDiagnostic AD, case Sema::AD_Unavailable: DD.Kind = Unavailable; break; - case Sema::AD_NotYetIntroduced: - DD.Kind = NotYetIntroduced; - break; case Sema::AD_Partial: llvm_unreachable("AD_Partial diags should not be delayed"); } @@ -66,7 +63,6 @@ void DelayedDiagnostic::Destroy() { case Deprecation: case Unavailable: - case NotYetIntroduced: delete [] DeprecationData.Message; break; diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index a775be9ea25..0f6470bf453 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -2196,7 +2196,7 @@ static bool mergeDeclAttribute(Sema &S, NamedDecl *D, NewAttr = S.mergeAvailabilityAttr(D, AA->getRange(), AA->getPlatform(), AA->getIntroduced(), AA->getDeprecated(), AA->getObsoleted(), AA->getUnavailable(), - AA->getMessage(), AA->getNopartial(), AMK, + AA->getMessage(), AA->getStrict(), AMK, AttrSpellingListIndex); else if (const auto *VA = dyn_cast<VisibilityAttr>(Attr)) NewAttr = S.mergeVisibilityAttr(D, VA->getRange(), VA->getVisibility(), diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index d2db4b92849..3f6af3d765b 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -1918,7 +1918,7 @@ AvailabilityAttr *Sema::mergeAvailabilityAttr(NamedDecl *D, SourceRange Range, VersionTuple Obsoleted, bool IsUnavailable, StringRef Message, - bool IsNopartial, + bool IsStrict, AvailabilityMergeKind AMK, unsigned AttrSpellingListIndex) { VersionTuple MergedIntroduced = Introduced; @@ -2065,7 +2065,7 @@ AvailabilityAttr *Sema::mergeAvailabilityAttr(NamedDecl *D, SourceRange Range, return ::new (Context) AvailabilityAttr(Range, Context, Platform, Introduced, Deprecated, Obsoleted, IsUnavailable, Message, - IsNopartial, AttrSpellingListIndex); + IsStrict, AttrSpellingListIndex); } return nullptr; } @@ -2092,7 +2092,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, AvailabilityChange Deprecated = Attr.getAvailabilityDeprecated(); AvailabilityChange Obsoleted = Attr.getAvailabilityObsoleted(); bool IsUnavailable = Attr.getUnavailableLoc().isValid(); - bool IsNopartial = Attr.getNopartialLoc().isValid(); + bool IsStrict = Attr.getStrictLoc().isValid(); StringRef Str; if (const StringLiteral *SE = dyn_cast_or_null<StringLiteral>(Attr.getMessageExpr())) @@ -2103,7 +2103,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, Deprecated.Version, Obsoleted.Version, IsUnavailable, Str, - IsNopartial, + IsStrict, Sema::AMK_None, Index); if (NewAttr) @@ -2148,7 +2148,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, NewDeprecated, NewObsoleted, IsUnavailable, Str, - IsNopartial, + IsStrict, Sema::AMK_None, Index); if (NewAttr) @@ -2171,7 +2171,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, Deprecated.Version, Obsoleted.Version, IsUnavailable, Str, - IsNopartial, + IsStrict, Sema::AMK_None, Index); if (NewAttr) @@ -5964,14 +5964,6 @@ static void DoEmitAvailabilityWarning(Sema &S, Sema::AvailabilityDiagnostic K, property_note_select = /* partial */ 2; available_here_select_kind = /* partial */ 3; break; - - case Sema::AD_NotYetIntroduced: - diag = diag::err_notyetintroduced; - diag_message = diag::err_notyetintroduced_message; - diag_fwdclass_message = diag::warn_notyetintroduced_fwdclass_message; - property_note_select = /* deprecated */ 3; - available_here_select_kind = /* notyetintroduced */ 4; - break; } if (!Message.empty()) { @@ -5998,22 +5990,10 @@ static void DoEmitAvailabilityWarning(Sema &S, Sema::AvailabilityDiagnostic K, static void handleDelayedAvailabilityCheck(Sema &S, DelayedDiagnostic &DD, Decl *Ctx) { assert(DD.Kind == DelayedDiagnostic::Deprecation || - DD.Kind == DelayedDiagnostic::Unavailable || - DD.Kind == DelayedDiagnostic::NotYetIntroduced); - Sema::AvailabilityDiagnostic AD; - switch (DD.Kind) { - case DelayedDiagnostic::Deprecation: - AD = Sema::AD_Deprecation; - break; - case DelayedDiagnostic::Unavailable: - AD = Sema::AD_Unavailable; - break; - case DelayedDiagnostic::NotYetIntroduced: - AD = Sema::AD_NotYetIntroduced; - break; - default: - llvm_unreachable("Expecting: deprecated, unavailable, not-yet-introduced"); - } + DD.Kind == DelayedDiagnostic::Unavailable); + Sema::AvailabilityDiagnostic AD = DD.Kind == DelayedDiagnostic::Deprecation + ? Sema::AD_Deprecation + : Sema::AD_Unavailable; DD.Triggered = true; DoEmitAvailabilityWarning( S, AD, Ctx, DD.getDeprecationDecl(), DD.getDeprecationMessage(), DD.Loc, diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index ad6280d6c74..bfbca298ce8 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -159,12 +159,11 @@ 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. + // With strict, the compiler will emit unavailable error. AvailabilityAttr *AA = D->getAttr<AvailabilityAttr>(); - if (AA && AA->getNopartial() && + if (AA && AA->getStrict() && S.getCurContextAvailability() != AR_NotYetIntroduced) - S.EmitAvailabilityWarning(Sema::AD_NotYetIntroduced, + S.EmitAvailabilityWarning(Sema::AD_Unavailable, D, Message, Loc, UnknownObjCClass, ObjCPDecl, ObjCPropertyAccess); |