r199664 - Since the diagnostics engine understands Attr objects, this code is no longer required -- we can just pass in the attribute directly.

Aaron Ballman aaron at aaronballman.com
Mon Jan 20 07:06:09 PST 2014


Author: aaronballman
Date: Mon Jan 20 09:06:09 2014
New Revision: 199664

URL: http://llvm.org/viewvc/llvm-project?rev=199664&view=rev
Log:
Since the diagnostics engine understands Attr objects, this code is no longer required -- we can just pass in the attribute directly.

Modified:
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=199664&r1=199663&r2=199664&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Jan 20 09:06:09 2014
@@ -1245,15 +1245,6 @@ static void handleReturnsNonNullAttr(Sem
                                Attr.getAttributeSpellingListIndex()));
 }
 
-static const char *ownershipKindToDiagName(OwnershipAttr::OwnershipKind K) {
-  switch (K) {
-    case OwnershipAttr::Holds:    return "'ownership_holds'";
-    case OwnershipAttr::Takes:    return "'ownership_takes'";
-    case OwnershipAttr::Returns:  return "'ownership_returns'";
-  }
-  llvm_unreachable("unknown ownership");
-}
-
 static void handleOwnershipAttr(Sema &S, Decl *D, const AttributeList &AL) {
   // This attribute must be applied to a function declaration. The first
   // argument to the attribute must be an identifier, the name of the resource,
@@ -1339,7 +1330,7 @@ static void handleOwnershipAttr(Sema &S,
       if ((*i)->getOwnKind() != K && (*i)->args_end() !=
           std::find((*i)->args_begin(), (*i)->args_end(), Idx)) {
         S.Diag(AL.getLoc(), diag::err_attributes_are_not_compatible)
-          << AL.getName() << ownershipKindToDiagName((*i)->getOwnKind());
+          << AL.getName() << *i;
         return;
       }
     }





More information about the cfe-commits mailing list