summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 9351c52afbc..bfb82ac1388 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -1916,6 +1916,7 @@ AvailabilityAttr *Sema::mergeAvailabilityAttr(NamedDecl *D, SourceRange Range,
VersionTuple Obsoleted,
bool IsUnavailable,
StringRef Message,
+ bool IsNopartial,
AvailabilityMergeKind AMK,
unsigned AttrSpellingListIndex) {
VersionTuple MergedIntroduced = Introduced;
@@ -2062,7 +2063,7 @@ AvailabilityAttr *Sema::mergeAvailabilityAttr(NamedDecl *D, SourceRange Range,
return ::new (Context) AvailabilityAttr(Range, Context, Platform,
Introduced, Deprecated,
Obsoleted, IsUnavailable, Message,
- AttrSpellingListIndex);
+ IsNopartial, AttrSpellingListIndex);
}
return nullptr;
}
@@ -2089,6 +2090,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();
StringRef Str;
if (const StringLiteral *SE =
dyn_cast_or_null<StringLiteral>(Attr.getMessageExpr()))
@@ -2099,6 +2101,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D,
Deprecated.Version,
Obsoleted.Version,
IsUnavailable, Str,
+ IsNopartial,
Sema::AMK_None,
Index);
if (NewAttr)
@@ -2143,6 +2146,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D,
NewDeprecated,
NewObsoleted,
IsUnavailable, Str,
+ IsNopartial,
Sema::AMK_None,
Index);
if (NewAttr)
@@ -2165,6 +2169,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D,
Deprecated.Version,
Obsoleted.Version,
IsUnavailable, Str,
+ IsNopartial,
Sema::AMK_None,
Index);
if (NewAttr)
@@ -5957,6 +5962,14 @@ 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()) {
@@ -5983,10 +5996,22 @@ 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);
- Sema::AvailabilityDiagnostic AD = DD.Kind == DelayedDiagnostic::Deprecation
- ? Sema::AD_Deprecation
- : Sema::AD_Unavailable;
+ 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.Triggered = true;
DoEmitAvailabilityWarning(
S, AD, Ctx, DD.getDeprecationDecl(), DD.getDeprecationMessage(), DD.Loc,
OpenPOWER on IntegriCloud