]> granicus.if.org Git - clang/commitdiff
handle __vector_size__ like vector_size
authorChris Lattner <sabre@nondot.org>
Tue, 27 Nov 2007 07:28:18 +0000 (07:28 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 27 Nov 2007 07:28:18 +0000 (07:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44358 91177308-0d34-0410-b5e6-96231b3b80d8

AST/Type.cpp
Sema/SemaDecl.cpp

index 02a90047da833795938bca937ae36d642060bb12..b0ba353112c9c02b515af1dc12770ba818014e03 100644 (file)
@@ -687,7 +687,7 @@ void VariableArrayType::getAsStringInternal(std::string &S) const {
 }
 
 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 += ")))";
index 30505d66cd30a38ca68576fe98ca8edc04df052a..e50fe1101af4697899ae88944de8aeb2a9077725 100644 (file)
@@ -2470,7 +2470,8 @@ void Sema::AddTopLevelDecl(Decl *current, Decl *last) {
 }
 
 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 @@ void Sema::HandleDeclAttribute(Decl *New, AttributeList *rawAttr) {
         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