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

Douglas Gregor dgregor at apple.com
Tue Jan 20 13:02:14 PST 2009


Author: dgregor
Date: Tue Jan 20 15:02:13 2009
New Revision: 62611

URL: http://llvm.org/viewvc/llvm-project?rev=62611&view=rev
Log:
Use the ASTContext's allocator for FunctionTypeNoProto and TypeOfExpr

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=62611&r1=62610&r2=62611&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Jan 20 15:02:13 2009
@@ -1003,7 +1003,8 @@
     assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
   }
   
-  FunctionTypeNoProto *New = new FunctionTypeNoProto(ResultTy, Canonical);
+  void *Mem = Allocator.Allocate(sizeof(FunctionTypeNoProto), 8);
+  FunctionTypeNoProto *New = new (Mem) FunctionTypeNoProto(ResultTy, Canonical);
   Types.push_back(New);
   FunctionTypeNoProtos.InsertNode(New, InsertPos);
   return QualType(New, 0);
@@ -1216,7 +1217,8 @@
 /// on canonical type's (which are always unique).
 QualType ASTContext::getTypeOfExpr(Expr *tofExpr) {
   QualType Canonical = getCanonicalType(tofExpr->getType());
-  TypeOfExpr *toe = new TypeOfExpr(tofExpr, Canonical);
+  void *Mem = Allocator.Allocate(sizeof(TypeOfExpr), 8);
+  TypeOfExpr *toe = new (Mem) TypeOfExpr(tofExpr, Canonical);
   Types.push_back(toe);
   return QualType(toe, 0);
 }





More information about the cfe-commits mailing list