[cfe-commits] r44358 - in /cfe/trunk: AST/Type.cpp Sema/SemaDecl.cpp

Chris Lattner sabre at nondot.org
Mon Nov 26 23:28:19 PST 2007


Author: lattner
Date: Tue Nov 27 01:28:18 2007
New Revision: 44358

URL: http://llvm.org/viewvc/llvm-project?rev=44358&view=rev
Log:
handle __vector_size__ like vector_size

Modified:
    cfe/trunk/AST/Type.cpp
    cfe/trunk/Sema/SemaDecl.cpp

Modified: cfe/trunk/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Type.cpp?rev=44358&r1=44357&r2=44358&view=diff

==============================================================================
--- cfe/trunk/AST/Type.cpp (original)
+++ cfe/trunk/AST/Type.cpp Tue Nov 27 01:28:18 2007
@@ -687,7 +687,7 @@
 }
 
 void VectorType::getAsStringInternal(std::string &S) const {
-  S += " __attribute__((vector_size(";
+  S += " __attribute__((__vector_size__(";
   // FIXME: should multiply by element size somehow.
   S += llvm::utostr_32(NumElements*4); // convert back to bytes.
   S += ")))";

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=44358&r1=44357&r2=44358&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Tue Nov 27 01:28:18 2007
@@ -2470,7 +2470,8 @@
 }
 
 void Sema::HandleDeclAttribute(Decl *New, AttributeList *rawAttr) {
-  if (strcmp(rawAttr->getAttributeName()->getName(), "vector_size") == 0) {
+  if (!strcmp(rawAttr->getAttributeName()->getName(), "vector_size") ||
+      !strcmp(rawAttr->getAttributeName()->getName(), "__vector_size__")) {
     if (ValueDecl *vDecl = dyn_cast<ValueDecl>(New)) {
       QualType newType = HandleVectorTypeAttribute(vDecl->getType(), rawAttr);
       if (!newType.isNull()) // install the new vector type into the decl
@@ -2483,7 +2484,8 @@
         tDecl->setUnderlyingType(newType);
     }
   }
-  if (strcmp(rawAttr->getAttributeName()->getName(), "ocu_vector_type") == 0) {
+  if (!strcmp(rawAttr->getAttributeName()->getName(), "ocu_vector_type") ||
+      !strcmp(rawAttr->getAttributeName()->getName(), "__ocu_vector_type__")) {
     if (TypedefDecl *tDecl = dyn_cast<TypedefDecl>(New))
       HandleOCUVectorTypeAttribute(tDecl, rawAttr);
     else





More information about the cfe-commits mailing list