[cfe-commits] r39395 - in /cfe/cfe/trunk: AST/ASTContext.cpp AST/Builtins.cpp AST/Expr.cpp AST/Sema.cpp AST/Sema.h AST/SemaDecl.cpp AST/SemaExpr.cpp AST/SemaExprCXX.cpp AST/SemaType.cpp AST/Type.cpp Sema/Sema.cpp Sema/Sema.h Sema/SemaDecl.cpp Sema/SemaExpr.cpp Sema/SemaExprCXX.cpp Sema/SemaType.cpp include/clang/AST/ASTContext.h include/clang/AST/Builtins.h include/clang/AST/Decl.h include/clang/AST/Expr.h include/clang/AST/ExprCXX.h include/clang/AST/Type.h include/clang/Parse/DeclSpec.h

Steve Naroff snaroff at apple.com
Wed Jul 11 09:43:55 PDT 2007


Author: snaroff
Date: Wed Jul 11 11:43:55 2007
New Revision: 39395

URL: http://llvm.org/viewvc/llvm-project?rev=39395&view=rev
Log:
Bug #:
Submitted by:
Reviewed by:
-Changed the name of TypeRef to QualType. Many diffs.
-Changed the QualType constructor to require Quals be passed. This makes the code a bit
more verbose, however will make the code easier to work on. Given the complexity
of types, this should help spot bogosities.
-Changed the Expr constructor to require a QualType. Same motivation.

Modified:
    cfe/cfe/trunk/AST/ASTContext.cpp
    cfe/cfe/trunk/AST/Builtins.cpp
    cfe/cfe/trunk/AST/Expr.cpp
    cfe/cfe/trunk/AST/Sema.cpp
    cfe/cfe/trunk/AST/Sema.h
    cfe/cfe/trunk/AST/SemaDecl.cpp
    cfe/cfe/trunk/AST/SemaExpr.cpp
    cfe/cfe/trunk/AST/SemaExprCXX.cpp
    cfe/cfe/trunk/AST/SemaType.cpp
    cfe/cfe/trunk/AST/Type.cpp
    cfe/cfe/trunk/Sema/Sema.cpp
    cfe/cfe/trunk/Sema/Sema.h
    cfe/cfe/trunk/Sema/SemaDecl.cpp
    cfe/cfe/trunk/Sema/SemaExpr.cpp
    cfe/cfe/trunk/Sema/SemaExprCXX.cpp
    cfe/cfe/trunk/Sema/SemaType.cpp
    cfe/cfe/trunk/include/clang/AST/ASTContext.h
    cfe/cfe/trunk/include/clang/AST/Builtins.h
    cfe/cfe/trunk/include/clang/AST/Decl.h
    cfe/cfe/trunk/include/clang/AST/Expr.h
    cfe/cfe/trunk/include/clang/AST/ExprCXX.h
    cfe/cfe/trunk/include/clang/AST/Type.h
    cfe/cfe/trunk/include/clang/Parse/DeclSpec.h

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

==============================================================================
--- cfe/cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/cfe/trunk/AST/ASTContext.cpp Wed Jul 11 11:43:55 2007
@@ -83,8 +83,8 @@
 }
 
 
-void ASTContext::InitBuiltinType(TypeRef &R, BuiltinType::Kind K) {
-  Types.push_back((R = new BuiltinType(K)).getTypePtr());
+void ASTContext::InitBuiltinType(QualType &R, BuiltinType::Kind K) {
+  Types.push_back((R = QualType(new BuiltinType(K),0)).getTypePtr());
 }
 
 
@@ -125,7 +125,7 @@
 
 /// getPointerType - Return the uniqued reference to the type for a pointer to
 /// the specified type.
-TypeRef ASTContext::getPointerType(TypeRef T) {
+QualType ASTContext::getPointerType(QualType T) {
   // Unique pointers, to guarantee there is only one pointer of a particular
   // structure.
   FoldingSetNodeID ID;
@@ -133,11 +133,11 @@
   
   void *InsertPos = 0;
   if (PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
-    return PT;
+    return QualType(PT, 0);
   
   // If the pointee type isn't canonical, this won't be a canonical type either,
   // so fill in the canonical type field.
-  TypeRef Canonical = 0;
+  QualType Canonical;
   if (!T->isCanonical()) {
     Canonical = getPointerType(T.getCanonicalType());
    
@@ -148,13 +148,13 @@
   PointerType *New = new PointerType(T, Canonical);
   Types.push_back(New);
   PointerTypes.InsertNode(New, InsertPos);
-  return New;
+  return QualType(New, 0);
 }
 
 /// getArrayType - Return the unique reference to the type for an array of the
 /// specified element type.
-TypeRef ASTContext::getArrayType(TypeRef EltTy,ArrayType::ArraySizeModifier ASM,
-                                 unsigned EltTypeQuals, Expr *NumElts) {
+QualType ASTContext::getArrayType(QualType EltTy,ArrayType::ArraySizeModifier ASM,
+                                  unsigned EltTypeQuals, Expr *NumElts) {
   // Unique array types, to guarantee there is only one array of a particular
   // structure.
   FoldingSetNodeID ID;
@@ -162,11 +162,11 @@
       
   void *InsertPos = 0;
   if (ArrayType *ATP = ArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
-    return ATP;
+    return QualType(ATP, 0);
   
   // If the element type isn't canonical, this won't be a canonical type either,
   // so fill in the canonical type field.
-  TypeRef Canonical = 0;
+  QualType Canonical;
   if (!EltTy->isCanonical()) {
     Canonical = getArrayType(EltTy.getCanonicalType(), ASM, EltTypeQuals,
                              NumElts);
@@ -179,12 +179,12 @@
   ArrayType *New = new ArrayType(EltTy, ASM, EltTypeQuals, Canonical, NumElts);
   ArrayTypes.InsertNode(New, InsertPos);
   Types.push_back(New);
-  return New;
+  return QualType(New, 0);
 }
 
 /// getFunctionTypeNoProto - Return a K&R style C function type like 'int()'.
 ///
-TypeRef ASTContext::getFunctionTypeNoProto(TypeRef ResultTy) {
+QualType ASTContext::getFunctionTypeNoProto(QualType ResultTy) {
   // Unique functions, to guarantee there is only one function of a particular
   // structure.
   FoldingSetNodeID ID;
@@ -193,11 +193,11 @@
   void *InsertPos = 0;
   if (FunctionTypeNoProto *FT = 
         FunctionTypeNoProtos.FindNodeOrInsertPos(ID, InsertPos))
-    return FT;
+    return QualType(FT, 0);
   
-  TypeRef Canonical = 0;
+  QualType Canonical;
   if (!ResultTy->isCanonical()) {
-    Canonical =getFunctionTypeNoProto(ResultTy.getCanonicalType()).getTypePtr();
+    Canonical = getFunctionTypeNoProto(ResultTy.getCanonicalType());
     
     // Get the new insert position for the node we care about.
     FunctionTypeNoProto *NewIP =
@@ -208,13 +208,13 @@
   FunctionTypeNoProto *New = new FunctionTypeNoProto(ResultTy, Canonical);
   Types.push_back(New);
   FunctionTypeProtos.InsertNode(New, InsertPos);
-  return New;
+  return QualType(New, 0);
 }
 
 /// getFunctionType - Return a normal function type with a typed argument
 /// list.  isVariadic indicates whether the argument list includes '...'.
-TypeRef ASTContext::getFunctionType(TypeRef ResultTy, TypeRef *ArgArray,
-                                    unsigned NumArgs, bool isVariadic) {
+QualType ASTContext::getFunctionType(QualType ResultTy, QualType *ArgArray,
+                                     unsigned NumArgs, bool isVariadic) {
   // Unique functions, to guarantee there is only one function of a particular
   // structure.
   FoldingSetNodeID ID;
@@ -223,7 +223,7 @@
   void *InsertPos = 0;
   if (FunctionTypeProto *FTP = 
         FunctionTypeProtos.FindNodeOrInsertPos(ID, InsertPos))
-    return FTP;
+    return QualType(FTP, 0);
     
   // Determine whether the type being created is already canonical or not.  
   bool isCanonical = ResultTy->isCanonical();
@@ -232,9 +232,9 @@
       isCanonical = false;
 
   // If this type isn't canonical, get the canonical version of it.
-  TypeRef Canonical = 0;
+  QualType Canonical;
   if (!isCanonical) {
-    SmallVector<TypeRef, 16> CanonicalArgs;
+    SmallVector<QualType, 16> CanonicalArgs;
     CanonicalArgs.reserve(NumArgs);
     for (unsigned i = 0; i != NumArgs; ++i)
       CanonicalArgs.push_back(ArgArray[i].getCanonicalType());
@@ -253,41 +253,41 @@
   // variable size array (for parameter types) at the end of them.
   FunctionTypeProto *FTP = 
     (FunctionTypeProto*)malloc(sizeof(FunctionTypeProto) + 
-                               (NumArgs-1)*sizeof(TypeRef));
+                               (NumArgs-1)*sizeof(QualType));
   new (FTP) FunctionTypeProto(ResultTy, ArgArray, NumArgs, isVariadic,
                               Canonical);
   
   Types.push_back(FTP);
   FunctionTypeProtos.InsertNode(FTP, InsertPos);
-  return FTP;
+  return QualType(FTP, 0);
 }
 
 /// getTypedefType - Return the unique reference to the type for the
 /// specified typename decl.
-TypeRef ASTContext::getTypedefType(TypedefDecl *Decl) {
-  if (Decl->TypeForDecl) return Decl->TypeForDecl;
+QualType ASTContext::getTypedefType(TypedefDecl *Decl) {
+  if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
   
-  TypeRef Canonical = Decl->getUnderlyingType().getCanonicalType();
+  QualType Canonical = Decl->getUnderlyingType().getCanonicalType();
   Decl->TypeForDecl = new TypedefType(Decl, Canonical);
   Types.push_back(Decl->TypeForDecl);
-  return Decl->TypeForDecl;
+  return QualType(Decl->TypeForDecl, 0);
 }
 
 /// getTagDeclType - Return the unique reference to the type for the
 /// specified TagDecl (struct/union/class/enum) decl.
-TypeRef ASTContext::getTagDeclType(TagDecl *Decl) {
+QualType ASTContext::getTagDeclType(TagDecl *Decl) {
   // The decl stores the type cache.
-  if (Decl->TypeForDecl) return Decl->TypeForDecl;
+  if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
   
-  Decl->TypeForDecl = new TagType(Decl, 0);
+  Decl->TypeForDecl = new TagType(Decl, QualType());
   Types.push_back(Decl->TypeForDecl);
-  return Decl->TypeForDecl;
+  return QualType(Decl->TypeForDecl, 0);
 }
 
 /// getSizeType - Return the unique type for "size_t" (C99 7.17), the result 
 /// of the sizeof operator (C99 6.5.3.4p4). The value is target dependent and 
 /// needs to agree with the definition in <stddef.h>. 
-TypeRef ASTContext::getSizeType() const {
+QualType ASTContext::getSizeType() const {
   // On Darwin, size_t is defined as a "long unsigned int". 
   // FIXME: should derive from "Target".
   return UnsignedLongTy; 

Modified: cfe/cfe/trunk/AST/Builtins.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Builtins.cpp?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/Builtins.cpp (original)
+++ cfe/cfe/trunk/AST/Builtins.cpp Wed Jul 11 11:43:55 2007
@@ -56,7 +56,7 @@
 
 /// DecodeTypeFromStr - This decodes one type descriptor from Str, advancing the
 /// pointer over the consumed characters.  This returns the resultant type.
-static TypeRef DecodeTypeFromStr(const char *&Str, ASTContext &Context) {
+static QualType DecodeTypeFromStr(const char *&Str, ASTContext &Context) {
   // Modifiers.
   bool Long = false, LongLong = false, Signed = false, Unsigned = false;
   
@@ -109,12 +109,12 @@
 }
 
 /// GetBuiltinType - Return the type for the specified builtin.
-TypeRef Builtin::Context::GetBuiltinType(unsigned id, ASTContext &Context)const{
+QualType Builtin::Context::GetBuiltinType(unsigned id, ASTContext &Context)const{
   const char *TypeStr = GetRecord(id).Type;
   
-  SmallVector<TypeRef, 8> ArgTypes;
+  SmallVector<QualType, 8> ArgTypes;
   
-  TypeRef ResType = DecodeTypeFromStr(TypeStr, Context);
+  QualType ResType = DecodeTypeFromStr(TypeStr, Context);
   while (TypeStr[0] && TypeStr[0] != '.')
     ArgTypes.push_back(DecodeTypeFromStr(TypeStr, Context));
   

Modified: cfe/cfe/trunk/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Expr.cpp?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/Expr.cpp (original)
+++ cfe/cfe/trunk/AST/Expr.cpp Wed Jul 11 11:43:55 2007
@@ -22,7 +22,7 @@
 //===----------------------------------------------------------------------===//
 
 StringLiteral::StringLiteral(const char *strData, unsigned byteLength, 
-                             bool Wide, TypeRef t) : 
+                             bool Wide, QualType t) : 
   Expr(StringLiteralClass, t) {
   // OPTIMIZE: could allocate this appended to the StringLiteral.
   char *AStrData = new char[byteLength];

Modified: cfe/cfe/trunk/AST/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Sema.cpp?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/Sema.cpp (original)
+++ cfe/cfe/trunk/AST/Sema.cpp Wed Jul 11 11:43:55 2007
@@ -31,7 +31,7 @@
   return true;
 }
 
-bool Sema::Diag(SourceLocation Loc, unsigned DiagID, TypeRef t) {
+bool Sema::Diag(SourceLocation Loc, unsigned DiagID, QualType t) {
   std::string Name;
   t.getAsString(Name);
   PP.Diag(Loc, DiagID, Name);

Modified: cfe/cfe/trunk/AST/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Sema.h?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/Sema.h (original)
+++ cfe/cfe/trunk/AST/Sema.h Wed Jul 11 11:43:55 2007
@@ -28,7 +28,7 @@
   class VarDecl;
   class TypedefDecl;
   class FunctionDecl;
-  class TypeRef;
+  class QualType;
   class LangOptions;
   class DeclaratorChunk;
   class LexerToken;
@@ -58,12 +58,12 @@
             const std::string &Msg = std::string());
   bool Diag(const LexerToken &Tok, unsigned DiagID,
             const std::string &M = std::string());
-  bool Diag(SourceLocation Loc, unsigned DiagID, TypeRef t);
+  bool Diag(SourceLocation Loc, unsigned DiagID, QualType t);
   
   //===--------------------------------------------------------------------===//
   // Type Analysis / Processing: SemaType.cpp.
   //
-  TypeRef GetTypeForDeclarator(Declarator &D, Scope *S);
+  QualType GetTypeForDeclarator(Declarator &D, Scope *S);
   
   virtual TypeResult ParseTypeName(Scope *S, Declarator &D);
   

Modified: cfe/cfe/trunk/AST/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaDecl.cpp?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/SemaDecl.cpp (original)
+++ cfe/cfe/trunk/AST/SemaDecl.cpp Wed Jul 11 11:43:55 2007
@@ -109,7 +109,7 @@
 Decl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, Scope *S) {
   Builtin::ID BID = (Builtin::ID)bid;
 
-  TypeRef R = Context.BuiltinInfo.GetBuiltinType(BID, Context);
+  QualType R = Context.BuiltinInfo.GetBuiltinType(BID, Context);
   FunctionDecl *New = new FunctionDecl(SourceLocation(), II, R);
   
   // Find translation-unit scope to insert this function into.
@@ -248,7 +248,7 @@
     }
     New = NewTD;
   } else if (D.isFunctionDeclarator()) {
-    TypeRef R = GetTypeForDeclarator(D, S);
+    QualType R = GetTypeForDeclarator(D, S);
     if (R.isNull()) return 0; // FIXME: "auto func();" passes through...
     
     FunctionDecl::StorageClass SC;
@@ -272,7 +272,7 @@
     }
     New = NewFD;
   } else {
-    TypeRef R = GetTypeForDeclarator(D, S);
+    QualType R = GetTypeForDeclarator(D, S);
     if (R.isNull()) return 0;
 
     VarDecl *NewVD;
@@ -355,7 +355,7 @@
   
   // FIXME: Handle storage class (auto, register). No declarator?
   VarDecl *New = new ParmVarDecl(PI.IdentLoc, II, 
-                                 TypeRef::getFromOpaquePtr(PI.TypeInfo), 
+                                 QualType::getFromOpaquePtr(PI.TypeInfo), 
                                  VarDecl::None);
 
   // If this has an identifier, add it to the scope stack.
@@ -464,7 +464,7 @@
 TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D) {
   assert(D.getIdentifier() && "Wrong callback for declspec withotu declarator");
   
-  TypeRef T = GetTypeForDeclarator(D, S);
+  QualType T = GetTypeForDeclarator(D, S);
   if (T.isNull()) return 0;
   
   // Scope manipulation handled by caller.
@@ -593,7 +593,7 @@
     
   }
   
-  TypeRef T = GetTypeForDeclarator(D, S);
+  QualType T = GetTypeForDeclarator(D, S);
   if (T.isNull()) return 0;
 
   return new FieldDecl(Loc, II, T);
@@ -729,7 +729,7 @@
     }
   }
   
-  TypeRef Ty = Context.getTagDeclType(TheEnumDecl);
+  QualType Ty = Context.getTagDeclType(TheEnumDecl);
   EnumConstantDecl *New = new EnumConstantDecl(IdLoc, Id, Ty);
   
   // Register this decl in the current scope stack.

Modified: cfe/cfe/trunk/AST/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaExpr.cpp?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/SemaExpr.cpp (original)
+++ cfe/cfe/trunk/AST/SemaExpr.cpp Wed Jul 11 11:43:55 2007
@@ -44,7 +44,7 @@
     StringTokLocs.push_back(StringToks[i].getLocation());
   
   // FIXME: handle wchar_t
-  TypeRef t = Context.getPointerType(Context.CharTy);
+  QualType t = Context.getPointerType(Context.CharTy);
   
   // FIXME: use factory.
   // Pass &StringTokLocs[0], StringTokLocs.size() to factory!
@@ -122,7 +122,7 @@
     return ExprResult(true);
 
   if (Literal.isIntegerLiteral()) {
-    TypeRef t;
+    QualType t;
     if (Literal.hasSuffix()) {
       if (Literal.isLong) 
         t = Literal.isUnsigned ? Context.UnsignedLongTy : Context.LongTy;
@@ -178,7 +178,7 @@
     return CheckIncrementDecrementOperand((Expr *)Input, OpLoc, Opc);
   
   // when all the check functions are written, this will go away...
-  return new UnaryOperator((Expr*)Input, Opc, 0);
+  return new UnaryOperator((Expr*)Input, Opc, QualType());
 }
 
 Action::ExprResult Sema::
@@ -189,7 +189,7 @@
   if (Ty == 0) return true;
   
   // Verify that this is a valid expression.
-  TypeRef ArgTy = TypeRef::getFromOpaquePtr(Ty);
+  QualType ArgTy = QualType::getFromOpaquePtr(Ty);
   
   if (isa<FunctionType>(ArgTy) && isSizeof) {
     // alignof(function) is allowed.
@@ -224,21 +224,21 @@
 Action::ExprResult Sema::
 ParseArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc,
                         ExprTy *Idx, SourceLocation RLoc) {
-  TypeRef t1 = ((Expr *)Base)->getType();
-  TypeRef t2 = ((Expr *)Idx)->getType();
+  QualType t1 = ((Expr *)Base)->getType();
+  QualType t2 = ((Expr *)Idx)->getType();
 
   assert(!t1.isNull() && "no type for array base expression");
   assert(!t2.isNull() && "no type for array index expression");
 
-  TypeRef canonT1 = t1.getCanonicalType();
-  TypeRef canonT2 = t2.getCanonicalType();
+  QualType canonT1 = t1.getCanonicalType();
+  QualType canonT2 = t2.getCanonicalType();
   
   // C99 6.5.2.1p2: the expression e1[e2] is by definition precisely equivalent
   // to the expression *((e1)+(e2)). This means the array "Base" may actually be 
   // in the subscript position. As a result, we need to derive the array base 
   // and index from the expression types.
   
-  TypeRef baseType, indexType;
+  QualType baseType, indexType;
   if (isa<ArrayType>(canonT1) || isa<PointerType>(canonT1)) {
     baseType = canonT1;
     indexType = canonT2;
@@ -253,7 +253,7 @@
     return Diag(LLoc, diag::err_typecheck_subscript);
 
   // FIXME: need to deal with const...
-  TypeRef resultType;
+  QualType resultType;
   if (ArrayType *ary = dyn_cast<ArrayType>(baseType)) {
     resultType = ary->getElementType();
   } else if (PointerType *ary = dyn_cast<PointerType>(baseType)) {
@@ -270,11 +270,11 @@
 ParseMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
                          tok::TokenKind OpKind, SourceLocation MemberLoc,
                          IdentifierInfo &Member) {
-  TypeRef qualifiedType = ((Expr *)Base)->getType();
+  QualType qualifiedType = ((Expr *)Base)->getType();
   
   assert(!qualifiedType.isNull() && "no type for member expression");
   
-  TypeRef canonType = qualifiedType.getCanonicalType();
+  QualType canonType = qualifiedType.getCanonicalType();
 
   if (OpKind == tok::arrow) {
     if (PointerType *PT = dyn_cast<PointerType>(canonType)) {
@@ -314,7 +314,7 @@
               SourceLocation RParenLoc, ExprTy *Op) {
   // If error parsing type, ignore.
   if (Ty == 0) return true;
-  return new CastExpr(TypeRef::getFromOpaquePtr(Ty), (Expr*)Op);
+  return new CastExpr(QualType::getFromOpaquePtr(Ty), (Expr*)Op);
 }
 
 
@@ -390,7 +390,7 @@
 
 Expr *Sema::ImplicitConversion(Expr *E) {
 #if 0
-  TypeRef t = E->getType();
+  QualType t = E->getType();
   if (t != 0) t.dump();
   else printf("no type for expr %s\n", E->getStmtClassName());
 #endif
@@ -428,11 +428,11 @@
 Action::ExprResult
 Sema::CheckIncrementDecrementOperand(Expr *op, SourceLocation OpLoc,
                                                unsigned OpCode) {
-  TypeRef qType = op->getType();
+  QualType qType = op->getType();
 
   assert(!qType.isNull() && "no type for increment/decrement expression");
 
-  TypeRef canonType = qType.getCanonicalType();
+  QualType canonType = qType.getCanonicalType();
 
   // C99 6.5.2.4p1
   if (const PointerType *pt = dyn_cast<PointerType>(canonType)) {

Modified: cfe/cfe/trunk/AST/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaExprCXX.cpp?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/SemaExprCXX.cpp (original)
+++ cfe/cfe/trunk/AST/SemaExprCXX.cpp Wed Jul 11 11:43:55 2007
@@ -33,7 +33,7 @@
   case tok::kw_static_cast:      Op = CXXCastExpr::StaticCast;      break;
   }
   
-  return new CXXCastExpr(Op, TypeRef::getFromOpaquePtr(Ty), (Expr*)E);
+  return new CXXCastExpr(Op, QualType::getFromOpaquePtr(Ty), (Expr*)E);
 }
 
 /// ParseCXXBoolLiteral - Parse {true,false} literals.

Modified: cfe/cfe/trunk/AST/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaType.cpp?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/SemaType.cpp (original)
+++ cfe/cfe/trunk/AST/SemaType.cpp Wed Jul 11 11:43:55 2007
@@ -21,12 +21,12 @@
 
 /// ConvertDeclSpecToType - Convert the specified declspec to the appropriate
 /// type object.  This returns null on error.
-static TypeRef ConvertDeclSpecToType(const DeclSpec &DS, ASTContext &Ctx) {
+static QualType ConvertDeclSpecToType(const DeclSpec &DS, ASTContext &Ctx) {
   // FIXME: Should move the logic from DeclSpec::Finish to here for validity
   // checking.
   
   switch (DS.getTypeSpecType()) {
-  default: return TypeRef(); // FIXME: Handle unimp cases!
+  default: return QualType(); // FIXME: Handle unimp cases!
   case DeclSpec::TST_void: return Ctx.VoidTy;
   case DeclSpec::TST_char:
     if (DS.getTypeSpecSign() == DeclSpec::TSS_unspecified)
@@ -100,8 +100,8 @@
 
 /// GetTypeForDeclarator - Convert the type for the specified declarator to Type
 /// instances.
-TypeRef Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
-  TypeRef T = ConvertDeclSpecToType(D.getDeclSpec(), Context);
+QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
+  QualType T = ConvertDeclSpecToType(D.getDeclSpec(), Context);
 
   // If there was an error parsing declspecs, return a null type pointer.
   if (T.isNull()) return T;
@@ -140,11 +140,11 @@
         T->getAsString(Name);
         Diag(D.getIdentifierLoc(), diag::err_illegal_decl_array_incomplete_type,
              Name);
-        return TypeRef();
+        return QualType();
       } else if (isa<FunctionType>(CanonicalT)) {
         Diag(D.getIdentifierLoc(), diag::err_illegal_decl_array_of_functions,
              D.getIdentifier()->getName());
-        return TypeRef();
+        return QualType();
       } else if (RecordType *EltTy = dyn_cast<RecordType>(CanonicalT)) {
         // If the element type is a struct or union that contains a variadic
         // array, reject it: C99 6.7.2.1p2.
@@ -152,7 +152,7 @@
           std::string Name;
           T->getAsString(Name);
           Diag(DeclType.Loc, diag::err_flexible_array_in_array, Name);
-          return TypeRef();
+          return QualType();
         }
       }
       T = Context.getArrayType(T, ASM, ATI.TypeQuals, 
@@ -175,12 +175,12 @@
       } else {
         // Otherwise, we have a function with an argument list that is
         // potentially variadic.
-        SmallVector<TypeRef, 16> ArgTys;
+        SmallVector<QualType, 16> ArgTys;
         
         for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) {
-          TypeRef ArgTy = TypeRef::getFromOpaquePtr(FTI.ArgInfo[i].TypeInfo);
+          QualType ArgTy = QualType::getFromOpaquePtr(FTI.ArgInfo[i].TypeInfo);
           if (ArgTy.isNull())
-            return TypeRef();  // Error occurred parsing argument type.
+            return QualType();  // Error occurred parsing argument type.
           
           // Look for 'void'.  void is allowed only as a single argument to a
           // function with no other parameters (C99 6.7.5.3p10).  We record
@@ -191,7 +191,7 @@
             // have arguments of incomplete type.
             if (FTI.NumArgs != 1 || FTI.isVariadic) {
               Diag(DeclType.Loc, diag::err_void_only_param);
-              return TypeRef();
+              return QualType();
             }
             // Reject, but continue to parse 'int(void abc)'.
             if (FTI.ArgInfo[i].Ident)
@@ -223,7 +223,7 @@
   // the parser.
   assert(D.getIdentifier() == 0 && "Type name should have no identifier!");
   
-  TypeRef T = GetTypeForDeclarator(D, S);
+  QualType T = GetTypeForDeclarator(D, S);
   
   // If the type of the declarator was invalid, this is an invalid typename.
   if (T.isNull())
@@ -235,7 +235,7 @@
 Sema::TypeResult Sema::ParseParamDeclaratorType(Scope *S, Declarator &D) {
   // Note: parameters have identifiers, but we don't care about them here, we
   // just want the type converted.
-  TypeRef T = GetTypeForDeclarator(D, S);
+  QualType T = GetTypeForDeclarator(D, S);
   
   // If the type of the declarator was invalid, this is an invalid typename.
   if (T.isNull())

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

==============================================================================
--- cfe/cfe/trunk/AST/Type.cpp (original)
+++ cfe/cfe/trunk/AST/Type.cpp Wed Jul 11 11:43:55 2007
@@ -205,7 +205,7 @@
 /// recursively, any member or element of all contained aggregates or unions)
 /// with a const-qualified type.
 
-bool TypeRef::isModifiableLvalue() const {
+bool QualType::isModifiableLvalue() const {
   if (isConstQualified())
     return false;
   else
@@ -250,8 +250,8 @@
   }
 }
 
-void FunctionTypeProto::Profile(FoldingSetNodeID &ID, TypeRef Result,
-                                TypeRef* ArgTys,
+void FunctionTypeProto::Profile(FoldingSetNodeID &ID, QualType Result,
+                                QualType* ArgTys,
                                 unsigned NumArgs, bool isVariadic) {
   ID.AddPointer(Result.getAsOpaquePtr());
   for (unsigned i = 0; i != NumArgs; ++i)
@@ -275,7 +275,7 @@
 // Type Printing
 //===----------------------------------------------------------------------===//
 
-void TypeRef::dump() const {
+void QualType::dump() const {
   std::string R = "foo";
   getAsString(R);
   std::cerr << R << "\n";
@@ -284,15 +284,15 @@
 static void AppendTypeQualList(std::string &S, unsigned TypeQuals) {
   // Note: funkiness to ensure we get a space only between quals.
   bool NonePrinted = true;
-  if (TypeQuals & TypeRef::Const)
+  if (TypeQuals & QualType::Const)
     S += "const", NonePrinted = false;
-  if (TypeQuals & TypeRef::Volatile)
+  if (TypeQuals & QualType::Volatile)
     S += (NonePrinted+" volatile"), NonePrinted = false;
-  if (TypeQuals & TypeRef::Restrict)
+  if (TypeQuals & QualType::Restrict)
     S += (NonePrinted+" restrict"), NonePrinted = false;
 }
 
-void TypeRef::getAsString(std::string &S) const {
+void QualType::getAsString(std::string &S) const {
   if (isNull()) {
     S += "NULL TYPE\n";
     return;

Modified: cfe/cfe/trunk/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/Sema.cpp?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/Sema.cpp (original)
+++ cfe/cfe/trunk/Sema/Sema.cpp Wed Jul 11 11:43:55 2007
@@ -31,7 +31,7 @@
   return true;
 }
 
-bool Sema::Diag(SourceLocation Loc, unsigned DiagID, TypeRef t) {
+bool Sema::Diag(SourceLocation Loc, unsigned DiagID, QualType t) {
   std::string Name;
   t.getAsString(Name);
   PP.Diag(Loc, DiagID, Name);

Modified: cfe/cfe/trunk/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/Sema.h?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/Sema.h (original)
+++ cfe/cfe/trunk/Sema/Sema.h Wed Jul 11 11:43:55 2007
@@ -28,7 +28,7 @@
   class VarDecl;
   class TypedefDecl;
   class FunctionDecl;
-  class TypeRef;
+  class QualType;
   class LangOptions;
   class DeclaratorChunk;
   class LexerToken;
@@ -58,12 +58,12 @@
             const std::string &Msg = std::string());
   bool Diag(const LexerToken &Tok, unsigned DiagID,
             const std::string &M = std::string());
-  bool Diag(SourceLocation Loc, unsigned DiagID, TypeRef t);
+  bool Diag(SourceLocation Loc, unsigned DiagID, QualType t);
   
   //===--------------------------------------------------------------------===//
   // Type Analysis / Processing: SemaType.cpp.
   //
-  TypeRef GetTypeForDeclarator(Declarator &D, Scope *S);
+  QualType GetTypeForDeclarator(Declarator &D, Scope *S);
   
   virtual TypeResult ParseTypeName(Scope *S, Declarator &D);
   

Modified: cfe/cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaDecl.cpp?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaDecl.cpp Wed Jul 11 11:43:55 2007
@@ -109,7 +109,7 @@
 Decl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, Scope *S) {
   Builtin::ID BID = (Builtin::ID)bid;
 
-  TypeRef R = Context.BuiltinInfo.GetBuiltinType(BID, Context);
+  QualType R = Context.BuiltinInfo.GetBuiltinType(BID, Context);
   FunctionDecl *New = new FunctionDecl(SourceLocation(), II, R);
   
   // Find translation-unit scope to insert this function into.
@@ -248,7 +248,7 @@
     }
     New = NewTD;
   } else if (D.isFunctionDeclarator()) {
-    TypeRef R = GetTypeForDeclarator(D, S);
+    QualType R = GetTypeForDeclarator(D, S);
     if (R.isNull()) return 0; // FIXME: "auto func();" passes through...
     
     FunctionDecl::StorageClass SC;
@@ -272,7 +272,7 @@
     }
     New = NewFD;
   } else {
-    TypeRef R = GetTypeForDeclarator(D, S);
+    QualType R = GetTypeForDeclarator(D, S);
     if (R.isNull()) return 0;
 
     VarDecl *NewVD;
@@ -355,7 +355,7 @@
   
   // FIXME: Handle storage class (auto, register). No declarator?
   VarDecl *New = new ParmVarDecl(PI.IdentLoc, II, 
-                                 TypeRef::getFromOpaquePtr(PI.TypeInfo), 
+                                 QualType::getFromOpaquePtr(PI.TypeInfo), 
                                  VarDecl::None);
 
   // If this has an identifier, add it to the scope stack.
@@ -464,7 +464,7 @@
 TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D) {
   assert(D.getIdentifier() && "Wrong callback for declspec withotu declarator");
   
-  TypeRef T = GetTypeForDeclarator(D, S);
+  QualType T = GetTypeForDeclarator(D, S);
   if (T.isNull()) return 0;
   
   // Scope manipulation handled by caller.
@@ -593,7 +593,7 @@
     
   }
   
-  TypeRef T = GetTypeForDeclarator(D, S);
+  QualType T = GetTypeForDeclarator(D, S);
   if (T.isNull()) return 0;
 
   return new FieldDecl(Loc, II, T);
@@ -729,7 +729,7 @@
     }
   }
   
-  TypeRef Ty = Context.getTagDeclType(TheEnumDecl);
+  QualType Ty = Context.getTagDeclType(TheEnumDecl);
   EnumConstantDecl *New = new EnumConstantDecl(IdLoc, Id, Ty);
   
   // Register this decl in the current scope stack.

Modified: cfe/cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaExpr.cpp?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaExpr.cpp Wed Jul 11 11:43:55 2007
@@ -44,7 +44,7 @@
     StringTokLocs.push_back(StringToks[i].getLocation());
   
   // FIXME: handle wchar_t
-  TypeRef t = Context.getPointerType(Context.CharTy);
+  QualType t = Context.getPointerType(Context.CharTy);
   
   // FIXME: use factory.
   // Pass &StringTokLocs[0], StringTokLocs.size() to factory!
@@ -122,7 +122,7 @@
     return ExprResult(true);
 
   if (Literal.isIntegerLiteral()) {
-    TypeRef t;
+    QualType t;
     if (Literal.hasSuffix()) {
       if (Literal.isLong) 
         t = Literal.isUnsigned ? Context.UnsignedLongTy : Context.LongTy;
@@ -178,7 +178,7 @@
     return CheckIncrementDecrementOperand((Expr *)Input, OpLoc, Opc);
   
   // when all the check functions are written, this will go away...
-  return new UnaryOperator((Expr*)Input, Opc, 0);
+  return new UnaryOperator((Expr*)Input, Opc, QualType());
 }
 
 Action::ExprResult Sema::
@@ -189,7 +189,7 @@
   if (Ty == 0) return true;
   
   // Verify that this is a valid expression.
-  TypeRef ArgTy = TypeRef::getFromOpaquePtr(Ty);
+  QualType ArgTy = QualType::getFromOpaquePtr(Ty);
   
   if (isa<FunctionType>(ArgTy) && isSizeof) {
     // alignof(function) is allowed.
@@ -224,21 +224,21 @@
 Action::ExprResult Sema::
 ParseArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc,
                         ExprTy *Idx, SourceLocation RLoc) {
-  TypeRef t1 = ((Expr *)Base)->getType();
-  TypeRef t2 = ((Expr *)Idx)->getType();
+  QualType t1 = ((Expr *)Base)->getType();
+  QualType t2 = ((Expr *)Idx)->getType();
 
   assert(!t1.isNull() && "no type for array base expression");
   assert(!t2.isNull() && "no type for array index expression");
 
-  TypeRef canonT1 = t1.getCanonicalType();
-  TypeRef canonT2 = t2.getCanonicalType();
+  QualType canonT1 = t1.getCanonicalType();
+  QualType canonT2 = t2.getCanonicalType();
   
   // C99 6.5.2.1p2: the expression e1[e2] is by definition precisely equivalent
   // to the expression *((e1)+(e2)). This means the array "Base" may actually be 
   // in the subscript position. As a result, we need to derive the array base 
   // and index from the expression types.
   
-  TypeRef baseType, indexType;
+  QualType baseType, indexType;
   if (isa<ArrayType>(canonT1) || isa<PointerType>(canonT1)) {
     baseType = canonT1;
     indexType = canonT2;
@@ -253,7 +253,7 @@
     return Diag(LLoc, diag::err_typecheck_subscript);
 
   // FIXME: need to deal with const...
-  TypeRef resultType;
+  QualType resultType;
   if (ArrayType *ary = dyn_cast<ArrayType>(baseType)) {
     resultType = ary->getElementType();
   } else if (PointerType *ary = dyn_cast<PointerType>(baseType)) {
@@ -270,11 +270,11 @@
 ParseMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
                          tok::TokenKind OpKind, SourceLocation MemberLoc,
                          IdentifierInfo &Member) {
-  TypeRef qualifiedType = ((Expr *)Base)->getType();
+  QualType qualifiedType = ((Expr *)Base)->getType();
   
   assert(!qualifiedType.isNull() && "no type for member expression");
   
-  TypeRef canonType = qualifiedType.getCanonicalType();
+  QualType canonType = qualifiedType.getCanonicalType();
 
   if (OpKind == tok::arrow) {
     if (PointerType *PT = dyn_cast<PointerType>(canonType)) {
@@ -314,7 +314,7 @@
               SourceLocation RParenLoc, ExprTy *Op) {
   // If error parsing type, ignore.
   if (Ty == 0) return true;
-  return new CastExpr(TypeRef::getFromOpaquePtr(Ty), (Expr*)Op);
+  return new CastExpr(QualType::getFromOpaquePtr(Ty), (Expr*)Op);
 }
 
 
@@ -390,7 +390,7 @@
 
 Expr *Sema::ImplicitConversion(Expr *E) {
 #if 0
-  TypeRef t = E->getType();
+  QualType t = E->getType();
   if (t != 0) t.dump();
   else printf("no type for expr %s\n", E->getStmtClassName());
 #endif
@@ -428,11 +428,11 @@
 Action::ExprResult
 Sema::CheckIncrementDecrementOperand(Expr *op, SourceLocation OpLoc,
                                                unsigned OpCode) {
-  TypeRef qType = op->getType();
+  QualType qType = op->getType();
 
   assert(!qType.isNull() && "no type for increment/decrement expression");
 
-  TypeRef canonType = qType.getCanonicalType();
+  QualType canonType = qType.getCanonicalType();
 
   // C99 6.5.2.4p1
   if (const PointerType *pt = dyn_cast<PointerType>(canonType)) {

Modified: cfe/cfe/trunk/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaExprCXX.cpp?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/SemaExprCXX.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaExprCXX.cpp Wed Jul 11 11:43:55 2007
@@ -33,7 +33,7 @@
   case tok::kw_static_cast:      Op = CXXCastExpr::StaticCast;      break;
   }
   
-  return new CXXCastExpr(Op, TypeRef::getFromOpaquePtr(Ty), (Expr*)E);
+  return new CXXCastExpr(Op, QualType::getFromOpaquePtr(Ty), (Expr*)E);
 }
 
 /// ParseCXXBoolLiteral - Parse {true,false} literals.

Modified: cfe/cfe/trunk/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaType.cpp?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/SemaType.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaType.cpp Wed Jul 11 11:43:55 2007
@@ -21,12 +21,12 @@
 
 /// ConvertDeclSpecToType - Convert the specified declspec to the appropriate
 /// type object.  This returns null on error.
-static TypeRef ConvertDeclSpecToType(const DeclSpec &DS, ASTContext &Ctx) {
+static QualType ConvertDeclSpecToType(const DeclSpec &DS, ASTContext &Ctx) {
   // FIXME: Should move the logic from DeclSpec::Finish to here for validity
   // checking.
   
   switch (DS.getTypeSpecType()) {
-  default: return TypeRef(); // FIXME: Handle unimp cases!
+  default: return QualType(); // FIXME: Handle unimp cases!
   case DeclSpec::TST_void: return Ctx.VoidTy;
   case DeclSpec::TST_char:
     if (DS.getTypeSpecSign() == DeclSpec::TSS_unspecified)
@@ -100,8 +100,8 @@
 
 /// GetTypeForDeclarator - Convert the type for the specified declarator to Type
 /// instances.
-TypeRef Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
-  TypeRef T = ConvertDeclSpecToType(D.getDeclSpec(), Context);
+QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
+  QualType T = ConvertDeclSpecToType(D.getDeclSpec(), Context);
 
   // If there was an error parsing declspecs, return a null type pointer.
   if (T.isNull()) return T;
@@ -140,11 +140,11 @@
         T->getAsString(Name);
         Diag(D.getIdentifierLoc(), diag::err_illegal_decl_array_incomplete_type,
              Name);
-        return TypeRef();
+        return QualType();
       } else if (isa<FunctionType>(CanonicalT)) {
         Diag(D.getIdentifierLoc(), diag::err_illegal_decl_array_of_functions,
              D.getIdentifier()->getName());
-        return TypeRef();
+        return QualType();
       } else if (RecordType *EltTy = dyn_cast<RecordType>(CanonicalT)) {
         // If the element type is a struct or union that contains a variadic
         // array, reject it: C99 6.7.2.1p2.
@@ -152,7 +152,7 @@
           std::string Name;
           T->getAsString(Name);
           Diag(DeclType.Loc, diag::err_flexible_array_in_array, Name);
-          return TypeRef();
+          return QualType();
         }
       }
       T = Context.getArrayType(T, ASM, ATI.TypeQuals, 
@@ -175,12 +175,12 @@
       } else {
         // Otherwise, we have a function with an argument list that is
         // potentially variadic.
-        SmallVector<TypeRef, 16> ArgTys;
+        SmallVector<QualType, 16> ArgTys;
         
         for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) {
-          TypeRef ArgTy = TypeRef::getFromOpaquePtr(FTI.ArgInfo[i].TypeInfo);
+          QualType ArgTy = QualType::getFromOpaquePtr(FTI.ArgInfo[i].TypeInfo);
           if (ArgTy.isNull())
-            return TypeRef();  // Error occurred parsing argument type.
+            return QualType();  // Error occurred parsing argument type.
           
           // Look for 'void'.  void is allowed only as a single argument to a
           // function with no other parameters (C99 6.7.5.3p10).  We record
@@ -191,7 +191,7 @@
             // have arguments of incomplete type.
             if (FTI.NumArgs != 1 || FTI.isVariadic) {
               Diag(DeclType.Loc, diag::err_void_only_param);
-              return TypeRef();
+              return QualType();
             }
             // Reject, but continue to parse 'int(void abc)'.
             if (FTI.ArgInfo[i].Ident)
@@ -223,7 +223,7 @@
   // the parser.
   assert(D.getIdentifier() == 0 && "Type name should have no identifier!");
   
-  TypeRef T = GetTypeForDeclarator(D, S);
+  QualType T = GetTypeForDeclarator(D, S);
   
   // If the type of the declarator was invalid, this is an invalid typename.
   if (T.isNull())
@@ -235,7 +235,7 @@
 Sema::TypeResult Sema::ParseParamDeclaratorType(Scope *S, Declarator &D) {
   // Note: parameters have identifiers, but we don't care about them here, we
   // just want the type converted.
-  TypeRef T = GetTypeForDeclarator(D, S);
+  QualType T = GetTypeForDeclarator(D, S);
   
   // If the type of the declarator was invalid, this is an invalid typename.
   if (T.isNull())

Modified: cfe/cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/ASTContext.h?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/cfe/trunk/include/clang/AST/ASTContext.h Wed Jul 11 11:43:55 2007
@@ -36,14 +36,14 @@
   Builtin::Context BuiltinInfo;
 
   // Builtin Types.
-  TypeRef VoidTy;
-  TypeRef BoolTy;
-  TypeRef CharTy;
-  TypeRef SignedCharTy, ShortTy, IntTy, LongTy, LongLongTy;
-  TypeRef UnsignedCharTy, UnsignedShortTy, UnsignedIntTy, UnsignedLongTy;
-  TypeRef UnsignedLongLongTy;
-  TypeRef FloatTy, DoubleTy, LongDoubleTy;
-  TypeRef FloatComplexTy, DoubleComplexTy, LongDoubleComplexTy;
+  QualType VoidTy;
+  QualType BoolTy;
+  QualType CharTy;
+  QualType SignedCharTy, ShortTy, IntTy, LongTy, LongLongTy;
+  QualType UnsignedCharTy, UnsignedShortTy, UnsignedIntTy, UnsignedLongTy;
+  QualType UnsignedLongLongTy;
+  QualType FloatTy, DoubleTy, LongDoubleTy;
+  QualType FloatComplexTy, DoubleComplexTy, LongDoubleComplexTy;
   
   ASTContext(TargetInfo &t, IdentifierTable &idents) : Target(t) {
     InitBuiltinTypes();
@@ -55,36 +55,36 @@
   
   /// getPointerType - Return the uniqued reference to the type for a pointer to
   /// the specified type.
-  TypeRef getPointerType(TypeRef T);
+  QualType getPointerType(QualType T);
   
   /// getArrayType - Return the unique reference to the type for an array of the
   /// specified element type.
-  TypeRef getArrayType(TypeRef EltTy, ArrayType::ArraySizeModifier ASM,
-                       unsigned EltTypeQuals, Expr *NumElts);
+  QualType getArrayType(QualType EltTy, ArrayType::ArraySizeModifier ASM,
+                        unsigned EltTypeQuals, Expr *NumElts);
 
   /// getFunctionTypeNoProto - Return a K&R style C function type like 'int()'.
   ///
-  TypeRef getFunctionTypeNoProto(TypeRef ResultTy);
+  QualType getFunctionTypeNoProto(QualType ResultTy);
   
   /// getFunctionType - Return a normal function type with a typed argument
   /// list.  isVariadic indicates whether the argument list includes '...'.
-  TypeRef getFunctionType(TypeRef ResultTy, TypeRef *ArgArray,
-                          unsigned NumArgs, bool isVariadic);
+  QualType getFunctionType(QualType ResultTy, QualType *ArgArray,
+                           unsigned NumArgs, bool isVariadic);
   
   /// getTypedefType - Return the unique reference to the type for the
   /// specified typename decl.
-  TypeRef getTypedefType(TypedefDecl *Decl);
+  QualType getTypedefType(TypedefDecl *Decl);
 
   /// getTagDeclType - Return the unique reference to the type for the
   /// specified TagDecl (struct/union/class/enum) decl.
-  TypeRef getTagDeclType(TagDecl *Decl);
+  QualType getTagDeclType(TagDecl *Decl);
   
   /// getSizeType - Return the unique type for "size_t" (C99 7.17), defined
   /// in <stddef.h>. The sizeof operator requires this (C99 6.5.3.4p4).
-  TypeRef getSizeType() const;
+  QualType getSizeType() const;
 private:
   void InitBuiltinTypes();
-  void InitBuiltinType(TypeRef &R, BuiltinType::Kind K);
+  void InitBuiltinType(QualType &R, BuiltinType::Kind K);
 };
   
 }  // end namespace clang

Modified: cfe/cfe/trunk/include/clang/AST/Builtins.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Builtins.h?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Builtins.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Builtins.h Wed Jul 11 11:43:55 2007
@@ -22,7 +22,7 @@
   class TargetInfo;
   class IdentifierTable;
   class ASTContext;
-  class TypeRef;
+  class QualType;
 
 namespace Builtin {
 enum ID {
@@ -63,7 +63,7 @@
   }
   
   /// GetBuiltinType - Return the type for the specified builtin.
-  TypeRef GetBuiltinType(unsigned ID, ASTContext &Context) const;
+  QualType GetBuiltinType(unsigned ID, ASTContext &Context) const;
 private:
   const Info &GetRecord(unsigned ID) const;
 };

Modified: cfe/cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Decl.h?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Decl.h Wed Jul 11 11:43:55 2007
@@ -104,13 +104,13 @@
 /// an lvalue) a function (in which case it is a function designator) or
 /// an enum constant. 
 class ValueDecl : public Decl {
-  TypeRef DeclType;
+  QualType DeclType;
 protected:
-  ValueDecl(Kind DK, SourceLocation L, IdentifierInfo *Id, TypeRef T): 
+  ValueDecl(Kind DK, SourceLocation L, IdentifierInfo *Id, QualType T): 
              Decl(DK, L, Id), DeclType(T) {}
 public:
-  TypeRef getType() const { return DeclType; }
-  TypeRef getCanonicalType() const { return DeclType.getCanonicalType(); }
+  QualType getType() const { return DeclType; }
+  QualType getCanonicalType() const { return DeclType.getCanonicalType(); }
   
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) {
@@ -134,7 +134,7 @@
   }
   static bool classof(const VarDecl *D) { return true; }
 protected:
-  VarDecl(Kind DK, SourceLocation L, IdentifierInfo *Id, TypeRef T,
+  VarDecl(Kind DK, SourceLocation L, IdentifierInfo *Id, QualType T,
           StorageClass SC)
     : ValueDecl(DK, L, Id, T) {}
 private:
@@ -145,7 +145,7 @@
 /// BlockVarDecl - Represent a local variable declaration.
 class BlockVarDecl : public VarDecl {
 public:
-  BlockVarDecl(SourceLocation L, IdentifierInfo *Id, TypeRef T, StorageClass S)
+  BlockVarDecl(SourceLocation L, IdentifierInfo *Id, QualType T, StorageClass S)
     : VarDecl(BlockVariable, L, Id, T, S) {}
   
   // Implement isa/cast/dyncast/etc.
@@ -159,7 +159,7 @@
 /// pointer to the decl's scope, which is transient).
 class FileVarDecl : public VarDecl {
 public:
-  FileVarDecl(SourceLocation L, IdentifierInfo *Id, TypeRef T, StorageClass S)
+  FileVarDecl(SourceLocation L, IdentifierInfo *Id, QualType T, StorageClass S)
     : VarDecl(FileVariable, L, Id, T, S) {}
   
   // Implement isa/cast/dyncast/etc.
@@ -170,7 +170,7 @@
 /// ParmVarDecl - Represent a parameter to a function.
 class ParmVarDecl : public VarDecl {
 public:
-  ParmVarDecl(SourceLocation L, IdentifierInfo *Id, TypeRef T, StorageClass S)
+  ParmVarDecl(SourceLocation L, IdentifierInfo *Id, QualType T, StorageClass S)
     : VarDecl(ParmVariable, L, Id, T, S) {}
   
   // Implement isa/cast/dyncast/etc.
@@ -185,7 +185,7 @@
   enum StorageClass {
     None, Extern, Static
   };
-  FunctionDecl(SourceLocation L, IdentifierInfo *Id, TypeRef T, StorageClass S=None)
+  FunctionDecl(SourceLocation L, IdentifierInfo *Id, QualType T, StorageClass S=None)
     : ValueDecl(Function, L, Id, T), 
       ParamInfo(0), Body(0), DeclChain(0), SClass(S) {}
   virtual ~FunctionDecl();
@@ -228,13 +228,13 @@
 /// FieldDecl - An instance of this class is created by Sema::ParseField to 
 /// represent a member of a struct/union/class.
 class FieldDecl : public Decl {
-  TypeRef DeclType;
+  QualType DeclType;
 public:
-  FieldDecl(SourceLocation L, IdentifierInfo *Id, TypeRef T)
+  FieldDecl(SourceLocation L, IdentifierInfo *Id, QualType T)
     : Decl(Field, L, Id), DeclType(T) {}
 
-  TypeRef getType() const { return DeclType; }
-  TypeRef getCanonicalType() const { return DeclType.getCanonicalType(); }
+  QualType getType() const { return DeclType; }
+  QualType getCanonicalType() const { return DeclType.getCanonicalType(); }
   
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) {
@@ -250,7 +250,7 @@
 class EnumConstantDecl : public ValueDecl {
 public:
   // FIXME: Capture value info.
-  EnumConstantDecl(SourceLocation L, IdentifierInfo *Id, TypeRef T)
+  EnumConstantDecl(SourceLocation L, IdentifierInfo *Id, QualType T)
     : ValueDecl(EnumConstant, L, Id, T) {}
 
   // Implement isa/cast/dyncast/etc.
@@ -284,12 +284,12 @@
 
 class TypedefDecl : public TypeDecl {
   /// UnderlyingType - This is the type the typedef is set to.
-  TypeRef UnderlyingType;
+  QualType UnderlyingType;
 public:
-  TypedefDecl(SourceLocation L, IdentifierInfo *Id, TypeRef T)
+  TypedefDecl(SourceLocation L, IdentifierInfo *Id, QualType T)
     : TypeDecl(Typedef, L, Id), UnderlyingType(T) {}
   
-  TypeRef getUnderlyingType() const { return UnderlyingType; }
+  QualType getUnderlyingType() const { return UnderlyingType; }
   
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return D->getKind() == Typedef; }

Modified: cfe/cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Expr.h?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Expr.h Wed Jul 11 11:43:55 2007
@@ -28,12 +28,12 @@
 /// is required.
 ///
 class Expr : public Stmt {
-  TypeRef TR;
+  QualType TR;
 protected:
-  Expr(StmtClass SC, TypeRef T=0) : Stmt(SC), TR(T) {}
+  Expr(StmtClass SC, QualType T) : Stmt(SC), TR(T) {}
   ~Expr() {}
 public:  
-  TypeRef getType() const { return TR; }
+  QualType getType() const { return TR; }
   
   virtual void visit(StmtVisitor &Visitor);
   static bool classof(const Stmt *T) { 
@@ -52,7 +52,7 @@
 class DeclRefExpr : public Expr {
   Decl *D; // a ValueDecl or EnumConstantDecl
 public:
-  DeclRefExpr(Decl *d, TypeRef t) : Expr(DeclRefExprClass, t), D(d) {}
+  DeclRefExpr(Decl *d, QualType t) : Expr(DeclRefExprClass, t), D(d) {}
   
   Decl *getDecl() const { return D; }
   
@@ -68,7 +68,7 @@
 public:
   // type should be IntTy, LongTy, LongLongTy, UnsignedIntTy, UnsignedLongTy, 
   // or UnsignedLongLongTy
-  IntegerLiteral(intmax_t value, TypeRef type)
+  IntegerLiteral(intmax_t value, QualType type)
     : Expr(IntegerLiteralClass, type), Value(value) {
     assert(type->isIntegralType() && "Illegal type in IntegerLiteral");
   }
@@ -82,7 +82,7 @@
 class FloatingLiteral : public Expr {
   float Value; // FIXME
 public:
-  FloatingLiteral(float value, TypeRef type) : 
+  FloatingLiteral(float value, QualType type) : 
     Expr(FloatingLiteralClass, type), Value(value) {} 
   virtual void visit(StmtVisitor &Visitor);
   static bool classof(const Stmt *T) { 
@@ -96,7 +96,7 @@
   unsigned ByteLength;
   bool IsWide;
 public:
-  StringLiteral(const char *strData, unsigned byteLength, bool Wide, TypeRef t);
+  StringLiteral(const char *strData, unsigned byteLength, bool Wide, QualType t);
   virtual ~StringLiteral();
   
   const char *getStrData() const { return StrData; }
@@ -117,7 +117,7 @@
   Expr *Val;
 public:
   ParenExpr(SourceLocation l, SourceLocation r, Expr *val)
-    : Expr(ParenExprClass), L(l), R(r), Val(val) {}
+    : Expr(ParenExprClass, QualType()), L(l), R(r), Val(val) {}
   
   Expr *getSubExpr() { return Val; }
   
@@ -146,7 +146,7 @@
     Extension         // __extension__ marker.
   };
 
-  UnaryOperator(Expr *input, Opcode opc, TypeRef type)
+  UnaryOperator(Expr *input, Opcode opc, QualType type)
     : Expr(UnaryOperatorClass, type), Val(input), Opc(opc) {}
   
   /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
@@ -177,14 +177,14 @@
 /// *types*.  sizeof(expr) is handled by UnaryOperator.
 class SizeOfAlignOfTypeExpr : public Expr {
   bool isSizeof;  // true if sizeof, false if alignof.
-  TypeRef Ty;
+  QualType Ty;
 public:
-  SizeOfAlignOfTypeExpr(bool issizeof, TypeRef argType, TypeRef resultType) : 
+  SizeOfAlignOfTypeExpr(bool issizeof, QualType argType, QualType resultType) : 
     Expr(SizeOfAlignOfTypeExprClass, resultType),
     isSizeof(issizeof), Ty(argType) {}
   
   bool isSizeOf() const { return isSizeof; }
-  TypeRef getArgumentType() const { return Ty; }
+  QualType getArgumentType() const { return Ty; }
 
   virtual void visit(StmtVisitor &Visitor);
   static bool classof(const Stmt *T) { 
@@ -201,7 +201,7 @@
 class ArraySubscriptExpr : public Expr {
   Expr *Base, *Idx;
 public:
-  ArraySubscriptExpr(Expr *base, Expr *idx, TypeRef t) : 
+  ArraySubscriptExpr(Expr *base, Expr *idx, QualType t) : 
     Expr(ArraySubscriptExprClass, t),
     Base(base), Idx(idx) {}
   
@@ -276,13 +276,15 @@
 /// CastExpr - [C99 6.5.4] Cast Operators.
 ///
 class CastExpr : public Expr {
-  TypeRef Ty;
+  QualType Ty;
   Expr *Op;
 public:
-  CastExpr(TypeRef ty, Expr *op) : Expr(CastExprClass), Ty(ty), Op(op) {}
-  CastExpr(StmtClass SC, TypeRef ty, Expr *op) : Expr(SC), Ty(ty), Op(op) {}
+  CastExpr(QualType ty, Expr *op) : 
+    Expr(CastExprClass, QualType()), Ty(ty), Op(op) {}
+  CastExpr(StmtClass SC, QualType ty, Expr *op) : 
+    Expr(SC, QualType()), Ty(ty), Op(op) {}
   
-  TypeRef getDestType() const { return Ty; }
+  QualType getDestType() const { return Ty; }
   
   Expr *getSubExpr() { return Op; }
   virtual void visit(StmtVisitor &Visitor);
@@ -317,7 +319,7 @@
   };
   
   BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc)
-    : Expr(BinaryOperatorClass), LHS(lhs), RHS(rhs), Opc(opc) {}
+    : Expr(BinaryOperatorClass, QualType()), LHS(lhs), RHS(rhs), Opc(opc) {}
 
   /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
   /// corresponds to, e.g. "<<=".
@@ -353,7 +355,7 @@
   Expr *Cond, *LHS, *RHS;  // Left/Middle/Right hand sides.
 public:
   ConditionalOperator(Expr *cond, Expr *lhs, Expr *rhs)
-    : Expr(ConditionalOperatorClass), Cond(cond), LHS(lhs), RHS(rhs) {}
+    : Expr(ConditionalOperatorClass, QualType()), Cond(cond), LHS(lhs), RHS(rhs) {}
 
   Expr *getCond() { return Cond; }
   Expr *getLHS() { return LHS; }

Modified: cfe/cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/ExprCXX.h?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/cfe/trunk/include/clang/AST/ExprCXX.h Wed Jul 11 11:43:55 2007
@@ -34,7 +34,7 @@
       ConstCast
     };
 
-    CXXCastExpr(Opcode op, TypeRef ty, Expr *expr)
+    CXXCastExpr(Opcode op, QualType ty, Expr *expr)
       : CastExpr(CXXCastExprClass, ty, expr), Op(op) {}
 
     Opcode getOpcode() const { return Op; }
@@ -48,7 +48,8 @@
   class CXXBoolLiteralExpr : public Expr {
     bool Value;
   public:
-    CXXBoolLiteralExpr(bool val) : Expr(CXXBoolLiteralExprClass), Value(val) {}
+    CXXBoolLiteralExpr(bool val) : 
+      Expr(CXXBoolLiteralExprClass, QualType()), Value(val) {}
     virtual void visit(StmtVisitor &Visitor);
   };
 

Modified: cfe/cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Type.h?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Type.h Wed Jul 11 11:43:55 2007
@@ -27,7 +27,7 @@
   class EnumDecl;
   class Expr;
   
-/// TypeRef - For efficiency, we don't store CVR-qualified types as nodes on
+/// QualType - For efficiency, we don't store CVR-qualified types as nodes on
 /// their own: instead each reference to a type stores the qualifiers.  This
 /// greatly reduces the number of nodes we need to allocate for types (for
 /// example we only need one for 'int', 'const int', 'volatile int',
@@ -35,9 +35,9 @@
 ///
 /// As an added efficiency bonus, instead of making this a pair, we just store
 /// the three bits we care about in the low bits of the pointer.  To handle the
-/// packing/unpacking, we make TypeRef be a simple wrapper class that acts like
+/// packing/unpacking, we make QualType be a simple wrapper class that acts like
 /// a smart pointer.
-class TypeRef {
+class QualType {
   uintptr_t ThePtr;
 public:
   enum TQ {   // NOTE: These flags must be kept in sync with DeclSpec::TQ.
@@ -47,17 +47,17 @@
     CVRFlags = Const|Restrict|Volatile
   };
   
-  TypeRef() : ThePtr(0) {}
+  QualType() : ThePtr(0) {}
   
-  TypeRef(Type *Ptr, unsigned Quals = 0) {
+  QualType(Type *Ptr, unsigned Quals) {
     assert((Quals & ~CVRFlags) == 0 && "Invalid type qualifiers!");
     ThePtr = reinterpret_cast<uintptr_t>(Ptr);
     assert((ThePtr & CVRFlags) == 0 && "Type pointer not 8-byte aligned?");
     ThePtr |= Quals;
   }
 
-  static TypeRef getFromOpaquePtr(void *Ptr) {
-    TypeRef T;
+  static QualType getFromOpaquePtr(void *Ptr) {
+    QualType T;
     T.ThePtr = reinterpret_cast<uintptr_t>(Ptr);
     return T;
   }
@@ -81,7 +81,7 @@
     return getTypePtr();
   }
   
-  /// isNull - Return true if this TypeRef doesn't point to a type yet.
+  /// isNull - Return true if this QualType doesn't point to a type yet.
   bool isNull() const {
     return ThePtr == 0;
   }
@@ -96,20 +96,20 @@
     return ThePtr & Restrict;
   }
   
-  TypeRef getQualifiedType(unsigned TQs) const {
-    return TypeRef(getTypePtr(), TQs);
+  QualType getQualifiedType(unsigned TQs) const {
+    return QualType(getTypePtr(), TQs);
   }
   
-  TypeRef getUnqualifiedType() const {
-    return TypeRef(getTypePtr());
+  QualType getUnqualifiedType() const {
+    return QualType(getTypePtr(), 0);
   }
   
   /// operator==/!= - Indicate whether the specified types and qualifiers are
   /// identical.
-  bool operator==(const TypeRef &RHS) const {
+  bool operator==(const QualType &RHS) const {
     return ThePtr == RHS.ThePtr;
   }
-  bool operator!=(const TypeRef &RHS) const {
+  bool operator!=(const QualType &RHS) const {
     return ThePtr != RHS.ThePtr;
   }
   /// isModifiableLvalue - C99 6.3.2.1p1: returns true if the type is an lvalue
@@ -124,21 +124,21 @@
 
   /// getCanonicalType - Return the canonical version of this type, with the
   /// appropriate type qualifiers on it.
-  inline TypeRef getCanonicalType() const;
+  inline QualType getCanonicalType() const;
 };
 
 } // end clang.
 
-/// Implement simplify_type for TypeRef, so that we can dyn_cast from TypeRef to
+/// Implement simplify_type for QualType, so that we can dyn_cast from QualType to
 /// a specific Type class.
-template<> struct simplify_type<const clang::TypeRef> {
+template<> struct simplify_type<const clang::QualType> {
   typedef clang::Type* SimpleType;
-  static SimpleType getSimplifiedValue(const clang::TypeRef &Val) {
+  static SimpleType getSimplifiedValue(const clang::QualType &Val) {
     return Val.getTypePtr();
   }
 };
-template<> struct simplify_type<clang::TypeRef>
-  : public simplify_type<const clang::TypeRef> {};
+template<> struct simplify_type<clang::QualType>
+  : public simplify_type<const clang::QualType> {};
 
 namespace clang {
 
@@ -173,15 +173,15 @@
     Builtin, Pointer, Array, FunctionNoProto, FunctionProto, TypeName, Tagged
   };
 private:
-  TypeRef CanonicalType;
+  QualType CanonicalType;
 
   /// TypeClass bitfield - Enum that specifies what subclass this belongs to.
   /// Note that this should stay at the end of the ivars for Type so that
   /// subclasses can pack their bitfields into the same word.
   TypeClass TC : 3;
 protected:
-  Type(TypeClass tc, TypeRef Canonical)
-    : CanonicalType(Canonical.isNull() ? TypeRef(this,0) : Canonical), TC(tc) {}
+  Type(TypeClass tc, QualType Canonical)
+    : CanonicalType(Canonical.isNull() ? QualType(this,0) : Canonical), TC(tc) {}
   virtual ~Type();
   friend class ASTContext;
 public:  
@@ -227,12 +227,12 @@
   
   bool isLvalue() const;         // C99 6.3.2.1
 private:
-  // this forces clients to use isModifiableLvalue on TypeRef, the class that 
-  // knows if the type is const. This predicate is a helper to TypeRef. 
+  // this forces clients to use isModifiableLvalue on QualType, the class that 
+  // knows if the type is const. This predicate is a helper to QualType. 
   bool isModifiableLvalue() const; // C99 6.3.2.1p1
   
-  TypeRef getCanonicalType() const { return CanonicalType; }
-  friend class TypeRef;
+  QualType getCanonicalType() const { return CanonicalType; }
+  friend class QualType;
 public:
   virtual void getAsString(std::string &InnerString) const = 0;
   
@@ -253,7 +253,7 @@
 private:
   Kind TypeKind;
 public:
-  BuiltinType(Kind K) : Type(Builtin, 0), TypeKind(K) {}
+  BuiltinType(Kind K) : Type(Builtin, QualType()), TypeKind(K) {}
   
   Kind getKind() const { return TypeKind; }
   const char *getName() const;
@@ -267,14 +267,14 @@
 /// PointerType - C99 6.7.5.1 - Pointer Declarators.
 ///
 class PointerType : public Type, public FoldingSetNode {
-  TypeRef PointeeType;
-  PointerType(TypeRef Pointee, TypeRef CanonicalPtr) :
+  QualType PointeeType;
+  PointerType(QualType Pointee, QualType CanonicalPtr) :
     Type(Pointer, CanonicalPtr), PointeeType(Pointee) {
   }
   friend class ASTContext;  // ASTContext creates these.
 public:
     
-  TypeRef getPointeeType() const { return PointeeType; }
+  QualType getPointeeType() const { return PointeeType; }
   
   virtual void getAsString(std::string &InnerString) const;
   
@@ -282,7 +282,7 @@
   void Profile(FoldingSetNodeID &ID) {
     Profile(ID, getPointeeType());
   }
-  static void Profile(FoldingSetNodeID &ID, TypeRef Pointee) {
+  static void Profile(FoldingSetNodeID &ID, QualType Pointee) {
     ID.AddPointer(Pointee.getAsOpaquePtr());
   }
   
@@ -309,19 +309,19 @@
   unsigned IndexTypeQuals : 3;
   
   /// ElementType - The element type of the array.
-  TypeRef ElementType;
+  QualType ElementType;
   
   /// SizeExpr - The size is either a constant or assignment expression (for 
   /// Variable Length Arrays). VLA's are only permitted within a function block. 
   Expr *SizeExpr;
   
-  ArrayType(TypeRef et, ArraySizeModifier sm, unsigned tq, TypeRef can, Expr *e)
+  ArrayType(QualType et, ArraySizeModifier sm, unsigned tq, QualType can, Expr *e)
     : Type(Array, can), SizeModifier(sm), IndexTypeQuals(tq), ElementType(et),
       SizeExpr(e) {}
   friend class ASTContext;  // ASTContext creates these.
 public:
     
-  TypeRef getElementType() const { return ElementType; }
+  QualType getElementType() const { return ElementType; }
   ArraySizeModifier getSizeModifier() const { return SizeModifier; }
   unsigned getIndexTypeQualifier() const { return IndexTypeQuals; }
   Expr *getSize() const { return SizeExpr; }
@@ -333,7 +333,7 @@
             getSize());
   }
   static void Profile(FoldingSetNodeID &ID, ArraySizeModifier SizeModifier,
-                      unsigned IndexTypeQuals, TypeRef ElementType,
+                      unsigned IndexTypeQuals, QualType ElementType,
                       Expr *SizeExpr) {
     ID.AddInteger(SizeModifier);
     ID.AddInteger(IndexTypeQuals);
@@ -354,14 +354,14 @@
   bool SubClassData : 1;
   
   // The type returned by the function.
-  TypeRef ResultType;
+  QualType ResultType;
 protected:
-  FunctionType(TypeClass tc, TypeRef res, bool SubclassInfo, TypeRef Canonical)
+  FunctionType(TypeClass tc, QualType res, bool SubclassInfo, QualType Canonical)
     : Type(tc, Canonical), SubClassData(SubclassInfo), ResultType(res) {}
   bool getSubClassData() const { return SubClassData; }
 public:
   
-  TypeRef getResultType() const { return ResultType; }
+  QualType getResultType() const { return ResultType; }
 
   
   static bool classof(const Type *T) {
@@ -374,7 +374,7 @@
 /// FunctionTypeNoProto - Represents a K&R-style 'int foo()' function, which has
 /// no information available about its arguments.
 class FunctionTypeNoProto : public FunctionType, public FoldingSetNode {
-  FunctionTypeNoProto(TypeRef Result, TypeRef Canonical)
+  FunctionTypeNoProto(QualType Result, QualType Canonical)
     : FunctionType(FunctionNoProto, Result, false, Canonical) {}
   friend class ASTContext;  // ASTContext creates these.
 public:
@@ -385,7 +385,7 @@
   void Profile(FoldingSetNodeID &ID) {
     Profile(ID, getResultType());
   }
-  static void Profile(FoldingSetNodeID &ID, TypeRef ResultType) {
+  static void Profile(FoldingSetNodeID &ID, QualType ResultType) {
     ID.AddPointer(ResultType.getAsOpaquePtr());
   }
   
@@ -399,8 +399,8 @@
 /// 'int foo(int)' or 'int foo(void)'.  'void' is represented as having no
 /// arguments, not as having a single void argument.
 class FunctionTypeProto : public FunctionType, public FoldingSetNode {
-  FunctionTypeProto(TypeRef Result, TypeRef *ArgArray, unsigned numArgs,
-                    bool isVariadic, TypeRef Canonical)
+  FunctionTypeProto(QualType Result, QualType *ArgArray, unsigned numArgs,
+                    bool isVariadic, QualType Canonical)
     : FunctionType(FunctionProto, Result, isVariadic, Canonical),
       NumArgs(numArgs) {
     for (unsigned i = 0; i != numArgs; ++i)
@@ -413,11 +413,11 @@
   /// ArgInfo - This array holds the argument types.  Note that this is actually
   /// a variable-sized array, so it must be the last instance variable in the
   /// class.
-  TypeRef ArgInfo[1];
+  QualType ArgInfo[1];
   friend class ASTContext;  // ASTContext creates these.
 public:
   unsigned getNumArgs() const { return NumArgs; }
-  TypeRef getArgType(unsigned i) const {
+  QualType getArgType(unsigned i) const {
     assert(i < NumArgs && "Invalid argument number!");
     return ArgInfo[i];
   }
@@ -432,14 +432,14 @@
   static bool classof(const FunctionTypeProto *) { return true; }
   
   void Profile(FoldingSetNodeID &ID);
-  static void Profile(FoldingSetNodeID &ID, TypeRef Result, TypeRef* ArgTys,
+  static void Profile(FoldingSetNodeID &ID, QualType Result, QualType* ArgTys,
                       unsigned NumArgs, bool isVariadic);
 };
 
 
 class TypedefType : public Type {
   TypedefDecl *Decl;
-  TypedefType(TypedefDecl *D, TypeRef can) : Type(TypeName, can), Decl(D) {
+  TypedefType(TypedefDecl *D, QualType can) : Type(TypeName, can), Decl(D) {
     assert(!isa<TypedefType>(can) && "Invalid canonical type");
   }
   friend class ASTContext;  // ASTContext creates these.
@@ -456,7 +456,7 @@
 
 class TagType : public Type {
   TagDecl *Decl;
-  TagType(TagDecl *D, TypeRef can) : Type(Tagged, can), Decl(D) {}
+  TagType(TagDecl *D, QualType can) : Type(Tagged, can), Decl(D) {}
   friend class ASTContext;  // ASTContext creates these.
 public:
     
@@ -477,7 +477,7 @@
   RecordDecl *getDecl() const {
     return reinterpret_cast<RecordDecl*>(TagType::getDecl());
   }
-  // FIXME: This predicate is a helper to TypeRef/Type. It needs to 
+  // FIXME: This predicate is a helper to QualType/Type. It needs to 
   // recursively check all fields for const-ness. If any field is declared
   // const, it needs to return false. 
   bool isModifiableLvalue() const { return true; } 
@@ -497,10 +497,10 @@
 
 /// getCanonicalType - Return the canonical version of this type, with the
 /// appropriate type qualifiers on it.
-inline TypeRef TypeRef::getCanonicalType() const {
-  return TypeRef(getTypePtr()->getCanonicalType().getTypePtr(),
-                 getQualifiers() |
-                 getTypePtr()->getCanonicalType().getQualifiers());
+inline QualType QualType::getCanonicalType() const {
+  return QualType(getTypePtr()->getCanonicalType().getTypePtr(),
+                  getQualifiers() |
+                  getTypePtr()->getCanonicalType().getQualifiers());
 }
   
 }  // end namespace clang

Modified: cfe/cfe/trunk/include/clang/Parse/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Parse/DeclSpec.h?rev=39395&r1=39394&r2=39395&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/DeclSpec.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/DeclSpec.h Wed Jul 11 11:43:55 2007
@@ -76,7 +76,7 @@
   };
   
   // type-qualifiers
-  enum TQ {   // NOTE: These flags must be kept in sync with TypeRef::TQ.
+  enum TQ {   // NOTE: These flags must be kept in sync with QualType::TQ.
     TQ_unspecified = 0,
     TQ_const       = 1,
     TQ_restrict    = 2,





More information about the cfe-commits mailing list