r196155 - The CUDA device attribute doesn't need custom logic to check the number of attribute arguments (the common attribute handler already does this). Switching to use the simple attribute handler. No functional change intended.

Aaron Ballman aaron at aaronballman.com
Mon Dec 2 13:09:08 PST 2013


Author: aaronballman
Date: Mon Dec  2 15:09:08 2013
New Revision: 196155

URL: http://llvm.org/viewvc/llvm-project?rev=196155&view=rev
Log:
The CUDA device attribute doesn't need custom logic to check the number of attribute arguments (the common attribute handler already does this). Switching to use the simple attribute handler. No functional change intended.

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=196155&r1=196154&r2=196155&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Dec  2 15:09:08 2013
@@ -3143,19 +3143,6 @@ static void handleNoDebugAttr(Sema &S, D
                          Attr.getAttributeSpellingListIndex()));
 }
 
-static void handleDeviceAttr(Sema &S, Decl *D, const AttributeList &Attr) {
-  // check the attribute arguments.
-  if (Attr.getNumArgs() != 0) {
-    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
-      << Attr.getName() << 0;
-    return;
-  }
-
-  D->addAttr(::new (S.Context)
-              CUDADeviceAttr(Attr.getRange(), S.Context,
-                            Attr.getAttributeSpellingListIndex()));
-}
-
 static void handleGlobalAttr(Sema &S, Decl *D, const AttributeList &Attr) {
   FunctionDecl *FD = cast<FunctionDecl>(D);
   if (!FD->getResultType()->isVoidType()) {
@@ -3954,7 +3941,8 @@ static void ProcessDeclAttribute(Sema &S
   case AttributeList::AT_Format:      handleFormatAttr      (S, D, Attr); break;
   case AttributeList::AT_FormatArg:   handleFormatArgAttr   (S, D, Attr); break;
   case AttributeList::AT_CUDAGlobal:  handleGlobalAttr      (S, D, Attr); break;
-  case AttributeList::AT_CUDADevice:  handleDeviceAttr      (S, D, Attr); break;
+  case AttributeList::AT_CUDADevice:
+    handleSimpleAttribute<CUDADeviceAttr>(S, D, Attr); break;
   case AttributeList::AT_CUDAHost:
     handleSimpleAttribute<CUDAHostAttr>(S, D, Attr); break;
   case AttributeList::AT_GNUInline:   handleGNUInlineAttr   (S, D, Attr); break;





More information about the cfe-commits mailing list