forked from OSchip/llvm-project
Simplified code for deprecated attribute wih message a little.
llvm-svn: 115856
This commit is contained in:
parent
524e60b4e4
commit
776653a70a
|
@ -2552,7 +2552,7 @@ void Sema::HandleDelayedDeprecationCheck(DelayedDiagnostic &DD,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DD.Triggered = true;
|
DD.Triggered = true;
|
||||||
if (strlen(DD.DeprecationData.Message))
|
if (DD.DeprecationData.Message)
|
||||||
Diag(DD.Loc, diag::warn_deprecated_message)
|
Diag(DD.Loc, diag::warn_deprecated_message)
|
||||||
<< DD.DeprecationData.Decl->getDeclName()
|
<< DD.DeprecationData.Decl->getDeclName()
|
||||||
<< DD.DeprecationData.Message;
|
<< DD.DeprecationData.Message;
|
||||||
|
@ -2573,7 +2573,7 @@ void Sema::EmitDeprecationWarning(NamedDecl *D, const char * Message,
|
||||||
// Otherwise, don't warn if our current context is deprecated.
|
// Otherwise, don't warn if our current context is deprecated.
|
||||||
if (isDeclDeprecated(cast<Decl>(CurContext)))
|
if (isDeclDeprecated(cast<Decl>(CurContext)))
|
||||||
return;
|
return;
|
||||||
if (strlen(Message))
|
if (Message)
|
||||||
Diag(Loc, diag::warn_deprecated_message) << D->getDeclName()
|
Diag(Loc, diag::warn_deprecated_message) << D->getDeclName()
|
||||||
<< Message;
|
<< Message;
|
||||||
else
|
else
|
||||||
|
|
|
@ -59,7 +59,7 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc) {
|
||||||
// See if the decl is deprecated.
|
// See if the decl is deprecated.
|
||||||
if (const DeprecatedAttr *DA = D->getAttr<DeprecatedAttr>()) {
|
if (const DeprecatedAttr *DA = D->getAttr<DeprecatedAttr>()) {
|
||||||
const char *Message =
|
const char *Message =
|
||||||
DA->getMessage().empty() ? "" : DA->getMessage().data();
|
DA->getMessage().empty() ? 0 : DA->getMessage().data();
|
||||||
EmitDeprecationWarning(D, Message, Loc);
|
EmitDeprecationWarning(D, Message, Loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue