]> granicus.if.org Git - clang/commitdiff
Simplified code for deprecated attribute wih message a little.
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 6 Oct 2010 22:20:08 +0000 (22:20 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 6 Oct 2010 22:20:08 +0000 (22:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115856 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp
lib/Sema/SemaExpr.cpp

index 1376472eec0a4a8d8c68277853a118500d28a62b..3e1ced29a8d031b06462dbe0ca9c4b0eabb7a2f1 100644 (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
index d54a85822100da98d910aa697e764bcbbce7fd04..fa1ce7a21c570d77dcd88147a3ebe43cacf84773 100644 (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);
   }