Simplified code for deprecated attribute wih message a little.

llvm-svn: 115856
This commit is contained in:
Fariborz Jahanian 2010-10-06 22:20:08 +00:00
parent 524e60b4e4
commit 776653a70a
2 changed files with 3 additions and 3 deletions

View File

@ -2552,7 +2552,7 @@ void Sema::HandleDelayedDeprecationCheck(DelayedDiagnostic &DD,
return;
DD.Triggered = true;
if (strlen(DD.DeprecationData.Message))
if (DD.DeprecationData.Message)
Diag(DD.Loc, diag::warn_deprecated_message)
<< DD.DeprecationData.Decl->getDeclName()
<< 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.
if (isDeclDeprecated(cast<Decl>(CurContext)))
return;
if (strlen(Message))
if (Message)
Diag(Loc, diag::warn_deprecated_message) << D->getDeclName()
<< Message;
else

View File

@ -59,7 +59,7 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc) {
// See if the decl is deprecated.
if (const DeprecatedAttr *DA = D->getAttr<DeprecatedAttr>()) {
const char *Message =
DA->getMessage().empty() ? "" : DA->getMessage().data();
DA->getMessage().empty() ? 0 : DA->getMessage().data();
EmitDeprecationWarning(D, Message, Loc);
}