[cfe-commits] r68761 - /cfe/trunk/lib/AST/ASTContext.cpp

Anders Carlsson andersca at mac.com
Thu Apr 9 21:47:03 PDT 2009


Author: andersca
Date: Thu Apr  9 23:47:03 2009
New Revision: 68761

URL: http://llvm.org/viewvc/llvm-project?rev=68761&view=rev
Log:
Use the same alignment for reference declarations as for pointer declarations.

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

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

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu Apr  9 23:47:03 2009
@@ -306,8 +306,11 @@
 
   if (const ValueDecl *VD = dyn_cast<ValueDecl>(D)) {
     QualType T = VD->getType();
-    // Incomplete or function types default to 1.
-    if (!T->isIncompleteType() && !T->isFunctionType()) {
+    if (const ReferenceType* RT = T->getAsReferenceType()) {
+      unsigned AS = RT->getPointeeType().getAddressSpace();
+      Align = Target.getPointerWidth(AS);
+    } else if (!T->isIncompleteType() && !T->isFunctionType()) {
+      // Incomplete or function types default to 1.
       while (isa<VariableArrayType>(T) || isa<IncompleteArrayType>(T))
         T = cast<ArrayType>(T)->getElementType();
 





More information about the cfe-commits mailing list