Refine r251469 to give better (and more localizable) diagnostics

for all the reasons that ARC makes things implicitly unavailable.

llvm-svn: 251496
This commit is contained in:
John McCall
2015-10-28 05:03:19 +00:00
parent 9b1534df9d
commit c6af8c606d
12 changed files with 122 additions and 71 deletions

View File

@@ -296,7 +296,7 @@ Sema::~Sema() {
/// make the relevant declaration unavailable instead of erroring, do
/// so and return true.
bool Sema::makeUnavailableInSystemHeader(SourceLocation loc,
StringRef msg) {
UnavailableAttr::ImplicitReason reason) {
// If we're not in a function, it's an error.
FunctionDecl *fn = dyn_cast<FunctionDecl>(CurContext);
if (!fn) return false;
@@ -312,7 +312,7 @@ bool Sema::makeUnavailableInSystemHeader(SourceLocation loc,
// If the function is already unavailable, it's not an error.
if (fn->hasAttr<UnavailableAttr>()) return true;
fn->addAttr(UnavailableAttr::CreateImplicit(Context, msg, loc));
fn->addAttr(UnavailableAttr::CreateImplicit(Context, "", reason, loc));
return true;
}