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

Mike Stump mrs at apple.com
Sat Jul 25 16:24:03 PDT 2009


Author: mrs
Date: Sat Jul 25 18:24:03 2009
New Revision: 77097

URL: http://llvm.org/viewvc/llvm-project?rev=77097&view=rev
Log:
Preserve qualifiers.

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=77097&r1=77096&r2=77097&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sat Jul 25 18:24:03 2009
@@ -1042,15 +1042,21 @@
 }
 
 QualType ASTContext::getNoReturnType(QualType T) {
+  QualifierSet qs;
+  qs.strip(T);
   if (T->isPointerType()) {
     QualType Pointee = T->getAsPointerType()->getPointeeType();
     QualType ResultType = getNoReturnType(Pointee);
-    return getPointerType(ResultType);
+    ResultType = getPointerType(ResultType);
+    ResultType.setCVRQualifiers(T.getCVRQualifiers());
+    return qs.apply(ResultType, *this);
   }
   if (T->isBlockPointerType()) {
     QualType Pointee = T->getAsBlockPointerType()->getPointeeType();
     QualType ResultType = getNoReturnType(Pointee);
-    return getBlockPointerType(ResultType);
+    ResultType = getBlockPointerType(ResultType);
+    ResultType.setCVRQualifiers(T.getCVRQualifiers());
+    return qs.apply(ResultType, *this);
   }    
   if (!T->isFunctionType())
     assert(0 && "can't noreturn qualify non-pointer to function or block type");
@@ -2157,7 +2163,7 @@
     const Type *UT = qualifiers.strip(QT);
     if (const ArrayType *AT = getAsArrayType(QualType(UT,0))) {
       QT = AT->getElementType();
-    }else {
+    } else {
       return qualifiers.apply(QT, *this);
     }
   }
@@ -3369,6 +3375,7 @@
     allLTypes = false;
   if (getCanonicalType(retType) != getCanonicalType(rbase->getResultType()))
     allRTypes = false;
+  // FIXME: double check this
   bool NoReturn = lbase->getNoReturnAttr() || rbase->getNoReturnAttr();
   if (NoReturn != lbase->getNoReturnAttr())
     allLTypes = false;





More information about the cfe-commits mailing list