]> granicus.if.org Git - clang/commitdiff
Make VectorType printing less broken.
authorDaniel Dunbar <daniel@zuster.org>
Sun, 5 Oct 2008 05:43:11 +0000 (05:43 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sun, 5 Oct 2008 05:43:11 +0000 (05:43 +0000)
 - Print size as number of elements times "sizeof(elt type)", not
   perfect but better than just printing the completely wrong type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57100 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Type.cpp

index e35525df9c534da2ded173602cb235311c6382ec..74e52fef88fd4da22fd0c2a8950956e757a70df4 100644 (file)
@@ -921,11 +921,11 @@ void VariableArrayType::getAsStringInternal(std::string &S) const {
 }
 
 void VectorType::getAsStringInternal(std::string &S) const {
+  // FIXME: We prefer to print the size directly here, but have no way
+  // to get the size of the type.
   S += " __attribute__((__vector_size__(";
-  // FIXME: should multiply by element size somehow.
-  S += llvm::utostr_32(NumElements*4); // convert back to bytes.
-  S += ")))";
-  ElementType.getAsStringInternal(S);
+  S += llvm::utostr_32(NumElements); // convert back to bytes.
+  S += " * sizeof(" + ElementType.getAsString() + "))))";
 }
 
 void ExtVectorType::getAsStringInternal(std::string &S) const {