summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp1
-rw-r--r--clang/lib/Parse/ParseDecl.cpp24
-rw-r--r--clang/lib/Parse/Parser.cpp1
-rw-r--r--clang/lib/Sema/SemaDecl.cpp3
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp14
5 files changed, 10 insertions, 33 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 50ce2719d36..36255a81144 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -1074,7 +1074,6 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
.Case("attribute_availability_tvos", true)
.Case("attribute_availability_watchos", true)
.Case("attribute_availability_with_strict", true)
- .Case("attribute_availability_with_replacement", true)
.Case("attribute_availability_in_templates", true)
.Case("attribute_cf_returns_not_retained", true)
.Case("attribute_cf_returns_retained", true)
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index fef5d8d4441..52f3f9fe504 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -833,8 +833,7 @@ VersionTuple Parser::ParseVersionTuple(SourceRange &Range) {
/// \brief Parse the contents of the "availability" attribute.
///
/// availability-attribute:
-/// 'availability' '(' platform ',' opt-strict version-arg-list,
-/// opt-replacement, opt-message')'
+/// 'availability' '(' platform ',' opt-strict version-arg-list, opt-message')'
///
/// platform:
/// identifier
@@ -851,8 +850,6 @@ VersionTuple Parser::ParseVersionTuple(SourceRange &Range) {
/// 'deprecated' '=' version
/// 'obsoleted' = version
/// 'unavailable'
-/// opt-replacement:
-/// 'replacement' '=' <string>
/// opt-message:
/// 'message' '=' <string>
void Parser::ParseAvailabilityAttribute(IdentifierInfo &Availability,
@@ -864,7 +861,7 @@ void Parser::ParseAvailabilityAttribute(IdentifierInfo &Availability,
AttributeList::Syntax Syntax) {
enum { Introduced, Deprecated, Obsoleted, Unknown };
AvailabilityChange Changes[Unknown];
- ExprResult MessageExpr, ReplacementExpr;
+ ExprResult MessageExpr;
// Opening '('.
BalancedDelimiterTracker T(*this, tok::l_paren);
@@ -896,10 +893,9 @@ void Parser::ParseAvailabilityAttribute(IdentifierInfo &Availability,
Ident_unavailable = PP.getIdentifierInfo("unavailable");
Ident_message = PP.getIdentifierInfo("message");
Ident_strict = PP.getIdentifierInfo("strict");
- Ident_replacement = PP.getIdentifierInfo("replacement");
}
- // Parse the optional "strict", the optional "replacement" and the set of
+ // Parse the optional "strict" and the set of
// introductions/deprecations/removals.
SourceLocation UnavailableLoc, StrictLoc;
do {
@@ -935,17 +931,14 @@ void Parser::ParseAvailabilityAttribute(IdentifierInfo &Availability,
return;
}
ConsumeToken();
- if (Keyword == Ident_message || Keyword == Ident_replacement) {
+ if (Keyword == Ident_message) {
if (Tok.isNot(tok::string_literal)) {
Diag(Tok, diag::err_expected_string_literal)
<< /*Source='availability attribute'*/2;
SkipUntil(tok::r_paren, StopAtSemi);
return;
}
- if (Keyword == Ident_message)
- MessageExpr = ParseStringLiteralExpression();
- else
- ReplacementExpr = ParseStringLiteralExpression();
+ MessageExpr = ParseStringLiteralExpression();
// Also reject wide string literals.
if (StringLiteral *MessageStringLiteral =
cast_or_null<StringLiteral>(MessageExpr.get())) {
@@ -957,10 +950,7 @@ void Parser::ParseAvailabilityAttribute(IdentifierInfo &Availability,
return;
}
}
- if (Keyword == Ident_message)
- break;
- else
- continue;
+ break;
}
// Special handling of 'NA' only when applied to introduced or
@@ -1047,7 +1037,7 @@ void Parser::ParseAvailabilityAttribute(IdentifierInfo &Availability,
Changes[Deprecated],
Changes[Obsoleted],
UnavailableLoc, MessageExpr.get(),
- Syntax, StrictLoc, ReplacementExpr.get());
+ Syntax, StrictLoc);
}
/// \brief Parse the contents of the "objc_bridge_related" attribute.
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index 07f60cbbe16..9ef57cb5384 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -492,7 +492,6 @@ void Parser::Initialize() {
Ident_obsoleted = nullptr;
Ident_unavailable = nullptr;
Ident_strict = nullptr;
- Ident_replacement = nullptr;
Ident__except = nullptr;
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 2f50b701cad..d8740d2beb1 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2196,8 +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->getStrict(),
- AA->getReplacement(), 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 c90d6236c18..18065cb52d8 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -1941,7 +1941,6 @@ AvailabilityAttr *Sema::mergeAvailabilityAttr(NamedDecl *D, SourceRange Range,
bool IsUnavailable,
StringRef Message,
bool IsStrict,
- StringRef Replacement,
AvailabilityMergeKind AMK,
unsigned AttrSpellingListIndex) {
VersionTuple MergedIntroduced = Introduced;
@@ -2088,8 +2087,7 @@ AvailabilityAttr *Sema::mergeAvailabilityAttr(NamedDecl *D, SourceRange Range,
return ::new (Context) AvailabilityAttr(Range, Context, Platform,
Introduced, Deprecated,
Obsoleted, IsUnavailable, Message,
- IsStrict, Replacement,
- AttrSpellingListIndex);
+ IsStrict, AttrSpellingListIndex);
}
return nullptr;
}
@@ -2121,17 +2119,13 @@ static void handleAvailabilityAttr(Sema &S, Decl *D,
if (const StringLiteral *SE =
dyn_cast_or_null<StringLiteral>(Attr.getMessageExpr()))
Str = SE->getString();
- StringRef Replacement;
- if (const StringLiteral *SE =
- dyn_cast_or_null<StringLiteral>(Attr.getReplacementExpr()))
- Replacement = SE->getString();
AvailabilityAttr *NewAttr = S.mergeAvailabilityAttr(ND, Attr.getRange(), II,
Introduced.Version,
Deprecated.Version,
Obsoleted.Version,
IsUnavailable, Str,
- IsStrict, Replacement,
+ IsStrict,
Sema::AMK_None,
Index);
if (NewAttr)
@@ -2177,7 +2171,6 @@ static void handleAvailabilityAttr(Sema &S, Decl *D,
NewObsoleted,
IsUnavailable, Str,
IsStrict,
- Replacement,
Sema::AMK_None,
Index);
if (NewAttr)
@@ -2201,7 +2194,6 @@ static void handleAvailabilityAttr(Sema &S, Decl *D,
Obsoleted.Version,
IsUnavailable, Str,
IsStrict,
- Replacement,
Sema::AMK_None,
Index);
if (NewAttr)
@@ -6237,8 +6229,6 @@ static void DoEmitAvailabilityWarning(Sema &S, Sema::AvailabilityDiagnostic K,
if (K == Sema::AD_Deprecation) {
if (auto attr = D->getAttr<DeprecatedAttr>())
Replacement = attr->getReplacement();
- if (auto attr = D->getAttr<AvailabilityAttr>())
- Replacement = attr->getReplacement();
if (!Replacement.empty())
UseRange =
OpenPOWER on IntegriCloud