diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Serialization')
7 files changed, 267 insertions, 97 deletions
diff --git a/contrib/llvm/tools/clang/lib/Serialization/ASTCommon.h b/contrib/llvm/tools/clang/lib/Serialization/ASTCommon.h index 16db8e3..eacb39d 100644 --- a/contrib/llvm/tools/clang/lib/Serialization/ASTCommon.h +++ b/contrib/llvm/tools/clang/lib/Serialization/ASTCommon.h @@ -50,6 +50,8 @@ TypeID MakeTypeID(ASTContext &Context, QualType T, IdxForTypeTy IdxForType) { return TypeIdx(PREDEF_TYPE_AUTO_DEDUCT).asTypeID(FastQuals); if (T == Context.AutoRRefDeductTy) return TypeIdx(PREDEF_TYPE_AUTO_RREF_DEDUCT).asTypeID(FastQuals); + if (T == Context.VaListTagTy) + return TypeIdx(PREDEF_TYPE_VA_LIST_TAG).asTypeID(FastQuals); return IdxForType(T).asTypeID(FastQuals); } diff --git a/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp b/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp index fd0c171..3adbc57 100644 --- a/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp +++ b/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp @@ -90,6 +90,12 @@ PCHValidator::ReadLanguageOptions(const LangOptions &LangOpts) { #define BENIGN_LANGOPT(Name, Bits, Default, Description) #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) #include "clang/Basic/LangOptions.def" + + if (PPLangOpts.ObjCRuntime != LangOpts.ObjCRuntime) { + Reader.Diag(diag::err_pch_langopt_value_mismatch) + << "target Objective-C runtime"; + return true; + } return false; } @@ -829,7 +835,7 @@ bool ASTReader::ParseLineTable(ModuleFile &F, Entries.push_back(LineEntry::get(FileOffset, LineNo, FilenameID, FileKind, IncludeOffset)); } - LineTable.AddEntry(FID, Entries); + LineTable.AddEntry(FileID::get(FID), Entries); } return false; @@ -1121,8 +1127,9 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(int ID) { // This is the module's main file. IncludeLoc = getImportLocation(F); } - FileID FID = SourceMgr.createFileID(File, IncludeLoc, - (SrcMgr::CharacteristicKind)Record[2], + SrcMgr::CharacteristicKind + FileCharacter = (SrcMgr::CharacteristicKind)Record[2]; + FileID FID = SourceMgr.createFileID(File, IncludeLoc, FileCharacter, ID, BaseOffset + Record[0]); SrcMgr::FileInfo &FileInfo = const_cast<SrcMgr::FileInfo&>(SourceMgr.getSLocEntry(FID).getFile()); @@ -1139,7 +1146,8 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(int ID) { } const SrcMgr::ContentCache *ContentCache - = SourceMgr.getOrCreateContentCache(File); + = SourceMgr.getOrCreateContentCache(File, + /*isSystemFile=*/FileCharacter != SrcMgr::C_User); if (OverriddenBuffer && !ContentCache->BufferOverridden && ContentCache->ContentsEntry == ContentCache->OrigEntry) { unsigned Code = SLocEntryCursor.ReadCode(); @@ -1737,6 +1745,17 @@ ASTReader::ReadASTBlock(ModuleFile &F) { } break; + case COMMENTS_BLOCK_ID: { + llvm::BitstreamCursor C = Stream; + if (Stream.SkipBlock() || + ReadBlockAbbrevs(C, COMMENTS_BLOCK_ID)) { + Error("malformed comments block in AST file"); + return Failure; + } + CommentsCursors.push_back(std::make_pair(C, &F)); + break; + } + default: if (!Stream.SkipBlock()) break; @@ -2473,6 +2492,26 @@ ASTReader::ASTReadResult ASTReader::validateFileEntries(ModuleFile &M) { Error("source location entry is incorrect"); return Failure; } + + off_t StoredSize = (off_t)Record[4]; + time_t StoredTime = (time_t)Record[5]; + + // Check if there was a request to override the contents of the file + // that was part of the precompiled header. Overridding such a file + // can lead to problems when lexing using the source locations from the + // PCH. + SourceManager &SM = getSourceManager(); + if (SM.isFileOverridden(File)) { + Error(diag::err_fe_pch_file_overridden, Filename); + // After emitting the diagnostic, recover by disabling the override so + // that the original file will be used. + SM.disableFileContentsOverride(File); + // The FileEntry is a virtual file entry with the size of the contents + // that would override the original contents. Set it to the original's + // size/time. + FileMgr.modifyFileEntry(const_cast<FileEntry*>(File), + StoredSize, StoredTime); + } // The stat info from the FileEntry came from the cached stat // info of the PCH, so we cannot trust it. @@ -2482,12 +2521,12 @@ ASTReader::ASTReadResult ASTReader::validateFileEntries(ModuleFile &M) { StatBuf.st_mtime = File->getModificationTime(); } - if (((off_t)Record[4] != StatBuf.st_size + if ((StoredSize != StatBuf.st_size #if !defined(LLVM_ON_WIN32) // In our regression testing, the Windows file system seems to // have inconsistent modification times that sometimes // erroneously trigger this error-handling path. - || (time_t)Record[5] != StatBuf.st_mtime + || StoredTime != StatBuf.st_mtime #endif )) { Error(diag::err_fe_pch_file_modified, Filename); @@ -2831,11 +2870,6 @@ void ASTReader::InitializeContext() { // Load the special types. if (SpecialTypes.size() >= NumSpecialTypeIDs) { - if (Context.getBuiltinVaListType().isNull()) { - Context.setBuiltinVaListType( - GetType(SpecialTypes[SPECIAL_TYPE_BUILTIN_VA_LIST])); - } - if (unsigned String = SpecialTypes[SPECIAL_TYPE_CF_CONSTANT_STRING]) { if (!Context.CFConstantStringTypeDecl) Context.setCFConstantStringType(GetType(String)); @@ -2975,7 +3009,7 @@ std::string ASTReader::getOriginalSourceFile(const std::string &ASTFileName, OwningPtr<llvm::MemoryBuffer> Buffer; Buffer.reset(FileMgr.getBufferForFile(ASTFileName, &ErrStr)); if (!Buffer) { - Diags.Report(diag::err_fe_unable_to_read_pch_file) << ErrStr; + Diags.Report(diag::err_fe_unable_to_read_pch_file) << ASTFileName << ErrStr; return std::string(); } @@ -3297,8 +3331,7 @@ ASTReader::ASTReadResult ASTReader::ReadSubmoduleBlock(ModuleFile &F) { /// them to the AST listener if one is set. /// /// \returns true if the listener deems the file unacceptable, false otherwise. -bool ASTReader::ParseLanguageOptions( - const SmallVectorImpl<uint64_t> &Record) { +bool ASTReader::ParseLanguageOptions(const RecordData &Record) { if (Listener) { LangOptions LangOpts; unsigned Idx = 0; @@ -3307,6 +3340,10 @@ bool ASTReader::ParseLanguageOptions( #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ LangOpts.set##Name(static_cast<LangOptions::Type>(Record[Idx++])); #include "clang/Basic/LangOptions.def" + + ObjCRuntime::Kind runtimeKind = (ObjCRuntime::Kind) Record[Idx++]; + VersionTuple runtimeVersion = ReadVersionTuple(Record, Idx); + LangOpts.ObjCRuntime = ObjCRuntime(runtimeKind, runtimeVersion); unsigned Length = Record[Idx++]; LangOpts.CurrentModule.assign(Record.begin() + Idx, @@ -3869,6 +3906,8 @@ QualType ASTReader::readTypeRecord(unsigned Index) { } else if (EST == EST_Uninstantiated) { EPI.ExceptionSpecDecl = ReadDeclAs<FunctionDecl>(*Loc.F, Record, Idx); EPI.ExceptionSpecTemplate = ReadDeclAs<FunctionDecl>(*Loc.F, Record, Idx); + } else if (EST == EST_Unevaluated) { + EPI.ExceptionSpecDecl = ReadDeclAs<FunctionDecl>(*Loc.F, Record, Idx); } return Context.getFunctionType(ResultType, ParamTypes.data(), NumParams, EPI); @@ -4124,7 +4163,6 @@ QualType ASTReader::readTypeRecord(unsigned Index) { class clang::TypeLocReader : public TypeLocVisitor<TypeLocReader> { ASTReader &Reader; ModuleFile &F; - llvm::BitstreamCursor &DeclsCursor; const ASTReader::RecordData &Record; unsigned &Idx; @@ -4141,7 +4179,7 @@ class clang::TypeLocReader : public TypeLocVisitor<TypeLocReader> { public: TypeLocReader(ASTReader &Reader, ModuleFile &F, const ASTReader::RecordData &Record, unsigned &Idx) - : Reader(Reader), F(F), DeclsCursor(F.DeclsCursor), Record(Record), Idx(Idx) + : Reader(Reader), F(F), Record(Record), Idx(Idx) { } // We want compile-time assurance that we've enumerated all of @@ -4221,7 +4259,6 @@ void TypeLocReader::VisitExtVectorTypeLoc(ExtVectorTypeLoc TL) { void TypeLocReader::VisitFunctionTypeLoc(FunctionTypeLoc TL) { TL.setLocalRangeBegin(ReadSourceLocation(Record, Idx)); TL.setLocalRangeEnd(ReadSourceLocation(Record, Idx)); - TL.setTrailingReturn(Record[Idx++]); for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i) { TL.setArg(i, ReadDeclAs<ParmVarDecl>(Record, Idx)); } @@ -4427,6 +4464,9 @@ QualType ASTReader::GetType(TypeID ID) { T = Context.ARCUnbridgedCastTy; break; + case PREDEF_TYPE_VA_LIST_TAG: + T = Context.getVaListTagType(); + break; } assert(!T.isNull() && "Unknown predefined type"); @@ -4627,13 +4667,18 @@ Decl *ASTReader::GetDecl(DeclID ID) { case PREDEF_DECL_OBJC_INSTANCETYPE_ID: return Context.getObjCInstanceTypeDecl(); + + case PREDEF_DECL_BUILTIN_VA_LIST_ID: + return Context.getBuiltinVaListDecl(); } } unsigned Index = ID - NUM_PREDEF_DECL_IDS; if (Index >= DeclsLoaded.size()) { + assert(0 && "declaration ID out-of-range for AST file"); Error("declaration ID out-of-range for AST file"); + return 0; } if (!DeclsLoaded[Index]) { @@ -4839,7 +4884,6 @@ namespace { class DeclContextNameLookupVisitor { ASTReader &Reader; llvm::SmallVectorImpl<const DeclContext *> &Contexts; - const DeclContext *DC; DeclarationName Name; SmallVectorImpl<NamedDecl *> &Decls; @@ -4941,7 +4985,6 @@ namespace { class DeclContextAllNamesVisitor { ASTReader &Reader; llvm::SmallVectorImpl<const DeclContext *> &Contexts; - const DeclContext *DC; llvm::DenseMap<DeclarationName, SmallVector<NamedDecl *, 8> > &Decls; public: @@ -5025,6 +5068,7 @@ void ASTReader::completeVisibleDeclsMap(const DeclContext *DC) { I = Decls.begin(), E = Decls.end(); I != E; ++I) { SetExternalVisibleDeclsForName(DC, I->first, I->second); } + const_cast<DeclContext *>(DC)->setHasExternalVisibleStorage(false); } /// \brief Under non-PCH compilation the consumer receives the objc methods @@ -5887,7 +5931,7 @@ ASTReader::ReadTemplateArgument(ModuleFile &F, case TemplateArgument::Integral: { llvm::APSInt Value = ReadAPSInt(Record, Idx); QualType T = readType(F, Record, Idx); - return TemplateArgument(Value, T); + return TemplateArgument(Context, Value, T); } case TemplateArgument::Template: return TemplateArgument(ReadTemplateName(F, Record, Idx)); @@ -6227,18 +6271,72 @@ IdentifierTable &ASTReader::getIdentifierTable() { /// \brief Record that the given ID maps to the given switch-case /// statement. void ASTReader::RecordSwitchCaseID(SwitchCase *SC, unsigned ID) { - assert(SwitchCaseStmts[ID] == 0 && "Already have a SwitchCase with this ID"); - SwitchCaseStmts[ID] = SC; + assert((*CurrSwitchCaseStmts)[ID] == 0 && + "Already have a SwitchCase with this ID"); + (*CurrSwitchCaseStmts)[ID] = SC; } /// \brief Retrieve the switch-case statement with the given ID. SwitchCase *ASTReader::getSwitchCaseWithID(unsigned ID) { - assert(SwitchCaseStmts[ID] != 0 && "No SwitchCase with this ID"); - return SwitchCaseStmts[ID]; + assert((*CurrSwitchCaseStmts)[ID] != 0 && "No SwitchCase with this ID"); + return (*CurrSwitchCaseStmts)[ID]; } void ASTReader::ClearSwitchCaseIDs() { - SwitchCaseStmts.clear(); + CurrSwitchCaseStmts->clear(); +} + +void ASTReader::ReadComments() { + std::vector<RawComment *> Comments; + for (SmallVectorImpl<std::pair<llvm::BitstreamCursor, + serialization::ModuleFile *> >::iterator + I = CommentsCursors.begin(), + E = CommentsCursors.end(); + I != E; ++I) { + llvm::BitstreamCursor &Cursor = I->first; + serialization::ModuleFile &F = *I->second; + SavedStreamPosition SavedPosition(Cursor); + + RecordData Record; + while (true) { + unsigned Code = Cursor.ReadCode(); + if (Code == llvm::bitc::END_BLOCK) + break; + + if (Code == llvm::bitc::ENTER_SUBBLOCK) { + // No known subblocks, always skip them. + Cursor.ReadSubBlockID(); + if (Cursor.SkipBlock()) { + Error("malformed block record in AST file"); + return; + } + continue; + } + + if (Code == llvm::bitc::DEFINE_ABBREV) { + Cursor.ReadAbbrevRecord(); + continue; + } + + // Read a record. + Record.clear(); + switch ((CommentRecordTypes) Cursor.ReadRecord(Code, Record)) { + case COMMENTS_RAW_COMMENT: { + unsigned Idx = 0; + SourceRange SR = ReadSourceRange(F, Record, Idx); + RawComment::CommentKind Kind = + (RawComment::CommentKind) Record[Idx++]; + bool IsTrailingComment = Record[Idx++]; + bool IsAlmostTrailingComment = Record[Idx++]; + Comments.push_back(new (Context) RawComment(SR, Kind, + IsTrailingComment, + IsAlmostTrailingComment)); + break; + } + } + } + } + Context.Comments.addCommentsToFront(Comments); } void ASTReader::finishPendingActions() { @@ -6353,7 +6451,8 @@ ASTReader::ASTReader(Preprocessor &PP, ASTContext &Context, DisableValidation(DisableValidation), DisableStatCache(DisableStatCache), AllowASTWithCompilerErrors(AllowASTWithCompilerErrors), - CurrentGeneration(0), NumStatHits(0), NumStatMisses(0), + CurrentGeneration(0), CurrSwitchCaseStmts(&SwitchCaseStmts), + NumStatHits(0), NumStatMisses(0), NumSLocEntriesRead(0), TotalNumSLocEntries(0), NumStatementsRead(0), TotalNumStatements(0), NumMacrosRead(0), TotalNumMacros(0), NumSelectorsRead(0), NumMethodPoolEntriesRead(0), diff --git a/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp b/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp index 8dd53ee..cb21f82 100644 --- a/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp @@ -25,6 +25,7 @@ #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclTemplate.h" #include "clang/AST/Expr.h" +#include "llvm/Support/SaveAndRestore.h" using namespace clang; using namespace clang::serialization; @@ -629,6 +630,10 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) { if (Record[Idx++]) { // In practice, this won't be executed (since method definitions // don't occur in header files). + // Switch case IDs for this method body. + ASTReader::SwitchCaseMapTy SwitchCaseStmtsForObjCMethod; + SaveAndRestore<ASTReader::SwitchCaseMapTy *> + SCFOM(Reader.CurrSwitchCaseStmts, &SwitchCaseStmtsForObjCMethod); MD->setBody(Reader.ReadStmt(F)); MD->setSelfDecl(ReadDeclAs<ImplicitParamDecl>(Record, Idx)); MD->setCmdDecl(ReadDeclAs<ImplicitParamDecl>(Record, Idx)); @@ -637,6 +642,7 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) { MD->setVariadic(Record[Idx++]); MD->setSynthesized(Record[Idx++]); MD->setDefined(Record[Idx++]); + MD->IsOverriding = Record[Idx++]; MD->IsRedeclaration = Record[Idx++]; MD->HasRedeclaration = Record[Idx++]; @@ -649,7 +655,7 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) { MD->SetRelatedResultType(Record[Idx++]); MD->setResultType(Reader.readType(F, Record, Idx)); MD->setResultTypeSourceInfo(GetTypeSourceInfo(Record, Idx)); - MD->setEndLoc(ReadSourceLocation(Record, Idx)); + MD->DeclEndLoc = ReadSourceLocation(Record, Idx); unsigned NumParams = Record[Idx++]; SmallVector<ParmVarDecl *, 16> Params; Params.reserve(NumParams); @@ -797,7 +803,6 @@ void ASTDeclReader::VisitObjCCategoryDecl(ObjCCategoryDecl *CD) { ProtoLocs.push_back(ReadSourceLocation(Record, Idx)); CD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(), Reader.getContext()); - CD->setHasSynthBitfield(Record[Idx++]); } void ASTDeclReader::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *CAD) { @@ -843,7 +848,6 @@ void ASTDeclReader::VisitObjCImplementationDecl(ObjCImplementationDecl *D) { D->setIvarRBraceLoc(ReadSourceLocation(Record, Idx)); llvm::tie(D->IvarInitializers, D->NumIvarInitializers) = Reader.ReadCXXCtorInitializers(F, Record, Idx); - D->setHasSynthBitfield(Record[Idx++]); } @@ -859,12 +863,11 @@ void ASTDeclReader::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) { void ASTDeclReader::VisitFieldDecl(FieldDecl *FD) { VisitDeclaratorDecl(FD); - FD->setMutable(Record[Idx++]); - int BitWidthOrInitializer = Record[Idx++]; - if (BitWidthOrInitializer == 1) - FD->setBitWidth(Reader.ReadExpr(F)); - else if (BitWidthOrInitializer == 2) - FD->setInClassInitializer(Reader.ReadExpr(F)); + FD->Mutable = Record[Idx++]; + if (int BitWidthOrInitializer = Record[Idx++]) { + FD->InitializerOrBitWidth.setInt(BitWidthOrInitializer - 1); + FD->InitializerOrBitWidth.setPointer(Reader.ReadExpr(F)); + } if (!FD->getDeclName()) { if (FieldDecl *Tmpl = ReadDeclAs<FieldDecl>(Record, Idx)) Reader.getContext().setInstantiatedFromUnnamedFieldDecl(FD, Tmpl); @@ -1085,14 +1088,11 @@ void ASTDeclReader::ReadCXXDefinitionData( Data.HasPublicFields = Record[Idx++]; Data.HasMutableFields = Record[Idx++]; Data.HasOnlyCMembers = Record[Idx++]; + Data.HasInClassInitializer = Record[Idx++]; Data.HasTrivialDefaultConstructor = Record[Idx++]; Data.HasConstexprNonCopyMoveConstructor = Record[Idx++]; Data.DefaultedDefaultConstructorIsConstexpr = Record[Idx++]; - Data.DefaultedCopyConstructorIsConstexpr = Record[Idx++]; - Data.DefaultedMoveConstructorIsConstexpr = Record[Idx++]; Data.HasConstexprDefaultConstructor = Record[Idx++]; - Data.HasConstexprCopyConstructor = Record[Idx++]; - Data.HasConstexprMoveConstructor = Record[Idx++]; Data.HasTrivialCopyConstructor = Record[Idx++]; Data.HasTrivialMoveConstructor = Record[Idx++]; Data.HasTrivialCopyAssignment = Record[Idx++]; @@ -1242,7 +1242,6 @@ void ASTDeclReader::VisitImportDecl(ImportDecl *D) { SourceLocation *StoredLocs = reinterpret_cast<SourceLocation *>(D + 1); for (unsigned I = 0, N = Record.back(); I != N; ++I) StoredLocs[I] = ReadSourceLocation(Record, Idx); - ++Idx; } void ASTDeclReader::VisitAccessSpecDecl(AccessSpecDecl *D) { @@ -1500,7 +1499,8 @@ void ASTDeclReader::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) { void ASTDeclReader::VisitStaticAssertDecl(StaticAssertDecl *D) { VisitDecl(D); - D->AssertExpr = Reader.ReadExpr(F); + D->AssertExprAndFailed.setPointer(Reader.ReadExpr(F)); + D->AssertExprAndFailed.setInt(Record[Idx++]); D->Message = cast<StringLiteral>(Reader.ReadExpr(F)); D->RParenLoc = ReadSourceLocation(Record, Idx); } @@ -1528,7 +1528,7 @@ ASTDeclReader::VisitRedeclarable(Redeclarable<T> *D) { // We temporarily set the first (canonical) declaration as the previous one // which is the one that matters and mark the real previous DeclID to be // loaded & attached later on. - D->RedeclLink = typename Redeclarable<T>::PreviousDeclLink(FirstDecl); + D->RedeclLink = Redeclarable<T>::PreviousDeclLink(FirstDecl); } // Note that this declaration has been deserialized. @@ -1556,8 +1556,7 @@ void ASTDeclReader::mergeRedeclarable(Redeclarable<T> *D, // Have our redeclaration link point back at the canonical declaration // of the existing declaration, so that this declaration has the // appropriate canonical declaration. - D->RedeclLink - = typename Redeclarable<T>::PreviousDeclLink(ExistingCanon); + D->RedeclLink = Redeclarable<T>::PreviousDeclLink(ExistingCanon); // When we merge a namespace, update its pointer to the first namespace. if (NamespaceDecl *Namespace @@ -1799,22 +1798,22 @@ ASTDeclReader::FindExistingResult ASTDeclReader::findExisting(NamedDecl *D) { void ASTDeclReader::attachPreviousDecl(Decl *D, Decl *previous) { assert(D && previous); if (TagDecl *TD = dyn_cast<TagDecl>(D)) { - TD->RedeclLink.setPointer(cast<TagDecl>(previous)); + TD->RedeclLink.setNext(cast<TagDecl>(previous)); } else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { - FD->RedeclLink.setPointer(cast<FunctionDecl>(previous)); + FD->RedeclLink.setNext(cast<FunctionDecl>(previous)); } else if (VarDecl *VD = dyn_cast<VarDecl>(D)) { - VD->RedeclLink.setPointer(cast<VarDecl>(previous)); + VD->RedeclLink.setNext(cast<VarDecl>(previous)); } else if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D)) { - TD->RedeclLink.setPointer(cast<TypedefNameDecl>(previous)); + TD->RedeclLink.setNext(cast<TypedefNameDecl>(previous)); } else if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(D)) { - ID->RedeclLink.setPointer(cast<ObjCInterfaceDecl>(previous)); + ID->RedeclLink.setNext(cast<ObjCInterfaceDecl>(previous)); } else if (ObjCProtocolDecl *PD = dyn_cast<ObjCProtocolDecl>(D)) { - PD->RedeclLink.setPointer(cast<ObjCProtocolDecl>(previous)); + PD->RedeclLink.setNext(cast<ObjCProtocolDecl>(previous)); } else if (NamespaceDecl *ND = dyn_cast<NamespaceDecl>(D)) { - ND->RedeclLink.setPointer(cast<NamespaceDecl>(previous)); + ND->RedeclLink.setNext(cast<NamespaceDecl>(previous)); } else { RedeclarableTemplateDecl *TD = cast<RedeclarableTemplateDecl>(D); - TD->RedeclLink.setPointer(cast<RedeclarableTemplateDecl>(previous)); + TD->RedeclLink.setNext(cast<RedeclarableTemplateDecl>(previous)); } } diff --git a/contrib/llvm/tools/clang/lib/Serialization/ASTReaderStmt.cpp b/contrib/llvm/tools/clang/lib/Serialization/ASTReaderStmt.cpp index 007ecee..c5325b5 100644 --- a/contrib/llvm/tools/clang/lib/Serialization/ASTReaderStmt.cpp +++ b/contrib/llvm/tools/clang/lib/Serialization/ASTReaderStmt.cpp @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "clang/Serialization/ASTReader.h" +#include "clang/AST/ASTContext.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclTemplate.h" #include "clang/AST/StmtVisitor.h" @@ -161,9 +162,13 @@ void ASTStmtReader::VisitLabelStmt(LabelStmt *S) { void ASTStmtReader::VisitAttributedStmt(AttributedStmt *S) { VisitStmt(S); + uint64_t NumAttrs = Record[Idx++]; AttrVec Attrs; Reader.ReadAttributes(F, Attrs, Record, Idx); - S->Attrs = Attrs; + (void)NumAttrs; + assert(NumAttrs == S->NumAttrs); + assert(NumAttrs == Attrs.size()); + std::copy(Attrs.begin(), Attrs.end(), S->Attrs); S->SubStmt = Reader.ReadSubStmt(); S->AttrLoc = ReadSourceLocation(Record, Idx); } @@ -317,6 +322,11 @@ void ASTStmtReader::VisitAsmStmt(AsmStmt *S) { Clobbers.data(), NumClobbers); } +void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) { + // FIXME: Statement reader not yet implemented for MS style inline asm. + VisitStmt(S); +} + void ASTStmtReader::VisitExpr(Expr *E) { VisitStmt(E); E->setType(Reader.readType(F, Record, Idx)); @@ -816,12 +826,12 @@ void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) { E->setAtLoc(ReadSourceLocation(Record, Idx)); } -void ASTStmtReader::VisitObjCNumericLiteral(ObjCNumericLiteral *E) { +void ASTStmtReader::VisitObjCBoxedExpr(ObjCBoxedExpr *E) { VisitExpr(E); // could be one of several IntegerLiteral, FloatLiteral, etc. - E->Number = Reader.ReadSubStmt(); - E->ObjCNumericLiteralMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx); - E->AtLoc = ReadSourceLocation(Record, Idx); + E->SubExpr = Reader.ReadSubStmt(); + E->BoxingMethod = ReadDeclAs<ObjCMethodDecl>(Record, Idx); + E->Range = ReadSourceRange(Record, Idx); } void ASTStmtReader::VisitObjCArrayLiteral(ObjCArrayLiteral *E) { @@ -873,6 +883,7 @@ void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) { VisitExpr(E); E->setProtocol(ReadDeclAs<ObjCProtocolDecl>(Record, Idx)); E->setAtLoc(ReadSourceLocation(Record, Idx)); + E->ProtoLoc = ReadSourceLocation(Record, Idx); E->setRParenLoc(ReadSourceLocation(Record, Idx)); } @@ -1074,7 +1085,8 @@ void ASTStmtReader::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) { void ASTStmtReader::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) { VisitCallExpr(E); - E->setOperator((OverloadedOperatorKind)Record[Idx++]); + E->Operator = (OverloadedOperatorKind)Record[Idx++]; + E->Range = Reader.ReadSourceRange(F, Record, Idx); } void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) { @@ -1640,7 +1652,9 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { break; case STMT_ATTRIBUTED: - S = new (Context) AttributedStmt(Empty); + S = AttributedStmt::CreateEmpty( + Context, + /*NumAttrs*/Record[ASTStmtReader::NumStmtFields]); break; case STMT_IF: @@ -1888,8 +1902,8 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { case EXPR_OBJC_STRING_LITERAL: S = new (Context) ObjCStringLiteral(Empty); break; - case EXPR_OBJC_NUMERIC_LITERAL: - S = new (Context) ObjCNumericLiteral(Empty); + case EXPR_OBJC_BOXED_EXPRESSION: + S = new (Context) ObjCBoxedExpr(Empty); break; case EXPR_OBJC_ARRAY_LITERAL: S = ObjCArrayLiteral::CreateEmpty(Context, diff --git a/contrib/llvm/tools/clang/lib/Serialization/ASTWriter.cpp b/contrib/llvm/tools/clang/lib/Serialization/ASTWriter.cpp index 36933a9..425d2e3 100644 --- a/contrib/llvm/tools/clang/lib/Serialization/ASTWriter.cpp +++ b/contrib/llvm/tools/clang/lib/Serialization/ASTWriter.cpp @@ -198,6 +198,8 @@ void ASTTypeWriter::VisitFunctionProtoType(const FunctionProtoType *T) { } else if (T->getExceptionSpecType() == EST_Uninstantiated) { Writer.AddDeclRef(T->getExceptionSpecDecl(), Record); Writer.AddDeclRef(T->getExceptionSpecTemplate(), Record); + } else if (T->getExceptionSpecType() == EST_Unevaluated) { + Writer.AddDeclRef(T->getExceptionSpecDecl(), Record); } Code = TYPE_FUNCTION_PROTO; } @@ -484,7 +486,6 @@ void TypeLocWriter::VisitExtVectorTypeLoc(ExtVectorTypeLoc TL) { void TypeLocWriter::VisitFunctionTypeLoc(FunctionTypeLoc TL) { Writer.AddSourceLocation(TL.getLocalRangeBegin(), Record); Writer.AddSourceLocation(TL.getLocalRangeEnd(), Record); - Record.push_back(TL.getTrailingReturn()); for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i) Writer.AddDeclRef(TL.getArg(i), Record); } @@ -699,7 +700,7 @@ static void AddStmtsExprs(llvm::BitstreamWriter &Stream, RECORD(EXPR_BLOCK); RECORD(EXPR_GENERIC_SELECTION); RECORD(EXPR_OBJC_STRING_LITERAL); - RECORD(EXPR_OBJC_NUMERIC_LITERAL); + RECORD(EXPR_OBJC_BOXED_EXPRESSION); RECORD(EXPR_OBJC_ARRAY_LITERAL); RECORD(EXPR_OBJC_DICTIONARY_LITERAL); RECORD(EXPR_OBJC_ENCODE); @@ -1081,6 +1082,9 @@ void ASTWriter::WriteLanguageOptions(const LangOptions &LangOpts) { #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ Record.push_back(static_cast<unsigned>(LangOpts.get##Name())); #include "clang/Basic/LangOptions.def" + + Record.push_back((unsigned) LangOpts.ObjCRuntime.getKind()); + AddVersionTuple(LangOpts.ObjCRuntime.getVersion(), Record); Record.push_back(LangOpts.CurrentModule.size()); Record.append(LangOpts.CurrentModule.begin(), LangOpts.CurrentModule.end()); @@ -1242,15 +1246,14 @@ namespace { // Trait used for the on-disk hash table of header search information. class HeaderFileInfoTrait { ASTWriter &Writer; - const HeaderSearch &HS; // Keep track of the framework names we've used during serialization. SmallVector<char, 128> FrameworkStringData; llvm::StringMap<unsigned> FrameworkNameOffset; public: - HeaderFileInfoTrait(ASTWriter &Writer, const HeaderSearch &HS) - : Writer(Writer), HS(HS) { } + HeaderFileInfoTrait(ASTWriter &Writer) + : Writer(Writer) { } typedef const char *key_type; typedef key_type key_type_ref; @@ -1335,7 +1338,7 @@ void ASTWriter::WriteHeaderSearch(const HeaderSearch &HS, StringRef isysroot) { if (FilesByUID.size() > HS.header_file_size()) FilesByUID.resize(HS.header_file_size()); - HeaderFileInfoTrait GeneratorTrait(*this, HS); + HeaderFileInfoTrait GeneratorTrait(*this); OnDiskChainedHashTableGenerator<HeaderFileInfoTrait> Generator; SmallVector<const char *, 4> SavedStrings; unsigned NumHeaderSearchEntries = 0; @@ -1605,11 +1608,11 @@ void ASTWriter::WriteSourceManagerBlock(SourceManager &SourceMgr, for (LineTableInfo::iterator L = LineTable.begin(), LEnd = LineTable.end(); L != LEnd; ++L) { // Only emit entries for local files. - if (L->first < 0) + if (L->first.ID < 0) continue; // Emit the file ID - Record.push_back(L->first); + Record.push_back(L->first.ID); // Emit the line entries Record.push_back(L->second.size()); @@ -2241,6 +2244,23 @@ void ASTWriter::WriteFileDeclIDsMap() { Stream.EmitRecordWithBlob(AbbrevCode, Record, data(FileSortedIDs)); } +void ASTWriter::WriteComments() { + Stream.EnterSubblock(COMMENTS_BLOCK_ID, 3); + ArrayRef<RawComment *> RawComments = Context->Comments.getComments(); + RecordData Record; + for (ArrayRef<RawComment *>::iterator I = RawComments.begin(), + E = RawComments.end(); + I != E; ++I) { + Record.clear(); + AddSourceRange((*I)->getSourceRange(), Record); + Record.push_back((*I)->getKind()); + Record.push_back((*I)->isTrailingComment()); + Record.push_back((*I)->isAlmostTrailingComment()); + Stream.EmitRecord(COMMENTS_RAW_COMMENT, Record); + } + Stream.ExitBlock(); +} + //===----------------------------------------------------------------------===// // Global Method Pool and Selector Serialization //===----------------------------------------------------------------------===// @@ -3067,10 +3087,12 @@ void ASTWriter::WriteMergedDecls() { //===----------------------------------------------------------------------===// /// \brief Write a record containing the given attributes. -void ASTWriter::WriteAttributes(const AttrVec &Attrs, RecordDataImpl &Record) { +void ASTWriter::WriteAttributes(ArrayRef<const Attr*> Attrs, + RecordDataImpl &Record) { Record.push_back(Attrs.size()); - for (AttrVec::const_iterator i = Attrs.begin(), e = Attrs.end(); i != e; ++i){ - const Attr * A = *i; + for (ArrayRef<const Attr *>::iterator i = Attrs.begin(), + e = Attrs.end(); i != e; ++i){ + const Attr *A = *i; Record.push_back(A->getKind()); // FIXME: stable encoding, target attrs AddSourceRange(A->getRange(), Record); @@ -3121,7 +3143,8 @@ void ASTWriter::SetSelectorOffset(Selector Sel, uint32_t Offset) { ASTWriter::ASTWriter(llvm::BitstreamWriter &Stream) : Stream(Stream), Context(0), PP(0), Chain(0), WritingModule(0), - WritingAST(false), ASTHasCompilerErrors(false), + WritingAST(false), DoneWritingDeclsAndTypes(false), + ASTHasCompilerErrors(false), FirstDeclID(NUM_PREDEF_DECL_IDS), NextDeclID(FirstDeclID), FirstTypeID(NUM_PREDEF_TYPE_IDS), NextTypeID(FirstTypeID), FirstIdentID(NUM_PREDEF_IDENT_IDS), NextIdentID(FirstIdentID), @@ -3213,7 +3236,9 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls, DeclIDs[Context.UInt128Decl] = PREDEF_DECL_UNSIGNED_INT_128_ID; if (Context.ObjCInstanceTypeDecl) DeclIDs[Context.ObjCInstanceTypeDecl] = PREDEF_DECL_OBJC_INSTANCETYPE_ID; - + if (Context.BuiltinVaListDecl) + DeclIDs[Context.getBuiltinVaListDecl()] = PREDEF_DECL_BUILTIN_VA_LIST_ID; + if (!Chain) { // Make sure that we emit IdentifierInfos (and any attached // declarations) for builtins. We don't need to do this when we're @@ -3379,13 +3404,20 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls, Record.push_back(reinterpret_cast<uint64_t>(NS)); } } - + + // Make sure visible decls, added to DeclContexts previously loaded from + // an AST file, are registered for serialization. + for (SmallVector<const Decl *, 16>::iterator + I = UpdatingVisibleDecls.begin(), + E = UpdatingVisibleDecls.end(); I != E; ++I) { + GetDeclRef(*I); + } + // Resolve any declaration pointers within the declaration updates block. ResolveDeclUpdatesBlocks(); // Form the record of special types. RecordData SpecialTypes; - AddTypeRef(Context.getBuiltinVaListType(), SpecialTypes); AddTypeRef(Context.getRawCFConstantStringType(), SpecialTypes); AddTypeRef(Context.getFILEType(), SpecialTypes); AddTypeRef(Context.getjmp_bufType(), SpecialTypes); @@ -3413,8 +3445,11 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls, } Stream.ExitBlock(); + DoneWritingDeclsAndTypes = true; + WriteFileDeclIDsMap(); WriteSourceManagerBlock(Context.getSourceManager(), PP, isysroot); + WriteComments(); if (Chain) { // Write the mapping information describing our module dependencies and how @@ -3798,6 +3833,11 @@ TypeIdx ASTWriter::GetOrCreateTypeIdx(QualType T) { TypeIdx &Idx = TypeIdxs[T]; if (Idx.getIndex() == 0) { + if (DoneWritingDeclsAndTypes) { + assert(0 && "New type seen after serializing all the types to emit!"); + return TypeIdx(); + } + // We haven't seen this type before. Assign it a new ID and put it // into the queue of types to emit. Idx = TypeIdx(NextTypeID++); @@ -3835,6 +3875,11 @@ DeclID ASTWriter::GetDeclRef(const Decl *D) { assert(!(reinterpret_cast<uintptr_t>(D) & 0x01) && "Invalid decl pointer"); DeclID &ID = DeclIDs[D]; if (ID == 0) { + if (DoneWritingDeclsAndTypes) { + assert(0 && "New decl seen after serializing all the decls to emit!"); + return 0; + } + // We haven't seen this declaration before. Give it a new ID and // enqueue it in the list of declarations to emit. ID = NextDeclID++; @@ -4148,7 +4193,7 @@ void ASTWriter::AddTemplateArgument(const TemplateArgument &Arg, AddDeclRef(Arg.getAsDecl(), Record); break; case TemplateArgument::Integral: - AddAPSInt(*Arg.getAsIntegral(), Record); + AddAPSInt(Arg.getAsIntegral(), Record); AddTypeRef(Arg.getIntegralType(), Record); break; case TemplateArgument::Template: @@ -4310,14 +4355,11 @@ void ASTWriter::AddCXXDefinitionData(const CXXRecordDecl *D, RecordDataImpl &Rec Record.push_back(Data.HasPublicFields); Record.push_back(Data.HasMutableFields); Record.push_back(Data.HasOnlyCMembers); + Record.push_back(Data.HasInClassInitializer); Record.push_back(Data.HasTrivialDefaultConstructor); Record.push_back(Data.HasConstexprNonCopyMoveConstructor); Record.push_back(Data.DefaultedDefaultConstructorIsConstexpr); - Record.push_back(Data.DefaultedCopyConstructorIsConstexpr); - Record.push_back(Data.DefaultedMoveConstructorIsConstexpr); Record.push_back(Data.HasConstexprDefaultConstructor); - Record.push_back(Data.HasConstexprCopyConstructor); - Record.push_back(Data.HasConstexprMoveConstructor); Record.push_back(Data.HasTrivialCopyConstructor); Record.push_back(Data.HasTrivialMoveConstructor); Record.push_back(Data.HasTrivialCopyAssignment); @@ -4459,6 +4501,7 @@ void ASTWriter::AddedVisibleDecl(const DeclContext *DC, const Decl *D) { return; // Not a source decl added to a DeclContext from PCH. AddUpdatedDeclContext(DC); + UpdatingVisibleDecls.push_back(D); } void ASTWriter::AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) { diff --git a/contrib/llvm/tools/clang/lib/Serialization/ASTWriterDecl.cpp b/contrib/llvm/tools/clang/lib/Serialization/ASTWriterDecl.cpp index 1ee3ac4..602943b 100644 --- a/contrib/llvm/tools/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/contrib/llvm/tools/clang/lib/Serialization/ASTWriterDecl.cpp @@ -151,7 +151,8 @@ void ASTDeclWriter::VisitDecl(Decl *D) { Record.push_back(D->isInvalidDecl()); Record.push_back(D->hasAttrs()); if (D->hasAttrs()) - Writer.WriteAttributes(D->getAttrs(), Record); + Writer.WriteAttributes(ArrayRef<const Attr*>(D->getAttrs().begin(), + D->getAttrs().size()), Record); Record.push_back(D->isImplicit()); Record.push_back(D->isUsed(false)); Record.push_back(D->isReferenced()); @@ -417,6 +418,7 @@ void ASTDeclWriter::VisitObjCMethodDecl(ObjCMethodDecl *D) { Record.push_back(D->isVariadic()); Record.push_back(D->isSynthesized()); Record.push_back(D->isDefined()); + Record.push_back(D->IsOverriding); Record.push_back(D->IsRedeclaration); Record.push_back(D->HasRedeclaration); @@ -559,7 +561,6 @@ void ASTDeclWriter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) { PL = D->protocol_loc_begin(), PLEnd = D->protocol_loc_end(); PL != PLEnd; ++PL) Writer.AddSourceLocation(*PL, Record); - Record.push_back(D->hasSynthBitfield()); Code = serialization::DECL_OBJC_CATEGORY; } @@ -607,7 +608,6 @@ void ASTDeclWriter::VisitObjCImplementationDecl(ObjCImplementationDecl *D) { Writer.AddSourceLocation(D->getIvarRBraceLoc(), Record); Writer.AddCXXCtorInitializers(D->IvarInitializers, D->NumIvarInitializers, Record); - Record.push_back(D->hasSynthBitfield()); Code = serialization::DECL_OBJC_IMPLEMENTATION; } @@ -625,11 +625,13 @@ void ASTDeclWriter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) { void ASTDeclWriter::VisitFieldDecl(FieldDecl *D) { VisitDeclaratorDecl(D); Record.push_back(D->isMutable()); - Record.push_back(D->getBitWidth()? 1 : D->hasInClassInitializer() ? 2 : 0); - if (D->getBitWidth()) - Writer.AddStmt(D->getBitWidth()); - else if (D->hasInClassInitializer()) - Writer.AddStmt(D->getInClassInitializer()); + if (D->InitializerOrBitWidth.getInt() != ICIS_NoInit || + D->InitializerOrBitWidth.getPointer()) { + Record.push_back(D->InitializerOrBitWidth.getInt() + 1); + Writer.AddStmt(D->InitializerOrBitWidth.getPointer()); + } else { + Record.push_back(0); + } if (!D->getDeclName()) Writer.AddDeclRef(Context.getInstantiatedFromUnnamedFieldDecl(D), Record); @@ -1054,7 +1056,7 @@ void ASTDeclWriter::VisitClassTemplateDecl(ClassTemplateDecl *D) { VisitRedeclarableTemplateDecl(D); if (D->isFirstDeclaration()) { - typedef llvm::FoldingSet<ClassTemplateSpecializationDecl> CTSDSetTy; + typedef llvm::FoldingSetVector<ClassTemplateSpecializationDecl> CTSDSetTy; CTSDSetTy &CTSDSet = D->getSpecializations(); Record.push_back(CTSDSet.size()); for (CTSDSetTy::iterator I=CTSDSet.begin(), E = CTSDSet.end(); I!=E; ++I) { @@ -1062,7 +1064,8 @@ void ASTDeclWriter::VisitClassTemplateDecl(ClassTemplateDecl *D) { Writer.AddDeclRef(&*I, Record); } - typedef llvm::FoldingSet<ClassTemplatePartialSpecializationDecl> CTPSDSetTy; + typedef llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> + CTPSDSetTy; CTPSDSetTy &CTPSDSet = D->getPartialSpecializations(); Record.push_back(CTPSDSet.size()); for (CTPSDSetTy::iterator I=CTPSDSet.begin(), E=CTPSDSet.end(); I!=E; ++I) { @@ -1146,7 +1149,7 @@ void ASTDeclWriter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) { // Write the function specialization declarations. Record.push_back(D->getSpecializations().size()); - for (llvm::FoldingSet<FunctionTemplateSpecializationInfo>::iterator + for (llvm::FoldingSetVector<FunctionTemplateSpecializationInfo>::iterator I = D->getSpecializations().begin(), E = D->getSpecializations().end() ; I != E; ++I) { assert(I->Function->isCanonicalDecl() && @@ -1217,6 +1220,7 @@ void ASTDeclWriter::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) { void ASTDeclWriter::VisitStaticAssertDecl(StaticAssertDecl *D) { VisitDecl(D); Writer.AddStmt(D->getAssertExpr()); + Record.push_back(D->isFailed()); Writer.AddStmt(D->getMessage()); Writer.AddSourceLocation(D->getRParenLoc(), Record); Code = serialization::DECL_STATIC_ASSERT; diff --git a/contrib/llvm/tools/clang/lib/Serialization/ASTWriterStmt.cpp b/contrib/llvm/tools/clang/lib/Serialization/ASTWriterStmt.cpp index 1e31211..f63388f 100644 --- a/contrib/llvm/tools/clang/lib/Serialization/ASTWriterStmt.cpp +++ b/contrib/llvm/tools/clang/lib/Serialization/ASTWriterStmt.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "clang/Serialization/ASTWriter.h" +#include "clang/AST/ASTContext.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/DeclTemplate.h" @@ -108,6 +109,7 @@ void ASTStmtWriter::VisitLabelStmt(LabelStmt *S) { void ASTStmtWriter::VisitAttributedStmt(AttributedStmt *S) { VisitStmt(S); + Record.push_back(S->getAttrs().size()); Writer.WriteAttributes(S->getAttrs(), Record); Writer.AddStmt(S->getSubStmt()); Writer.AddSourceLocation(S->getAttrLoc(), Record); @@ -249,6 +251,11 @@ void ASTStmtWriter::VisitAsmStmt(AsmStmt *S) { Code = serialization::STMT_ASM; } +void ASTStmtWriter::VisitMSAsmStmt(MSAsmStmt *S) { + // FIXME: Statement writer not yet implemented for MS style inline asm. + VisitStmt(S); +} + void ASTStmtWriter::VisitExpr(Expr *E) { VisitStmt(E); Writer.AddTypeRef(E->getType(), Record); @@ -777,12 +784,12 @@ void ASTStmtWriter::VisitObjCStringLiteral(ObjCStringLiteral *E) { Code = serialization::EXPR_OBJC_STRING_LITERAL; } -void ASTStmtWriter::VisitObjCNumericLiteral(ObjCNumericLiteral *E) { +void ASTStmtWriter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) { VisitExpr(E); - Writer.AddStmt(E->getNumber()); - Writer.AddDeclRef(E->getObjCNumericLiteralMethod(), Record); - Writer.AddSourceLocation(E->getAtLoc(), Record); - Code = serialization::EXPR_OBJC_NUMERIC_LITERAL; + Writer.AddStmt(E->getSubExpr()); + Writer.AddDeclRef(E->getBoxingMethod(), Record); + Writer.AddSourceRange(E->getSourceRange(), Record); + Code = serialization::EXPR_OBJC_BOXED_EXPRESSION; } void ASTStmtWriter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) { @@ -837,6 +844,7 @@ void ASTStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) { VisitExpr(E); Writer.AddDeclRef(E->getProtocol(), Record); Writer.AddSourceLocation(E->getAtLoc(), Record); + Writer.AddSourceLocation(E->ProtoLoc, Record); Writer.AddSourceLocation(E->getRParenLoc(), Record); Code = serialization::EXPR_OBJC_PROTOCOL_EXPR; } @@ -1045,6 +1053,7 @@ void ASTStmtWriter::VisitMSDependentExistsStmt(MSDependentExistsStmt *S) { void ASTStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) { VisitCallExpr(E); Record.push_back(E->getOperator()); + Writer.AddSourceRange(E->Range, Record); Code = serialization::EXPR_CXX_OPERATOR_CALL; } |