diff options
-rw-r--r-- | include/clang/Frontend/ASTUnit.h | 4 | ||||
-rw-r--r-- | include/clang/Serialization/ASTBitCodes.h | 2 | ||||
-rw-r--r-- | include/clang/Serialization/ASTDeserializationListener.h | 9 | ||||
-rw-r--r-- | include/clang/Serialization/ASTReader.h | 20 | ||||
-rw-r--r-- | include/clang/Serialization/ASTWriter.h | 49 | ||||
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 325 | ||||
-rw-r--r-- | lib/Serialization/ASTReaderDecl.cpp | 126 | ||||
-rw-r--r-- | lib/Serialization/ASTReaderStmt.cpp | 213 | ||||
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 357 | ||||
-rw-r--r-- | lib/Serialization/ASTWriterDecl.cpp | 116 | ||||
-rw-r--r-- | lib/Serialization/ASTWriterStmt.cpp | 214 |
11 files changed, 722 insertions, 713 deletions
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index eed4faf423..1db7d4baca 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -198,7 +198,7 @@ private: /// \brief A list of the serialization ID numbers for each of the top-level /// declarations parsed within the precompiled preamble. - std::vector<pch::DeclID> TopLevelDeclsInPreamble; + std::vector<serialization::DeclID> TopLevelDeclsInPreamble; /// /// \defgroup CodeCompleteCaching Code-completion caching @@ -409,7 +409,7 @@ public: /// \brief Add a new top-level declaration, identified by its ID in /// the precompiled preamble. - void addTopLevelDeclFromPreamble(pch::DeclID D) { + void addTopLevelDeclFromPreamble(serialization::DeclID D) { TopLevelDeclsInPreamble.push_back(D); } diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h index 09fe264523..55c11e29f0 100644 --- a/include/clang/Serialization/ASTBitCodes.h +++ b/include/clang/Serialization/ASTBitCodes.h @@ -21,7 +21,7 @@ #include "llvm/System/DataTypes.h" namespace clang { - namespace pch { + namespace serialization { /// \brief AST file major version number supported by this version of /// Clang. /// diff --git a/include/clang/Serialization/ASTDeserializationListener.h b/include/clang/Serialization/ASTDeserializationListener.h index cddb482bf7..543d29e6e2 100644 --- a/include/clang/Serialization/ASTDeserializationListener.h +++ b/include/clang/Serialization/ASTDeserializationListener.h @@ -32,15 +32,16 @@ public: virtual void SetReader(ASTReader *Reader) = 0; /// \brief An identifier was deserialized from the AST file. - virtual void IdentifierRead(pch::IdentID ID, IdentifierInfo *II) = 0; + virtual void IdentifierRead(serialization::IdentID ID, + IdentifierInfo *II) = 0; /// \brief A type was deserialized from the AST file. The ID here has the /// qualifier bits already removed, and T is guaranteed to be locally /// unqualified. - virtual void TypeRead(pch::TypeID ID, QualType T) = 0; + virtual void TypeRead(serialization::TypeID ID, QualType T) = 0; /// \brief A decl was deserialized from the AST file. - virtual void DeclRead(pch::DeclID ID, const Decl *D) = 0; + virtual void DeclRead(serialization::DeclID ID, const Decl *D) = 0; /// \brief A selector was read from the AST file. - virtual void SelectorRead(pch::SelectorID iD, Selector Sel) = 0; + virtual void SelectorRead(serialization::SelectorID iD, Selector Sel) = 0; }; } diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index 9906e19bac..41d64b8b0d 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -10,7 +10,7 @@ // This file defines the ASTReader class, which reads AST files. // //===----------------------------------------------------------------------===// - + #ifndef LLVM_CLANG_FRONTEND_AST_READER_H #define LLVM_CLANG_FRONTEND_AST_READER_H @@ -321,7 +321,8 @@ private: /// = I + 1 has already been loaded. std::vector<Decl *> DeclsLoaded; - typedef llvm::DenseMap<pch::DeclID, std::pair<PerFileData *, uint64_t> > + typedef llvm::DenseMap<serialization::DeclID, + std::pair<PerFileData *, uint64_t> > DeclReplacementMap; /// \brief Declarations that have been replaced in a later file in the chain. DeclReplacementMap ReplacedDecls; @@ -330,7 +331,7 @@ private: struct DeclContextInfo { llvm::BitstreamCursor *Stream; uint64_t OffsetToVisibleDecls; - const pch::DeclID *LexicalDecls; + const serialization::DeclID *LexicalDecls; unsigned NumLexicalDecls; }; typedef llvm::SmallVector<DeclContextInfo, 1> DeclContextInfos; @@ -341,7 +342,8 @@ private: /// DeclContext. DeclContextOffsetsMap DeclContextOffsets; - typedef llvm::DenseMap<pch::DeclID, pch::DeclID> FirstLatestDeclIDMap; + typedef llvm::DenseMap<serialization::DeclID, serialization::DeclID> + FirstLatestDeclIDMap; /// \brief Map of first declarations from a chained PCH that point to the /// most recent declarations in another AST file. FirstLatestDeclIDMap FirstLatestDeclIDs; @@ -574,8 +576,8 @@ private: QualType ReadTypeRecord(unsigned Index); RecordLocation TypeCursorForIndex(unsigned Index); void LoadedDecl(unsigned Index, Decl *D); - Decl *ReadDeclRecord(unsigned Index, pch::DeclID ID); - RecordLocation DeclCursorForIndex(unsigned Index, pch::DeclID ID); + Decl *ReadDeclRecord(unsigned Index, serialization::DeclID ID); + RecordLocation DeclCursorForIndex(unsigned Index, serialization::DeclID ID); void PassInterestingDeclsToConsumer(); @@ -716,11 +718,11 @@ public: /// \brief Resolve a type ID into a type, potentially building a new /// type. - QualType GetType(pch::TypeID ID); + QualType GetType(serialization::TypeID ID); /// \brief Resolve a declaration ID into a declaration, potentially /// building a new declaration. - Decl *GetDecl(pch::DeclID ID); + Decl *GetDecl(serialization::DeclID ID); virtual Decl *GetExternalDecl(uint32_t ID); /// \brief Resolve the offset of a statement into a statement. @@ -927,7 +929,7 @@ public: virtual void ReadDefinedMacros(); /// \brief Retrieve the macro definition with the given ID. - MacroDefinition *getMacroDefinition(pch::IdentID ID); + MacroDefinition *getMacroDefinition(serialization::IdentID ID); /// \brief Retrieve the AST context that this AST reader supplements. ASTContext *getContext() { return Context; } diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h index bff4181884..68a6eb0cb8 100644 --- a/include/clang/Serialization/ASTWriter.h +++ b/include/clang/Serialization/ASTWriter.h @@ -114,10 +114,10 @@ private: std::queue<DeclOrType> DeclTypesToEmit; /// \brief The first ID number we can use for our own declarations. - pch::DeclID FirstDeclID; + serialization::DeclID FirstDeclID; /// \brief The decl ID that will be assigned to the next new decl. - pch::DeclID NextDeclID; + serialization::DeclID NextDeclID; /// \brief Map that provides the ID numbers of each declaration within /// the output stream, as well as those deserialized from a chained PCH. @@ -125,17 +125,17 @@ private: /// The ID numbers of declarations are consecutive (in order of /// discovery) and start at 2. 1 is reserved for the translation /// unit, while 0 is reserved for NULL. - llvm::DenseMap<const Decl *, pch::DeclID> DeclIDs; + llvm::DenseMap<const Decl *, serialization::DeclID> DeclIDs; /// \brief Offset of each declaration in the bitstream, indexed by /// the declaration's ID. std::vector<uint32_t> DeclOffsets; /// \brief The first ID number we can use for our own types. - pch::TypeID FirstTypeID; + serialization::TypeID FirstTypeID; /// \brief The type ID that will be assigned to the next new type. - pch::TypeID NextTypeID; + serialization::TypeID NextTypeID; /// \brief Map that provides the ID numbers of each type within the /// output stream, plus those deserialized from a chained PCH. @@ -146,17 +146,18 @@ private: /// allow for the const/volatile qualifiers. /// /// Keys in the map never have const/volatile qualifiers. - llvm::DenseMap<QualType, pch::TypeID, UnsafeQualTypeDenseMapInfo> TypeIDs; + llvm::DenseMap<QualType, serialization::TypeID, UnsafeQualTypeDenseMapInfo> + TypeIDs; /// \brief Offset of each type in the bitstream, indexed by /// the type's ID. std::vector<uint32_t> TypeOffsets; /// \brief The first ID number we can use for our own identifiers. - pch::IdentID FirstIdentID; + serialization::IdentID FirstIdentID; /// \brief The identifier ID that will be assigned to the next new identifier. - pch::IdentID NextIdentID; + serialization::IdentID NextIdentID; /// \brief Map that provides the ID numbers of each identifier in /// the output stream. @@ -164,20 +165,20 @@ private: /// The ID numbers for identifiers are consecutive (in order of /// discovery), starting at 1. An ID of zero refers to a NULL /// IdentifierInfo. - llvm::DenseMap<const IdentifierInfo *, pch::IdentID> IdentifierIDs; + llvm::DenseMap<const IdentifierInfo *, serialization::IdentID> IdentifierIDs; /// \brief Offsets of each of the identifier IDs into the identifier /// table. std::vector<uint32_t> IdentifierOffsets; /// \brief The first ID number we can use for our own selectors. - pch::SelectorID FirstSelectorID; + serialization::SelectorID FirstSelectorID; /// \brief The selector ID that will be assigned to the next new identifier. - pch::SelectorID NextSelectorID; + serialization::SelectorID NextSelectorID; /// \brief Map that provides the ID numbers of each Selector. - llvm::DenseMap<Selector, pch::SelectorID> SelectorIDs; + llvm::DenseMap<Selector, serialization::SelectorID> SelectorIDs; /// \brief Offset of each selector within the method pool/selector /// table, indexed by the Selector ID (-1). @@ -193,7 +194,8 @@ private: /// \brief Mapping from macro definitions (as they occur in the preprocessing /// record) to the index into the macro definitions table. - llvm::DenseMap<const MacroDefinition *, pch::IdentID> MacroDefinitions; + llvm::DenseMap<const MacroDefinition *, serialization::IdentID> + MacroDefinitions; /// \brief Mapping from the macro definition indices in \c MacroDefinitions /// to the corresponding offsets within the preprocessor block. @@ -232,7 +234,8 @@ private: /// happen, but the ObjC AST nodes are designed this way), it will be /// serialized again. In this case, it is registered here, so that the reader /// knows to read the updated version. - llvm::SmallVector<std::pair<pch::DeclID, uint64_t>, 16> ReplacedDecls; + llvm::SmallVector<std::pair<serialization::DeclID, uint64_t>, 16> + ReplacedDecls; /// \brief Statements that we've encountered while serializing a /// declaration or type. @@ -339,10 +342,10 @@ public: void AddCXXTemporary(const CXXTemporary *Temp, RecordData &Record); /// \brief Get the unique number used to refer to the given selector. - pch::SelectorID getSelectorRef(Selector Sel); + serialization::SelectorID getSelectorRef(Selector Sel); /// \brief Get the unique number used to refer to the given identifier. - pch::IdentID getIdentifierRef(const IdentifierInfo *II); + serialization::IdentID getIdentifierRef(const IdentifierInfo *II); /// \brief Retrieve the offset of the macro definition for the given /// identifier. @@ -356,7 +359,7 @@ public: /// \brief Retrieve the ID number corresponding to the given macro /// definition. - pch::IdentID getMacroDefinitionID(MacroDefinition *MD); + serialization::IdentID getMacroDefinitionID(MacroDefinition *MD); /// \brief Emit a reference to a type. void AddTypeRef(QualType T, RecordData &Record); @@ -377,11 +380,11 @@ public: void AddDeclRef(const Decl *D, RecordData &Record); /// \brief Force a declaration to be emitted and get its ID. - pch::DeclID GetDeclRef(const Decl *D); + serialization::DeclID GetDeclRef(const Decl *D); /// \brief Determine the declaration ID of an already-emitted /// declaration. - pch::DeclID getDeclID(const Decl *D); + serialization::DeclID getDeclID(const Decl *D); /// \brief Emit a declaration name. void AddDeclarationName(DeclarationName Name, RecordData &Record); @@ -462,10 +465,10 @@ public: // ASTDeserializationListener implementation void SetReader(ASTReader *Reader); - void IdentifierRead(pch::IdentID ID, IdentifierInfo *II); - void TypeRead(pch::TypeID ID, QualType T); - void DeclRead(pch::DeclID ID, const Decl *D); - void SelectorRead(pch::SelectorID iD, Selector Sel); + void IdentifierRead(serialization::IdentID ID, IdentifierInfo *II); + void TypeRead(serialization::TypeID ID, QualType T); + void DeclRead(serialization::DeclID ID, const Decl *D); + void SelectorRead(serialization::SelectorID iD, Selector Sel); }; /// \brief AST and semantic-analysis consumer that generates a diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 8448f424f9..eade765079 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -41,6 +41,7 @@ #include <cstdio> #include <sys/stat.h> using namespace clang; +using namespace clang::serialization; //===----------------------------------------------------------------------===// // PCH validator implementation @@ -470,7 +471,7 @@ class ASTSelectorLookupTrait { public: struct data_type { - pch::SelectorID ID; + SelectorID ID; ObjCMethodList Instance, Factory; }; @@ -634,7 +635,7 @@ public: const unsigned char* d, unsigned DataLen) { using namespace clang::io; - pch::IdentID ID = ReadUnalignedLE32(d); + IdentID ID = ReadUnalignedLE32(d); bool IsInteresting = ID & 0x01; // Wipe out the "is interesting" bit. @@ -907,7 +908,7 @@ ASTReader::ASTReadResult ASTReader::ReadSourceManagerBlock(PerFileData &F) { } // Enter the source manager block. - if (SLocEntryCursor.EnterSubBlock(pch::SOURCE_MANAGER_BLOCK_ID)) { + if (SLocEntryCursor.EnterSubBlock(SOURCE_MANAGER_BLOCK_ID)) { Error("malformed source manager block record in AST file"); return Failure; } @@ -946,14 +947,14 @@ ASTReader::ASTReadResult ASTReader::ReadSourceManagerBlock(PerFileData &F) { default: // Default behavior: ignore. break; - case pch::SM_LINE_TABLE: + case SM_LINE_TABLE: if (ParseLineTable(Record)) return Failure; break; - case pch::SM_SLOC_FILE_ENTRY: - case pch::SM_SLOC_BUFFER_ENTRY: - case pch::SM_SLOC_INSTANTIATION_ENTRY: + case SM_SLOC_FILE_ENTRY: + case SM_SLOC_BUFFER_ENTRY: + case SM_SLOC_INSTANTIATION_ENTRY: // Once we hit one of the source location entries, we're done. return Success; } @@ -1009,7 +1010,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(unsigned ID) { Error("incorrectly-formatted source location entry in AST file"); return Failure; - case pch::SM_SLOC_FILE_ENTRY: { + case SM_SLOC_FILE_ENTRY: { std::string Filename(BlobStart, BlobStart + BlobLen); MaybeAddSystemRootToFilename(Filename); const FileEntry *File = FileMgr.getFile(Filename); @@ -1059,7 +1060,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(unsigned ID) { break; } - case pch::SM_SLOC_BUFFER_ENTRY: { + case SM_SLOC_BUFFER_ENTRY: { const char *Name = BlobStart; unsigned Offset = Record[0]; unsigned Code = SLocEntryCursor.ReadCode(); @@ -1067,7 +1068,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(unsigned ID) { unsigned RecCode = SLocEntryCursor.ReadRecord(Code, Record, &BlobStart, &BlobLen); - if (RecCode != pch::SM_SLOC_BUFFER_BLOB) { + if (RecCode != SM_SLOC_BUFFER_BLOB) { Error("AST record has invalid code"); return Failure; } @@ -1088,7 +1089,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(unsigned ID) { break; } - case pch::SM_SLOC_INSTANTIATION_ENTRY: { + case SM_SLOC_INSTANTIATION_ENTRY: { SourceLocation SpellingLoc = SourceLocation::getFromRawEncoding(Record[1]); SourceMgr.createInstantiationLoc(SpellingLoc, @@ -1159,11 +1160,11 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){ // Read a record. Record.clear(); - pch::PreprocessorRecordTypes RecType = - (pch::PreprocessorRecordTypes)Stream.ReadRecord(Code, Record); + PreprocessorRecordTypes RecType = + (PreprocessorRecordTypes)Stream.ReadRecord(Code, Record); switch (RecType) { - case pch::PP_MACRO_OBJECT_LIKE: - case pch::PP_MACRO_FUNCTION_LIKE: { + case PP_MACRO_OBJECT_LIKE: + case PP_MACRO_FUNCTION_LIKE: { // If we already have a macro, that means that we've hit the end // of the definition of the macro we were looking for. We're // done. @@ -1183,7 +1184,7 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){ MI->setIsFromAST(); unsigned NextIndex = 3; - if (RecType == pch::PP_MACRO_FUNCTION_LIKE) { + if (RecType == PP_MACRO_FUNCTION_LIKE) { // Decode function-like macro info. bool isC99VarArgs = Record[3]; bool isGNUVarArgs = Record[4]; @@ -1218,7 +1219,7 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){ break; } - case pch::PP_TOKEN: { + case PP_TOKEN: { // If we see a TOKEN before a PP_MACRO_*, then the file is // erroneous, just pretend we didn't see this. if (Macro == 0) break; @@ -1235,7 +1236,7 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){ break; } - case pch::PP_MACRO_INSTANTIATION: { + case PP_MACRO_INSTANTIATION: { // If we already have a macro, that means that we've hit the end // of the definition of the macro we were looking for. We're // done. @@ -1261,7 +1262,7 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){ return; } - case pch::PP_MACRO_DEFINITION: { + case PP_MACRO_DEFINITION: { // If we already have a macro, that means that we've hit the end // of the definition of the macro we were looking for. We're // done. @@ -1305,7 +1306,7 @@ void ASTReader::ReadDefinedMacros() { continue; llvm::BitstreamCursor Cursor = MacroCursor; - if (Cursor.EnterSubBlock(pch::PREPROCESSOR_BLOCK_ID)) { + if (Cursor.EnterSubBlock(PREPROCESSOR_BLOCK_ID)) { Error("malformed preprocessor block record in AST file"); return; } @@ -1344,17 +1345,17 @@ void ASTReader::ReadDefinedMacros() { default: // Default behavior: ignore. break; - case pch::PP_MACRO_OBJECT_LIKE: - case pch::PP_MACRO_FUNCTION_LIKE: + case PP_MACRO_OBJECT_LIKE: + case PP_MACRO_FUNCTION_LIKE: DecodeIdentifierInfo(Record[0]); break; - case pch::PP_TOKEN: + case PP_TOKEN: // Ignore tokens. break; - case pch::PP_MACRO_INSTANTIATION: - case pch::PP_MACRO_DEFINITION: + case PP_MACRO_INSTANTIATION: + case PP_MACRO_DEFINITION: // Read the macro record. ReadMacroRecord(Chain[N - I - 1]->Stream, Cursor.GetCurrentBitNo()); break; @@ -1363,7 +1364,7 @@ void ASTReader::ReadDefinedMacros() { } } -MacroDefinition *ASTReader::getMacroDefinition(pch::IdentID ID) { +MacroDefinition *ASTReader::getMacroDefinition(IdentID ID) { if (ID == 0 || ID >= MacroDefinitionsLoaded.size()) return 0; @@ -1411,7 +1412,7 @@ ASTReader::ASTReadResult ASTReader::ReadASTBlock(PerFileData &F) { llvm::BitstreamCursor &Stream = F.Stream; - if (Stream.EnterSubBlock(pch::AST_BLOCK_ID)) { + if (Stream.EnterSubBlock(AST_BLOCK_ID)) { Error("malformed block record in AST file"); return Failure; } @@ -1432,7 +1433,7 @@ ASTReader::ReadASTBlock(PerFileData &F) { if (Code == llvm::bitc::ENTER_SUBBLOCK) { switch (Stream.ReadSubBlockID()) { - case pch::DECLTYPES_BLOCK_ID: + case DECLTYPES_BLOCK_ID: // We lazily load the decls block, but we want to set up the // DeclsCursor cursor to point into it. Clone our current bitcode // cursor to it, enter the block and read the abbrevs in that block. @@ -1440,13 +1441,13 @@ ASTReader::ReadASTBlock(PerFileData &F) { F.DeclsCursor = Stream; if (Stream.SkipBlock() || // Skip with the main cursor. // Read the abbrevs. - ReadBlockAbbrevs(F.DeclsCursor, pch::DECLTYPES_BLOCK_ID)) { + ReadBlockAbbrevs(F.DeclsCursor, DECLTYPES_BLOCK_ID)) { Error("malformed block record in AST file"); return Failure; } break; - case pch::PREPROCESSOR_BLOCK_ID: + case PREPROCESSOR_BLOCK_ID: F.MacroCursor = Stream; if (PP) PP->setExternalSource(this); @@ -1457,7 +1458,7 @@ ASTReader::ReadASTBlock(PerFileData &F) { } break; - case pch::SOURCE_MANAGER_BLOCK_ID: + case SOURCE_MANAGER_BLOCK_ID: switch (ReadSourceManagerBlock(F)) { case Success: break; @@ -1484,14 +1485,14 @@ ASTReader::ReadASTBlock(PerFileData &F) { Record.clear(); const char *BlobStart = 0; unsigned BlobLen = 0; - switch ((pch::ASTRecordTypes)Stream.ReadRecord(Code, Record, + switch ((ASTRecordTypes)Stream.ReadRecord(Code, Record, &BlobStart, &BlobLen)) { default: // Default behavior: ignore. break; - case pch::METADATA: { - if (Record[0] != pch::VERSION_MAJOR && !DisableValidation) { - Diag(Record[0] < pch::VERSION_MAJOR? diag::warn_pch_version_too_old + case METADATA: { + if (Record[0] != VERSION_MAJOR && !DisableValidation) { + Diag(Record[0] < VERSION_MAJOR? diag::warn_pch_version_too_old : diag::warn_pch_version_too_new); return IgnorePCH; } @@ -1505,13 +1506,13 @@ ASTReader::ReadASTBlock(PerFileData &F) { break; } - case pch::CHAINED_METADATA: { + case CHAINED_METADATA: { if (!First) { Error("CHAINED_METADATA is not first record in block"); return Failure; } - if (Record[0] != pch::VERSION_MAJOR && !DisableValidation) { - Diag(Record[0] < pch::VERSION_MAJOR? diag::warn_pch_version_too_old + if (Record[0] != VERSION_MAJOR && !DisableValidation) { + Diag(Record[0] < VERSION_MAJOR? diag::warn_pch_version_too_old : diag::warn_pch_version_too_new); return IgnorePCH; } @@ -1526,7 +1527,7 @@ ASTReader::ReadASTBlock(PerFileData &F) { break; } - case pch::TYPE_OFFSET: + case TYPE_OFFSET: if (F.LocalNumTypes != 0) { Error("duplicate TYPE_OFFSET record in AST file"); return Failure; @@ -1535,7 +1536,7 @@ ASTReader::ReadASTBlock(PerFileData &F) { F.LocalNumTypes = Record[0]; break; - case pch::DECL_OFFSET: + case DECL_OFFSET: if (F.LocalNumDecls != 0) { Error("duplicate DECL_OFFSET record in AST file"); return Failure; @@ -1544,20 +1545,20 @@ ASTReader::ReadASTBlock(PerFileData &F) { F.LocalNumDecls = Record[0]; break; - case pch::TU_UPDATE_LEXICAL: { + case TU_UPDATE_LEXICAL: { DeclContextInfo Info = { /* No visible information */ 0, 0, - reinterpret_cast<const pch::DeclID *>(BlobStart), - BlobLen / sizeof(pch::DeclID) + reinterpret_cast<const DeclID *>(BlobStart), + BlobLen / sizeof(DeclID) }; DeclContextOffsets[Context->getTranslationUnitDecl()].push_back(Info); break; } - case pch::REDECLS_UPDATE_LATEST: { + case REDECLS_UPDATE_LATEST: { assert(Record.size() % 2 == 0 && "Expected pairs of DeclIDs"); for (unsigned i = 0, e = Record.size(); i < e; i += 2) { - pch::DeclID First = Record[i], Latest = Record[i+1]; + DeclID First = Record[i], Latest = Record[i+1]; assert((FirstLatestDeclIDs.find(First) == FirstLatestDeclIDs.end() || Latest > FirstLatestDeclIDs[First]) && "The new latest is supposed to come after the previous latest"); @@ -1566,12 +1567,12 @@ ASTReader::ReadASTBlock(PerFileData &F) { break; } - case pch::LANGUAGE_OPTIONS: + case LANGUAGE_OPTIONS: if (ParseLanguageOptions(Record) && !DisableValidation) return IgnorePCH; break; - case pch::IDENTIFIER_TABLE: + case IDENTIFIER_TABLE: F.IdentifierTableData = BlobStart; if (Record[0]) { F.IdentifierLookupTable @@ -1584,7 +1585,7 @@ ASTReader::ReadASTBlock(PerFileData &F) { } break; - case pch::IDENTIFIER_OFFSET: + case IDENTIFIER_OFFSET: if (F.LocalNumIdentifiers != 0) { Error("duplicate IDENTIFIER_OFFSET record in AST file"); return Failure; @@ -1593,7 +1594,7 @@ ASTReader::ReadASTBlock(PerFileData &F) { F.LocalNumIdentifiers = Record[0]; break; - case pch::EXTERNAL_DEFINITIONS: + case EXTERNAL_DEFINITIONS: // Optimization for the first block. if (ExternalDefinitions.empty()) ExternalDefinitions.swap(Record); @@ -1602,7 +1603,7 @@ ASTReader::ReadASTBlock(PerFileData &F) { Record.begin(), Record.end()); break; - case pch::SPECIAL_TYPES: + case SPECIAL_TYPES: // Optimization for the first block if (SpecialTypes.empty()) SpecialTypes.swap(Record); @@ -1610,14 +1611,14 @@ ASTReader::ReadASTBlock(PerFileData &F) { SpecialTypes.insert(SpecialTypes.end(), Record.begin(), Record.end()); break; - case pch::STATISTICS: + case STATISTICS: TotalNumStatements += Record[0]; TotalNumMacros += Record[1]; TotalLexicalDeclContexts += Record[2]; TotalVisibleDeclContexts += Record[3]; break; - case pch::TENTATIVE_DEFINITIONS: + case TENTATIVE_DEFINITIONS: // Optimization for the first block. if (TentativeDefinitions.empty()) TentativeDefinitions.swap(Record); @@ -1626,7 +1627,7 @@ ASTReader::ReadASTBlock(PerFileData &F) { Record.begin(), Record.end()); break; - case pch::UNUSED_FILESCOPED_DECLS: + case UNUSED_FILESCOPED_DECLS: // Optimization for the first block. if (UnusedFileScopedDecls.empty()) UnusedFileScopedDecls.swap(Record); @@ -1635,12 +1636,12 @@ ASTReader::ReadASTBlock(PerFileData &F) { Record.begin(), Record.end()); break; - case pch::WEAK_UNDECLARED_IDENTIFIERS: + case WEAK_UNDECLARED_IDENTIFIERS: // Later blocks overwrite earlier ones. WeakUndeclaredIdentifiers.swap(Record); break; - case pch::LOCALLY_SCOPED_EXTERNAL_DECLS: + case LOCALLY_SCOPED_EXTERNAL_DECLS: // Optimization for the first block. if (LocallyScopedExternalDecls.empty()) LocallyScopedExternalDecls.swap(Record); @@ -1649,12 +1650,12 @@ ASTReader::ReadASTBlock(PerFileData &F) { Record.begin(), Record.end()); break; - case pch::SELECTOR_OFFSETS: + case SELECTOR_OFFSETS: F.SelectorOffsets = (const uint32_t *)BlobStart; F.LocalNumSelectors = Record[0]; break; - case pch::METHOD_POOL: + case METHOD_POOL: F.SelectorLookupTableData = (const unsigned char *)BlobStart; if (Record[0]) F.SelectorLookupTable @@ -1665,18 +1666,18 @@ ASTReader::ReadASTBlock(PerFileData &F) { TotalNumMethodPoolEntries += Record[1]; break; - case pch::REFERENCED_SELECTOR_POOL: { + case REFERENCED_SELECTOR_POOL: { ReferencedSelectorsData.insert(ReferencedSelectorsData.end(), Record.begin(), Record.end()); break; } - case pch::PP_COUNTER_VALUE: + case PP_COUNTER_VALUE: if (!Record.empty() && Listener) Listener->ReadCounter(Record[0]); break; - case pch::SOURCE_LOCATION_OFFSETS: + case SOURCE_LOCATION_OFFSETS: F.SLocOffsets = (const uint32_t *)BlobStart; F.LocalNumSLocEntries = Record[0]; // We cannot delay this until the entire chain is loaded, because then @@ -1686,7 +1687,7 @@ ASTReader::ReadASTBlock(PerFileData &F) { SourceMgr.PreallocateSLocEntries(this, TotalNumSLocEntries, Record[1]); break; - case pch::SOURCE_LOCATION_PRELOADS: + case SOURCE_LOCATION_PRELOADS: for (unsigned I = 0, N = Record.size(); I != N; ++I) { ASTReadResult Result = ReadSLocEntryRecord(Record[I]); if (Result != Success) @@ -1694,7 +1695,7 @@ ASTReader::ReadASTBlock(PerFileData &F) { } break; - case pch::STAT_CACHE: { + case STAT_CACHE: { ASTStatCache *MyStatCache = new ASTStatCache((const unsigned char *)BlobStart + Record[0], (const unsigned char *)BlobStart, @@ -1704,7 +1705,7 @@ ASTReader::ReadASTBlock(PerFileData &F) { break; } - case pch::EXT_VECTOR_DECLS: + case EXT_VECTOR_DECLS: // Optimization for the first block. if (ExtVectorDecls.empty()) ExtVectorDecls.swap(Record); @@ -1713,12 +1714,12 @@ ASTReader::ReadASTBlock(PerFileData &F) { Record.begin(), Record.end()); break; - case pch::VTABLE_USES: + case VTABLE_USES: // Later tables overwrite earlier ones. VTableUses.swap(Record); break; - case pch::DYNAMIC_CLASSES: + case DYNAMIC_CLASSES: // Optimization for the first block. if (DynamicClasses.empty()) DynamicClasses.swap(Record); @@ -1727,7 +1728,7 @@ ASTReader::ReadASTBlock(PerFileData &F) { Record.begin(), Record.end()); break; - case pch::PENDING_IMPLICIT_INSTANTIATIONS: + case PENDING_IMPLICIT_INSTANTIATIONS: // Optimization for the first block. if (PendingImplicitInstantiations.empty()) PendingImplicitInstantiations.swap(Record); @@ -1736,12 +1737,12 @@ ASTReader::ReadASTBlock(PerFileData &F) { PendingImplicitInstantiations.end(), Record.begin(), Record.end()); break; - case pch::SEMA_DECL_REFS: + case SEMA_DECL_REFS: // Later tables overwrite earlier ones. SemaDeclRefs.swap(Record); break; - case pch::ORIGINAL_FILE_NAME: + case ORIGINAL_FILE_NAME: // The primary AST will be the last to get here, so it will be the one // that's used. ActualOriginalFileName.assign(BlobStart, BlobLen); @@ -1749,7 +1750,7 @@ ASTReader::ReadASTBlock(PerFileData &F) { MaybeAddSystemRootToFilename(OriginalFileName); break; - case pch::VERSION_CONTROL_BRANCH_REVISION: { + case VERSION_CONTROL_BRANCH_REVISION: { const std::string &CurBranch = getClangFullRepositoryVersion(); llvm::StringRef ASTBranch(BlobStart, BlobLen); if (llvm::StringRef(CurBranch) != ASTBranch && !DisableValidation) { @@ -1759,19 +1760,19 @@ ASTReader::ReadASTBlock(PerFileData &F) { break; } - case pch::MACRO_DEFINITION_OFFSETS: + case MACRO_DEFINITION_OFFSETS: F.MacroDefinitionOffsets = (const uint32_t *)BlobStart; F.NumPreallocatedPreprocessingEntities = Record[0]; F.LocalNumMacroDefinitions = Record[1]; break; - case pch::DECL_REPLACEMENTS: { + case DECL_REPLACEMENTS: { if (Record.size() % 2 != 0) { Error("invalid DECL_REPLACEMENTS block in AST file"); return Failure; } for (unsigned I = 0, N = Record.size(); I != N; I += 2) - ReplacedDecls[static_cast<pch::DeclID>(Record[I])] = + ReplacedDecls[static_cast<DeclID>(Record[I])] = std::make_pair(&F, Record[I+1]); break; } @@ -1923,7 +1924,7 @@ ASTReader::ASTReadResult ASTReader::ReadASTCore(llvm::StringRef FileName) { return Failure; } break; - case pch::AST_BLOCK_ID: + case AST_BLOCK_ID: switch (ReadASTBlock(F)) { case Success: break; @@ -1986,22 +1987,22 @@ void ASTReader::InitializeContext(ASTContext &Ctx) { // Load the special types. Context->setBuiltinVaListType( - GetType(SpecialTypes[pch::SPECIAL_TYPE_BUILTIN_VA_LIST])); - if (unsigned Id = SpecialTypes[pch::SPECIAL_TYPE_OBJC_ID]) + GetType(SpecialTypes[SPECIAL_TYPE_BUILTIN_VA_LIST])); + if (unsigned Id = SpecialTypes[SPECIAL_TYPE_OBJC_ID]) Context->setObjCIdType(GetType(Id)); - if (unsigned Sel = SpecialTypes[pch::SPECIAL_TYPE_OBJC_SELECTOR]) + if (unsigned Sel = SpecialTypes[SPECIAL_TYPE_OBJC_SELECTOR]) Context->setObjCSelType(GetType(Sel)); - if (unsigned Proto = SpecialTypes[pch::SPECIAL_TYPE_OBJC_PROTOCOL]) + if (unsigned Proto = SpecialTypes[SPECIAL_TYPE_OBJC_PROTOCOL]) Context->setObjCProtoType(GetType(Proto)); - if (unsigned Class = SpecialTypes[pch::SPECIAL_TYPE_OBJC_CLASS]) + if (unsigned Class = SpecialTypes[SPECIAL_TYPE_OBJC_CLASS]) Context->setObjCClassType(GetType(Class)); - if (unsigned String = SpecialTypes[pch::SPECIAL_TYPE_CF_CONSTANT_STRING]) + if (unsigned String = SpecialTypes[SPECIAL_TYPE_CF_CONSTANT_STRING]) Context->setCFConstantStringType(GetType(String)); if (unsigned FastEnum - = SpecialTypes[pch::SPECIAL_TYPE_OBJC_FAST_ENUMERATION_STATE]) + = SpecialTypes[SPECIAL_TYPE_OBJC_FAST_ENUMERATION_STATE]) Context->setObjCFastEnumerationStateType(GetType(FastEnum)); - if (unsigned File = SpecialTypes[pch::SPECIAL_TYPE_FILE]) { + if (unsigned File = SpecialTypes[SPECIAL_TYPE_FILE]) { QualType FileType = GetType(File); if (FileType.isNull()) { Error("FILE type is NULL"); @@ -2018,7 +2019,7 @@ void ASTReader::InitializeContext(ASTContext &Ctx) { Context->setFILEDecl(Tag->getDecl()); } } - if (unsigned Jmp_buf = SpecialTypes[pch::SPECIAL_TYPE_jmp_buf]) { + if (unsigned Jmp_buf = SpecialTypes[SPECIAL_TYPE_jmp_buf]) { QualType Jmp_bufType = GetType(Jmp_buf); if (Jmp_bufType.isNull()) { Error("jmp_bug type is NULL"); @@ -2035,7 +2036,7 @@ void ASTReader::InitializeContext(ASTContext &Ctx) { Context->setjmp_bufDecl(Tag->getDecl()); } } - if (unsigned Sigjmp_buf = SpecialTypes[pch::SPECIAL_TYPE_sigjmp_buf]) { + if (unsigned Sigjmp_buf = SpecialTypes[SPECIAL_TYPE_sigjmp_buf]) { QualType Sigjmp_bufType = GetType(Sigjmp_buf); if (Sigjmp_bufType.isNull()) { Error("sigjmp_buf type is NULL"); @@ -2050,23 +2051,23 @@ void ASTReader::InitializeContext(ASTContext &Ctx) { } } if (unsigned ObjCIdRedef - = SpecialTypes[pch::SPECIAL_TYPE_OBJC_ID_REDEFINITION]) + = SpecialTypes[SPECIAL_TYPE_OBJC_ID_REDEFINITION]) Context->ObjCIdRedefinitionType = GetType(ObjCIdRedef); if (unsigned ObjCClassRedef - = SpecialTypes[pch::SPECIAL_TYPE_OBJC_CLASS_REDEFINITION]) + = SpecialTypes[SPECIAL_TYPE_OBJC_CLASS_REDEFINITION]) Context->ObjCClassRedefinitionType = GetType(ObjCClassRedef); - if (unsigned String = SpecialTypes[pch::SPECIAL_TYPE_BLOCK_DESCRIPTOR]) + if (unsigned String = SpecialTypes[ |