[cfe-commits] r139413 - in /cfe/trunk: include/clang/Serialization/ASTReader.h lib/Serialization/ASTReader.cpp lib/Serialization/ASTReaderDecl.cpp lib/Serialization/ASTReaderStmt.cpp

Douglas Gregor dgregor at apple.com
Fri Sep 9 14:34:22 PDT 2011


Author: dgregor
Date: Fri Sep  9 16:34:22 2011
New Revision: 139413

URL: http://llvm.org/viewvc/llvm-project?rev=139413&view=rev
Log:
In ASTReader, replace the never-NULL ASTContext pointer with an
ASTContext reference. Remove all of the extra checking and logic that
was used to cope with a NULL ASTContext. No effective functionality
change.

Modified:
    cfe/trunk/include/clang/Serialization/ASTReader.h
    cfe/trunk/lib/Serialization/ASTReader.cpp
    cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
    cfe/trunk/lib/Serialization/ASTReaderStmt.cpp

Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=139413&r1=139412&r2=139413&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Fri Sep  9 16:34:22 2011
@@ -233,7 +233,7 @@
   Preprocessor *PP;
 
   /// \brief The AST context into which we'll read the AST files.
-  ASTContext *Context;
+  ASTContext &Context;
       
   /// \brief The AST consumer.
   ASTConsumer *Consumer;
@@ -752,8 +752,8 @@
   /// \brief Set the Preprocessor to use.
   void setPreprocessor(Preprocessor &pp);
 
-  /// \brief Sets and initializes the given Context.
-  void InitializeContext(ASTContext &Context);
+  /// \brief Initializes the ASTContext
+  void InitializeContext();
 
   /// \brief Add in-memory (virtual file) buffer.
   void addInMemoryBuffer(StringRef &FileName, llvm::MemoryBuffer *Buffer) {
@@ -1267,7 +1267,7 @@
   }
   
   /// \brief Retrieve the AST context that this AST reader supplements.
-  ASTContext *getContext() { return Context; }
+  ASTContext &getContext() { return Context; }
 
   // \brief Contains declarations that were loaded before we have
   // access to a Sema object.

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=139413&r1=139412&r2=139413&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Sep  9 16:34:22 2011
@@ -498,7 +498,7 @@
 ASTSelectorLookupTrait::internal_key_type 
 ASTSelectorLookupTrait::ReadKey(const unsigned char* d, unsigned) {
   using namespace clang::io;
-  SelectorTable &SelTable = Reader.getContext()->Selectors;
+  SelectorTable &SelTable = Reader.getContext().Selectors;
   unsigned N = ReadUnalignedLE16(d);
   IdentifierInfo *FirstII
     = Reader.getLocalIdentifier(F, ReadUnalignedLE32(d));
@@ -632,7 +632,6 @@
 
   // Read all of the declarations visible at global scope with this
   // name.
-  if (Reader.getContext() == 0) return II;
   if (DataLen > 0) {
     SmallVector<uint32_t, 4> DeclIDs;
     for (; DataLen > 0; DataLen -= 4)
@@ -706,7 +705,7 @@
 ASTDeclContextNameLookupTrait::external_key_type 
 ASTDeclContextNameLookupTrait::GetExternalKey(
                                           const internal_key_type& Key) const {
-  ASTContext *Context = Reader.getContext();
+  ASTContext &Context = Reader.getContext();
   switch (Key.Kind) {
   case DeclarationName::Identifier:
     return DeclarationName((IdentifierInfo*)Key.Data);
@@ -717,23 +716,23 @@
     return DeclarationName(Selector(Key.Data));
 
   case DeclarationName::CXXConstructorName:
-    return Context->DeclarationNames.getCXXConstructorName(
-             Context->getCanonicalType(Reader.getLocalType(F, Key.Data)));
+    return Context.DeclarationNames.getCXXConstructorName(
+             Context.getCanonicalType(Reader.getLocalType(F, Key.Data)));
 
   case DeclarationName::CXXDestructorName:
-    return Context->DeclarationNames.getCXXDestructorName(
-             Context->getCanonicalType(Reader.getLocalType(F, Key.Data)));
+    return Context.DeclarationNames.getCXXDestructorName(
+             Context.getCanonicalType(Reader.getLocalType(F, Key.Data)));
 
   case DeclarationName::CXXConversionFunctionName:
-    return Context->DeclarationNames.getCXXConversionFunctionName(
-             Context->getCanonicalType(Reader.getLocalType(F, Key.Data)));
+    return Context.DeclarationNames.getCXXConversionFunctionName(
+             Context.getCanonicalType(Reader.getLocalType(F, Key.Data)));
 
   case DeclarationName::CXXOperatorName:
-    return Context->DeclarationNames.getCXXOperatorName(
+    return Context.DeclarationNames.getCXXOperatorName(
                                        (OverloadedOperatorKind)Key.Data);
 
   case DeclarationName::CXXLiteralOperatorName:
-    return Context->DeclarationNames.getCXXLiteralOperatorName(
+    return Context.DeclarationNames.getCXXLiteralOperatorName(
                                                    (IdentifierInfo*)Key.Data);
 
   case DeclarationName::CXXUsingDirective:
@@ -1934,14 +1933,12 @@
     }
         
     case TU_UPDATE_LEXICAL: {
-      DeclContext *TU = Context ? Context->getTranslationUnitDecl() : 0;
+      DeclContext *TU = Context.getTranslationUnitDecl();
       DeclContextInfo &Info = F.DeclContextInfos[TU];
       Info.LexicalDecls = reinterpret_cast<const KindDeclIDPair *>(BlobStart);
       Info.NumLexicalDecls 
         = static_cast<unsigned int>(BlobLen / sizeof(KindDeclIDPair));
-      if (TU)
-        TU->setHasExternalLexicalStorage(true);
-
+      TU->setHasExternalLexicalStorage(true);
       break;
     }
 
@@ -1952,8 +1949,8 @@
                         (const unsigned char *)BlobStart + Record[Idx++],
                         (const unsigned char *)BlobStart,
                         ASTDeclContextNameLookupTrait(*this, F));
-      if (ID == PREDEF_DECL_TRANSLATION_UNIT_ID && Context) { // Is it the TU?
-        DeclContext *TU = Context->getTranslationUnitDecl();
+      if (ID == PREDEF_DECL_TRANSLATION_UNIT_ID) { // Is it the TU?
+        DeclContext *TU = Context.getTranslationUnitDecl();
         F.DeclContextInfos[TU].NameLookupTableData = Table;
         TU->setHasExternalVisibleStorage(true);
       } else
@@ -2635,8 +2632,7 @@
     }
   }
 
-  if (Context)
-    InitializeContext(*Context);
+  InitializeContext();
 
   if (DeserializationListener)
     DeserializationListener->ReaderInitialized(this);
@@ -2797,59 +2793,38 @@
   PP->getHeaderSearchInfo().SetExternalSource(this);
 }
 
-void ASTReader::InitializeContext(ASTContext &Ctx) {
-  Context = &Ctx;
-  assert(Context && "Passed null context!");
-  
+void ASTReader::InitializeContext() {
   assert(PP && "Forgot to set Preprocessor ?");
   PP->getIdentifierTable().setExternalIdentifierLookup(this);
   PP->setExternalSource(this);
   
-  // If we have any update blocks for the TU waiting, we have to add
-  // them before we deserialize anything.
-  TranslationUnitDecl *TU = Ctx.getTranslationUnitDecl();
-  for (ModuleIterator M = ModuleMgr.begin(), MEnd = ModuleMgr.end(); 
-       M != MEnd; ++M) {
-    Module::DeclContextInfosMap::iterator DCU
-      = (*M)->DeclContextInfos.find(0);
-    if (DCU != (*M)->DeclContextInfos.end()) {
-      // Insertion could invalidate map, so grab value first.
-      DeclContextInfo Info = DCU->second;
-      (*M)->DeclContextInfos.erase(DCU);
-      (*M)->DeclContextInfos[TU] = Info;
-      
-      if (Info.NumLexicalDecls)
-        TU->setHasExternalLexicalStorage();
-      if (Info.NameLookupTableData)
-        TU->setHasExternalVisibleStorage();
-    }
-  }
-  
   // If there's a listener, notify them that we "read" the translation unit.
   if (DeserializationListener)
-    DeserializationListener->DeclRead(PREDEF_DECL_TRANSLATION_UNIT_ID, TU);
+    DeserializationListener->DeclRead(PREDEF_DECL_TRANSLATION_UNIT_ID, 
+                                      Context.getTranslationUnitDecl());
 
   // Make sure we load the declaration update records for the translation unit,
   // if there are any.
-  loadDeclUpdateRecords(PREDEF_DECL_TRANSLATION_UNIT_ID, TU);
+  loadDeclUpdateRecords(PREDEF_DECL_TRANSLATION_UNIT_ID, 
+                        Context.getTranslationUnitDecl());
   
   // FIXME: Find a better way to deal with collisions between these
   // built-in types. Right now, we just ignore the problem.
   
   // Load the special types.
-  if (Context->getBuiltinVaListType().isNull()) {
-    Context->setBuiltinVaListType(
+  if (Context.getBuiltinVaListType().isNull()) {
+    Context.setBuiltinVaListType(
       GetType(SpecialTypes[SPECIAL_TYPE_BUILTIN_VA_LIST]));
   }
   
   if (unsigned Proto = SpecialTypes[SPECIAL_TYPE_OBJC_PROTOCOL]) {
-    if (Context->ObjCProtoType.isNull())
-      Context->ObjCProtoType = GetType(Proto);
+    if (Context.ObjCProtoType.isNull())
+      Context.ObjCProtoType = GetType(Proto);
   }
   
   if (unsigned String = SpecialTypes[SPECIAL_TYPE_CF_CONSTANT_STRING]) {
-    if (!Context->CFConstantStringTypeDecl)
-      Context->setCFConstantStringType(GetType(String));
+    if (!Context.CFConstantStringTypeDecl)
+      Context.setCFConstantStringType(GetType(String));
   }
   
   if (unsigned File = SpecialTypes[SPECIAL_TYPE_FILE]) {
@@ -2859,16 +2834,16 @@
       return;
     }
     
-    if (!Context->FILEDecl) {
+    if (!Context.FILEDecl) {
       if (const TypedefType *Typedef = FileType->getAs<TypedefType>())
-        Context->setFILEDecl(Typedef->getDecl());
+        Context.setFILEDecl(Typedef->getDecl());
       else {
         const TagType *Tag = FileType->getAs<TagType>();
         if (!Tag) {
           Error("Invalid FILE type in AST file");
           return;
         }
-        Context->setFILEDecl(Tag->getDecl());
+        Context.setFILEDecl(Tag->getDecl());
       }
     }
   }
@@ -2880,16 +2855,16 @@
       return;
     }
     
-    if (!Context->jmp_bufDecl) {
+    if (!Context.jmp_bufDecl) {
       if (const TypedefType *Typedef = Jmp_bufType->getAs<TypedefType>())
-        Context->setjmp_bufDecl(Typedef->getDecl());
+        Context.setjmp_bufDecl(Typedef->getDecl());
       else {
         const TagType *Tag = Jmp_bufType->getAs<TagType>();
         if (!Tag) {
           Error("Invalid jmp_buf type in AST file");
           return;
         }
-        Context->setjmp_bufDecl(Tag->getDecl());
+        Context.setjmp_bufDecl(Tag->getDecl());
       }
     }
   }
@@ -2901,41 +2876,41 @@
       return;
     }
     
-    if (!Context->sigjmp_bufDecl) {
+    if (!Context.sigjmp_bufDecl) {
       if (const TypedefType *Typedef = Sigjmp_bufType->getAs<TypedefType>())
-        Context->setsigjmp_bufDecl(Typedef->getDecl());
+        Context.setsigjmp_bufDecl(Typedef->getDecl());
       else {
         const TagType *Tag = Sigjmp_bufType->getAs<TagType>();
         assert(Tag && "Invalid sigjmp_buf type in AST file");
-        Context->setsigjmp_bufDecl(Tag->getDecl());
+        Context.setsigjmp_bufDecl(Tag->getDecl());
       }
     }
   }
 
   if (unsigned ObjCIdRedef
         = SpecialTypes[SPECIAL_TYPE_OBJC_ID_REDEFINITION]) {
-    if (Context->ObjCIdRedefinitionType.isNull())
-      Context->ObjCIdRedefinitionType = GetType(ObjCIdRedef);
+    if (Context.ObjCIdRedefinitionType.isNull())
+      Context.ObjCIdRedefinitionType = GetType(ObjCIdRedef);
   }
 
   if (unsigned ObjCClassRedef
         = SpecialTypes[SPECIAL_TYPE_OBJC_CLASS_REDEFINITION]) {
-    if (Context->ObjCClassRedefinitionType.isNull())
-      Context->ObjCClassRedefinitionType = GetType(ObjCClassRedef);
+    if (Context.ObjCClassRedefinitionType.isNull())
+      Context.ObjCClassRedefinitionType = GetType(ObjCClassRedef);
   }
 
   if (unsigned ObjCSelRedef
         = SpecialTypes[SPECIAL_TYPE_OBJC_SEL_REDEFINITION]) {
-    if (Context->ObjCSelRedefinitionType.isNull())
-      Context->ObjCSelRedefinitionType = GetType(ObjCSelRedef);
+    if (Context.ObjCSelRedefinitionType.isNull())
+      Context.ObjCSelRedefinitionType = GetType(ObjCSelRedef);
   }
 
-  ReadPragmaDiagnosticMappings(Context->getDiagnostics());
+  ReadPragmaDiagnosticMappings(Context.getDiagnostics());
 
   // If there were any CUDA special declarations, deserialize them.
   if (!CUDASpecialDeclRefs.empty()) {
     assert(CUDASpecialDeclRefs.size() == 1 && "More decl refs than expected!");
-    Context->setcudaConfigureCallDecl(
+    Context.setcudaConfigureCallDecl(
                            cast<FunctionDecl>(GetDecl(CUDASpecialDeclRefs[0])));
   }
 }
@@ -3271,7 +3246,7 @@
     }
     QualType Base = readType(*Loc.F, Record, Idx);
     Qualifiers Quals = Qualifiers::fromOpaqueValue(Record[Idx++]);
-    return Context->getQualifiedType(Base, Quals);
+    return Context.getQualifiedType(Base, Quals);
   }
 
   case TYPE_COMPLEX: {
@@ -3280,7 +3255,7 @@
       return QualType();
     }
     QualType ElemType = readType(*Loc.F, Record, Idx);
-    return Context->getComplexType(ElemType);
+    return Context.getComplexType(ElemType);
   }
 
   case TYPE_POINTER: {
@@ -3289,7 +3264,7 @@
       return QualType();
     }
     QualType PointeeType = readType(*Loc.F, Record, Idx);
-    return Context->getPointerType(PointeeType);
+    return Context.getPointerType(PointeeType);
   }
 
   case TYPE_BLOCK_POINTER: {
@@ -3298,7 +3273,7 @@
       return QualType();
     }
     QualType PointeeType = readType(*Loc.F, Record, Idx);
-    return Context->getBlockPointerType(PointeeType);
+    return Context.getBlockPointerType(PointeeType);
   }
 
   case TYPE_LVALUE_REFERENCE: {
@@ -3307,7 +3282,7 @@
       return QualType();
     }
     QualType PointeeType = readType(*Loc.F, Record, Idx);
-    return Context->getLValueReferenceType(PointeeType, Record[1]);
+    return Context.getLValueReferenceType(PointeeType, Record[1]);
   }
 
   case TYPE_RVALUE_REFERENCE: {
@@ -3316,7 +3291,7 @@
       return QualType();
     }
     QualType PointeeType = readType(*Loc.F, Record, Idx);
-    return Context->getRValueReferenceType(PointeeType);
+    return Context.getRValueReferenceType(PointeeType);
   }
 
   case TYPE_MEMBER_POINTER: {
@@ -3329,7 +3304,7 @@
     if (PointeeType.isNull() || ClassType.isNull())
       return QualType();
     
-    return Context->getMemberPointerType(PointeeType, ClassType.getTypePtr());
+    return Context.getMemberPointerType(PointeeType, ClassType.getTypePtr());
   }
 
   case TYPE_CONSTANT_ARRAY: {
@@ -3338,7 +3313,7 @@
     unsigned IndexTypeQuals = Record[2];
     unsigned Idx = 3;
     llvm::APInt Size = ReadAPInt(Record, Idx);
-    return Context->getConstantArrayType(ElementType, Size,
+    return Context.getConstantArrayType(ElementType, Size,
                                          ASM, IndexTypeQuals);
   }
 
@@ -3346,7 +3321,7 @@
     QualType ElementType = readType(*Loc.F, Record, Idx);
     ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1];
     unsigned IndexTypeQuals = Record[2];
-    return Context->getIncompleteArrayType(ElementType, ASM, IndexTypeQuals);
+    return Context.getIncompleteArrayType(ElementType, ASM, IndexTypeQuals);
   }
 
   case TYPE_VARIABLE_ARRAY: {
@@ -3355,7 +3330,7 @@
     unsigned IndexTypeQuals = Record[2];
     SourceLocation LBLoc = ReadSourceLocation(*Loc.F, Record[3]);
     SourceLocation RBLoc = ReadSourceLocation(*Loc.F, Record[4]);
-    return Context->getVariableArrayType(ElementType, ReadExpr(*Loc.F),
+    return Context.getVariableArrayType(ElementType, ReadExpr(*Loc.F),
                                          ASM, IndexTypeQuals,
                                          SourceRange(LBLoc, RBLoc));
   }
@@ -3369,7 +3344,7 @@
     QualType ElementType = readType(*Loc.F, Record, Idx);
     unsigned NumElements = Record[1];
     unsigned VecKind = Record[2];
-    return Context->getVectorType(ElementType, NumElements,
+    return Context.getVectorType(ElementType, NumElements,
                                   (VectorType::VectorKind)VecKind);
   }
 
@@ -3381,7 +3356,7 @@
 
     QualType ElementType = readType(*Loc.F, Record, Idx);
     unsigned NumElements = Record[1];
-    return Context->getExtVectorType(ElementType, NumElements);
+    return Context.getExtVectorType(ElementType, NumElements);
   }
 
   case TYPE_FUNCTION_NO_PROTO: {
@@ -3392,7 +3367,7 @@
     QualType ResultType = readType(*Loc.F, Record, Idx);
     FunctionType::ExtInfo Info(Record[1], Record[2], Record[3],
                                (CallingConv)Record[4], Record[5]);
-    return Context->getFunctionNoProtoType(ResultType, Info);
+    return Context.getFunctionNoProtoType(ResultType, Info);
   }
 
   case TYPE_FUNCTION_PROTO: {
@@ -3426,13 +3401,13 @@
     } else if (EST == EST_ComputedNoexcept) {
       EPI.NoexceptExpr = ReadExpr(*Loc.F);
     }
-    return Context->getFunctionType(ResultType, ParamTypes.data(), NumParams,
+    return Context.getFunctionType(ResultType, ParamTypes.data(), NumParams,
                                     EPI);
   }
 
   case TYPE_UNRESOLVED_USING: {
     unsigned Idx = 0;
-    return Context->getTypeDeclType(
+    return Context.getTypeDeclType(
                   ReadDeclAs<UnresolvedUsingTypenameDecl>(*Loc.F, Record, Idx));
   }
       
@@ -3445,12 +3420,12 @@
     TypedefNameDecl *Decl = ReadDeclAs<TypedefNameDecl>(*Loc.F, Record, Idx);
     QualType Canonical = readType(*Loc.F, Record, Idx);
     if (!Canonical.isNull())
-      Canonical = Context->getCanonicalType(Canonical);
-    return Context->getTypedefType(Decl, Canonical);
+      Canonical = Context.getCanonicalType(Canonical);
+    return Context.getTypedefType(Decl, Canonical);
   }
 
   case TYPE_TYPEOF_EXPR:
-    return Context->getTypeOfExprType(ReadExpr(*Loc.F));
+    return Context.getTypeOfExprType(ReadExpr(*Loc.F));
 
   case TYPE_TYPEOF: {
     if (Record.size() != 1) {
@@ -3458,21 +3433,21 @@
       return QualType();
     }
     QualType UnderlyingType = readType(*Loc.F, Record, Idx);
-    return Context->getTypeOfType(UnderlyingType);
+    return Context.getTypeOfType(UnderlyingType);
   }
 
   case TYPE_DECLTYPE:
-    return Context->getDecltypeType(ReadExpr(*Loc.F));
+    return Context.getDecltypeType(ReadExpr(*Loc.F));
 
   case TYPE_UNARY_TRANSFORM: {
     QualType BaseType = readType(*Loc.F, Record, Idx);
     QualType UnderlyingType = readType(*Loc.F, Record, Idx);
     UnaryTransformType::UTTKind UKind = (UnaryTransformType::UTTKind)Record[2];
-    return Context->getUnaryTransformType(BaseType, UnderlyingType, UKind);
+    return Context.getUnaryTransformType(BaseType, UnderlyingType, UKind);
   }
 
   case TYPE_AUTO:
-    return Context->getAutoType(readType(*Loc.F, Record, Idx));
+    return Context.getAutoType(readType(*Loc.F, Record, Idx));
 
   case TYPE_RECORD: {
     if (Record.size() != 2) {
@@ -3482,7 +3457,7 @@
     unsigned Idx = 0;
     bool IsDependent = Record[Idx++];
     QualType T
-      = Context->getRecordType(ReadDeclAs<RecordDecl>(*Loc.F, Record, Idx));
+      = Context.getRecordType(ReadDeclAs<RecordDecl>(*Loc.F, Record, Idx));
     const_cast<Type*>(T.getTypePtr())->setDependent(IsDependent);
     return T;
   }
@@ -3495,7 +3470,7 @@
     unsigned Idx = 0;
     bool IsDependent = Record[Idx++];
     QualType T
-      = Context->getEnumType(ReadDeclAs<EnumDecl>(*Loc.F, Record, Idx));
+      = Context.getEnumType(ReadDeclAs<EnumDecl>(*Loc.F, Record, Idx));
     const_cast<Type*>(T.getTypePtr())->setDependent(IsDependent);
     return T;
   }
@@ -3508,7 +3483,7 @@
     QualType modifiedType = readType(*Loc.F, Record, Idx);
     QualType equivalentType = readType(*Loc.F, Record, Idx);
     AttributedType::Kind kind = static_cast<AttributedType::Kind>(Record[2]);
-    return Context->getAttributedType(kind, modifiedType, equivalentType);
+    return Context.getAttributedType(kind, modifiedType, equivalentType);
   }
 
   case TYPE_PAREN: {
@@ -3517,7 +3492,7 @@
       return QualType();
     }
     QualType InnerType = readType(*Loc.F, Record, Idx);
-    return Context->getParenType(InnerType);
+    return Context.getParenType(InnerType);
   }
 
   case TYPE_PACK_EXPANSION: {
@@ -3531,7 +3506,7 @@
     llvm::Optional<unsigned> NumExpansions;
     if (Record[1])
       NumExpansions = Record[1] - 1;
-    return Context->getPackExpansionType(Pattern, NumExpansions);
+    return Context.getPackExpansionType(Pattern, NumExpansions);
   }
 
   case TYPE_ELABORATED: {
@@ -3539,14 +3514,14 @@
     ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
     NestedNameSpecifier *NNS = ReadNestedNameSpecifier(*Loc.F, Record, Idx);
     QualType NamedType = readType(*Loc.F, Record, Idx);
-    return Context->getElaboratedType(Keyword, NNS, NamedType);
+    return Context.getElaboratedType(Keyword, NNS, NamedType);
   }
 
   case TYPE_OBJC_INTERFACE: {
     unsigned Idx = 0;
     ObjCInterfaceDecl *ItfD
       = ReadDeclAs<ObjCInterfaceDecl>(*Loc.F, Record, Idx);
-    return Context->getObjCInterfaceType(ItfD);
+    return Context.getObjCInterfaceType(ItfD);
   }
 
   case TYPE_OBJC_OBJECT: {
@@ -3556,13 +3531,13 @@
     SmallVector<ObjCProtocolDecl*, 4> Protos;
     for (unsigned I = 0; I != NumProtos; ++I)
       Protos.push_back(ReadDeclAs<ObjCProtocolDecl>(*Loc.F, Record, Idx));
-    return Context->getObjCObjectType(Base, Protos.data(), NumProtos);
+    return Context.getObjCObjectType(Base, Protos.data(), NumProtos);
   }
 
   case TYPE_OBJC_OBJECT_POINTER: {
     unsigned Idx = 0;
     QualType Pointee = readType(*Loc.F, Record, Idx);
-    return Context->getObjCObjectPointerType(Pointee);
+    return Context.getObjCObjectPointerType(Pointee);
   }
 
   case TYPE_SUBST_TEMPLATE_TYPE_PARM: {
@@ -3570,7 +3545,7 @@
     QualType Parm = readType(*Loc.F, Record, Idx);
     QualType Replacement = readType(*Loc.F, Record, Idx);
     return
-      Context->getSubstTemplateTypeParmType(cast<TemplateTypeParmType>(Parm),
+      Context.getSubstTemplateTypeParmType(cast<TemplateTypeParmType>(Parm),
                                             Replacement);
   }
 
@@ -3578,7 +3553,7 @@
     unsigned Idx = 0;
     QualType Parm = readType(*Loc.F, Record, Idx);
     TemplateArgument ArgPack = ReadTemplateArgument(*Loc.F, Record, Idx);
-    return Context->getSubstTemplateTypeParmPackType(
+    return Context.getSubstTemplateTypeParmPackType(
                                                cast<TemplateTypeParmType>(Parm),
                                                      ArgPack);
   }
@@ -3589,7 +3564,7 @@
     // FIXME: ASTContext::getInjectedClassNameType is not currently suitable
     // for AST reading, too much interdependencies.
     return
-      QualType(new (*Context, TypeAlignment) InjectedClassNameType(D, TST), 0);
+      QualType(new (Context, TypeAlignment) InjectedClassNameType(D, TST), 0);
   }
 
   case TYPE_TEMPLATE_TYPE_PARM: {
@@ -3599,7 +3574,7 @@
     bool Pack = Record[Idx++];
     TemplateTypeParmDecl *D
       = ReadDeclAs<TemplateTypeParmDecl>(*Loc.F, Record, Idx);
-    return Context->getTemplateTypeParmType(Depth, Index, Pack, D);
+    return Context.getTemplateTypeParmType(Depth, Index, Pack, D);
   }
 
   case TYPE_DEPENDENT_NAME: {
@@ -3609,8 +3584,8 @@
     const IdentifierInfo *Name = this->GetIdentifierInfo(*Loc.F, Record, Idx);
     QualType Canon = readType(*Loc.F, Record, Idx);
     if (!Canon.isNull())
-      Canon = Context->getCanonicalType(Canon);
-    return Context->getDependentNameType(Keyword, NNS, Name, Canon);
+      Canon = Context.getCanonicalType(Canon);
+    return Context.getDependentNameType(Keyword, NNS, Name, Canon);
   }
 
   case TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION: {
@@ -3623,7 +3598,7 @@
     Args.reserve(NumArgs);
     while (NumArgs--)
       Args.push_back(ReadTemplateArgument(*Loc.F, Record, Idx));
-    return Context->getDependentTemplateSpecializationType(Keyword, NNS, Name,
+    return Context.getDependentTemplateSpecializationType(Keyword, NNS, Name,
                                                       Args.size(), Args.data());
   }
 
@@ -3640,7 +3615,7 @@
     Expr *NumElts = ReadExpr(*Loc.F);
     SourceRange Brackets = ReadSourceRange(*Loc.F, Record, Idx);
 
-    return Context->getDependentSizedArrayType(ElementType, NumElts, ASM,
+    return Context.getDependentSizedArrayType(ElementType, NumElts, ASM,
                                                IndexTypeQuals, Brackets);
   }
 
@@ -3653,10 +3628,10 @@
     QualType Underlying = readType(*Loc.F, Record, Idx);
     QualType T;
     if (Underlying.isNull())
-      T = Context->getCanonicalTemplateSpecializationType(Name, Args.data(),
+      T = Context.getCanonicalTemplateSpecializationType(Name, Args.data(),
                                                           Args.size());
     else
-      T = Context->getTemplateSpecializationType(Name, Args.data(),
+      T = Context.getTemplateSpecializationType(Name, Args.data(),
                                                  Args.size(), Underlying);
     const_cast<Type*>(T.getTypePtr())->setDependent(IsDependent);
     return T;
@@ -3903,7 +3878,7 @@
   if (InfoTy.isNull())
     return 0;
 
-  TypeSourceInfo *TInfo = getContext()->CreateTypeSourceInfo(InfoTy);
+  TypeSourceInfo *TInfo = getContext().CreateTypeSourceInfo(InfoTy);
   TypeLocReader TLR(*this, F, Record, Idx);
   for (TypeLoc TL = TInfo->getTypeLoc(); !TL.isNull(); TL = TL.getNextTypeLoc())
     TLR.Visit(TL);
@@ -3918,45 +3893,45 @@
     QualType T;
     switch ((PredefinedTypeIDs)Index) {
     case PREDEF_TYPE_NULL_ID: return QualType();
-    case PREDEF_TYPE_VOID_ID: T = Context->VoidTy; break;
-    case PREDEF_TYPE_BOOL_ID: T = Context->BoolTy; break;
+    case PREDEF_TYPE_VOID_ID: T = Context.VoidTy; break;
+    case PREDEF_TYPE_BOOL_ID: T = Context.BoolTy; break;
 
     case PREDEF_TYPE_CHAR_U_ID:
     case PREDEF_TYPE_CHAR_S_ID:
       // FIXME: Check that the signedness of CharTy is correct!
-      T = Context->CharTy;
+      T = Context.CharTy;
       break;
 
-    case PREDEF_TYPE_UCHAR_ID:      T = Context->UnsignedCharTy;     break;
-    case PREDEF_TYPE_USHORT_ID:     T = Context->UnsignedShortTy;    break;
-    case PREDEF_TYPE_UINT_ID:       T = Context->UnsignedIntTy;      break;
-    case PREDEF_TYPE_ULONG_ID:      T = Context->UnsignedLongTy;     break;
-    case PREDEF_TYPE_ULONGLONG_ID:  T = Context->UnsignedLongLongTy; break;
-    case PREDEF_TYPE_UINT128_ID:    T = Context->UnsignedInt128Ty;   break;
-    case PREDEF_TYPE_SCHAR_ID:      T = Context->SignedCharTy;       break;
-    case PREDEF_TYPE_WCHAR_ID:      T = Context->WCharTy;            break;
-    case PREDEF_TYPE_SHORT_ID:      T = Context->ShortTy;            break;
-    case PREDEF_TYPE_INT_ID:        T = Context->IntTy;              break;
-    case PREDEF_TYPE_LONG_ID:       T = Context->LongTy;             break;
-    case PREDEF_TYPE_LONGLONG_ID:   T = Context->LongLongTy;         break;
-    case PREDEF_TYPE_INT128_ID:     T = Context->Int128Ty;           break;
-    case PREDEF_TYPE_FLOAT_ID:      T = Context->FloatTy;            break;
-    case PREDEF_TYPE_DOUBLE_ID:     T = Context->DoubleTy;           break;
-    case PREDEF_TYPE_LONGDOUBLE_ID: T = Context->LongDoubleTy;       break;
-    case PREDEF_TYPE_OVERLOAD_ID:   T = Context->OverloadTy;         break;
-    case PREDEF_TYPE_BOUND_MEMBER:  T = Context->BoundMemberTy;      break;
-    case PREDEF_TYPE_DEPENDENT_ID:  T = Context->DependentTy;        break;
-    case PREDEF_TYPE_UNKNOWN_ANY:   T = Context->UnknownAnyTy;       break;
-    case PREDEF_TYPE_NULLPTR_ID:    T = Context->NullPtrTy;          break;
-    case PREDEF_TYPE_CHAR16_ID:     T = Context->Char16Ty;           break;
-    case PREDEF_TYPE_CHAR32_ID:     T = Context->Char32Ty;           break;
-    case PREDEF_TYPE_OBJC_ID:       T = Context->ObjCBuiltinIdTy;    break;
-    case PREDEF_TYPE_OBJC_CLASS:    T = Context->ObjCBuiltinClassTy; break;
-    case PREDEF_TYPE_OBJC_SEL:      T = Context->ObjCBuiltinSelTy;   break;
-    case PREDEF_TYPE_AUTO_DEDUCT:   T = Context->getAutoDeductType(); break;
+    case PREDEF_TYPE_UCHAR_ID:      T = Context.UnsignedCharTy;     break;
+    case PREDEF_TYPE_USHORT_ID:     T = Context.UnsignedShortTy;    break;
+    case PREDEF_TYPE_UINT_ID:       T = Context.UnsignedIntTy;      break;
+    case PREDEF_TYPE_ULONG_ID:      T = Context.UnsignedLongTy;     break;
+    case PREDEF_TYPE_ULONGLONG_ID:  T = Context.UnsignedLongLongTy; break;
+    case PREDEF_TYPE_UINT128_ID:    T = Context.UnsignedInt128Ty;   break;
+    case PREDEF_TYPE_SCHAR_ID:      T = Context.SignedCharTy;       break;
+    case PREDEF_TYPE_WCHAR_ID:      T = Context.WCharTy;            break;
+    case PREDEF_TYPE_SHORT_ID:      T = Context.ShortTy;            break;
+    case PREDEF_TYPE_INT_ID:        T = Context.IntTy;              break;
+    case PREDEF_TYPE_LONG_ID:       T = Context.LongTy;             break;
+    case PREDEF_TYPE_LONGLONG_ID:   T = Context.LongLongTy;         break;
+    case PREDEF_TYPE_INT128_ID:     T = Context.Int128Ty;           break;
+    case PREDEF_TYPE_FLOAT_ID:      T = Context.FloatTy;            break;
+    case PREDEF_TYPE_DOUBLE_ID:     T = Context.DoubleTy;           break;
+    case PREDEF_TYPE_LONGDOUBLE_ID: T = Context.LongDoubleTy;       break;
+    case PREDEF_TYPE_OVERLOAD_ID:   T = Context.OverloadTy;         break;
+    case PREDEF_TYPE_BOUND_MEMBER:  T = Context.BoundMemberTy;      break;
+    case PREDEF_TYPE_DEPENDENT_ID:  T = Context.DependentTy;        break;
+    case PREDEF_TYPE_UNKNOWN_ANY:   T = Context.UnknownAnyTy;       break;
+    case PREDEF_TYPE_NULLPTR_ID:    T = Context.NullPtrTy;          break;
+    case PREDEF_TYPE_CHAR16_ID:     T = Context.Char16Ty;           break;
+    case PREDEF_TYPE_CHAR32_ID:     T = Context.Char32Ty;           break;
+    case PREDEF_TYPE_OBJC_ID:       T = Context.ObjCBuiltinIdTy;    break;
+    case PREDEF_TYPE_OBJC_CLASS:    T = Context.ObjCBuiltinClassTy; break;
+    case PREDEF_TYPE_OBJC_SEL:      T = Context.ObjCBuiltinSelTy;   break;
+    case PREDEF_TYPE_AUTO_DEDUCT:   T = Context.getAutoDeductType(); break;
         
     case PREDEF_TYPE_AUTO_RREF_DEDUCT: 
-      T = Context->getAutoRRefDeductType(); 
+      T = Context.getAutoRRefDeductType(); 
       break;
     }
 
@@ -4077,7 +4052,7 @@
 
   unsigned Idx = 0;
   unsigned NumBases = Record[Idx++];
-  void *Mem = Context->Allocate(sizeof(CXXBaseSpecifier) * NumBases);
+  void *Mem = Context.Allocate(sizeof(CXXBaseSpecifier) * NumBases);
   CXXBaseSpecifier *Bases = new (Mem) CXXBaseSpecifier [NumBases];
   for (unsigned I = 0; I != NumBases; ++I)
     Bases[I] = ReadCXXBaseSpecifier(*Loc.F, Record, Idx);
@@ -4110,32 +4085,25 @@
       return 0;
         
     case PREDEF_DECL_TRANSLATION_UNIT_ID:
-      assert(Context && "No context available?");
-      return Context->getTranslationUnitDecl();
+      return Context.getTranslationUnitDecl();
         
     case PREDEF_DECL_OBJC_ID_ID:
-      assert(Context && "No context available?");
-      return Context->getObjCIdDecl();
+      return Context.getObjCIdDecl();
 
     case PREDEF_DECL_OBJC_SEL_ID:
-      assert(Context && "No context available?");
-      return Context->getObjCSelDecl();
+      return Context.getObjCSelDecl();
 
     case PREDEF_DECL_OBJC_CLASS_ID:
-      assert(Context && "No context available?");
-      return Context->getObjCClassDecl();
+      return Context.getObjCClassDecl();
         
     case PREDEF_DECL_INT_128_ID:
-      assert(Context && "No context available?");
-      return Context->getInt128Decl();
+      return Context.getInt128Decl();
 
     case PREDEF_DECL_UNSIGNED_INT_128_ID:
-      assert(Context && "No context available?");
-      return Context->getUInt128Decl();
+      return Context.getUInt128Decl();
         
     case PREDEF_DECL_OBJC_INSTANCETYPE_ID:
-      assert(Context && "No context available?");
-      return Context->getObjCInstanceTypeDecl();
+      return Context.getObjCInstanceTypeDecl();
     }
     
     return 0;
@@ -4981,23 +4949,23 @@
     return DeclarationName(ReadSelector(F, Record, Idx));
 
   case DeclarationName::CXXConstructorName:
-    return Context->DeclarationNames.getCXXConstructorName(
-                          Context->getCanonicalType(readType(F, Record, Idx)));
+    return Context.DeclarationNames.getCXXConstructorName(
+                          Context.getCanonicalType(readType(F, Record, Idx)));
 
   case DeclarationName::CXXDestructorName:
-    return Context->DeclarationNames.getCXXDestructorName(
-                          Context->getCanonicalType(readType(F, Record, Idx)));
+    return Context.DeclarationNames.getCXXDestructorName(
+                          Context.getCanonicalType(readType(F, Record, Idx)));
 
   case DeclarationName::CXXConversionFunctionName:
-    return Context->DeclarationNames.getCXXConversionFunctionName(
-                          Context->getCanonicalType(readType(F, Record, Idx)));
+    return Context.DeclarationNames.getCXXConversionFunctionName(
+                          Context.getCanonicalType(readType(F, Record, Idx)));
 
   case DeclarationName::CXXOperatorName:
-    return Context->DeclarationNames.getCXXOperatorName(
+    return Context.DeclarationNames.getCXXOperatorName(
                                        (OverloadedOperatorKind)Record[Idx++]);
 
   case DeclarationName::CXXLiteralOperatorName:
-    return Context->DeclarationNames.getCXXLiteralOperatorName(
+    return Context.DeclarationNames.getCXXLiteralOperatorName(
                                        GetIdentifierInfo(F, Record, Idx));
 
   case DeclarationName::CXXUsingDirective:
@@ -5056,7 +5024,7 @@
   unsigned NumTPLists = Record[Idx++];
   Info.NumTemplParamLists = NumTPLists;
   if (NumTPLists) {
-    Info.TemplParamLists = new (*Context) TemplateParameterList*[NumTPLists];
+    Info.TemplParamLists = new (Context) TemplateParameterList*[NumTPLists];
     for (unsigned i=0; i != NumTPLists; ++i)
       Info.TemplParamLists[i] = ReadTemplateParameterList(F, Record, Idx);
   }
@@ -5076,23 +5044,23 @@
     while (size--)
       Decls.addDecl(ReadDeclAs<NamedDecl>(F, Record, Idx));
 
-    return Context->getOverloadedTemplateName(Decls.begin(), Decls.end());
+    return Context.getOverloadedTemplateName(Decls.begin(), Decls.end());
   }
 
   case TemplateName::QualifiedTemplate: {
     NestedNameSpecifier *NNS = ReadNestedNameSpecifier(F, Record, Idx);
     bool hasTemplKeyword = Record[Idx++];
     TemplateDecl *Template = ReadDeclAs<TemplateDecl>(F, Record, Idx);
-    return Context->getQualifiedTemplateName(NNS, hasTemplKeyword, Template);
+    return Context.getQualifiedTemplateName(NNS, hasTemplKeyword, Template);
   }
 
   case TemplateName::DependentTemplate: {
     NestedNameSpecifier *NNS = ReadNestedNameSpecifier(F, Record, Idx);
     if (Record[Idx++])  // isIdentifier
-      return Context->getDependentTemplateName(NNS,
+      return Context.getDependentTemplateName(NNS,
                                                GetIdentifierInfo(F, Record, 
                                                                  Idx));
-    return Context->getDependentTemplateName(NNS,
+    return Context.getDependentTemplateName(NNS,
                                          (OverloadedOperatorKind)Record[Idx++]);
   }
 
@@ -5101,7 +5069,7 @@
       = ReadDeclAs<TemplateTemplateParmDecl>(F, Record, Idx);
     if (!param) return TemplateName();
     TemplateName replacement = ReadTemplateName(F, Record, Idx);
-    return Context->getSubstTemplateTemplateParm(param, replacement);
+    return Context.getSubstTemplateTemplateParm(param, replacement);
   }
       
   case TemplateName::SubstTemplateTemplateParmPack: {
@@ -5114,7 +5082,7 @@
     if (ArgPack.getKind() != TemplateArgument::Pack)
       return TemplateName();
     
-    return Context->getSubstTemplateTemplateParmPack(Param, ArgPack);
+    return Context.getSubstTemplateTemplateParmPack(Param, ArgPack);
   }
   }
 
@@ -5151,7 +5119,7 @@
     return TemplateArgument(ReadExpr(F));
   case TemplateArgument::Pack: {
     unsigned NumArgs = Record[Idx++];
-    TemplateArgument *Args = new (*Context) TemplateArgument[NumArgs];
+    TemplateArgument *Args = new (Context) TemplateArgument[NumArgs];
     for (unsigned I = 0; I != NumArgs; ++I)
       Args[I] = ReadTemplateArgument(F, Record, Idx);
     return TemplateArgument(Args, NumArgs);
@@ -5176,7 +5144,7 @@
     Params.push_back(ReadDeclAs<NamedDecl>(F, Record, Idx));
 
   TemplateParameterList* TemplateParams =
-    TemplateParameterList::Create(*Context, TemplateLoc, LAngleLoc,
+    TemplateParameterList::Create(Context, TemplateLoc, LAngleLoc,
                                   Params.data(), Params.size(), RAngleLoc);
   return TemplateParams;
 }
@@ -5225,10 +5193,8 @@
   CXXCtorInitializer **CtorInitializers = 0;
   unsigned NumInitializers = Record[Idx++];
   if (NumInitializers) {
-    ASTContext &C = *getContext();
-
     CtorInitializers
-        = new (C) CXXCtorInitializer*[NumInitializers];
+        = new (Context) CXXCtorInitializer*[NumInitializers];
     for (unsigned i=0; i != NumInitializers; ++i) {
       TypeSourceInfo *BaseClassInfo = 0;
       bool IsBaseVirtual = false;
@@ -5274,22 +5240,22 @@
 
       CXXCtorInitializer *BOMInit;
       if (Type == CTOR_INITIALIZER_BASE) {
-        BOMInit = new (C) CXXCtorInitializer(C, BaseClassInfo, IsBaseVirtual,
+        BOMInit = new (Context) CXXCtorInitializer(Context, BaseClassInfo, IsBaseVirtual,
                                              LParenLoc, Init, RParenLoc,
                                              MemberOrEllipsisLoc);
       } else if (Type == CTOR_INITIALIZER_DELEGATING) {
-        BOMInit = new (C) CXXCtorInitializer(C, MemberOrEllipsisLoc, LParenLoc,
+        BOMInit = new (Context) CXXCtorInitializer(Context, MemberOrEllipsisLoc, LParenLoc,
                                              Target, Init, RParenLoc);
       } else if (IsWritten) {
         if (Member)
-          BOMInit = new (C) CXXCtorInitializer(C, Member, MemberOrEllipsisLoc,
+          BOMInit = new (Context) CXXCtorInitializer(Context, Member, MemberOrEllipsisLoc,
                                                LParenLoc, Init, RParenLoc);
         else 
-          BOMInit = new (C) CXXCtorInitializer(C, IndirectMember,
+          BOMInit = new (Context) CXXCtorInitializer(Context, IndirectMember,
                                                MemberOrEllipsisLoc, LParenLoc,
                                                Init, RParenLoc);
       } else {
-        BOMInit = CXXCtorInitializer::Create(C, Member, MemberOrEllipsisLoc,
+        BOMInit = CXXCtorInitializer::Create(Context, Member, MemberOrEllipsisLoc,
                                              LParenLoc, Init, RParenLoc,
                                              Indices.data(), Indices.size());
       }
@@ -5314,19 +5280,19 @@
     switch (Kind) {
     case NestedNameSpecifier::Identifier: {
       IdentifierInfo *II = GetIdentifierInfo(F, Record, Idx);
-      NNS = NestedNameSpecifier::Create(*Context, Prev, II);
+      NNS = NestedNameSpecifier::Create(Context, Prev, II);
       break;
     }
 
     case NestedNameSpecifier::Namespace: {
       NamespaceDecl *NS = ReadDeclAs<NamespaceDecl>(F, Record, Idx);
-      NNS = NestedNameSpecifier::Create(*Context, Prev, NS);
+      NNS = NestedNameSpecifier::Create(Context, Prev, NS);
       break;
     }
 
     case NestedNameSpecifier::NamespaceAlias: {
       NamespaceAliasDecl *Alias =ReadDeclAs<NamespaceAliasDecl>(F, Record, Idx);
-      NNS = NestedNameSpecifier::Create(*Context, Prev, Alias);
+      NNS = NestedNameSpecifier::Create(Context, Prev, Alias);
       break;
     }
 
@@ -5337,12 +5303,12 @@
         return 0;
       
       bool Template = Record[Idx++];
-      NNS = NestedNameSpecifier::Create(*Context, Prev, Template, T);
+      NNS = NestedNameSpecifier::Create(Context, Prev, Template, T);
       break;
     }
 
     case NestedNameSpecifier::Global: {
-      NNS = NestedNameSpecifier::GlobalSpecifier(*Context);
+      NNS = NestedNameSpecifier::GlobalSpecifier(Context);
       // No associated value, and there can't be a prefix.
       break;
     }
@@ -5364,21 +5330,21 @@
     case NestedNameSpecifier::Identifier: {
       IdentifierInfo *II = GetIdentifierInfo(F, Record, Idx);      
       SourceRange Range = ReadSourceRange(F, Record, Idx);
-      Builder.Extend(*Context, II, Range.getBegin(), Range.getEnd());
+      Builder.Extend(Context, II, Range.getBegin(), Range.getEnd());
       break;
     }
 
     case NestedNameSpecifier::Namespace: {
       NamespaceDecl *NS = ReadDeclAs<NamespaceDecl>(F, Record, Idx);
       SourceRange Range = ReadSourceRange(F, Record, Idx);
-      Builder.Extend(*Context, NS, Range.getBegin(), Range.getEnd());
+      Builder.Extend(Context, NS, Range.getBegin(), Range.getEnd());
       break;
     }
 
     case NestedNameSpecifier::NamespaceAlias: {
       NamespaceAliasDecl *Alias =ReadDeclAs<NamespaceAliasDecl>(F, Record, Idx);
       SourceRange Range = ReadSourceRange(F, Record, Idx);
-      Builder.Extend(*Context, Alias, Range.getBegin(), Range.getEnd());
+      Builder.Extend(Context, Alias, Range.getBegin(), Range.getEnd());
       break;
     }
 
@@ -5391,7 +5357,7 @@
       SourceLocation ColonColonLoc = ReadSourceLocation(F, Record, Idx);
 
       // FIXME: 'template' keyword location not saved anywhere, so we fake it.
-      Builder.Extend(*Context, 
+      Builder.Extend(Context, 
                      Template? T->getTypeLoc().getBeginLoc() : SourceLocation(),
                      T->getTypeLoc(), ColonColonLoc);
       break;
@@ -5399,13 +5365,13 @@
 
     case NestedNameSpecifier::Global: {
       SourceLocation ColonColonLoc = ReadSourceLocation(F, Record, Idx);
-      Builder.MakeGlobal(*Context, ColonColonLoc);
+      Builder.MakeGlobal(Context, ColonColonLoc);
       break;
     }
     }
   }
   
-  return Builder.getWithLocInContext(*Context);
+  return Builder.getWithLocInContext(Context);
 }
 
 SourceRange
@@ -5460,7 +5426,7 @@
                                           const RecordData &Record,
                                           unsigned &Idx) {
   CXXDestructorDecl *Decl = ReadDeclAs<CXXDestructorDecl>(F, Record, Idx);
-  return CXXTemporary::Create(*Context, Decl);
+  return CXXTemporary::Create(Context, Decl);
 }
 
 DiagnosticBuilder ASTReader::Diag(unsigned DiagID) {
@@ -5530,7 +5496,7 @@
                      bool DisableStatCache)
   : Listener(new PCHValidator(PP, *this)), DeserializationListener(0),
     SourceMgr(PP.getSourceManager()), FileMgr(PP.getFileManager()),
-    Diags(PP.getDiagnostics()), SemaObj(0), PP(&PP), Context(&Context),
+    Diags(PP.getDiagnostics()), SemaObj(0), PP(&PP), Context(Context),
     Consumer(0), ModuleMgr(FileMgr.getFileSystemOptions()),
     RelocatablePCH(false), isysroot(isysroot),
     DisableValidation(DisableValidation),

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=139413&r1=139412&r2=139413&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Fri Sep  9 16:34:22 2011
@@ -231,7 +231,7 @@
     // unit DeclContext as a placeholder.
     DeclContextIDForTemplateParmDecl = ReadDeclID(Record, Idx);
     LexicalDeclContextIDForTemplateParmDecl = ReadDeclID(Record, Idx);
-    D->setDeclContext(Reader.getContext()->getTranslationUnitDecl()); 
+    D->setDeclContext(Reader.getContext().getTranslationUnitDecl()); 
   } else {
     D->setDeclContext(ReadDeclAs<DeclContext>(Record, Idx));
     D->setLexicalDeclContext(ReadDeclAs<DeclContext>(Record, Idx));
@@ -286,7 +286,7 @@
   TD->setEmbeddedInDeclarator(Record[Idx++]);
   TD->setRBraceLoc(ReadSourceLocation(Record, Idx));
   if (Record[Idx++]) { // hasExtInfo
-    TagDecl::ExtInfo *Info = new (*Reader.getContext()) TagDecl::ExtInfo();
+    TagDecl::ExtInfo *Info = new (Reader.getContext()) TagDecl::ExtInfo();
     ReadQualifierInfo(*Info, Record, Idx);
     TD->TypedefNameDeclOrQualifier = Info;
   } else
@@ -332,7 +332,7 @@
   DD->setInnerLocStart(ReadSourceLocation(Record, Idx));
   if (Record[Idx++]) { // hasExtInfo
     DeclaratorDecl::ExtInfo *Info
-        = new (*Reader.getContext()) DeclaratorDecl::ExtInfo();
+        = new (Reader.getContext()) DeclaratorDecl::ExtInfo();
     ReadQualifierInfo(*Info, Record, Idx);
     DD->DeclInfo = Info;
   }
@@ -357,7 +357,7 @@
     FunctionDecl *InstFD = ReadDeclAs<FunctionDecl>(Record, Idx);
     TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
     SourceLocation POI = ReadSourceLocation(Record, Idx);
-    FD->setInstantiationOfMemberFunction(*Reader.getContext(), InstFD, TSK);
+    FD->setInstantiationOfMemberFunction(Reader.getContext(), InstFD, TSK);
     FD->getMemberSpecializationInfo()->setPointOfInstantiation(POI);
     break;
   }
@@ -386,7 +386,7 @@
     
     SourceLocation POI = ReadSourceLocation(Record, Idx);
 
-    ASTContext &C = *Reader.getContext();
+    ASTContext &C = Reader.getContext();
     TemplateArgumentList *TemplArgList
       = TemplateArgumentList::CreateCopy(C, TemplArgs.data(), TemplArgs.size());
     TemplateArgumentListInfo *TemplArgsInfo
@@ -434,7 +434,7 @@
     TemplArgs.setLAngleLoc(ReadSourceLocation(Record, Idx));
     TemplArgs.setRAngleLoc(ReadSourceLocation(Record, Idx));
     
-    FD->setDependentTemplateSpecialization(*Reader.getContext(),
+    FD->setDependentTemplateSpecialization(Reader.getContext(),
                                            TemplDecls, TemplArgs);
     break;
   }
@@ -465,7 +465,7 @@
   Params.reserve(NumParams);
   for (unsigned I = 0; I != NumParams; ++I)
     Params.push_back(ReadDeclAs<ParmVarDecl>(Record, Idx));
-  FD->setParams(*Reader.getContext(), Params.data(), NumParams);
+  FD->setParams(Reader.getContext(), Params.data(), NumParams);
 }
 
 void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) {
@@ -493,7 +493,7 @@
   Params.reserve(NumParams);
   for (unsigned I = 0; I != NumParams; ++I)
     Params.push_back(ReadDeclAs<ParmVarDecl>(Record, Idx));
-  MD->setMethodParams(*Reader.getContext(), Params.data(), NumParams,
+  MD->setMethodParams(Reader.getContext(), Params.data(), NumParams,
                       NumParams);
 }
 
@@ -520,7 +520,7 @@
   for (unsigned I = 0; I != NumProtocols; ++I)
     ProtoLocs.push_back(ReadSourceLocation(Record, Idx));
   ID->setProtocolList(Protocols.data(), NumProtocols, ProtoLocs.data(),
-                      *Reader.getContext());
+                      Reader.getContext());
   
   // Read the transitive closure of protocols referenced by this class.
   NumProtocols = Record[Idx++];
@@ -529,7 +529,7 @@
   for (unsigned I = 0; I != NumProtocols; ++I)
     Protocols.push_back(ReadDeclAs<ObjCProtocolDecl>(Record, Idx));
   ID->AllReferencedProtocols.set(Protocols.data(), NumProtocols,
-                                 *Reader.getContext());
+                                 Reader.getContext());
   
   // Read the ivars.
   unsigned NumIvars = Record[Idx++];
@@ -571,7 +571,7 @@
   for (unsigned I = 0; I != NumProtoRefs; ++I)
     ProtoLocs.push_back(ReadSourceLocation(Record, Idx));
   PD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(),
-                      *Reader.getContext());
+                      Reader.getContext());
 }
 
 void ASTDeclReader::VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *FD) {
@@ -582,7 +582,7 @@
   VisitDecl(CD);
   ObjCInterfaceDecl *ClassRef = ReadDeclAs<ObjCInterfaceDecl>(Record, Idx);
   SourceLocation SLoc = ReadSourceLocation(Record, Idx);
-  CD->setClass(*Reader.getContext(), ClassRef, SLoc);
+  CD->setClass(Reader.getContext(), ClassRef, SLoc);
 }
 
 void ASTDeclReader::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *FPD) {
@@ -597,7 +597,7 @@
   for (unsigned I = 0; I != NumProtoRefs; ++I)
     ProtoLocs.push_back(ReadSourceLocation(Record, Idx));
   FPD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(),
-                       *Reader.getContext());
+                       Reader.getContext());
 }
 
 void ASTDeclReader::VisitObjCCategoryDecl(ObjCCategoryDecl *CD) {
@@ -613,7 +613,7 @@
   for (unsigned I = 0; I != NumProtoRefs; ++I)
     ProtoLocs.push_back(ReadSourceLocation(Record, Idx));
   CD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(),
-                      *Reader.getContext());
+                      Reader.getContext());
   CD->NextClassCategory = ReadDeclAs<ObjCCategoryDecl>(Record, Idx);
   CD->setHasSynthBitfield(Record[Idx++]);
   CD->setAtLoc(ReadSourceLocation(Record, Idx));
@@ -683,7 +683,7 @@
     FD->setInClassInitializer(Reader.ReadExpr(F));
   if (!FD->getDeclName()) {
     if (FieldDecl *Tmpl = ReadDeclAs<FieldDecl>(Record, Idx))
-      Reader.getContext()->setInstantiatedFromUnnamedFieldDecl(FD, Tmpl);
+      Reader.getContext().setInstantiatedFromUnnamedFieldDecl(FD, Tmpl);
   }
 }
 
@@ -692,7 +692,7 @@
 
   FD->ChainingSize = Record[Idx++];
   assert(FD->ChainingSize >= 2 && "Anonymous chaining must be >= 2");
-  FD->Chaining = new (*Reader.getContext())NamedDecl*[FD->ChainingSize];
+  FD->Chaining = new (Reader.getContext())NamedDecl*[FD->ChainingSize];
 
   for (unsigned I = 0; I != FD->ChainingSize; ++I)
     FD->Chaining[I] = ReadDeclAs<NamedDecl>(Record, Idx);
@@ -716,7 +716,7 @@
     VarDecl *Tmpl = ReadDeclAs<VarDecl>(Record, Idx);
     TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
     SourceLocation POI = ReadSourceLocation(Record, Idx);
-    Reader.getContext()->setInstantiatedFromStaticDataMember(VD, Tmpl, TSK,POI);
+    Reader.getContext().setInstantiatedFromStaticDataMember(VD, Tmpl, TSK,POI);
   }
 }
 
@@ -773,7 +773,7 @@
 
     captures.push_back(BlockDecl::Capture(decl, byRef, nested, copyExpr));
   }
-  BD->setCaptures(*Reader.getContext(), captures.begin(),
+  BD->setCaptures(Reader.getContext(), captures.begin(),
                   captures.end(), capturesCXXThis);
 }
 
@@ -820,7 +820,7 @@
   D->FirstUsingShadow = ReadDeclAs<UsingShadowDecl>(Record, Idx);
   D->setTypeName(Record[Idx++]);
   if (NamedDecl *Pattern = ReadDeclAs<NamedDecl>(Record, Idx))
-    Reader.getContext()->setInstantiatedFromUsingDecl(D, Pattern);
+    Reader.getContext().setInstantiatedFromUsingDecl(D, Pattern);
 }
 
 void ASTDeclReader::VisitUsingShadowDecl(UsingShadowDecl *D) {
@@ -829,7 +829,7 @@
   D->UsingOrNextShadow = ReadDeclAs<NamedDecl>(Record, Idx);
   UsingShadowDecl *Pattern = ReadDeclAs<UsingShadowDecl>(Record, Idx);
   if (Pattern)
-    Reader.getContext()->setInstantiatedFromUsingShadowDecl(D, Pattern);
+    Reader.getContext().setInstantiatedFromUsingShadowDecl(D, Pattern);
 }
 
 void ASTDeclReader::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
@@ -911,7 +911,7 @@
                                                 CXXRecordDecl *DefinitionDecl,
                                                 const RecordData &Record,
                                                 unsigned &Idx) {
-  ASTContext &C = *Reader.getContext();
+  ASTContext &C = Reader.getContext();
 
   if (D == DefinitionDecl) {
     D->DefinitionData = new (C) struct CXXRecordDecl::DefinitionData(D);
@@ -947,7 +947,7 @@
   CXXRecordDecl *DefinitionDecl = ReadDeclAs<CXXRecordDecl>(Record, Idx);
   InitializeCXXDefinitionData(D, DefinitionDecl, Record, Idx);
 
-  ASTContext &C = *Reader.getContext();
+  ASTContext &C = Reader.getContext();
 
   enum CXXRecKind {
     CXXRecNotTemplate = 0, CXXRecTemplate, CXXRecMemberSpecialization
@@ -986,7 +986,7 @@
     // Avoid invariant checking of CXXMethodDecl::addOverriddenMethod,
     // MD may be initializing.
     if (CXXMethodDecl *MD = ReadDeclAs<CXXMethodDecl>(Record, Idx))
-      Reader.getContext()->addOverriddenMethod(D, MD);
+      Reader.getContext().addOverriddenMethod(D, MD);
   }
 }
 
@@ -1071,7 +1071,7 @@
     if (PreviousDeclID != FirstDeclID)
       Reader.PendingPreviousDecls.push_back(std::make_pair(D, PreviousDeclID));
   } else {
-    D->CommonOrPrev = D->newCommon(*Reader.getContext());
+    D->CommonOrPrev = D->newCommon(Reader.getContext());
     if (RedeclarableTemplateDecl *RTD
           = ReadDeclAs<RedeclarableTemplateDecl>(Record, Idx)) {
       assert(RTD->getKind() == D->getKind() &&
@@ -1130,7 +1130,7 @@
       
       ClassTemplateDecl::Common *CommonPtr = D->getCommonPtr();
       CommonPtr->LazySpecializations
-        = new (*Reader.getContext()) DeclID [SpecIDs.size()];
+        = new (Reader.getContext()) DeclID [SpecIDs.size()];
       memcpy(CommonPtr->LazySpecializations, SpecIDs.data(), 
              SpecIDs.size() * sizeof(DeclID));
     }
@@ -1143,7 +1143,7 @@
                                            ClassTemplateSpecializationDecl *D) {
   VisitCXXRecordDecl(D);
   
-  ASTContext &C = *Reader.getContext();
+  ASTContext &C = Reader.getContext();
   if (Decl *InstD = ReadDecl(Record, Idx)) {
     if (ClassTemplateDecl *CTD = dyn_cast<ClassTemplateDecl>(InstD)) {
       D->SpecializedTemplate = CTD;
@@ -1195,7 +1195,7 @@
                                     ClassTemplatePartialSpecializationDecl *D) {
   VisitClassTemplateSpecializationDecl(D);
 
-  ASTContext &C = *Reader.getContext();
+  ASTContext &C = Reader.getContext();
   D->TemplateParams = Reader.ReadTemplateParameterList(F, Record, Idx);
 
   unsigned NumArgs = Record[Idx++];
@@ -1476,211 +1476,211 @@
     assert(false && "Record cannot be de-serialized with ReadDeclRecord");
     break;
   case DECL_TYPEDEF:
-    D = TypedefDecl::Create(*Context, 0, SourceLocation(), SourceLocation(),
+    D = TypedefDecl::Create(Context, 0, SourceLocation(), SourceLocation(),
                             0, 0);
     break;
   case DECL_TYPEALIAS:
-    D = TypeAliasDecl::Create(*Context, 0, SourceLocation(), SourceLocation(),
+    D = TypeAliasDecl::Create(Context, 0, SourceLocation(), SourceLocation(),
                               0, 0);
     break;
   case DECL_ENUM:
-    D = EnumDecl::Create(*Context, Decl::EmptyShell());
+    D = EnumDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_RECORD:
-    D = RecordDecl::Create(*Context, Decl::EmptyShell());
+    D = RecordDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_ENUM_CONSTANT:
-    D = EnumConstantDecl::Create(*Context, 0, SourceLocation(), 0, QualType(),
+    D = EnumConstantDecl::Create(Context, 0, SourceLocation(), 0, QualType(),
                                  0, llvm::APSInt());
     break;
   case DECL_FUNCTION:
-    D = FunctionDecl::Create(*Context, 0, SourceLocation(), SourceLocation(),
+    D = FunctionDecl::Create(Context, 0, SourceLocation(), SourceLocation(),
                              DeclarationName(), QualType(), 0);
     break;
   case DECL_LINKAGE_SPEC:
-    D = LinkageSpecDecl::Create(*Context, 0, SourceLocation(), SourceLocation(),
+    D = LinkageSpecDecl::Create(Context, 0, SourceLocation(), SourceLocation(),
                                 (LinkageSpecDecl::LanguageIDs)0,
                                 SourceLocation());
     break;
   case DECL_LABEL:
-    D = LabelDecl::Create(*Context, 0, SourceLocation(), 0);
+    D = LabelDecl::Create(Context, 0, SourceLocation(), 0);
     break;
   case DECL_NAMESPACE:
-    D = NamespaceDecl::Create(*Context, 0, SourceLocation(),
+    D = NamespaceDecl::Create(Context, 0, SourceLocation(),
                               SourceLocation(), 0);
     break;
   case DECL_NAMESPACE_ALIAS:
-    D = NamespaceAliasDecl::Create(*Context, 0, SourceLocation(),
+    D = NamespaceAliasDecl::Create(Context, 0, SourceLocation(),
                                    SourceLocation(), 0, 
                                    NestedNameSpecifierLoc(),
                                    SourceLocation(), 0);
     break;
   case DECL_USING:
-    D = UsingDecl::Create(*Context, 0, SourceLocation(),
+    D = UsingDecl::Create(Context, 0, SourceLocation(),
                           NestedNameSpecifierLoc(), DeclarationNameInfo(), 
                           false);
     break;
   case DECL_USING_SHADOW:
-    D = UsingShadowDecl::Create(*Context, 0, SourceLocation(), 0, 0);
+    D = UsingShadowDecl::Create(Context, 0, SourceLocation(), 0, 0);
     break;
   case DECL_USING_DIRECTIVE:
-    D = UsingDirectiveDecl::Create(*Context, 0, SourceLocation(),
+    D = UsingDirectiveDecl::Create(Context, 0, SourceLocation(),
                                    SourceLocation(), NestedNameSpecifierLoc(),
                                    SourceLocation(), 0, 0);
     break;
   case DECL_UNRESOLVED_USING_VALUE:
-    D = UnresolvedUsingValueDecl::Create(*Context, 0, SourceLocation(),
+    D = UnresolvedUsingValueDecl::Create(Context, 0, SourceLocation(),
                                          NestedNameSpecifierLoc(), 
                                          DeclarationNameInfo());
     break;
   case DECL_UNRESOLVED_USING_TYPENAME:
-    D = UnresolvedUsingTypenameDecl::Create(*Context, 0, SourceLocation(),
+    D = UnresolvedUsingTypenameDecl::Create(Context, 0, SourceLocation(),
                                             SourceLocation(), 
                                             NestedNameSpecifierLoc(),
                                             SourceLocation(),
                                             DeclarationName());
     break;
   case DECL_CXX_RECORD:
-    D = CXXRecordDecl::Create(*Context, Decl::EmptyShell());
+    D = CXXRecordDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_CXX_METHOD:
-    D = CXXMethodDecl::Create(*Context, 0, SourceLocation(),
+    D = CXXMethodDecl::Create(Context, 0, SourceLocation(),
                               DeclarationNameInfo(), QualType(), 0,
                               false, SC_None, false, false, SourceLocation());
     break;
   case DECL_CXX_CONSTRUCTOR:
-    D = CXXConstructorDecl::Create(*Context, Decl::EmptyShell());
+    D = CXXConstructorDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_CXX_DESTRUCTOR:
-    D = CXXDestructorDecl::Create(*Context, Decl::EmptyShell());
+    D = CXXDestructorDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_CXX_CONVERSION:
-    D = CXXConversionDecl::Create(*Context, Decl::EmptyShell());
+    D = CXXConversionDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_ACCESS_SPEC:
-    D = AccessSpecDecl::Create(*Context, Decl::EmptyShell());
+    D = AccessSpecDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_FRIEND:
-    D = FriendDecl::Create(*Context, Decl::EmptyShell());
+    D = FriendDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_FRIEND_TEMPLATE:
-    D = FriendTemplateDecl::Create(*Context, Decl::EmptyShell());
+    D = FriendTemplateDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_CLASS_TEMPLATE:
-    D = ClassTemplateDecl::Create(*Context, Decl::EmptyShell());
+    D = ClassTemplateDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_CLASS_TEMPLATE_SPECIALIZATION:
-    D = ClassTemplateSpecializationDecl::Create(*Context, Decl::EmptyShell());
+    D = ClassTemplateSpecializationDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION:
-    D = ClassTemplatePartialSpecializationDecl::Create(*Context,
+    D = ClassTemplatePartialSpecializationDecl::Create(Context,
                                                        Decl::EmptyShell());
     break;
   case DECL_CLASS_SCOPE_FUNCTION_SPECIALIZATION:
-    D = ClassScopeFunctionSpecializationDecl::Create(*Context,
+    D = ClassScopeFunctionSpecializationDecl::Create(Context,
                                                      Decl::EmptyShell());
     break;
   case DECL_FUNCTION_TEMPLATE:
-      D = FunctionTemplateDecl::Create(*Context, Decl::EmptyShell());
+      D = FunctionTemplateDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_TEMPLATE_TYPE_PARM:
-    D = TemplateTypeParmDecl::Create(*Context, Decl::EmptyShell());
+    D = TemplateTypeParmDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_NON_TYPE_TEMPLATE_PARM:
-    D = NonTypeTemplateParmDecl::Create(*Context, 0, SourceLocation(),
+    D = NonTypeTemplateParmDecl::Create(Context, 0, SourceLocation(),
                                         SourceLocation(), 0, 0, 0, QualType(),
                                         false, 0);
     break;
   case DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK:
-    D = NonTypeTemplateParmDecl::Create(*Context, 0, SourceLocation(),
+    D = NonTypeTemplateParmDecl::Create(Context, 0, SourceLocation(),
                                         SourceLocation(), 0, 0, 0, QualType(),
                                         0, 0, Record[Idx++], 0);
     break;
   case DECL_TEMPLATE_TEMPLATE_PARM:
-    D = TemplateTemplateParmDecl::Create(*Context, 0, SourceLocation(), 0, 0,
+    D = TemplateTemplateParmDecl::Create(Context, 0, SourceLocation(), 0, 0,
                                          false, 0, 0);
     break;
   case DECL_TYPE_ALIAS_TEMPLATE:
-    D = TypeAliasTemplateDecl::Create(*Context, Decl::EmptyShell());
+    D = TypeAliasTemplateDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_STATIC_ASSERT:
-    D = StaticAssertDecl::Create(*Context, 0, SourceLocation(), 0, 0,
+    D = StaticAssertDecl::Create(Context, 0, SourceLocation(), 0, 0,
                                  SourceLocation());
     break;
 
   case DECL_OBJC_METHOD:
-    D = ObjCMethodDecl::Create(*Context, SourceLocation(), SourceLocation(),
+    D = ObjCMethodDecl::Create(Context, SourceLocation(), SourceLocation(),
                                Selector(), QualType(), 0, 0);
     break;
   case DECL_OBJC_INTERFACE:
-    D = ObjCInterfaceDecl::Create(*Context, 0, SourceLocation(), 0);
+    D = ObjCInterfaceDecl::Create(Context, 0, SourceLocation(), 0);
     break;
   case DECL_OBJC_IVAR:
-    D = ObjCIvarDecl::Create(*Context, 0, SourceLocation(), SourceLocation(),
+    D = ObjCIvarDecl::Create(Context, 0, SourceLocation(), SourceLocation(),
                              0, QualType(), 0, ObjCIvarDecl::None);
     break;
   case DECL_OBJC_PROTOCOL:
-    D = ObjCProtocolDecl::Create(*Context, 0, SourceLocation(), 0);
+    D = ObjCProtocolDecl::Create(Context, 0, SourceLocation(), 0);
     break;
   case DECL_OBJC_AT_DEFS_FIELD:
-    D = ObjCAtDefsFieldDecl::Create(*Context, 0, SourceLocation(),
+    D = ObjCAtDefsFieldDecl::Create(Context, 0, SourceLocation(),
                                     SourceLocation(), 0, QualType(), 0);
     break;
   case DECL_OBJC_CLASS:
-    D = ObjCClassDecl::Create(*Context, 0, SourceLocation());
+    D = ObjCClassDecl::Create(Context, 0, SourceLocation());
     break;
   case DECL_OBJC_FORWARD_PROTOCOL:
-    D = ObjCForwardProtocolDecl::Create(*Context, 0, SourceLocation());
+    D = ObjCForwardProtocolDecl::Create(Context, 0, SourceLocation());
     break;
   case DECL_OBJC_CATEGORY:
-    D = ObjCCategoryDecl::Create(*Context, Decl::EmptyShell());
+    D = ObjCCategoryDecl::Create(Context, Decl::EmptyShell());
     break;
   case DECL_OBJC_CATEGORY_IMPL:
-    D = ObjCCategoryImplDecl::Create(*Context, 0, SourceLocation(), 0, 0);
+    D = ObjCCategoryImplDecl::Create(Context, 0, SourceLocation(), 0, 0);
     break;
   case DECL_OBJC_IMPLEMENTATION:
-    D = ObjCImplementationDecl::Create(*Context, 0, SourceLocation(), 0, 0);
+    D = ObjCImplementationDecl::Create(Context, 0, SourceLocation(), 0, 0);
     break;
   case DECL_OBJC_COMPATIBLE_ALIAS:
-    D = ObjCCompatibleAliasDecl::Create(*Context, 0, SourceLocation(), 0, 0);
+    D = ObjCCompatibleAliasDecl::Create(Context, 0, SourceLocation(), 0, 0);
     break;
   case DECL_OBJC_PROPERTY:
-    D = ObjCPropertyDecl::Create(*Context, 0, SourceLocation(), 0, SourceLocation(),
+    D = ObjCPropertyDecl::Create(Context, 0, SourceLocation(), 0, SourceLocation(),
                                  0);
     break;
   case DECL_OBJC_PROPERTY_IMPL:
-    D = ObjCPropertyImplDecl::Create(*Context, 0, SourceLocation(),
+    D = ObjCPropertyImplDecl::Create(Context, 0, SourceLocation(),
                                      SourceLocation(), 0,
                                      ObjCPropertyImplDecl::Dynamic, 0,
                                      SourceLocation());
     break;
   case DECL_FIELD:
-    D = FieldDecl::Create(*Context, 0, SourceLocation(), SourceLocation(), 0,
+    D = FieldDecl::Create(Context, 0, SourceLocation(), SourceLocation(), 0,
                           QualType(), 0, 0, false, false);
     break;
   case DECL_INDIRECTFIELD:
-    D = IndirectFieldDecl::Create(*Context, 0, SourceLocation(), 0, QualType(),
+    D = IndirectFieldDecl::Create(Context, 0, SourceLocation(), 0, QualType(),
                                   0, 0);
     break;
   case DECL_VAR:
-    D = VarDecl::Create(*Context, 0, SourceLocation(), SourceLocation(), 0,
+    D = VarDecl::Create(Context, 0, SourceLocation(), SourceLocation(), 0,
                         QualType(), 0, SC_None, SC_None);
     break;
 
   case DECL_IMPLICIT_PARAM:
-    D = ImplicitParamDecl::Create(*Context, 0, SourceLocation(), 0, QualType());
+    D = ImplicitParamDecl::Create(Context, 0, SourceLocation(), 0, QualType());
     break;
 
   case DECL_PARM_VAR:
-    D = ParmVarDecl::Create(*Context, 0, SourceLocation(), SourceLocation(), 0,
+    D = ParmVarDecl::Create(Context, 0, SourceLocation(), SourceLocation(), 0,
                             QualType(), 0, SC_None, SC_None, 0);
     break;
   case DECL_FILE_SCOPE_ASM:
-    D = FileScopeAsmDecl::Create(*Context, 0, 0, SourceLocation(),
+    D = FileScopeAsmDecl::Create(Context, 0, 0, SourceLocation(),
                                  SourceLocation());
     break;
   case DECL_BLOCK:
-    D = BlockDecl::Create(*Context, 0, SourceLocation());
+    D = BlockDecl::Create(Context, 0, SourceLocation());
     break;
   case DECL_CXX_BASE_SPECIFIERS:
     Error("attempt to read a C++ base-specifier record as a declaration");

Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=139413&r1=139412&r2=139413&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Fri Sep  9 16:34:22 2011
@@ -118,7 +118,7 @@
   unsigned NumStmts = Record[Idx++];
   while (NumStmts--)
     Stmts.push_back(Reader.ReadSubStmt());
-  S->setStmts(*Reader.getContext(), Stmts.data(), Stmts.size());
+  S->setStmts(Reader.getContext(), Stmts.data(), Stmts.size());
   S->setLBracLoc(ReadSourceLocation(Record, Idx));
   S->setRBracLoc(ReadSourceLocation(Record, Idx));
 }
@@ -156,7 +156,7 @@
 
 void ASTStmtReader::VisitIfStmt(IfStmt *S) {
   VisitStmt(S);
-  S->setConditionVariable(*Reader.getContext(), 
+  S->setConditionVariable(Reader.getContext(), 
                           ReadDeclAs<VarDecl>(Record, Idx));
   S->setCond(Reader.ReadSubExpr());
   S->setThen(Reader.ReadSubStmt());
@@ -167,7 +167,7 @@
 
 void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
   VisitStmt(S);
-  S->setConditionVariable(*Reader.getContext(),
+  S->setConditionVariable(Reader.getContext(),
                           ReadDeclAs<VarDecl>(Record, Idx));
   S->setCond(Reader.ReadSubExpr());
   S->setBody(Reader.ReadSubStmt());
@@ -189,7 +189,7 @@
 
 void ASTStmtReader::VisitWhileStmt(WhileStmt *S) {
   VisitStmt(S);
-  S->setConditionVariable(*Reader.getContext(),
+  S->setConditionVariable(Reader.getContext(),
                           ReadDeclAs<VarDecl>(Record, Idx));
 
   S->setCond(Reader.ReadSubExpr());
@@ -210,7 +210,7 @@
   VisitStmt(S);
   S->setInit(Reader.ReadSubStmt());
   S->setCond(Reader.ReadSubExpr());
-  S->setConditionVariable(*Reader.getContext(),
+  S->setConditionVariable(Reader.getContext(),
                           ReadDeclAs<VarDecl>(Record, Idx));
   S->setInc(Reader.ReadSubExpr());
   S->setBody(Reader.ReadSubStmt());
@@ -263,7 +263,7 @@
     Decls.reserve(Record.size() - Idx);    
     for (unsigned N = Record.size(); Idx != N; )
       Decls.push_back(ReadDecl(Record, Idx));
-    S->setDeclGroup(DeclGroupRef(DeclGroup::Create(*Reader.getContext(),
+    S->setDeclGroup(DeclGroupRef(DeclGroup::Create(Reader.getContext(),
                                                    Decls.data(),
                                                    Decls.size())));
   }
@@ -297,7 +297,7 @@
   for (unsigned I = 0; I != NumClobbers; ++I)
     Clobbers.push_back(cast_or_null<StringLiteral>(Reader.ReadSubStmt()));
 
-  S->setOutputsAndInputsAndClobbers(*Reader.getContext(),
+  S->setOutputsAndInputsAndClobbers(Reader.getContext(),
                                     Names.data(), Constraints.data(), 
                                     Exprs.data(), NumOutputs, NumInputs, 
                                     Clobbers.data(), NumClobbers);
@@ -350,12 +350,12 @@
 void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) {
   VisitExpr(E);
   E->setLocation(ReadSourceLocation(Record, Idx));
-  E->setValue(*Reader.getContext(), Reader.ReadAPInt(Record, Idx));
+  E->setValue(Reader.getContext(), Reader.ReadAPInt(Record, Idx));
 }
 
 void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) {
   VisitExpr(E);
-  E->setValue(*Reader.getContext(), Reader.ReadAPFloat(Record, Idx));
+  E->setValue(Reader.getContext(), Reader.ReadAPFloat(Record, Idx));
   E->setExact(Record[Idx++]);
   E->setLocation(ReadSourceLocation(Record, Idx));
 }
@@ -376,7 +376,7 @@
 
   // Read string data
   llvm::SmallString<16> Str(&Record[Idx], &Record[Idx] + Len);
-  E->setString(*Reader.getContext(), Str.str());
+  E->setString(Reader.getContext(), Str.str());
   Idx += Len;
 
   // Read source locations
@@ -401,7 +401,7 @@
 void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) {
   VisitExpr(E);
   unsigned NumExprs = Record[Idx++];
-  E->Exprs = new (*Reader.getContext()) Stmt*[NumExprs];
+  E->Exprs = new (Reader.getContext()) Stmt*[NumExprs];
   for (unsigned i = 0; i != NumExprs; ++i)
     E->Exprs[i] = Reader.ReadSubStmt();
   E->NumExprs = NumExprs;
@@ -447,7 +447,7 @@
       break;
         
     case Node::Base: {
-      CXXBaseSpecifier *Base = new (*Reader.getContext()) CXXBaseSpecifier();
+      CXXBaseSpecifier *Base = new (Reader.getContext()) CXXBaseSpecifier();
       *Base = Reader.ReadCXXBaseSpecifier(F, Record, Idx);
       E->setComponent(I, Node(Base));
       break;
@@ -481,7 +481,7 @@
 
 void ASTStmtReader::VisitCallExpr(CallExpr *E) {
   VisitExpr(E);
-  E->setNumArgs(*Reader.getContext(), Record[Idx++]);
+  E->setNumArgs(Reader.getContext(), Record[Idx++]);
   E->setRParenLoc(ReadSourceLocation(Record, Idx));
   E->setCallee(Reader.ReadSubExpr());
   for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
@@ -527,7 +527,7 @@
   E->setCastKind((CastExpr::CastKind)Record[Idx++]);
   CastExpr::path_iterator BaseI = E->path_begin();
   while (NumBaseSpecs--) {
-    CXXBaseSpecifier *BaseSpec = new (*Reader.getContext()) CXXBaseSpecifier;
+    CXXBaseSpecifier *BaseSpec = new (Reader.getContext()) CXXBaseSpecifier;
     *BaseSpec = Reader.ReadCXXBaseSpecifier(F, Record, Idx);
     *BaseI++ = BaseSpec;
   }
@@ -614,15 +614,15 @@
     E->ArrayFillerOrUnionFieldInit = ReadDeclAs<FieldDecl>(Record, Idx);
   E->sawArrayRangeDesignator(Record[Idx++]);
   unsigned NumInits = Record[Idx++];
-  E->reserveInits(*Reader.getContext(), NumInits);
+  E->reserveInits(Reader.getContext(), NumInits);
   if (isArrayFiller) {
     for (unsigned I = 0; I != NumInits; ++I) {
       Expr *init = Reader.ReadSubExpr();
-      E->updateInit(*Reader.getContext(), I, init ? init : filler);
+      E->updateInit(Reader.getContext(), I, init ? init : filler);
     }
   } else {
     for (unsigned I = 0; I != NumInits; ++I)
-      E->updateInit(*Reader.getContext(), I, Reader.ReadSubExpr());
+      E->updateInit(Reader.getContext(), I, Reader.ReadSubExpr());
   }
 }
 
@@ -686,7 +686,7 @@
     }
     }
   }
-  E->setDesignators(*Reader.getContext(), 
+  E->setDesignators(Reader.getContext(), 
                     Designators.data(), Designators.size());
 }
 
@@ -736,7 +736,7 @@
   unsigned NumExprs = Record[Idx++];
   while (NumExprs--)
     Exprs.push_back(Reader.ReadSubExpr());
-  E->setExprs(*Reader.getContext(), Exprs.data(), Exprs.size());
+  E->setExprs(Reader.getContext(), Exprs.data(), Exprs.size());
   E->setBuiltinLoc(ReadSourceLocation(Record, Idx));
   E->setRParenLoc(ReadSourceLocation(Record, Idx));
 }
@@ -757,9 +757,9 @@
 void ASTStmtReader::VisitGenericSelectionExpr(GenericSelectionExpr *E) {
   VisitExpr(E);
   E->NumAssocs = Record[Idx++];
-  E->AssocTypes = new (*Reader.getContext()) TypeSourceInfo*[E->NumAssocs];
+  E->AssocTypes = new (Reader.getContext()) TypeSourceInfo*[E->NumAssocs];
   E->SubExprs =
-   new(*Reader.getContext()) Stmt*[GenericSelectionExpr::END_EXPR+E->NumAssocs];
+   new(Reader.getContext()) Stmt*[GenericSelectionExpr::END_EXPR+E->NumAssocs];
 
   E->SubExprs[GenericSelectionExpr::CONTROLLING] = Reader.ReadSubExpr();
   for (unsigned I = 0, N = E->getNumAssocs(); I != N; ++I) {
@@ -976,7 +976,7 @@
   VisitExpr(E);
   E->NumArgs = Record[Idx++];
   if (E->NumArgs)
-    E->Args = new (*Reader.getContext()) Stmt*[E->NumArgs];
+    E->Args = new (Reader.getContext()) Stmt*[E->NumArgs];
   for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
     E->setArg(I, Reader.ReadSubExpr());
   E->setConstructor(ReadDeclAs<CXXConstructorDecl>(Record, Idx));
@@ -1100,7 +1100,7 @@
   E->ConstructorLParen = ReadSourceLocation(Record, Idx);
   E->ConstructorRParen = ReadSourceLocation(Record, Idx);
 
-  E->AllocateArgsArray(*Reader.getContext(), isArray, NumPlacementArgs,
+  E->AllocateArgsArray(Reader.getContext(), isArray, NumPlacementArgs,
                        NumCtorArgs);
 
   // Install all the subexpressions.
@@ -1142,7 +1142,7 @@
   VisitExpr(E);
   unsigned NumTemps = Record[Idx++];
   if (NumTemps) {
-    E->setNumTemporaries(*Reader.getContext(), NumTemps);
+    E->setNumTemporaries(Reader.getContext(), NumTemps);
     for (unsigned i = 0; i != NumTemps; ++i)
       E->setTemporary(i, Reader.ReadCXXTemporary(F, Record, Idx));
   }
@@ -1205,7 +1205,7 @@
     AccessSpecifier AS = (AccessSpecifier)Record[Idx++];
     Decls.addDecl(D, AS);
   }
-  E->initializeResults(*Reader.getContext(), Decls.begin(), Decls.end());
+  E->initializeResults(Reader.getContext(), Decls.begin(), Decls.end());
 
   ReadDeclarationNameInfo(E->NameInfo, Record, Idx);
   E->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
@@ -1539,7 +1539,7 @@
 
     case EXPR_DECL_REF:
       S = DeclRefExpr::CreateEmpty(
-        *Context,
+        Context,
         /*HasQualifier=*/Record[ASTStmtReader::NumExprFields],
         /*HasFoundDecl=*/Record[ASTStmtReader::NumExprFields + 1],
         /*HasExplicitTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 2],
@@ -1548,11 +1548,11 @@
       break;
 
     case EXPR_INTEGER_LITERAL:
-      S = IntegerLiteral::Create(*Context, Empty);
+      S = IntegerLiteral::Create(Context, Empty);
       break;
 
     case EXPR_FLOATING_LITERAL:
-      S = FloatingLiteral::Create(*Context, Empty);
+      S = FloatingLiteral::Create(Context, Empty);
       break;
 
     case EXPR_IMAGINARY_LITERAL:
@@ -1560,7 +1560,7 @@
       break;
 
     case EXPR_STRING_LITERAL:
-      S = StringLiteral::CreateEmpty(*Context,
+      S = StringLiteral::CreateEmpty(Context,
                                      Record[ASTStmtReader::NumExprFields + 1]);
       break;
 
@@ -1581,7 +1581,7 @@
       break;
 
     case EXPR_OFFSETOF:
-      S = OffsetOfExpr::CreateEmpty(*Context, 
+      S = OffsetOfExpr::CreateEmpty(Context, 
                                     Record[ASTStmtReader::NumExprFields],
                                     Record[ASTStmtReader::NumExprFields + 1]);
       break;
@@ -1595,7 +1595,7 @@
       break;
 
     case EXPR_CALL:
-      S = new (Context) CallExpr(*Context, Stmt::CallExprClass, Empty);
+      S = new (Context) CallExpr(Context, Stmt::CallExprClass, Empty);
       break;
 
     case EXPR_MEMBER: {
@@ -1632,7 +1632,7 @@
       DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc);
       bool IsArrow = Record[Idx++];
 
-      S = MemberExpr::Create(*Context, Base, IsArrow, QualifierLoc,
+      S = MemberExpr::Create(Context, Base, IsArrow, QualifierLoc,
                              MemberD, FoundDecl, MemberNameInfo,
                              HasExplicitTemplateArgs ? &ArgInfo : 0, T, VK, OK);
       ReadDeclarationNameLoc(F, cast<MemberExpr>(S)->MemberDNLoc,
@@ -1657,12 +1657,12 @@
       break;
 
     case EXPR_IMPLICIT_CAST:
-      S = ImplicitCastExpr::CreateEmpty(*Context,
+      S = ImplicitCastExpr::CreateEmpty(Context,
                        /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
       break;
 
     case EXPR_CSTYLE_CAST:
-      S = CStyleCastExpr::CreateEmpty(*Context,
+      S = CStyleCastExpr::CreateEmpty(Context,
                        /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
       break;
 
@@ -1675,11 +1675,11 @@
       break;
 
     case EXPR_INIT_LIST:
-      S = new (Context) InitListExpr(*getContext(), Empty);
+      S = new (Context) InitListExpr(getContext(), Empty);
       break;
 
     case EXPR_DESIGNATED_INIT:
-      S = DesignatedInitExpr::CreateEmpty(*Context,
+      S = DesignatedInitExpr::CreateEmpty(Context,
                                      Record[ASTStmtReader::NumExprFields] - 1);
 
       break;
@@ -1746,7 +1746,7 @@
       llvm_unreachable("mismatching AST file");
       break;
     case EXPR_OBJC_MESSAGE_EXPR:
-      S = ObjCMessageExpr::CreateEmpty(*Context,
+      S = ObjCMessageExpr::CreateEmpty(Context,
                                      Record[ASTStmtReader::NumExprFields]);
       break;
     case EXPR_OBJC_ISA:
@@ -1768,7 +1768,7 @@
       S = new (Context) ObjCAtFinallyStmt(Empty);
       break;
     case STMT_OBJC_AT_TRY:
-      S = ObjCAtTryStmt::CreateEmpty(*Context, 
+      S = ObjCAtTryStmt::CreateEmpty(Context, 
                                      Record[ASTStmtReader::NumStmtFields],
                                      Record[ASTStmtReader::NumStmtFields + 1]);
       break;
@@ -1795,7 +1795,7 @@
       break;
 
     case STMT_CXX_TRY:
-      S = CXXTryStmt::Create(*Context, Empty,
+      S = CXXTryStmt::Create(Context, Empty,
              /*NumHandlers=*/Record[ASTStmtReader::NumStmtFields]);
       break;
 
@@ -1804,11 +1804,11 @@
       break;
 
     case EXPR_CXX_OPERATOR_CALL:
-      S = new (Context) CXXOperatorCallExpr(*Context, Empty);
+      S = new (Context) CXXOperatorCallExpr(Context, Empty);
       break;
 
     case EXPR_CXX_MEMBER_CALL:
-      S = new (Context) CXXMemberCallExpr(*Context, Empty);
+      S = new (Context) CXXMemberCallExpr(Context, Empty);
       break;
         
     case EXPR_CXX_CONSTRUCT:
@@ -1820,26 +1820,26 @@
       break;
 
     case EXPR_CXX_STATIC_CAST:
-      S = CXXStaticCastExpr::CreateEmpty(*Context,
+      S = CXXStaticCastExpr::CreateEmpty(Context,
                        /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
       break;
 
     case EXPR_CXX_DYNAMIC_CAST:
-      S = CXXDynamicCastExpr::CreateEmpty(*Context,
+      S = CXXDynamicCastExpr::CreateEmpty(Context,
                        /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
       break;
 
     case EXPR_CXX_REINTERPRET_CAST:
-      S = CXXReinterpretCastExpr::CreateEmpty(*Context,
+      S = CXXReinterpretCastExpr::CreateEmpty(Context,
                        /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
       break;
 
     case EXPR_CXX_CONST_CAST:
-      S = CXXConstCastExpr::CreateEmpty(*Context);
+      S = CXXConstCastExpr::CreateEmpty(Context);
       break;
 
     case EXPR_CXX_FUNCTIONAL_CAST:
-      S = CXXFunctionalCastExpr::CreateEmpty(*Context,
+      S = CXXFunctionalCastExpr::CreateEmpty(Context,
                        /*PathSize*/ Record[ASTStmtReader::NumExprFields]);
       break;
 
@@ -1872,7 +1872,7 @@
       bool HasOtherExprStored = Record[ASTStmtReader::NumExprFields];
       if (HasOtherExprStored) {
         Expr *SubExpr = ReadSubExpr();
-        S = CXXDefaultArgExpr::Create(*Context, SourceLocation(), 0, SubExpr);
+        S = CXXDefaultArgExpr::Create(Context, SourceLocation(), 0, SubExpr);
       } else
         S = new (Context) CXXDefaultArgExpr(Empty);
       break;
@@ -1899,7 +1899,7 @@
       break;
       
     case EXPR_CXX_DEPENDENT_SCOPE_MEMBER:
-      S = CXXDependentScopeMemberExpr::CreateEmpty(*Context,
+      S = CXXDependentScopeMemberExpr::CreateEmpty(Context,
           /*HasExplicitTemplateArgs=*/Record[ASTStmtReader::NumExprFields],
                   /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
                                    ? Record[ASTStmtReader::NumExprFields + 1] 
@@ -1907,7 +1907,7 @@
       break;
       
     case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF:
-      S = DependentScopeDeclRefExpr::CreateEmpty(*Context,
+      S = DependentScopeDeclRefExpr::CreateEmpty(Context,
           /*HasExplicitTemplateArgs=*/Record[ASTStmtReader::NumExprFields],
                   /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
                                    ? Record[ASTStmtReader::NumExprFields + 1] 
@@ -1915,12 +1915,12 @@
       break;
       
     case EXPR_CXX_UNRESOLVED_CONSTRUCT:
-      S = CXXUnresolvedConstructExpr::CreateEmpty(*Context,
+      S = CXXUnresolvedConstructExpr::CreateEmpty(Context,
                               /*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
       break;
       
     case EXPR_CXX_UNRESOLVED_MEMBER:
-      S = UnresolvedMemberExpr::CreateEmpty(*Context,
+      S = UnresolvedMemberExpr::CreateEmpty(Context,
           /*HasExplicitTemplateArgs=*/Record[ASTStmtReader::NumExprFields],
                   /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
                                    ? Record[ASTStmtReader::NumExprFields + 1] 
@@ -1928,7 +1928,7 @@
       break;
       
     case EXPR_CXX_UNRESOLVED_LOOKUP:
-      S = UnresolvedLookupExpr::CreateEmpty(*Context,
+      S = UnresolvedLookupExpr::CreateEmpty(Context,
           /*HasExplicitTemplateArgs=*/Record[ASTStmtReader::NumExprFields],
                   /*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]
                                    ? Record[ASTStmtReader::NumExprFields + 1] 
@@ -1991,7 +1991,7 @@
     }
 
     case EXPR_CUDA_KERNEL_CALL:
-      S = new (Context) CUDAKernelCallExpr(*Context, Empty);
+      S = new (Context) CUDAKernelCallExpr(Context, Empty);
       break;
         
     case EXPR_ASTYPE:





More information about the cfe-commits mailing list