diff options
Diffstat (limited to 'lib/Frontend')
-rw-r--r-- | lib/Frontend/PCHReader.cpp | 11 | ||||
-rw-r--r-- | lib/Frontend/PCHReaderDecl.cpp | 4 | ||||
-rw-r--r-- | lib/Frontend/PCHWriter.cpp | 20 | ||||
-rw-r--r-- | lib/Frontend/RewriteObjC.cpp | 16 |
4 files changed, 22 insertions, 29 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index 6e4e28eed1..c329f7b64f 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -2165,8 +2165,10 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) { return QualType(); } unsigned Tag = Record[1]; - return Context->getElaboratedType(GetType(Record[0]), - (ElaboratedType::TagKind) Tag); + // FIXME: Deserialize the qualifier (C++ only) + return Context->getElaboratedType((ElaboratedTypeKeyword) Tag, + /* NNS */ 0, + GetType(Record[0])); } case pch::TYPE_OBJC_INTERFACE: { @@ -2334,9 +2336,6 @@ void TypeLocReader::VisitRecordTypeLoc(RecordTypeLoc TL) { void TypeLocReader::VisitEnumTypeLoc(EnumTypeLoc TL) { TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); } -void TypeLocReader::VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) { - TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); -} void TypeLocReader::VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) { TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); } @@ -2354,7 +2353,7 @@ void TypeLocReader::VisitTemplateSpecializationTypeLoc( Reader.GetTemplateArgumentLocInfo(TL.getTypePtr()->getArg(i).getKind(), Record, Idx)); } -void TypeLocReader::VisitQualifiedNameTypeLoc(QualifiedNameTypeLoc TL) { +void TypeLocReader::VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) { TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); } void TypeLocReader::VisitInjectedClassNameTypeLoc(InjectedClassNameTypeLoc TL) { diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp index c4f9622db8..3f91d0cafb 100644 --- a/lib/Frontend/PCHReaderDecl.cpp +++ b/lib/Frontend/PCHReaderDecl.cpp @@ -865,7 +865,7 @@ Decl *PCHReader::ReadDeclRecord(uint64_t Offset, unsigned Index) { D = EnumDecl::Create(*Context, 0, SourceLocation(), 0, SourceLocation(), 0); break; case pch::DECL_RECORD: - D = RecordDecl::Create(*Context, TagDecl::TK_struct, 0, SourceLocation(), + D = RecordDecl::Create(*Context, TTK_Struct, 0, SourceLocation(), 0, SourceLocation(), 0); break; case pch::DECL_ENUM_CONSTANT: @@ -913,7 +913,7 @@ Decl *PCHReader::ReadDeclRecord(uint64_t Offset, unsigned Index) { DeclarationName()); break; case pch::DECL_CXX_RECORD: - D = CXXRecordDecl::Create(*Context, TagDecl::TK_struct, 0, + D = CXXRecordDecl::Create(*Context, TTK_Struct, 0, SourceLocation(), 0, SourceLocation(), 0); break; case pch::DECL_CXX_METHOD: diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp index dc1fb23ac0..b323dcf4b8 100644 --- a/lib/Frontend/PCHWriter.cpp +++ b/lib/Frontend/PCHWriter.cpp @@ -213,12 +213,6 @@ void PCHTypeWriter::VisitEnumType(const EnumType *T) { Code = pch::TYPE_ENUM; } -void PCHTypeWriter::VisitElaboratedType(const ElaboratedType *T) { - Writer.AddTypeRef(T->getUnderlyingType(), Record); - Record.push_back(T->getTagKind()); - Code = pch::TYPE_ELABORATED; -} - void PCHTypeWriter::VisitSubstTemplateTypeParmType( const SubstTemplateTypeParmType *T) { @@ -234,9 +228,12 @@ PCHTypeWriter::VisitTemplateSpecializationType( assert(false && "Cannot serialize template specialization types"); } -void PCHTypeWriter::VisitQualifiedNameType(const QualifiedNameType *T) { - // FIXME: Serialize this type (C++ only) - assert(false && "Cannot serialize qualified name types"); +void PCHTypeWriter::VisitElaboratedType(const ElaboratedType *T) { + Writer.AddTypeRef(T->getNamedType(), Record); + Record.push_back(T->getKeyword()); + // FIXME: Serialize the qualifier (C++ only) + assert(T->getQualifier() == 0 && "Cannot serialize qualified name types"); + Code = pch::TYPE_ELABORATED; } void PCHTypeWriter::VisitInjectedClassNameType(const InjectedClassNameType *T) { @@ -383,9 +380,6 @@ void TypeLocWriter::VisitRecordTypeLoc(RecordTypeLoc TL) { void TypeLocWriter::VisitEnumTypeLoc(EnumTypeLoc TL) { Writer.AddSourceLocation(TL.getNameLoc(), Record); } -void TypeLocWriter::VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) { - Writer.AddSourceLocation(TL.getNameLoc(), Record); -} void TypeLocWriter::VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) { Writer.AddSourceLocation(TL.getNameLoc(), Record); } @@ -401,7 +395,7 @@ void TypeLocWriter::VisitTemplateSpecializationTypeLoc( for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i) Writer.AddTemplateArgumentLoc(TL.getArgLoc(i), Record); } -void TypeLocWriter::VisitQualifiedNameTypeLoc(QualifiedNameTypeLoc TL) { +void TypeLocWriter::VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) { Writer.AddSourceLocation(TL.getNameLoc(), Record); } void TypeLocWriter::VisitInjectedClassNameTypeLoc(InjectedClassNameTypeLoc TL) { diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp index 11698325e9..3c415c79d9 100644 --- a/lib/Frontend/RewriteObjC.cpp +++ b/lib/Frontend/RewriteObjC.cpp @@ -1349,7 +1349,7 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV, std::string RecName = clsDeclared->getIdentifier()->getName(); RecName += "_IMPL"; IdentifierInfo *II = &Context->Idents.get(RecName); - RecordDecl *RD = RecordDecl::Create(*Context, TagDecl::TK_struct, TUDecl, + RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl, SourceLocation(), II); assert(RD && "RewriteObjCIvarRefExpr(): Can't find RecordDecl"); QualType castT = Context->getPointerType(Context->getTagDeclType(RD)); @@ -1394,7 +1394,7 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV, std::string RecName = clsDeclared->getIdentifier()->getName(); RecName += "_IMPL"; IdentifierInfo *II = &Context->Idents.get(RecName); - RecordDecl *RD = RecordDecl::Create(*Context, TagDecl::TK_struct, TUDecl, + RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl, SourceLocation(), II); assert(RD && "RewriteObjCIvarRefExpr(): Can't find RecordDecl"); QualType castT = Context->getPointerType(Context->getTagDeclType(RD)); @@ -2426,7 +2426,7 @@ void RewriteObjC::SynthMsgSendFunctionDecl() { void RewriteObjC::SynthMsgSendSuperFunctionDecl() { IdentifierInfo *msgSendIdent = &Context->Idents.get("objc_msgSendSuper"); llvm::SmallVector<QualType, 16> ArgTys; - RecordDecl *RD = RecordDecl::Create(*Context, TagDecl::TK_struct, TUDecl, + RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl, SourceLocation(), &Context->Idents.get("objc_super")); QualType argT = Context->getPointerType(Context->getTagDeclType(RD)); @@ -2475,7 +2475,7 @@ void RewriteObjC::SynthMsgSendSuperStretFunctionDecl() { IdentifierInfo *msgSendIdent = &Context->Idents.get("objc_msgSendSuper_stret"); llvm::SmallVector<QualType, 16> ArgTys; - RecordDecl *RD = RecordDecl::Create(*Context, TagDecl::TK_struct, TUDecl, + RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl, SourceLocation(), &Context->Idents.get("objc_super")); QualType argT = Context->getPointerType(Context->getTagDeclType(RD)); @@ -2625,7 +2625,7 @@ bool RewriteObjC::isSuperReceiver(Expr *recExpr) { // struct objc_super { struct objc_object *receiver; struct objc_class *super; }; QualType RewriteObjC::getSuperStructType() { if (!SuperStructDecl) { - SuperStructDecl = RecordDecl::Create(*Context, TagDecl::TK_struct, TUDecl, + SuperStructDecl = RecordDecl::Create(*Context, TTK_Struct, TUDecl, SourceLocation(), &Context->Idents.get("objc_super")); QualType FieldTypes[2]; @@ -2651,7 +2651,7 @@ QualType RewriteObjC::getSuperStructType() { QualType RewriteObjC::getConstantStringStructType() { if (!ConstantStringDecl) { - ConstantStringDecl = RecordDecl::Create(*Context, TagDecl::TK_struct, TUDecl, + ConstantStringDecl = RecordDecl::Create(*Context, TTK_Struct, TUDecl, SourceLocation(), &Context->Idents.get("__NSConstantStringImpl")); QualType FieldTypes[4]; @@ -4573,7 +4573,7 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) { const FunctionProtoType *FTP = dyn_cast<FunctionProtoType>(FT); // FTP will be null for closures that don't take arguments. - RecordDecl *RD = RecordDecl::Create(*Context, TagDecl::TK_struct, TUDecl, + RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl, SourceLocation(), &Context->Idents.get("__block_impl")); QualType PtrBlock = Context->getPointerType(Context->getTagDeclType(RD)); @@ -5245,7 +5245,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp, RewriteByRefString(RecName, Name, ND); IdentifierInfo *II = &Context->Idents.get(RecName.c_str() + sizeof("struct")); - RecordDecl *RD = RecordDecl::Create(*Context, TagDecl::TK_struct, TUDecl, + RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl, SourceLocation(), II); assert(RD && "SynthBlockInitExpr(): Can't find RecordDecl"); QualType castT = Context->getPointerType(Context->getTagDeclType(RD)); |