Skip to content

[clang] Downgrade err_nserrordomain_invalid_decl to a warning #2368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -9751,6 +9751,8 @@ def err_nsreturns_retained_attribute_mismatch : Error<
" attributes">;
def err_nserrordomain_invalid_decl : Error<
"domain argument %select{|%1 }0does not refer to global constant">;
def warn_nserrordomain_invalid_decl : Warning<
"domain argument %select{|%1 }0does not refer to global constant">;
def err_nserrordomain_wrong_type : Error<
"domain argument %0 does not point to an NSString or CFString constant">;

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaDeclAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5545,7 +5545,7 @@ static void handleNSErrorDomain(Sema &S, Decl *D, const ParsedAttr &AL) {

auto *DRE = dyn_cast<DeclRefExpr>(AL.getArgAsExpr(0));
if (!DRE) {
S.Diag(Loc, diag::err_nserrordomain_invalid_decl) << 0;
S.Diag(Loc, diag::warn_nserrordomain_invalid_decl) << 0;
return;
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/Sema/ns_error_enum.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ typedef NS_ERROR_ENUM(unsigned char, MyErrorEnumInvalid, InvalidDomain) {
};

typedef NS_ERROR_ENUM(unsigned char, MyErrorEnumInvalid, "domain-string");
// expected-error@-1{{domain argument does not refer to global constant}}
// expected-warning@-1{{domain argument does not refer to global constant}}

void foo() {}
typedef NS_ERROR_ENUM(unsigned char, MyErrorEnumInvalidFunction, foo);
Expand Down