[cfe-commits] r57100 - /cfe/trunk/lib/AST/Type.cpp

Daniel Dunbar daniel at zuster.org
Sat Oct 4 22:43:11 PDT 2008


Author: ddunbar
Date: Sun Oct  5 00:43:11 2008
New Revision: 57100

URL: http://llvm.org/viewvc/llvm-project?rev=57100&view=rev
Log:
Make VectorType printing less broken.
 - Print size as number of elements times "sizeof(elt type)", not
   perfect but better than just printing the completely wrong type.

Modified:
    cfe/trunk/lib/AST/Type.cpp

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

==============================================================================
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Sun Oct  5 00:43:11 2008
@@ -921,11 +921,11 @@
 }
 
 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 {





More information about the cfe-commits mailing list