Rename pch namespace to serialization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111478 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sebastian Redl 2010-08-18 23:57:32 +00:00
Родитель 05a0760532
Коммит 8538e8d43a
11 изменённых файлов: 722 добавлений и 713 удалений

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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.
///

Просмотреть файл

@ -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;
};
}

Просмотреть файл

@ -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; }

Просмотреть файл

@ -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

Просмотреть файл

@ -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[SPECIAL_TYPE_BLOCK_DESCRIPTOR])
Context->setBlockDescriptorType(GetType(String));
if (unsigned String
= SpecialTypes[pch::SPECIAL_TYPE_BLOCK_EXTENDED_DESCRIPTOR])
= SpecialTypes[SPECIAL_TYPE_BLOCK_EXTENDED_DESCRIPTOR])
Context->setBlockDescriptorExtendedType(GetType(String));
if (unsigned ObjCSelRedef
= SpecialTypes[pch::SPECIAL_TYPE_OBJC_SEL_REDEFINITION])
= SpecialTypes[SPECIAL_TYPE_OBJC_SEL_REDEFINITION])
Context->ObjCSelRedefinitionType = GetType(ObjCSelRedef);
if (unsigned String = SpecialTypes[pch::SPECIAL_TYPE_NS_CONSTANT_STRING])
if (unsigned String = SpecialTypes[SPECIAL_TYPE_NS_CONSTANT_STRING])
Context->setNSConstantStringType(GetType(String));
if (SpecialTypes[pch::SPECIAL_TYPE_INT128_INSTALLED])
if (SpecialTypes[SPECIAL_TYPE_INT128_INSTALLED])
Context->setInt128Installed();
}
@ -2109,8 +2110,8 @@ std::string ASTReader::getOriginalSourceFile(const std::string &ASTFileName,
// We only know the AST subblock ID.
switch (BlockID) {
case pch::AST_BLOCK_ID:
if (Stream.EnterSubBlock(pch::AST_BLOCK_ID)) {
case AST_BLOCK_ID:
if (Stream.EnterSubBlock(AST_BLOCK_ID)) {
Diags.Report(diag::err_fe_pch_malformed_block) << ASTFileName;
return std::string();
}
@ -2143,7 +2144,7 @@ std::string ASTReader::getOriginalSourceFile(const std::string &ASTFileName,
const char *BlobStart = 0;
unsigned BlobLen = 0;
if (Stream.ReadRecord(Code, Record, &BlobStart, &BlobLen)
== pch::ORIGINAL_FILE_NAME)
== ORIGINAL_FILE_NAME)
return std::string(BlobStart, BlobLen);
}
@ -2267,8 +2268,8 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
DeclsCursor.JumpToBit(Loc.second);
RecordData Record;
unsigned Code = DeclsCursor.ReadCode();
switch ((pch::TypeCode)DeclsCursor.ReadRecord(Code, Record)) {
case pch::TYPE_EXT_QUAL: {
switch ((TypeCode)DeclsCursor.ReadRecord(Code, Record)) {
case TYPE_EXT_QUAL: {
if (Record.size() != 2) {
Error("Incorrect encoding of extended qualifier type");
return QualType();
@ -2278,7 +2279,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getQualifiedType(Base, Quals);
}
case pch::TYPE_COMPLEX: {
case TYPE_COMPLEX: {
if (Record.size() != 1) {
Error("Incorrect encoding of complex type");
return QualType();
@ -2287,7 +2288,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getComplexType(ElemType);
}
case pch::TYPE_POINTER: {
case TYPE_POINTER: {
if (Record.size() != 1) {
Error("Incorrect encoding of pointer type");
return QualType();
@ -2296,7 +2297,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getPointerType(PointeeType);
}
case pch::TYPE_BLOCK_POINTER: {
case TYPE_BLOCK_POINTER: {
if (Record.size() != 1) {
Error("Incorrect encoding of block pointer type");
return QualType();
@ -2305,7 +2306,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getBlockPointerType(PointeeType);
}
case pch::TYPE_LVALUE_REFERENCE: {
case TYPE_LVALUE_REFERENCE: {
if (Record.size() != 1) {
Error("Incorrect encoding of lvalue reference type");
return QualType();
@ -2314,7 +2315,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getLValueReferenceType(PointeeType);
}
case pch::TYPE_RVALUE_REFERENCE: {
case TYPE_RVALUE_REFERENCE: {
if (Record.size() != 1) {
Error("Incorrect encoding of rvalue reference type");
return QualType();
@ -2323,7 +2324,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getRValueReferenceType(PointeeType);
}
case pch::TYPE_MEMBER_POINTER: {
case TYPE_MEMBER_POINTER: {
if (Record.size() != 2) {
Error("Incorrect encoding of member pointer type");
return QualType();
@ -2333,7 +2334,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getMemberPointerType(PointeeType, ClassType.getTypePtr());
}
case pch::TYPE_CONSTANT_ARRAY: {
case TYPE_CONSTANT_ARRAY: {
QualType ElementType = GetType(Record[0]);
ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1];
unsigned IndexTypeQuals = Record[2];
@ -2343,14 +2344,14 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
ASM, IndexTypeQuals);
}
case pch::TYPE_INCOMPLETE_ARRAY: {
case TYPE_INCOMPLETE_ARRAY: {
QualType ElementType = GetType(Record[0]);
ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1];
unsigned IndexTypeQuals = Record[2];
return Context->getIncompleteArrayType(ElementType, ASM, IndexTypeQuals);
}
case pch::TYPE_VARIABLE_ARRAY: {
case TYPE_VARIABLE_ARRAY: {
QualType ElementType = GetType(Record[0]);
ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1];
unsigned IndexTypeQuals = Record[2];
@ -2361,7 +2362,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
SourceRange(LBLoc, RBLoc));
}
case pch::TYPE_VECTOR: {
case TYPE_VECTOR: {
if (Record.size() != 3) {
Error("incorrect encoding of vector type in AST file");
return QualType();
@ -2374,7 +2375,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
(VectorType::AltiVecSpecific)AltiVecSpec);
}
case pch::TYPE_EXT_VECTOR: {
case TYPE_EXT_VECTOR: {
if (Record.size() != 3) {
Error("incorrect encoding of extended vector type in AST file");
return QualType();
@ -2385,7 +2386,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getExtVectorType(ElementType, NumElements);
}
case pch::TYPE_FUNCTION_NO_PROTO: {
case TYPE_FUNCTION_NO_PROTO: {
if (Record.size() != 4) {
Error("incorrect encoding of no-proto function type");
return QualType();
@ -2395,7 +2396,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getFunctionNoProtoType(ResultType, Info);
}
case pch::TYPE_FUNCTION_PROTO: {
case TYPE_FUNCTION_PROTO: {
QualType ResultType = GetType(Record[0]);
bool NoReturn = Record[1];
unsigned RegParm = Record[2];
@ -2421,11 +2422,11 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
CallConv));
}
case pch::TYPE_UNRESOLVED_USING:
case TYPE_UNRESOLVED_USING:
return Context->getTypeDeclType(
cast<UnresolvedUsingTypenameDecl>(GetDecl(Record[0])));
case pch::TYPE_TYPEDEF: {
case TYPE_TYPEDEF: {
if (Record.size() != 2) {
Error("incorrect encoding of typedef type");
return QualType();
@ -2435,10 +2436,10 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getTypedefType(Decl, Canonical);
}
case pch::TYPE_TYPEOF_EXPR:
case TYPE_TYPEOF_EXPR:
return Context->getTypeOfExprType(ReadExpr(DeclsCursor));
case pch::TYPE_TYPEOF: {
case TYPE_TYPEOF: {
if (Record.size() != 1) {
Error("incorrect encoding of typeof(type) in AST file");
return QualType();
@ -2447,10 +2448,10 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getTypeOfType(UnderlyingType);
}
case pch::TYPE_DECLTYPE:
case TYPE_DECLTYPE:
return Context->getDecltypeType(ReadExpr(DeclsCursor));
case pch::TYPE_RECORD: {
case TYPE_RECORD: {
if (Record.size() != 2) {
Error("incorrect encoding of record type");
return QualType();
@ -2461,7 +2462,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return T;
}
case pch::TYPE_ENUM: {
case TYPE_ENUM: {
if (Record.size() != 2) {
Error("incorrect encoding of enum type");
return QualType();
@ -2472,7 +2473,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return T;
}
case pch::TYPE_ELABORATED: {
case TYPE_ELABORATED: {
unsigned Idx = 0;
ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
NestedNameSpecifier *NNS = ReadNestedNameSpecifier(Record, Idx);
@ -2480,13 +2481,13 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getElaboratedType(Keyword, NNS, NamedType);
}
case pch::TYPE_OBJC_INTERFACE: {
case TYPE_OBJC_INTERFACE: {
unsigned Idx = 0;
ObjCInterfaceDecl *ItfD = cast<ObjCInterfaceDecl>(GetDecl(Record[Idx++]));
return Context->getObjCInterfaceType(ItfD);
}
case pch::TYPE_OBJC_OBJECT: {
case TYPE_OBJC_OBJECT: {
unsigned Idx = 0;
QualType Base = GetType(Record[Idx++]);
unsigned NumProtos = Record[Idx++];
@ -2496,13 +2497,13 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getObjCObjectType(Base, Protos.data(), NumProtos);
}
case pch::TYPE_OBJC_OBJECT_POINTER: {
case TYPE_OBJC_OBJECT_POINTER: {
unsigned Idx = 0;
QualType Pointee = GetType(Record[Idx++]);
return Context->getObjCObjectPointerType(Pointee);
}
case pch::TYPE_SUBST_TEMPLATE_TYPE_PARM: {
case TYPE_SUBST_TEMPLATE_TYPE_PARM: {
unsigned Idx = 0;
QualType Parm = GetType(Record[Idx++]);
QualType Replacement = GetType(Record[Idx++]);
@ -2511,7 +2512,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
Replacement);
}
case pch::TYPE_INJECTED_CLASS_NAME: {
case TYPE_INJECTED_CLASS_NAME: {
CXXRecordDecl *D = cast<CXXRecordDecl>(GetDecl(Record[0]));
QualType TST = GetType(Record[1]); // probably derivable
// FIXME: ASTContext::getInjectedClassNameType is not currently suitable
@ -2520,7 +2521,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
QualType(new (*Context, TypeAlignment) InjectedClassNameType(D, TST), 0);
}
case pch::TYPE_TEMPLATE_TYPE_PARM: {
case TYPE_TEMPLATE_TYPE_PARM: {
unsigned Idx = 0;
unsigned Depth = Record[Idx++];
unsigned Index = Record[Idx++];
@ -2529,7 +2530,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getTemplateTypeParmType(Depth, Index, Pack, Name);
}
case pch::TYPE_DEPENDENT_NAME: {
case TYPE_DEPENDENT_NAME: {
unsigned Idx = 0;
ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
NestedNameSpecifier *NNS = ReadNestedNameSpecifier(Record, Idx);
@ -2538,7 +2539,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
return Context->getDependentNameType(Keyword, NNS, Name, Canon);
}
case pch::TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION: {
case TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION: {
unsigned Idx = 0;
ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
NestedNameSpecifier *NNS = ReadNestedNameSpecifier(Record, Idx);
@ -2552,7 +2553,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
Args.size(), Args.data());
}
case pch::TYPE_DEPENDENT_SIZED_ARRAY: {
case TYPE_DEPENDENT_SIZED_ARRAY: {
unsigned Idx = 0;
// ArrayType
@ -2569,7 +2570,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
IndexTypeQuals, Brackets);
}
case pch::TYPE_TEMPLATE_SPECIALIZATION: {
case TYPE_TEMPLATE_SPECIALIZATION: {
unsigned Idx = 0;
bool IsDependent = Record[Idx++];
TemplateName Name = ReadTemplateName(Record, Idx);
@ -2787,54 +2788,54 @@ TypeSourceInfo *ASTReader::GetTypeSourceInfo(llvm::BitstreamCursor &DeclsCursor,
return TInfo;
}
QualType ASTReader::GetType(pch::TypeID ID) {
QualType ASTReader::GetType(TypeID ID) {
unsigned FastQuals = ID & Qualifiers::FastMask;
unsigned Index = ID >> Qualifiers::FastWidth;
if (Index < pch::NUM_PREDEF_TYPE_IDS) {
if (Index < NUM_PREDEF_TYPE_IDS) {
QualType T;
switch ((pch::PredefinedTypeIDs)Index) {
case pch::PREDEF_TYPE_NULL_ID: return QualType();
case pch::PREDEF_TYPE_VOID_ID: T = Context->VoidTy; break;
case pch::PREDEF_TYPE_BOOL_ID: T = Context->BoolTy; break;
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 pch::PREDEF_TYPE_CHAR_U_ID:
case pch::PREDEF_TYPE_CHAR_S_ID:
case PREDEF_TYPE_CHAR_U_ID:
case PREDEF_TYPE_CHAR_S_ID:
// FIXME: Check that the signedness of CharTy is correct!
T = Context->CharTy;
break;
case pch::PREDEF_TYPE_UCHAR_ID: T = Context->UnsignedCharTy; break;
case pch::PREDEF_TYPE_USHORT_ID: T = Context->UnsignedShortTy; break;
case pch::PREDEF_TYPE_UINT_ID: T = Context->UnsignedIntTy; break;
case pch::PREDEF_TYPE_ULONG_ID: T = Context->UnsignedLongTy; break;
case pch::PREDEF_TYPE_ULONGLONG_ID: T = Context->UnsignedLongLongTy; break;
case pch::PREDEF_TYPE_UINT128_ID: T = Context->UnsignedInt128Ty; break;
case pch::PREDEF_TYPE_SCHAR_ID: T = Context->SignedCharTy; break;
case pch::PREDEF_TYPE_WCHAR_ID: T = Context->WCharTy; break;
case pch::PREDEF_TYPE_SHORT_ID: T = Context->ShortTy; break;
case pch::PREDEF_TYPE_INT_ID: T = Context->IntTy; break;
case pch::PREDEF_TYPE_LONG_ID: T = Context->LongTy; break;
case pch::PREDEF_TYPE_LONGLONG_ID: T = Context->LongLongTy; break;
case pch::PREDEF_TYPE_INT128_ID: T = Context->Int128Ty; break;
case pch::PREDEF_TYPE_FLOAT_ID: T = Context->FloatTy; break;
case pch::PREDEF_TYPE_DOUBLE_ID: T = Context->DoubleTy; break;
case pch::PREDEF_TYPE_LONGDOUBLE_ID: T = Context->LongDoubleTy; break;
case pch::PREDEF_TYPE_OVERLOAD_ID: T = Context->OverloadTy; break;
case pch::PREDEF_TYPE_DEPENDENT_ID: T = Context->DependentTy; break;
case pch::PREDEF_TYPE_NULLPTR_ID: T = Context->NullPtrTy; break;
case pch::PREDEF_TYPE_CHAR16_ID: T = Context->Char16Ty; break;
case pch::PREDEF_TYPE_CHAR32_ID: T = Context->Char32Ty; break;
case pch::PREDEF_TYPE_OBJC_ID: T = Context->ObjCBuiltinIdTy; break;
case pch::PREDEF_TYPE_OBJC_CLASS: T = Context->ObjCBuiltinClassTy; break;
case pch::PREDEF_TYPE_OBJC_SEL: T = Context->ObjCBuiltinSelTy; 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_DEPENDENT_ID: T = Context->DependentTy; 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;
}
assert(!T.isNull() && "Unknown predefined type");
return T.withFastQualifiers(FastQuals);
}
Index -= pch::NUM_PREDEF_TYPE_IDS;
Index -= NUM_PREDEF_TYPE_IDS;
assert(Index < TypesLoaded.size() && "Type index out-of-range");
if (TypesLoaded[Index].isNull()) {
TypesLoaded[Index] = ReadTypeRecord(Index);
@ -2900,7 +2901,7 @@ TranslationUnitDecl *ASTReader::GetTranslationUnitDecl() {
return cast<TranslationUnitDecl>(DeclsLoaded[0]);
}
Decl *ASTReader::GetDecl(pch::DeclID ID) {
Decl *ASTReader::GetDecl(DeclID ID) {
if (ID == 0)
return 0;
@ -2954,7 +2955,7 @@ bool ASTReader::FindExternalLexicalDecls(const DeclContext *DC,
continue;
// Load all of the declaration IDs
for (const pch::DeclID *ID = I->LexicalDecls,
for (const DeclID *ID = I->LexicalDecls,
*IDE = ID + I->NumLexicalDecls;
ID != IDE; ++ID)
Decls.push_back(GetDecl(*ID));
@ -2992,7 +2993,7 @@ ASTReader::FindExternalVisibleDeclsByName(const DeclContext *DC,
RecordData Record;
unsigned Code = DeclsCursor.ReadCode();
unsigned RecCode = DeclsCursor.ReadRecord(Code, Record);
if (RecCode != pch::DECL_CONTEXT_VISIBLE) {
if (RecCode != DECL_CONTEXT_VISIBLE) {
Error("Expected visible block");
return DeclContext::lookup_result(DeclContext::lookup_iterator(),
DeclContext::lookup_iterator());

Просмотреть файл

@ -21,7 +21,7 @@
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
using namespace clang;
using namespace clang::serialization;
//===----------------------------------------------------------------------===//
// Declaration deserialization
@ -31,16 +31,16 @@ namespace clang {
class ASTDeclReader : public DeclVisitor<ASTDeclReader, void> {
ASTReader &Reader;
llvm::BitstreamCursor &Cursor;
const pch::DeclID ThisDeclID;
const DeclID ThisDeclID;
const ASTReader::RecordData &Record;
unsigned &Idx;
pch::TypeID TypeIDForTypeDecl;
TypeID TypeIDForTypeDecl;
uint64_t GetCurrentCursorOffset();
public:
ASTDeclReader(ASTReader &Reader, llvm::BitstreamCursor &Cursor,
pch::DeclID thisDeclID, const ASTReader::RecordData &Record,
DeclID thisDeclID, const ASTReader::RecordData &Record,
unsigned &Idx)
: Reader(Reader), Cursor(Cursor), ThisDeclID(thisDeclID), Record(Record),
Idx(Idx), TypeIDForTypeDecl(0) { }
@ -1103,7 +1103,7 @@ void ASTReader::ReadAttributes(llvm::BitstreamCursor &DeclsCursor,
RecordData Record;
unsigned Idx = 0;
unsigned RecCode = DeclsCursor.ReadRecord(Code, Record);
assert(RecCode == pch::DECL_ATTR && "Expected attribute record");
assert(RecCode == DECL_ATTR && "Expected attribute record");
(void)RecCode;
while (Idx < Record.size()) {
@ -1155,7 +1155,7 @@ static bool isConsumerInterestedIn(Decl *D) {
/// \brief Get the correct cursor and offset for loading a type.
ASTReader::RecordLocation
ASTReader::DeclCursorForIndex(unsigned Index, pch::DeclID ID) {
ASTReader::DeclCursorForIndex(unsigned Index, DeclID ID) {
// See if there's an override.
DeclReplacementMap::iterator It = ReplacedDecls.find(ID);
if (It != ReplacedDecls.end())
@ -1173,7 +1173,7 @@ ASTReader::DeclCursorForIndex(unsigned Index, pch::DeclID ID) {
}
/// \brief Read the declaration at the given offset from the AST file.
Decl *ASTReader::ReadDeclRecord(unsigned Index, pch::DeclID ID) {
Decl *ASTReader::ReadDeclRecord(unsigned Index, DeclID ID) {
RecordLocation Loc = DeclCursorForIndex(Index, ID);
llvm::BitstreamCursor &DeclsCursor = *Loc.first;
// Keep track of where we are in the stream, then jump back there
@ -1192,191 +1192,191 @@ Decl *ASTReader::ReadDeclRecord(unsigned Index, pch::DeclID ID) {
ASTDeclReader Reader(*this, DeclsCursor, ID, Record, Idx);
Decl *D = 0;
switch ((pch::DeclCode)DeclsCursor.ReadRecord(Code, Record)) {
case pch::DECL_ATTR:
case pch::DECL_CONTEXT_LEXICAL:
case pch::DECL_CONTEXT_VISIBLE:
switch ((DeclCode)DeclsCursor.ReadRecord(Code, Record)) {
case DECL_ATTR:
case DECL_CONTEXT_LEXICAL:
case DECL_CONTEXT_VISIBLE:
assert(false && "Record cannot be de-serialized with ReadDeclRecord");
break;
case pch::DECL_TRANSLATION_UNIT:
case DECL_TRANSLATION_UNIT:
assert(Index == 0 && "Translation unit must be at index 0");
D = Context->getTranslationUnitDecl();
break;
case pch::DECL_TYPEDEF:
case DECL_TYPEDEF:
D = TypedefDecl::Create(*Context, 0, SourceLocation(), 0, 0);
break;
case pch::DECL_ENUM:
case DECL_ENUM:
D = EnumDecl::Create(*Context, Decl::EmptyShell());
break;
case pch::DECL_RECORD:
case DECL_RECORD:
D = RecordDecl::Create(*Context, Decl::EmptyShell());
break;
case pch::DECL_ENUM_CONSTANT:
case DECL_ENUM_CONSTANT:
D = EnumConstantDecl::Create(*Context, 0, SourceLocation(), 0, QualType(),
0, llvm::APSInt());
break;
case pch::DECL_FUNCTION:
case DECL_FUNCTION:
D = FunctionDecl::Create(*Context, 0, SourceLocation(), DeclarationName(),
QualType(), 0);
break;
case pch::DECL_LINKAGE_SPEC:
case DECL_LINKAGE_SPEC:
D = LinkageSpecDecl::Create(*Context, 0, SourceLocation(),
(LinkageSpecDecl::LanguageIDs)0,
false);
break;
case pch::DECL_NAMESPACE:
case DECL_NAMESPACE:
D = NamespaceDecl::Create(*Context, 0, SourceLocation(), 0);
break;
case pch::DECL_NAMESPACE_ALIAS:
case DECL_NAMESPACE_ALIAS:
D = NamespaceAliasDecl::Create(*Context, 0, SourceLocation(),
SourceLocation(), 0, SourceRange(), 0,
SourceLocation(), 0);
break;
case pch::DECL_USING:
case DECL_USING:
D = UsingDecl::Create(*Context, 0, SourceRange(), SourceLocation(),
0, DeclarationNameInfo(), false);
break;
case pch::DECL_USING_SHADOW:
case DECL_USING_SHADOW:
D = UsingShadowDecl::Create(*Context, 0, SourceLocation(), 0, 0);
break;
case pch::DECL_USING_DIRECTIVE:
case DECL_USING_DIRECTIVE:
D = UsingDirectiveDecl::Create(*Context, 0, SourceLocation(),
SourceLocation(), SourceRange(), 0,
SourceLocation(), 0, 0);
break;
case pch::DECL_UNRESOLVED_USING_VALUE:
case DECL_UNRESOLVED_USING_VALUE:
D = UnresolvedUsingValueDecl::Create(*Context, 0, SourceLocation(),
SourceRange(), 0,
DeclarationNameInfo());
break;
case pch::DECL_UNRESOLVED_USING_TYPENAME:
case DECL_UNRESOLVED_USING_TYPENAME:
D = UnresolvedUsingTypenameDecl::Create(*Context, 0, SourceLocation(),
SourceLocation(), SourceRange(),
0, SourceLocation(),
DeclarationName());
break;
case pch::DECL_CXX_RECORD:
case DECL_CXX_RECORD:
D = CXXRecordDecl::Create(*Context, Decl::EmptyShell());
break;
case pch::DECL_CXX_METHOD:
case DECL_CXX_METHOD:
D = CXXMethodDecl::Create(*Context, 0, DeclarationNameInfo(),
QualType(), 0);
break;
case pch::DECL_CXX_CONSTRUCTOR:
case DECL_CXX_CONSTRUCTOR:
D = CXXConstructorDecl::Create(*Context, Decl::EmptyShell());
break;
case pch::DECL_CXX_DESTRUCTOR:
case DECL_CXX_DESTRUCTOR:
D = CXXDestructorDecl::Create(*Context, Decl::EmptyShell());
break;
case pch::DECL_CXX_CONVERSION:
case DECL_CXX_CONVERSION:
D = CXXConversionDecl::Create(*Context, Decl::EmptyShell());
break;
case pch::DECL_ACCESS_SPEC:
case DECL_ACCESS_SPEC:
D = AccessSpecDecl::Create(*Context, AS_none, 0, SourceLocation(),
SourceLocation());
break;
case pch::DECL_FRIEND:
case DECL_FRIEND:
D = FriendDecl::Create(*Context, Decl::EmptyShell());
break;
case pch::DECL_FRIEND_TEMPLATE:
case DECL_FRIEND_TEMPLATE:
D = FriendTemplateDecl::Create(*Context, Decl::EmptyShell());
break;
case pch::DECL_CLASS_TEMPLATE:
case DECL_CLASS_TEMPLATE:
D = ClassTemplateDecl::Create(*Context, 0, SourceLocation(),
DeclarationName(), 0, 0, 0);
break;
case pch::DECL_CLASS_TEMPLATE_SPECIALIZATION:
case DECL_CLASS_TEMPLATE_SPECIALIZATION:
D = ClassTemplateSpecializationDecl::Create(*Context, Decl::EmptyShell());
break;
case pch::DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION:
case DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION:
D = ClassTemplatePartialSpecializationDecl::Create(*Context,
Decl::EmptyShell());
break;
case pch::DECL_FUNCTION_TEMPLATE:
case DECL_FUNCTION_TEMPLATE:
D = FunctionTemplateDecl::Create(*Context, 0, SourceLocation(),
DeclarationName(), 0, 0);
break;
case pch::DECL_TEMPLATE_TYPE_PARM:
case DECL_TEMPLATE_TYPE_PARM:
D = TemplateTypeParmDecl::Create(*Context, Decl::EmptyShell());
break;
case pch::DECL_NON_TYPE_TEMPLATE_PARM:
case DECL_NON_TYPE_TEMPLATE_PARM:
D = NonTypeTemplateParmDecl::Create(*Context, 0, SourceLocation(), 0,0,0,
QualType(),0);
break;
case pch::DECL_TEMPLATE_TEMPLATE_PARM:
case DECL_TEMPLATE_TEMPLATE_PARM:
D = TemplateTemplateParmDecl::Create(*Context, 0, SourceLocation(),0,0,0,0);
break;
case pch::DECL_STATIC_ASSERT:
case DECL_STATIC_ASSERT:
D = StaticAssertDecl::Create(*Context, 0, SourceLocation(), 0, 0);
break;
case pch::DECL_OBJC_METHOD:
case DECL_OBJC_METHOD:
D = ObjCMethodDecl::Create(*Context, SourceLocation(), SourceLocation(),
Selector(), QualType(), 0, 0);
break;
case pch::DECL_OBJC_INTERFACE:
case DECL_OBJC_INTERFACE:
D = ObjCInterfaceDecl::Create(*Context, 0, SourceLocation(), 0);
break;
case pch::DECL_OBJC_IVAR:
case DECL_OBJC_IVAR:
D = ObjCIvarDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0,
ObjCIvarDecl::None);
break;
case pch::DECL_OBJC_PROTOCOL:
case DECL_OBJC_PROTOCOL:
D = ObjCProtocolDecl::Create(*Context, 0, SourceLocation(), 0);
break;
case pch::DECL_OBJC_AT_DEFS_FIELD:
case DECL_OBJC_AT_DEFS_FIELD:
D = ObjCAtDefsFieldDecl::Create(*Context, 0, SourceLocation(), 0,
QualType(), 0);
break;
case pch::DECL_OBJC_CLASS:
case DECL_OBJC_CLASS:
D = ObjCClassDecl::Create(*Context, 0, SourceLocation());
break;
case pch::DECL_OBJC_FORWARD_PROTOCOL:
case DECL_OBJC_FORWARD_PROTOCOL:
D = ObjCForwardProtocolDecl::Create(*Context, 0, SourceLocation());
break;
case pch::DECL_OBJC_CATEGORY:
case DECL_OBJC_CATEGORY:
D = ObjCCategoryDecl::Create(*Context, 0, SourceLocation(),
SourceLocation(), SourceLocation(), 0);
break;
case pch::DECL_OBJC_CATEGORY_IMPL:
case DECL_OBJC_CATEGORY_IMPL:
D = ObjCCategoryImplDecl::Create(*Context, 0, SourceLocation(), 0, 0);
break;
case pch::DECL_OBJC_IMPLEMENTATION:
case DECL_OBJC_IMPLEMENTATION:
D = ObjCImplementationDecl::Create(*Context, 0, SourceLocation(), 0, 0);
break;
case pch::DECL_OBJC_COMPATIBLE_ALIAS:
case DECL_OBJC_COMPATIBLE_ALIAS:
D = ObjCCompatibleAliasDecl::Create(*Context, 0, SourceLocation(), 0, 0);
break;
case pch::DECL_OBJC_PROPERTY:
case DECL_OBJC_PROPERTY:
D = ObjCPropertyDecl::Create(*Context, 0, SourceLocation(), 0, SourceLocation(),
0);
break;
case pch::DECL_OBJC_PROPERTY_IMPL:
case DECL_OBJC_PROPERTY_IMPL:
D = ObjCPropertyImplDecl::Create(*Context, 0, SourceLocation(),
SourceLocation(), 0,
ObjCPropertyImplDecl::Dynamic, 0);
break;
case pch::DECL_FIELD:
case DECL_FIELD:
D = FieldDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0, 0,
false);
break;
case pch::DECL_VAR:
case DECL_VAR:
D = VarDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0,
VarDecl::None, VarDecl::None);
break;
case pch::DECL_IMPLICIT_PARAM:
case DECL_IMPLICIT_PARAM:
D = ImplicitParamDecl::Create(*Context, 0, SourceLocation(), 0, QualType());
break;
case pch::DECL_PARM_VAR:
case DECL_PARM_VAR:
D = ParmVarDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0,
VarDecl::None, VarDecl::None, 0);
break;
case pch::DECL_FILE_SCOPE_ASM:
case DECL_FILE_SCOPE_ASM:
D = FileScopeAsmDecl::Create(*Context, 0, SourceLocation(), 0);
break;
case pch::DECL_BLOCK:
case DECL_BLOCK:
D = BlockDecl::Create(*Context, 0, SourceLocation());
break;
}
@ -1427,13 +1427,13 @@ bool ASTReader::ReadDeclContextStorage(llvm::BitstreamCursor &Cursor,
unsigned BlobLen;
unsigned Code = Cursor.ReadCode();
unsigned RecCode = Cursor.ReadRecord(Code, Record, &Blob, &BlobLen);
if (RecCode != pch::DECL_CONTEXT_LEXICAL) {
if (RecCode != DECL_CONTEXT_LEXICAL) {
Error("Expected lexical block");
return true;
}
Info.LexicalDecls = reinterpret_cast<const pch::DeclID*>(Blob);
Info.NumLexicalDecls = BlobLen / sizeof(pch::DeclID);
Info.LexicalDecls = reinterpret_cast<const DeclID*>(Blob);
Info.NumLexicalDecls = BlobLen / sizeof(DeclID);
} else {
Info.LexicalDecls = 0;
Info.NumLexicalDecls = 0;

Просмотреть файл

@ -16,6 +16,7 @@
#include "clang/AST/DeclCXX.h"
#include "clang/AST/StmtVisitor.h"
using namespace clang;
using namespace clang::serialization;
namespace clang {
@ -653,8 +654,8 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
llvm::SmallVector<Designator, 4> Designators;
while (Idx < Record.size()) {
switch ((pch::DesignatorTypes)Record[Idx++]) {
case pch::DESIG_FIELD_DECL: {
switch ((DesignatorTypes)Record[Idx++]) {
case DESIG_FIELD_DECL: {
FieldDecl *Field = cast<FieldDecl>(Reader.GetDecl(Record[Idx++]));
SourceLocation DotLoc
= SourceLocation::getFromRawEncoding(Record[Idx++]);
@ -666,7 +667,7 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
break;
}
case pch::DESIG_FIELD_NAME: {
case DESIG_FIELD_NAME: {
const IdentifierInfo *Name = Reader.GetIdentifierInfo(Record, Idx);
SourceLocation DotLoc
= SourceLocation::getFromRawEncoding(Record[Idx++]);
@ -676,7 +677,7 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
break;
}
case pch::DESIG_ARRAY: {
case DESIG_ARRAY: {
unsigned Index = Record[Idx++];
SourceLocation LBracketLoc
= SourceLocation::getFromRawEncoding(Record[Idx++]);
@ -686,7 +687,7 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
break;
}
case pch::DESIG_ARRAY_RANGE: {
case DESIG_ARRAY_RANGE: {
unsigned Index = Record[Idx++];
SourceLocation LBracketLoc
= SourceLocation::getFromRawEncoding(Record[Idx++]);
@ -1312,145 +1313,145 @@ Stmt *ASTReader::ReadStmtFromStream(llvm::BitstreamCursor &Cursor) {
Idx = 0;
Record.clear();
bool Finished = false;
switch ((pch::StmtCode)Cursor.ReadRecord(Code, Record)) {
case pch::STMT_STOP:
switch ((StmtCode)Cursor.ReadRecord(Code, Record)) {
case STMT_STOP:
Finished = true;
break;
case pch::STMT_NULL_PTR:
case STMT_NULL_PTR:
S = 0;
break;
case pch::STMT_NULL:
case STMT_NULL:
S = new (Context) NullStmt(Empty);
break;
case pch::STMT_COMPOUND:
case STMT_COMPOUND:
S = new (Context) CompoundStmt(Empty);
break;
case pch::STMT_CASE:
case STMT_CASE:
S = new (Context) CaseStmt(Empty);
break;
case pch::STMT_DEFAULT:
case STMT_DEFAULT:
S = new (Context) DefaultStmt(Empty);
break;
case pch::STMT_LABEL:
case STMT_LABEL:
S = new (Context) LabelStmt(Empty);
break;
case pch::STMT_IF:
case STMT_IF:
S = new (Context) IfStmt(Empty);
break;
case pch::STMT_SWITCH:
case STMT_SWITCH:
S = new (Context) SwitchStmt(Empty);
break;
case pch::STMT_WHILE:
case STMT_WHILE:
S = new (Context) WhileStmt(Empty);
break;
case pch::STMT_DO:
case STMT_DO:
S = new (Context) DoStmt(Empty);
break;
case pch::STMT_FOR:
case STMT_FOR:
S = new (Context) ForStmt(Empty);
break;
case pch::STMT_GOTO:
case STMT_GOTO:
S = new (Context) GotoStmt(Empty);
break;
case pch::STMT_INDIRECT_GOTO:
case STMT_INDIRECT_GOTO:
S = new (Context) IndirectGotoStmt(Empty);
break;
case pch::STMT_CONTINUE:
case STMT_CONTINUE:
S = new (Context) ContinueStmt(Empty);
break;
case pch::STMT_BREAK:
case STMT_BREAK:
S = new (Context) BreakStmt(Empty);
break;
case pch::STMT_RETURN:
case STMT_RETURN:
S = new (Context) ReturnStmt(Empty);
break;
case pch::STMT_DECL:
case STMT_DECL:
S = new (Context) DeclStmt(Empty);
break;
case pch::STMT_ASM:
case STMT_ASM:
S = new (Context) AsmStmt(Empty);
break;
case pch::EXPR_PREDEFINED:
case EXPR_PREDEFINED:
S = new (Context) PredefinedExpr(Empty);
break;
case pch::EXPR_DECL_REF:
case EXPR_DECL_REF:
S = DeclRefExpr::CreateEmpty(*Context,
/*HasQualifier=*/Record[ASTStmtReader::NumExprFields],
/*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields + 1]);
break;
case pch::EXPR_INTEGER_LITERAL:
case EXPR_INTEGER_LITERAL:
S = new (Context) IntegerLiteral(Empty);
break;
case pch::EXPR_FLOATING_LITERAL:
case EXPR_FLOATING_LITERAL:
S = new (Context) FloatingLiteral(Empty);
break;
case pch::EXPR_IMAGINARY_LITERAL:
case EXPR_IMAGINARY_LITERAL:
S = new (Context) ImaginaryLiteral(Empty);
break;
case pch::EXPR_STRING_LITERAL:
case EXPR_STRING_LITERAL:
S = StringLiteral::CreateEmpty(*Context,
Record[ASTStmtReader::NumExprFields + 1]);
break;
case pch::EXPR_CHARACTER_LITERAL:
case EXPR_CHARACTER_LITERAL:
S = new (Context) CharacterLiteral(Empty);
break;
case pch::EXPR_PAREN:
case EXPR_PAREN:
S = new (Context) ParenExpr(Empty);
break;
case pch::EXPR_PAREN_LIST:
case EXPR_PAREN_LIST:
S = new (Context) ParenListExpr(Empty);
break;
case pch::EXPR_UNARY_OPERATOR:
case EXPR_UNARY_OPERATOR:
S = new (Context) UnaryOperator(Empty);
break;
case pch::EXPR_OFFSETOF:
case EXPR_OFFSETOF:
S = OffsetOfExpr::CreateEmpty(*Context,
Record[ASTStmtReader::NumExprFields],
Record[ASTStmtReader::NumExprFields + 1]);
break;
case pch::EXPR_SIZEOF_ALIGN_OF:
case EXPR_SIZEOF_ALIGN_OF:
S = new (Context) SizeOfAlignOfExpr(Empty);
break;
case pch::EXPR_ARRAY_SUBSCRIPT:
case EXPR_ARRAY_SUBSCRIPT:
S = new (Context) ArraySubscriptExpr(Empty);
break;
case pch::EXPR_CALL:
case EXPR_CALL:
S = new (Context) CallExpr(*Context, Stmt::CallExprClass, Empty);
break;
case pch::EXPR_MEMBER: {
case EXPR_MEMBER: {
// We load everything here and fully initialize it at creation.
// That way we can use MemberExpr::Create and don't have to duplicate its
// logic with a MemberExpr::CreateEmpty.
@ -1490,207 +1491,207 @@ Stmt *ASTReader::ReadStmtFromStream(llvm::BitstreamCursor &Cursor) {
break;
}
case pch::EXPR_BINARY_OPERATOR:
case EXPR_BINARY_OPERATOR:
S = new (Context) BinaryOperator(Empty);
break;
case pch::EXPR_COMPOUND_ASSIGN_OPERATOR:
case EXPR_COMPOUND_ASSIGN_OPERATOR:
S = new (Context) CompoundAssignOperator(Empty);
break;
case pch::EXPR_CONDITIONAL_OPERATOR:
case EXPR_CONDITIONAL_OPERATOR:
S = new (Context) ConditionalOperator(Empty);
break;
case pch::EXPR_IMPLICIT_CAST:
case EXPR_IMPLICIT_CAST:
S = ImplicitCastExpr::CreateEmpty(*Context,
/*PathSize*/ Record[ASTStmtReader::NumExprFields]);
break;
case pch::EXPR_CSTYLE_CAST:
case EXPR_CSTYLE_CAST:
S = CStyleCastExpr::CreateEmpty(*Context,
/*PathSize*/ Record[ASTStmtReader::NumExprFields]);
break;
case pch::EXPR_COMPOUND_LITERAL:
case EXPR_COMPOUND_LITERAL:
S = new (Context) CompoundLiteralExpr(Empty);
break;
case pch::EXPR_EXT_VECTOR_ELEMENT:
case EXPR_EXT_VECTOR_ELEMENT:
S = new (Context) ExtVectorElementExpr(Empty);
break;
case pch::EXPR_INIT_LIST:
case EXPR_INIT_LIST:
S = new (Context) InitListExpr(*getContext(), Empty);
break;
case pch::EXPR_DESIGNATED_INIT:
case EXPR_DESIGNATED_INIT:
S = DesignatedInitExpr::CreateEmpty(*Context,
Record[ASTStmtReader::NumExprFields] - 1);
break;
case pch::EXPR_IMPLICIT_VALUE_INIT:
case EXPR_IMPLICIT_VALUE_INIT:
S = new (Context) ImplicitValueInitExpr(Empty);
break;
case pch::EXPR_VA_ARG:
case EXPR_VA_ARG:
S = new (Context) VAArgExpr(Empty);
break;
case pch::EXPR_ADDR_LABEL:
case EXPR_ADDR_LABEL:
S = new (Context) AddrLabelExpr(Empty);
break;
case pch::EXPR_STMT:
case EXPR_STMT:
S = new (Context) StmtExpr(Empty);
break;
case pch::EXPR_TYPES_COMPATIBLE:
case EXPR_TYPES_COMPATIBLE:
S = new (Context) TypesCompatibleExpr(Empty);
break;
case pch::EXPR_CHOOSE:
case EXPR_CHOOSE:
S = new (Context) ChooseExpr(Empty);
break;
case pch::EXPR_GNU_NULL:
case EXPR_GNU_NULL:
S = new (Context) GNUNullExpr(Empty);
break;
case pch::EXPR_SHUFFLE_VECTOR:
case EXPR_SHUFFLE_VECTOR:
S = new (Context) ShuffleVectorExpr(Empty);
break;
case pch::EXPR_BLOCK:
case EXPR_BLOCK:
S = new (Context) BlockExpr(Empty);
break;
case pch::EXPR_BLOCK_DECL_REF:
case EXPR_BLOCK_DECL_REF:
S = new (Context) BlockDeclRefExpr(Empty);
break;
case pch::EXPR_OBJC_STRING_LITERAL:
case EXPR_OBJC_STRING_LITERAL:
S = new (Context) ObjCStringLiteral(Empty);
break;
case pch::EXPR_OBJC_ENCODE:
case EXPR_OBJC_ENCODE:
S = new (Context) ObjCEncodeExpr(Empty);
break;
case pch::EXPR_OBJC_SELECTOR_EXPR:
case EXPR_OBJC_SELECTOR_EXPR:
S = new (Context) ObjCSelectorExpr(Empty);
break;
case pch::EXPR_OBJC_PROTOCOL_EXPR:
case EXPR_OBJC_PROTOCOL_EXPR:
S = new (Context) ObjCProtocolExpr(Empty);
break;
case pch::EXPR_OBJC_IVAR_REF_EXPR:
case EXPR_OBJC_IVAR_REF_EXPR:
S = new (Context) ObjCIvarRefExpr(Empty);
break;
case pch::EXPR_OBJC_PROPERTY_REF_EXPR:
case EXPR_OBJC_PROPERTY_REF_EXPR:
S = new (Context) ObjCPropertyRefExpr(Empty);
break;
case pch::EXPR_OBJC_KVC_REF_EXPR:
case EXPR_OBJC_KVC_REF_EXPR:
S = new (Context) ObjCImplicitSetterGetterRefExpr(Empty);
break;
case pch::EXPR_OBJC_MESSAGE_EXPR:
case EXPR_OBJC_MESSAGE_EXPR:
S = ObjCMessageExpr::CreateEmpty(*Context,
Record[ASTStmtReader::NumExprFields]);
break;
case pch::EXPR_OBJC_SUPER_EXPR:
case EXPR_OBJC_SUPER_EXPR:
S = new (Context) ObjCSuperExpr(Empty);
break;
case pch::EXPR_OBJC_ISA:
case EXPR_OBJC_ISA:
S = new (Context) ObjCIsaExpr(Empty);
break;
case pch::STMT_OBJC_FOR_COLLECTION:
case STMT_OBJC_FOR_COLLECTION:
S = new (Context) ObjCForCollectionStmt(Empty);
break;
case pch::STMT_OBJC_CATCH:
case STMT_OBJC_CATCH:
S = new (Context) ObjCAtCatchStmt(Empty);
break;
case pch::STMT_OBJC_FINALLY:
case STMT_OBJC_FINALLY:
S = new (Context) ObjCAtFinallyStmt(Empty);
break;
case pch::STMT_OBJC_AT_TRY:
case STMT_OBJC_AT_TRY:
S = ObjCAtTryStmt::CreateEmpty(*Context,
Record[ASTStmtReader::NumStmtFields],
Record[ASTStmtReader::NumStmtFields + 1]);
break;
case pch::STMT_OBJC_AT_SYNCHRONIZED:
case STMT_OBJC_AT_SYNCHRONIZED:
S = new (Context) ObjCAtSynchronizedStmt(Empty);
break;
case pch::STMT_OBJC_AT_THROW:
case STMT_OBJC_AT_THROW:
S = new (Context) ObjCAtThrowStmt(Empty);
break;
case pch::STMT_CXX_CATCH:
case STMT_CXX_CATCH:
S = new (Context) CXXCatchStmt(Empty);
break;
case pch::STMT_CXX_TRY:
case STMT_CXX_TRY:
S = CXXTryStmt::Create(*Context, Empty,
/*NumHandlers=*/Record[ASTStmtReader::NumStmtFields]);
break;
case pch::EXPR_CXX_OPERATOR_CALL:
case EXPR_CXX_OPERATOR_CALL:
S = new (Context) CXXOperatorCallExpr(*Context, Empty);
break;
case pch::EXPR_CXX_MEMBER_CALL:
case EXPR_CXX_MEMBER_CALL:
S = new (Context) CXXMemberCallExpr(*Context, Empty);
break;
case pch::EXPR_CXX_CONSTRUCT:
case EXPR_CXX_CONSTRUCT:
S = new (Context) CXXConstructExpr(Empty);
break;
case pch::EXPR_CXX_TEMPORARY_OBJECT:
case EXPR_CXX_TEMPORARY_OBJECT:
S = new (Context) CXXTemporaryObjectExpr(Empty);
break;
case pch::EXPR_CXX_STATIC_CAST:
case EXPR_CXX_STATIC_CAST:
S = CXXStaticCastExpr::CreateEmpty(*Context,
/*PathSize*/ Record[ASTStmtReader::NumExprFields]);
break;
case pch::EXPR_CXX_DYNAMIC_CAST:
case EXPR_CXX_DYNAMIC_CAST:
S = CXXDynamicCastExpr::CreateEmpty(*Context,
/*PathSize*/ Record[ASTStmtReader::NumExprFields]);
break;
case pch::EXPR_CXX_REINTERPRET_CAST:
case EXPR_CXX_REINTERPRET_CAST:
S = CXXReinterpretCastExpr::CreateEmpty(*Context,
/*PathSize*/ Record[ASTStmtReader::NumExprFields]);
break;
case pch::EXPR_CXX_CONST_CAST:
case EXPR_CXX_CONST_CAST:
S = CXXConstCastExpr::CreateEmpty(*Context);
break;
case pch::EXPR_CXX_FUNCTIONAL_CAST:
case EXPR_CXX_FUNCTIONAL_CAST:
S = CXXFunctionalCastExpr::CreateEmpty(*Context,
/*PathSize*/ Record[ASTStmtReader::NumExprFields]);
break;
case pch::EXPR_CXX_BOOL_LITERAL:
case EXPR_CXX_BOOL_LITERAL:
S = new (Context) CXXBoolLiteralExpr(Empty);
break;
case pch::EXPR_CXX_NULL_PTR_LITERAL:
case EXPR_CXX_NULL_PTR_LITERAL:
S = new (Context) CXXNullPtrLiteralExpr(Empty);
break;
case pch::EXPR_CXX_TYPEID_EXPR:
case EXPR_CXX_TYPEID_EXPR:
S = new (Context) CXXTypeidExpr(Empty, true);
break;
case pch::EXPR_CXX_TYPEID_TYPE:
case EXPR_CXX_TYPEID_TYPE:
S = new (Context) CXXTypeidExpr(Empty, false);
break;
case pch::EXPR_CXX_THIS:
case EXPR_CXX_THIS:
S = new (Context) CXXThisExpr(Empty);
break;
case pch::EXPR_CXX_THROW:
case EXPR_CXX_THROW:
S = new (Context) CXXThrowExpr(Empty);
break;
case pch::EXPR_CXX_DEFAULT_ARG: {
case EXPR_CXX_DEFAULT_ARG: {
bool HasOtherExprStored = Record[ASTStmtReader::NumExprFields];
if (HasOtherExprStored) {
Expr *SubExpr = ReadSubExpr();
@ -1699,56 +1700,56 @@ Stmt *ASTReader::ReadStmtFromStream(llvm::BitstreamCursor &Cursor) {
S = new (Context) CXXDefaultArgExpr(Empty);
break;
}
case pch::EXPR_CXX_BIND_TEMPORARY:
case EXPR_CXX_BIND_TEMPORARY:
S = new (Context) CXXBindTemporaryExpr(Empty);
break;
case pch::EXPR_CXX_BIND_REFERENCE:
case EXPR_CXX_BIND_REFERENCE:
S = new (Context) CXXBindReferenceExpr(Empty);
break;
case pch::EXPR_CXX_SCALAR_VALUE_INIT:
case EXPR_CXX_SCALAR_VALUE_INIT:
S = new (Context) CXXScalarValueInitExpr(Empty);
break;
case pch::EXPR_CXX_NEW:
case EXPR_CXX_NEW:
S = new (Context) CXXNewExpr(Empty);
break;
case pch::EXPR_CXX_DELETE:
case EXPR_CXX_DELETE:
S = new (Context) CXXDeleteExpr(Empty);
break;
case pch::EXPR_CXX_PSEUDO_DESTRUCTOR:
case EXPR_CXX_PSEUDO_DESTRUCTOR:
S = new (Context) CXXPseudoDestructorExpr(Empty);
break;
case pch::EXPR_CXX_EXPR_WITH_TEMPORARIES:
case EXPR_CXX_EXPR_WITH_TEMPORARIES:
S = new (Context) CXXExprWithTemporaries(Empty);
break;
case pch::EXPR_CXX_DEPENDENT_SCOPE_MEMBER:
case EXPR_CXX_DEPENDENT_SCOPE_MEMBER:
S = CXXDependentScopeMemberExpr::CreateEmpty(*Context,
/*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]);
break;
case pch::EXPR_CXX_DEPENDENT_SCOPE_DECL_REF:
case EXPR_CXX_DEPENDENT_SCOPE_DECL_REF:
S = DependentScopeDeclRefExpr::CreateEmpty(*Context,
/*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]);
break;
case pch::EXPR_CXX_UNRESOLVED_CONSTRUCT:
case EXPR_CXX_UNRESOLVED_CONSTRUCT:
S = CXXUnresolvedConstructExpr::CreateEmpty(*Context,
/*NumArgs=*/Record[ASTStmtReader::NumExprFields]);
break;
case pch::EXPR_CXX_UNRESOLVED_MEMBER:
case EXPR_CXX_UNRESOLVED_MEMBER:
S = UnresolvedMemberExpr::CreateEmpty(*Context,
/*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]);
break;
case pch::EXPR_CXX_UNRESOLVED_LOOKUP:
case EXPR_CXX_UNRESOLVED_LOOKUP:
S = UnresolvedLookupExpr::CreateEmpty(*Context,
/*NumTemplateArgs=*/Record[ASTStmtReader::NumExprFields]);
break;
case pch::EXPR_CXX_UNARY_TYPE_TRAIT:
case EXPR_CXX_UNARY_TYPE_TRAIT:
S = new (Context) UnaryTypeTraitExpr(Empty);
break;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -33,7 +33,7 @@ namespace clang {
ASTWriter::RecordData &Record;
public:
pch::DeclCode Code;
serialization::DeclCode Code;
unsigned AbbrevToUse;
ASTDeclWriter(ASTWriter &Writer, ASTContext &Context,
@ -142,7 +142,7 @@ void ASTDeclWriter::VisitDecl(Decl *D) {
void ASTDeclWriter::VisitTranslationUnitDecl(TranslationUnitDecl *D) {
VisitDecl(D);
Writer.AddDeclRef(D->getAnonymousNamespace(), Record);
Code = pch::DECL_TRANSLATION_UNIT;
Code = serialization::DECL_TRANSLATION_UNIT;
}
void ASTDeclWriter::VisitNamedDecl(NamedDecl *D) {
@ -158,7 +158,7 @@ void ASTDeclWriter::VisitTypeDecl(TypeDecl *D) {
void ASTDeclWriter::VisitTypedefDecl(TypedefDecl *D) {
VisitTypeDecl(D);
Writer.AddTypeSourceInfo(D->getTypeSourceInfo(), Record);
Code = pch::DECL_TYPEDEF;
Code = serialization::DECL_TYPEDEF;
}
void ASTDeclWriter::VisitTagDecl(TagDecl *D) {
@ -181,7 +181,7 @@ void ASTDeclWriter::VisitEnumDecl(EnumDecl *D) {
Record.push_back(D->getNumPositiveBits());
Record.push_back(D->getNumNegativeBits());
Writer.AddDeclRef(D->getInstantiatedFromMemberEnum(), Record);
Code = pch::DECL_ENUM;
Code = serialization::DECL_ENUM;
}
void ASTDeclWriter::VisitRecordDecl(RecordDecl *D) {
@ -189,7 +189,7 @@ void ASTDeclWriter::VisitRecordDecl(RecordDecl *D) {
Record.push_back(D->hasFlexibleArrayMember());
Record.push_back(D->isAnonymousStructOrUnion());
Record.push_back(D->hasObjectMember());
Code = pch::DECL_RECORD;
Code = serialization::DECL_RECORD;
}
void ASTDeclWriter::VisitValueDecl(ValueDecl *D) {
@ -203,7 +203,7 @@ void ASTDeclWriter::VisitEnumConstantDecl(EnumConstantDecl *D) {
if (D->getInitExpr())
Writer.AddStmt(D->getInitExpr());
Writer.AddAPSInt(D->getInitVal(), Record);
Code = pch::DECL_ENUM_CONSTANT;
Code = serialization::DECL_ENUM_CONSTANT;
}
void ASTDeclWriter::VisitDeclaratorDecl(DeclaratorDecl *D) {
@ -299,7 +299,7 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
for (FunctionDecl::param_iterator P = D->param_begin(), PEnd = D->param_end();
P != PEnd; ++P)
Writer.AddDeclRef(*P, Record);
Code = pch::DECL_FUNCTION;
Code = serialization::DECL_FUNCTION;
}
void ASTDeclWriter::VisitObjCMethodDecl(ObjCMethodDecl *D) {
@ -330,13 +330,13 @@ void ASTDeclWriter::VisitObjCMethodDecl(ObjCMethodDecl *D) {
for (ObjCMethodDecl::param_iterator P = D->param_begin(),
PEnd = D->param_end(); P != PEnd; ++P)
Writer.AddDeclRef(*P, Record);
Code = pch::DECL_OBJC_METHOD;
Code = serialization::DECL_OBJC_METHOD;
}
void ASTDeclWriter::VisitObjCContainerDecl(ObjCContainerDecl *D) {
VisitNamedDecl(D);
Writer.AddSourceRange(D->getAtEndRange(), Record);
// Abstract class (no need to define a stable pch::DECL code).
// Abstract class (no need to define a stable serialization::DECL code).
}
void ASTDeclWriter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {
@ -362,7 +362,7 @@ void ASTDeclWriter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {
Writer.AddSourceLocation(D->getClassLoc(), Record);
Writer.AddSourceLocation(D->getSuperClassLoc(), Record);
Writer.AddSourceLocation(D->getLocEnd(), Record);
Code = pch::DECL_OBJC_INTERFACE;
Code = serialization::DECL_OBJC_INTERFACE;
}
void ASTDeclWriter::VisitObjCIvarDecl(ObjCIvarDecl *D) {
@ -370,7 +370,7 @@ void ASTDeclWriter::VisitObjCIvarDecl(ObjCIvarDecl *D) {
// FIXME: stable encoding for @public/@private/@protected/@package
Record.push_back(D->getAccessControl());
Record.push_back(D->getSynthesize());
Code = pch::DECL_OBJC_IVAR;
Code = serialization::DECL_OBJC_IVAR;
}
void ASTDeclWriter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {
@ -385,12 +385,12 @@ void ASTDeclWriter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {
PLEnd = D->protocol_loc_end();
PL != PLEnd; ++PL)
Writer.AddSourceLocation(*PL, Record);
Code = pch::DECL_OBJC_PROTOCOL;
Code = serialization::DECL_OBJC_PROTOCOL;
}
void ASTDeclWriter::VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D) {
VisitFieldDecl(D);
Code = pch::DECL_OBJC_AT_DEFS_FIELD;
Code = serialization::DECL_OBJC_AT_DEFS_FIELD;
}
void ASTDeclWriter::VisitObjCClassDecl(ObjCClassDecl *D) {
@ -400,7 +400,7 @@ void ASTDeclWriter::VisitObjCClassDecl(ObjCClassDecl *D) {
Writer.AddDeclRef(I->getInterface(), Record);
for (ObjCClassDecl::iterator I = D->begin(), IEnd = D->end(); I != IEnd; ++I)
Writer.AddSourceLocation(I->getLocation(), Record);
Code = pch::DECL_OBJC_CLASS;
Code = serialization::DECL_OBJC_CLASS;
}
void ASTDeclWriter::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *D) {
@ -413,7 +413,7 @@ void ASTDeclWriter::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *D) {
PL = D->protocol_loc_begin(), PLEnd = D->protocol_loc_end();
PL != PLEnd; ++PL)
Writer.AddSourceLocation(*PL, Record);
Code = pch::DECL_OBJC_FORWARD_PROTOCOL;
Code = serialization::DECL_OBJC_FORWARD_PROTOCOL;
}
void ASTDeclWriter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) {
@ -430,13 +430,13 @@ void ASTDeclWriter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) {
Writer.AddDeclRef(D->getNextClassCategory(), Record);
Writer.AddSourceLocation(D->getAtLoc(), Record);
Writer.AddSourceLocation(D->getCategoryNameLoc(), Record);
Code = pch::DECL_OBJC_CATEGORY;
Code = serialization::DECL_OBJC_CATEGORY;
}
void ASTDeclWriter::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D) {
VisitNamedDecl(D);
Writer.AddDeclRef(D->getClassInterface(), Record);
Code = pch::DECL_OBJC_COMPATIBLE_ALIAS;
Code = serialization::DECL_OBJC_COMPATIBLE_ALIAS;
}
void ASTDeclWriter::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
@ -453,19 +453,19 @@ void ASTDeclWriter::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
Writer.AddDeclRef(D->getGetterMethodDecl(), Record);
Writer.AddDeclRef(D->getSetterMethodDecl(), Record);
Writer.AddDeclRef(D->getPropertyIvarDecl(), Record);
Code = pch::DECL_OBJC_PROPERTY;
Code = serialization::DECL_OBJC_PROPERTY;
}
void ASTDeclWriter::VisitObjCImplDecl(ObjCImplDecl *D) {
VisitObjCContainerDecl(D);
Writer.AddDeclRef(D->getClassInterface(), Record);
// Abstract class (no need to define a stable pch::DECL code).
// Abstract class (no need to define a stable serialization::DECL code).
}
void ASTDeclWriter::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) {
VisitObjCImplDecl(D);
Writer.AddIdentifierRef(D->getIdentifier(), Record);
Code = pch::DECL_OBJC_CATEGORY_IMPL;
Code = serialization::DECL_OBJC_CATEGORY_IMPL;
}
void ASTDeclWriter::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
@ -473,7 +473,7 @@ void ASTDeclWriter::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
Writer.AddDeclRef(D->getSuperClass(), Record);
Writer.AddCXXBaseOrMemberInitializers(D->IvarInitializers,
D->NumIvarInitializers, Record);
Code = pch::DECL_OBJC_IMPLEMENTATION;
Code = serialization::DECL_OBJC_IMPLEMENTATION;
}
void ASTDeclWriter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
@ -483,7 +483,7 @@ void ASTDeclWriter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
Writer.AddDeclRef(D->getPropertyIvarDecl(), Record);
Writer.AddStmt(D->getGetterCXXConstructor());
Writer.AddStmt(D->getSetterCXXAssignment());
Code = pch::DECL_OBJC_PROPERTY_IMPL;
Code = serialization::DECL_OBJC_PROPERTY_IMPL;
}
void ASTDeclWriter::VisitFieldDecl(FieldDecl *D) {
@ -494,7 +494,7 @@ void ASTDeclWriter::VisitFieldDecl(FieldDecl *D) {
Writer.AddStmt(D->getBitWidth());
if (!D->getDeclName())
Writer.AddDeclRef(Context.getInstantiatedFromUnnamedFieldDecl(D), Record);
Code = pch::DECL_FIELD;
Code = serialization::DECL_FIELD;
}
void ASTDeclWriter::VisitVarDecl(VarDecl *D) {
@ -519,12 +519,12 @@ void ASTDeclWriter::VisitVarDecl(VarDecl *D) {
Writer.AddSourceLocation(SpecInfo->getPointOfInstantiation(), Record);
}
Code = pch::DECL_VAR;
Code = serialization::DECL_VAR;
}
void ASTDeclWriter::VisitImplicitParamDecl(ImplicitParamDecl *D) {
VisitVarDecl(D);
Code = pch::DECL_IMPLICIT_PARAM;
Code = serialization::DECL_IMPLICIT_PARAM;
}
void ASTDeclWriter::VisitParmVarDecl(ParmVarDecl *D) {
@ -534,7 +534,7 @@ void ASTDeclWriter::VisitParmVarDecl(ParmVarDecl *D) {
Record.push_back(D->hasUninstantiatedDefaultArg());
if (D->hasUninstantiatedDefaultArg())
Writer.AddStmt(D->getUninstantiatedDefaultArg());
Code = pch::DECL_PARM_VAR;
Code = serialization::DECL_PARM_VAR;
// If the assumptions about the DECL_PARM_VAR abbrev are true, use it. Here
// we dynamically check for the properties that we optimize for, but don't
@ -567,7 +567,7 @@ void ASTDeclWriter::VisitParmVarDecl(ParmVarDecl *D) {
void ASTDeclWriter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) {
VisitDecl(D);
Writer.AddStmt(D->getAsmString());
Code = pch::DECL_FILE_SCOPE_ASM;
Code = serialization::DECL_FILE_SCOPE_ASM;
}
void ASTDeclWriter::VisitBlockDecl(BlockDecl *D) {
@ -578,7 +578,7 @@ void ASTDeclWriter::VisitBlockDecl(BlockDecl *D) {
for (FunctionDecl::param_iterator P = D->param_begin(), PEnd = D->param_end();
P != PEnd; ++P)
Writer.AddDeclRef(*P, Record);
Code = pch::DECL_BLOCK;
Code = serialization::DECL_BLOCK;
}
void ASTDeclWriter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
@ -587,7 +587,7 @@ void ASTDeclWriter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
// declaration, which don't seem to be readily available in the AST.
Record.push_back(D->getLanguage());
Record.push_back(D->hasBraces());
Code = pch::DECL_LINKAGE_SPEC;
Code = serialization::DECL_LINKAGE_SPEC;
}
void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) {
@ -602,7 +602,7 @@ void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) {
Writer.AddDeclRef(D->getAnonymousNamespace(), Record);
else
Writer.AddDeclRef(D->getOriginalNamespace(), Record);
Code = pch::DECL_NAMESPACE;
Code = serialization::DECL_NAMESPACE;
if (Writer.hasChain() && !D->isOriginalNamespace() &&
D->getOriginalNamespace()->getPCHLevel() > 0) {
@ -617,7 +617,7 @@ void ASTDeclWriter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
Writer.AddNestedNameSpecifier(D->getQualifier(), Record);
Writer.AddSourceLocation(D->getTargetNameLoc(), Record);
Writer.AddDeclRef(D->getNamespace(), Record);
Code = pch::DECL_NAMESPACE_ALIAS;
Code = serialization::DECL_NAMESPACE_ALIAS;
}
void ASTDeclWriter::VisitUsingDecl(UsingDecl *D) {
@ -631,7 +631,7 @@ void ASTDeclWriter::VisitUsingDecl(UsingDecl *D) {
Writer.AddDeclRef(*P, Record);
Record.push_back(D->isTypeName());
Writer.AddDeclRef(Context.getInstantiatedFromUsingDecl(D), Record);
Code = pch::DECL_USING;
Code = serialization::DECL_USING;
}
void ASTDeclWriter::VisitUsingShadowDecl(UsingShadowDecl *D) {
@ -639,7 +639,7 @@ void ASTDeclWriter::VisitUsingShadowDecl(UsingShadowDecl *D) {
Writer.AddDeclRef(D->getTargetDecl(), Record);
Writer.AddDeclRef(D->getUsingDecl(), Record);
Writer.AddDeclRef(Context.getInstantiatedFromUsingShadowDecl(D), Record);
Code = pch::DECL_USING_SHADOW;
Code = serialization::DECL_USING_SHADOW;
}
void ASTDeclWriter::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
@ -650,7 +650,7 @@ void ASTDeclWriter::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
Writer.AddSourceLocation(D->getIdentLocation(), Record);
Writer.AddDeclRef(D->getNominatedNamespace(), Record);
Writer.AddDeclRef(dyn_cast<Decl>(D->getCommonAncestor()), Record);
Code = pch::DECL_USING_DIRECTIVE;
Code = serialization::DECL_USING_DIRECTIVE;
}
void ASTDeclWriter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
@ -658,7 +658,7 @@ void ASTDeclWriter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
Writer.AddSourceRange(D->getTargetNestedNameRange(), Record);
Writer.AddSourceLocation(D->getUsingLoc(), Record);
Writer.AddNestedNameSpecifier(D->getTargetNestedNameSpecifier(), Record);
Code = pch::DECL_UNRESOLVED_USING_VALUE;
Code = serialization::DECL_UNRESOLVED_USING_VALUE;
}
void ASTDeclWriter::VisitUnresolvedUsingTypenameDecl(
@ -668,7 +668,7 @@ void ASTDeclWriter::VisitUnresolvedUsingTypenameDecl(
Writer.AddSourceLocation(D->getUsingLoc(), Record);
Writer.AddSourceLocation(D->getTypenameLoc(), Record);
Writer.AddNestedNameSpecifier(D->getTargetNestedNameSpecifier(), Record);
Code = pch::DECL_UNRESOLVED_USING_TYPENAME;
Code = serialization::DECL_UNRESOLVED_USING_TYPENAME;
}
void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) {
@ -747,7 +747,7 @@ void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) {
Record.push_back(CXXRecNotTemplate);
}
Code = pch::DECL_CXX_RECORD;
Code = serialization::DECL_CXX_RECORD;
}
void ASTDeclWriter::VisitCXXMethodDecl(CXXMethodDecl *D) {
@ -757,7 +757,7 @@ void ASTDeclWriter::VisitCXXMethodDecl(CXXMethodDecl *D) {
I = D->begin_overridden_methods(), E = D->end_overridden_methods();
I != E; ++I)
Writer.AddDeclRef(*I, Record);
Code = pch::DECL_CXX_METHOD;
Code = serialization::DECL_CXX_METHOD;
}
void ASTDeclWriter::VisitCXXConstructorDecl(CXXConstructorDecl *D) {
@ -768,7 +768,7 @@ void ASTDeclWriter::VisitCXXConstructorDecl(CXXConstructorDecl *D) {
Writer.AddCXXBaseOrMemberInitializers(D->BaseOrMemberInitializers,
D->NumBaseOrMemberInitializers, Record);
Code = pch::DECL_CXX_CONSTRUCTOR;
Code = serialization::DECL_CXX_CONSTRUCTOR;
}
void ASTDeclWriter::VisitCXXDestructorDecl(CXXDestructorDecl *D) {
@ -777,19 +777,19 @@ void ASTDeclWriter::VisitCXXDestructorDecl(CXXDestructorDecl *D) {
Record.push_back(D->ImplicitlyDefined);
Writer.AddDeclRef(D->OperatorDelete, Record);
Code = pch::DECL_CXX_DESTRUCTOR;
Code = serialization::DECL_CXX_DESTRUCTOR;
}
void ASTDeclWriter::VisitCXXConversionDecl(CXXConversionDecl *D) {
VisitCXXMethodDecl(D);
Record.push_back(D->IsExplicitSpecified);
Code = pch::DECL_CXX_CONVERSION;
Code = serialization::DECL_CXX_CONVERSION;
}
void ASTDeclWriter::VisitAccessSpecDecl(AccessSpecDecl *D) {
VisitDecl(D);
Writer.AddSourceLocation(D->getColonLoc(), Record);
Code = pch::DECL_ACCESS_SPEC;
Code = serialization::DECL_ACCESS_SPEC;
}
void ASTDeclWriter::VisitFriendDecl(FriendDecl *D) {
@ -801,7 +801,7 @@ void ASTDeclWriter::VisitFriendDecl(FriendDecl *D) {
Writer.AddDeclRef(D->Friend.get<NamedDecl*>(), Record);
Writer.AddDeclRef(D->NextFriend, Record);
Writer.AddSourceLocation(D->FriendLoc, Record);
Code = pch::DECL_FRIEND;
Code = serialization::DECL_FRIEND;
}
void ASTDeclWriter::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
@ -815,7 +815,7 @@ void ASTDeclWriter::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
else
Writer.AddTypeSourceInfo(D->getFriendType(), Record);
Writer.AddSourceLocation(D->getFriendLoc(), Record);
Code = pch::DECL_FRIEND_TEMPLATE;
Code = serialization::DECL_FRIEND_TEMPLATE;
}
void ASTDeclWriter::VisitTemplateDecl(TemplateDecl *D) {
@ -876,7 +876,7 @@ void ASTDeclWriter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
// InjectedClassNameType is computed, no need to write it.
}
Code = pch::DECL_CLASS_TEMPLATE;
Code = serialization::DECL_CLASS_TEMPLATE;
}
void ASTDeclWriter::VisitClassTemplateSpecializationDecl(
@ -910,7 +910,7 @@ void ASTDeclWriter::VisitClassTemplateSpecializationDecl(
Writer.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl(), Record);
}
Code = pch::DECL_CLASS_TEMPLATE_SPECIALIZATION;
Code = serialization::DECL_CLASS_TEMPLATE_SPECIALIZATION;
}
void ASTDeclWriter::VisitClassTemplatePartialSpecializationDecl(
@ -931,7 +931,7 @@ void ASTDeclWriter::VisitClassTemplatePartialSpecializationDecl(
Record.push_back(D->isMemberSpecialization());
}
Code = pch::DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION;
Code = serialization::DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION;
}
void ASTDeclWriter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
@ -950,7 +950,7 @@ void ASTDeclWriter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
Writer.AddDeclRef(I->Function, Record);
}
}
Code = pch::DECL_FUNCTION_TEMPLATE;
Code = serialization::DECL_FUNCTION_TEMPLATE;
}
void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
@ -961,7 +961,7 @@ void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
Record.push_back(D->defaultArgumentWasInherited());
Writer.AddTypeSourceInfo(D->getDefaultArgumentInfo(), Record);
Code = pch::DECL_TEMPLATE_TYPE_PARM;
Code = serialization::DECL_TEMPLATE_TYPE_PARM;
}
void ASTDeclWriter::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {
@ -975,7 +975,7 @@ void ASTDeclWriter::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {
Writer.AddStmt(D->getDefaultArgument());
Record.push_back(D->defaultArgumentWasInherited());
}
Code = pch::DECL_NON_TYPE_TEMPLATE_PARM;
Code = serialization::DECL_NON_TYPE_TEMPLATE_PARM;
}
void ASTDeclWriter::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) {
@ -986,14 +986,14 @@ void ASTDeclWriter::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) {
// Rest of TemplateTemplateParmDecl.
Writer.AddTemplateArgumentLoc(D->getDefaultArgument(), Record);
Record.push_back(D->defaultArgumentWasInherited());
Code = pch::DECL_TEMPLATE_TEMPLATE_PARM;
Code = serialization::DECL_TEMPLATE_TEMPLATE_PARM;
}
void ASTDeclWriter::VisitStaticAssertDecl(StaticAssertDecl *D) {
VisitDecl(D);
Writer.AddStmt(D->getAssertExpr());
Writer.AddStmt(D->getMessage());
Code = pch::DECL_STATIC_ASSERT;
Code = serialization::DECL_STATIC_ASSERT;
}
/// \brief Emit the DeclContext part of a declaration context decl.
@ -1045,7 +1045,7 @@ void ASTWriter::WriteDeclsBlockAbbrevs() {
using namespace llvm;
// Abbreviation for DECL_PARM_VAR.
BitCodeAbbrev *Abv = new BitCodeAbbrev();
Abv->Add(BitCodeAbbrevOp(pch::DECL_PARM_VAR));
Abv->Add(BitCodeAbbrevOp(serialization::DECL_PARM_VAR));
// Decl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
@ -1064,7 +1064,7 @@ void ASTWriter::WriteDeclsBlockAbbrevs() {
// ValueDecl
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
// DeclaratorDecl
Abv->Add(BitCodeAbbrevOp(pch::PREDEF_TYPE_NULL_ID)); // InfoType
Abv->Add(BitCodeAbbrevOp(serialization::PREDEF_TYPE_NULL_ID)); // InfoType
// VarDecl
Abv->Add(BitCodeAbbrevOp(0)); // StorageClass
Abv->Add(BitCodeAbbrevOp(0)); // StorageClassAsWritten
@ -1083,7 +1083,7 @@ void ASTWriter::WriteDeclsBlockAbbrevs() {
ParmVarDeclAbbrev = Stream.EmitAbbrev(Abv);
Abv = new BitCodeAbbrev();
Abv->Add(BitCodeAbbrevOp(pch::DECL_CONTEXT_LEXICAL));
Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_LEXICAL));
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
DeclContextLexicalAbbrev = Stream.EmitAbbrev(Abv);
}
@ -1126,10 +1126,10 @@ void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
}
// Determine the ID for this declaration
pch::DeclID &IDR = DeclIDs[D];
serialization::DeclID &IDR = DeclIDs[D];
if (IDR == 0)
IDR = NextDeclID++;
pch::DeclID ID = IDR;
serialization::DeclID ID = IDR;
if (ID < FirstDeclID) {
// We're replacing a decl in a previous file.
@ -1148,7 +1148,7 @@ void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
// Build and emit a record for this declaration
Record.clear();
W.Code = (pch::DeclCode)0;
W.Code = (serialization::DeclCode)0;
W.AbbrevToUse = 0;
W.Visit(D);
if (DC) W.VisitDeclContext(DC, LexicalOffset, VisibleOffset);

Просмотреть файл

@ -28,7 +28,7 @@ namespace clang {
ASTWriter::RecordData &Record;
public:
pch::StmtCode Code;
serialization::StmtCode Code;
ASTStmtWriter(ASTWriter &Writer, ASTWriter::RecordData &Record)
: Writer(Writer), Record(Record) { }
@ -169,7 +169,7 @@ void ASTStmtWriter::VisitStmt(Stmt *S) {
void ASTStmtWriter::VisitNullStmt(NullStmt *S) {
VisitStmt(S);
Writer.AddSourceLocation(S->getSemiLoc(), Record);
Code = pch::STMT_NULL;
Code = serialization::STMT_NULL;
}
void ASTStmtWriter::VisitCompoundStmt(CompoundStmt *S) {
@ -180,7 +180,7 @@ void ASTStmtWriter::VisitCompoundStmt(CompoundStmt *S) {
Writer.AddStmt(*CS);
Writer.AddSourceLocation(S->getLBracLoc(), Record);
Writer.AddSourceLocation(S->getRBracLoc(), Record);
Code = pch::STMT_COMPOUND;
Code = serialization::STMT_COMPOUND;
}
void ASTStmtWriter::VisitSwitchCase(SwitchCase *S) {
@ -196,7 +196,7 @@ void ASTStmtWriter::VisitCaseStmt(CaseStmt *S) {
Writer.AddSourceLocation(S->getCaseLoc(), Record);
Writer.AddSourceLocation(S->getEllipsisLoc(), Record);
Writer.AddSourceLocation(S->getColonLoc(), Record);
Code = pch::STMT_CASE;
Code = serialization::STMT_CASE;
}
void ASTStmtWriter::VisitDefaultStmt(DefaultStmt *S) {
@ -204,7 +204,7 @@ void ASTStmtWriter::VisitDefaultStmt(DefaultStmt *S) {
Writer.AddStmt(S->getSubStmt());
Writer.AddSourceLocation(S->getDefaultLoc(), Record);
Writer.AddSourceLocation(S->getColonLoc(), Record);
Code = pch::STMT_DEFAULT;
Code = serialization::STMT_DEFAULT;
}
void ASTStmtWriter::VisitLabelStmt(LabelStmt *S) {
@ -213,7 +213,7 @@ void ASTStmtWriter::VisitLabelStmt(LabelStmt *S) {
Writer.AddStmt(S->getSubStmt());
Writer.AddSourceLocation(S->getIdentLoc(), Record);
Record.push_back(Writer.GetLabelID(S));
Code = pch::STMT_LABEL;
Code = serialization::STMT_LABEL;
}
void ASTStmtWriter::VisitIfStmt(IfStmt *S) {
@ -224,7 +224,7 @@ void ASTStmtWriter::VisitIfStmt(IfStmt *S) {
Writer.AddStmt(S->getElse());
Writer.AddSourceLocation(S->getIfLoc(), Record);
Writer.AddSourceLocation(S->getElseLoc(), Record);
Code = pch::STMT_IF;
Code = serialization::STMT_IF;
}
void ASTStmtWriter::VisitSwitchStmt(SwitchStmt *S) {
@ -236,7 +236,7 @@ void ASTStmtWriter::VisitSwitchStmt(SwitchStmt *S) {
for (SwitchCase *SC = S->getSwitchCaseList(); SC;
SC = SC->getNextSwitchCase())
Record.push_back(Writer.RecordSwitchCaseID(SC));
Code = pch::STMT_SWITCH;
Code = serialization::STMT_SWITCH;
}
void ASTStmtWriter::VisitWhileStmt(WhileStmt *S) {
@ -245,7 +245,7 @@ void ASTStmtWriter::VisitWhileStmt(WhileStmt *S) {
Writer.AddStmt(S->getCond());
Writer.AddStmt(S->getBody());
Writer.AddSourceLocation(S->getWhileLoc(), Record);
Code = pch::STMT_WHILE;
Code = serialization::STMT_WHILE;
}
void ASTStmtWriter::VisitDoStmt(DoStmt *S) {
@ -255,7 +255,7 @@ void ASTStmtWriter::VisitDoStmt(DoStmt *S) {
Writer.AddSourceLocation(S->getDoLoc(), Record);
Writer.AddSourceLocation(S->getWhileLoc(), Record);
Writer.AddSourceLocation(S->getRParenLoc(), Record);
Code = pch::STMT_DO;
Code = serialization::STMT_DO;
}
void ASTStmtWriter::VisitForStmt(ForStmt *S) {
@ -268,7 +268,7 @@ void ASTStmtWriter::VisitForStmt(ForStmt *S) {
Writer.AddSourceLocation(S->getForLoc(), Record);
Writer.AddSourceLocation(S->getLParenLoc(), Record);
Writer.AddSourceLocation(S->getRParenLoc(), Record);
Code = pch::STMT_FOR;
Code = serialization::STMT_FOR;
}
void ASTStmtWriter::VisitGotoStmt(GotoStmt *S) {
@ -276,7 +276,7 @@ void ASTStmtWriter::VisitGotoStmt(GotoStmt *S) {
Record.push_back(Writer.GetLabelID(S->getLabel()));
Writer.AddSourceLocation(S->getGotoLoc(), Record);
Writer.AddSourceLocation(S->getLabelLoc(), Record);
Code = pch::STMT_GOTO;
Code = serialization::STMT_GOTO;
}
void ASTStmtWriter::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
@ -284,19 +284,19 @@ void ASTStmtWriter::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
Writer.AddSourceLocation(S->getGotoLoc(), Record);
Writer.AddSourceLocation(S->getStarLoc(), Record);
Writer.AddStmt(S->getTarget());
Code = pch::STMT_INDIRECT_GOTO;
Code = serialization::STMT_INDIRECT_GOTO;
}
void ASTStmtWriter::VisitContinueStmt(ContinueStmt *S) {
VisitStmt(S);
Writer.AddSourceLocation(S->getContinueLoc(), Record);
Code = pch::STMT_CONTINUE;
Code = serialization::STMT_CONTINUE;
}
void ASTStmtWriter::VisitBreakStmt(BreakStmt *S) {
VisitStmt(S);
Writer.AddSourceLocation(S->getBreakLoc(), Record);
Code = pch::STMT_BREAK;
Code = serialization::STMT_BREAK;
}
void ASTStmtWriter::VisitReturnStmt(ReturnStmt *S) {
@ -304,7 +304,7 @@ void ASTStmtWriter::VisitReturnStmt(ReturnStmt *S) {
Writer.AddStmt(S->getRetValue());
Writer.AddSourceLocation(S->getReturnLoc(), Record);
Writer.AddDeclRef(S->getNRVOCandidate(), Record);
Code = pch::STMT_RETURN;
Code = serialization::STMT_RETURN;
}
void ASTStmtWriter::VisitDeclStmt(DeclStmt *S) {
@ -314,7 +314,7 @@ void ASTStmtWriter::VisitDeclStmt(DeclStmt *S) {
DeclGroupRef DG = S->getDeclGroup();
for (DeclGroupRef::iterator D = DG.begin(), DEnd = DG.end(); D != DEnd; ++D)
Writer.AddDeclRef(*D, Record);
Code = pch::STMT_DECL;
Code = serialization::STMT_DECL;
}
void ASTStmtWriter::VisitAsmStmt(AsmStmt *S) {
@ -347,7 +347,7 @@ void ASTStmtWriter::VisitAsmStmt(AsmStmt *S) {
for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
Writer.AddStmt(S->getClobber(I));
Code = pch::STMT_ASM;
Code = serialization::STMT_ASM;
}
void ASTStmtWriter::VisitExpr(Expr *E) {
@ -361,7 +361,7 @@ void ASTStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getLocation(), Record);
Record.push_back(E->getIdentType()); // FIXME: stable encoding
Code = pch::EXPR_PREDEFINED;
Code = serialization::EXPR_PREDEFINED;
}
void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
@ -384,14 +384,14 @@ void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
Writer.AddDeclRef(E->getDecl(), Record);
// FIXME: write DeclarationNameLoc.
Writer.AddSourceLocation(E->getLocation(), Record);
Code = pch::EXPR_DECL_REF;
Code = serialization::EXPR_DECL_REF;
}
void ASTStmtWriter::VisitIntegerLiteral(IntegerLiteral *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getLocation(), Record);
Writer.AddAPInt(E->getValue(), Record);
Code = pch::EXPR_INTEGER_LITERAL;
Code = serialization::EXPR_INTEGER_LITERAL;
}
void ASTStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) {
@ -399,13 +399,13 @@ void ASTStmtWriter::VisitFloatingLiteral(FloatingLiteral *E) {
Writer.AddAPFloat(E->getValue(), Record);
Record.push_back(E->isExact());
Writer.AddSourceLocation(E->getLocation(), Record);
Code = pch::EXPR_FLOATING_LITERAL;
Code = serialization::EXPR_FLOATING_LITERAL;
}
void ASTStmtWriter::VisitImaginaryLiteral(ImaginaryLiteral *E) {
VisitExpr(E);
Writer.AddStmt(E->getSubExpr());
Code = pch::EXPR_IMAGINARY_LITERAL;
Code = serialization::EXPR_IMAGINARY_LITERAL;
}
void ASTStmtWriter::VisitStringLiteral(StringLiteral *E) {
@ -420,7 +420,7 @@ void ASTStmtWriter::VisitStringLiteral(StringLiteral *E) {
Record.append(E->getString().begin(), E->getString().end());
for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
Writer.AddSourceLocation(E->getStrTokenLoc(I), Record);
Code = pch::EXPR_STRING_LITERAL;
Code = serialization::EXPR_STRING_LITERAL;
}
void ASTStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {
@ -428,7 +428,7 @@ void ASTStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {
Record.push_back(E->getValue());
Writer.AddSourceLocation(E->getLocation(), Record);
Record.push_back(E->isWide());
Code = pch::EXPR_CHARACTER_LITERAL;
Code = serialization::EXPR_CHARACTER_LITERAL;
}
void ASTStmtWriter::VisitParenExpr(ParenExpr *E) {
@ -436,7 +436,7 @@ void ASTStmtWriter::VisitParenExpr(ParenExpr *E) {
Writer.AddSourceLocation(E->getLParen(), Record);
Writer.AddSourceLocation(E->getRParen(), Record);
Writer.AddStmt(E->getSubExpr());
Code = pch::EXPR_PAREN;
Code = serialization::EXPR_PAREN;
}
void ASTStmtWriter::VisitParenListExpr(ParenListExpr *E) {
@ -446,7 +446,7 @@ void ASTStmtWriter::VisitParenListExpr(ParenListExpr *E) {
Writer.AddStmt(E->Exprs[i]);
Writer.AddSourceLocation(E->LParenLoc, Record);
Writer.AddSourceLocation(E->RParenLoc, Record);
Code = pch::EXPR_PAREN_LIST;
Code = serialization::EXPR_PAREN_LIST;
}
void ASTStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
@ -454,7 +454,7 @@ void ASTStmtWriter::VisitUnaryOperator(UnaryOperator *E) {
Writer.AddStmt(E->getSubExpr());
Record.push_back(E->getOpcode()); // FIXME: stable encoding
Writer.AddSourceLocation(E->getOperatorLoc(), Record);
Code = pch::EXPR_UNARY_OPERATOR;
Code = serialization::EXPR_UNARY_OPERATOR;
}
void ASTStmtWriter::VisitOffsetOfExpr(OffsetOfExpr *E) {
@ -489,7 +489,7 @@ void ASTStmtWriter::VisitOffsetOfExpr(OffsetOfExpr *E) {
}
for (unsigned I = 0, N = E->getNumExpressions(); I != N; ++I)
Writer.AddStmt(E->getIndexExpr(I));
Code = pch::EXPR_OFFSETOF;
Code = serialization::EXPR_OFFSETOF;
}
void ASTStmtWriter::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
@ -503,7 +503,7 @@ void ASTStmtWriter::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
}
Writer.AddSourceLocation(E->getOperatorLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_SIZEOF_ALIGN_OF;
Code = serialization::EXPR_SIZEOF_ALIGN_OF;
}
void ASTStmtWriter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
@ -511,7 +511,7 @@ void ASTStmtWriter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
Writer.AddStmt(E->getLHS());
Writer.AddStmt(E->getRHS());
Writer.AddSourceLocation(E->getRBracketLoc(), Record);
Code = pch::EXPR_ARRAY_SUBSCRIPT;
Code = serialization::EXPR_ARRAY_SUBSCRIPT;
}
void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
@ -522,7 +522,7 @@ void ASTStmtWriter::VisitCallExpr(CallExpr *E) {
for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
Arg != ArgEnd; ++Arg)
Writer.AddStmt(*Arg);
Code = pch::EXPR_CALL;
Code = serialization::EXPR_CALL;
}
void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
@ -555,7 +555,7 @@ void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
// FIXME: write DeclarationNameLoc.
Writer.AddSourceLocation(E->getMemberLoc(), Record);
Record.push_back(E->isArrow());
Code = pch::EXPR_MEMBER;
Code = serialization::EXPR_MEMBER;
}
void ASTStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
@ -563,7 +563,7 @@ void ASTStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {
Writer.AddStmt(E->getBase());
Writer.AddSourceLocation(E->getIsaMemberLoc(), Record);
Record.push_back(E->isArrow());
Code = pch::EXPR_OBJC_ISA;
Code = serialization::EXPR_OBJC_ISA;
}
void ASTStmtWriter::VisitCastExpr(CastExpr *E) {
@ -583,14 +583,14 @@ void ASTStmtWriter::VisitBinaryOperator(BinaryOperator *E) {
Writer.AddStmt(E->getRHS());
Record.push_back(E->getOpcode()); // FIXME: stable encoding
Writer.AddSourceLocation(E->getOperatorLoc(), Record);
Code = pch::EXPR_BINARY_OPERATOR;
Code = serialization::EXPR_BINARY_OPERATOR;
}
void ASTStmtWriter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
VisitBinaryOperator(E);
Writer.AddTypeRef(E->getComputationLHSType(), Record);
Writer.AddTypeRef(E->getComputationResultType(), Record);
Code = pch::EXPR_COMPOUND_ASSIGN_OPERATOR;
Code = serialization::EXPR_COMPOUND_ASSIGN_OPERATOR;
}
void ASTStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
@ -600,13 +600,13 @@ void ASTStmtWriter::VisitConditionalOperator(ConditionalOperator *E) {
Writer.AddStmt(E->getRHS());
Writer.AddSourceLocation(E->getQuestionLoc(), Record);
Writer.AddSourceLocation(E->getColonLoc(), Record);
Code = pch::EXPR_CONDITIONAL_OPERATOR;
Code = serialization::EXPR_CONDITIONAL_OPERATOR;
}
void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
VisitCastExpr(E);
Record.push_back(E->getCategory());
Code = pch::EXPR_IMPLICIT_CAST;
Code = serialization::EXPR_IMPLICIT_CAST;
}
void ASTStmtWriter::VisitExplicitCastExpr(ExplicitCastExpr *E) {
@ -618,7 +618,7 @@ void ASTStmtWriter::VisitCStyleCastExpr(CStyleCastExpr *E) {
VisitExplicitCastExpr(E);
Writer.AddSourceLocation(E->getLParenLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_CSTYLE_CAST;
Code = serialization::EXPR_CSTYLE_CAST;
}
void ASTStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
@ -627,7 +627,7 @@ void ASTStmtWriter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
Writer.AddTypeSourceInfo(E->getTypeSourceInfo(), Record);
Writer.AddStmt(E->getInitializer());
Record.push_back(E->isFileScope());
Code = pch::EXPR_COMPOUND_LITERAL;
Code = serialization::EXPR_COMPOUND_LITERAL;
}
void ASTStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
@ -635,7 +635,7 @@ void ASTStmtWriter::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
Writer.AddStmt(E->getBase());
Writer.AddIdentifierRef(&E->getAccessor(), Record);
Writer.AddSourceLocation(E->getAccessorLoc(), Record);
Code = pch::EXPR_EXT_VECTOR_ELEMENT;
Code = serialization::EXPR_EXT_VECTOR_ELEMENT;
}
void ASTStmtWriter::VisitInitListExpr(InitListExpr *E) {
@ -648,7 +648,7 @@ void ASTStmtWriter::VisitInitListExpr(InitListExpr *E) {
Writer.AddSourceLocation(E->getRBraceLoc(), Record);
Writer.AddDeclRef(E->getInitializedFieldInUnion(), Record);
Record.push_back(E->hadArrayRangeDesignator());
Code = pch::EXPR_INIT_LIST;
Code = serialization::EXPR_INIT_LIST;
}
void ASTStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
@ -663,34 +663,34 @@ void ASTStmtWriter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
D != DEnd; ++D) {
if (D->isFieldDesignator()) {
if (FieldDecl *Field = D->getField()) {
Record.push_back(pch::DESIG_FIELD_DECL);
Record.push_back(serialization::DESIG_FIELD_DECL);
Writer.AddDeclRef(Field, Record);
} else {
Record.push_back(pch::DESIG_FIELD_NAME);
Record.push_back(serialization::DESIG_FIELD_NAME);
Writer.AddIdentifierRef(D->getFieldName(), Record);
}
Writer.AddSourceLocation(D->getDotLoc(), Record);
Writer.AddSourceLocation(D->getFieldLoc(), Record);
} else if (D->isArrayDesignator()) {
Record.push_back(pch::DESIG_ARRAY);
Record.push_back(serialization::DESIG_ARRAY);
Record.push_back(D->getFirstExprIndex());
Writer.AddSourceLocation(D->getLBracketLoc(), Record);
Writer.AddSourceLocation(D->getRBracketLoc(), Record);
} else {
assert(D->isArrayRangeDesignator() && "Unknown designator");
Record.push_back(pch::DESIG_ARRAY_RANGE);
Record.push_back(serialization::DESIG_ARRAY_RANGE);
Record.push_back(D->getFirstExprIndex());
Writer.AddSourceLocation(D->getLBracketLoc(), Record);
Writer.AddSourceLocation(D->getEllipsisLoc(), Record);
Writer.AddSourceLocation(D->getRBracketLoc(), Record);
}
}
Code = pch::EXPR_DESIGNATED_INIT;
Code = serialization::EXPR_DESIGNATED_INIT;
}
void ASTStmtWriter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
VisitExpr(E);
Code = pch::EXPR_IMPLICIT_VALUE_INIT;
Code = serialization::EXPR_IMPLICIT_VALUE_INIT;
}
void ASTStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
@ -699,7 +699,7 @@ void ASTStmtWriter::VisitVAArgExpr(VAArgExpr *E) {
Writer.AddTypeSourceInfo(E->getWrittenTypeInfo(), Record);
Writer.AddSourceLocation(E->getBuiltinLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_VA_ARG;
Code = serialization::EXPR_VA_ARG;
}
void ASTStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
@ -707,7 +707,7 @@ void ASTStmtWriter::VisitAddrLabelExpr(AddrLabelExpr *E) {
Writer.AddSourceLocation(E->getAmpAmpLoc(), Record);
Writer.AddSourceLocation(E->getLabelLoc(), Record);
Record.push_back(Writer.GetLabelID(E->getLabel()));
Code = pch::EXPR_ADDR_LABEL;
Code = serialization::EXPR_ADDR_LABEL;
}
void ASTStmtWriter::VisitStmtExpr(StmtExpr *E) {
@ -715,7 +715,7 @@ void ASTStmtWriter::VisitStmtExpr(StmtExpr *E) {
Writer.AddStmt(E->getSubStmt());
Writer.AddSourceLocation(E->getLParenLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_STMT;
Code = serialization::EXPR_STMT;
}
void ASTStmtWriter::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) {
@ -724,7 +724,7 @@ void ASTStmtWriter::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) {
Writer.AddTypeSourceInfo(E->getArgTInfo2(), Record);
Writer.AddSourceLocation(E->getBuiltinLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_TYPES_COMPATIBLE;
Code = serialization::EXPR_TYPES_COMPATIBLE;
}
void ASTStmtWriter::VisitChooseExpr(ChooseExpr *E) {
@ -734,13 +734,13 @@ void ASTStmtWriter::VisitChooseExpr(ChooseExpr *E) {
Writer.AddStmt(E->getRHS());
Writer.AddSourceLocation(E->getBuiltinLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_CHOOSE;
Code = serialization::EXPR_CHOOSE;
}
void ASTStmtWriter::VisitGNUNullExpr(GNUNullExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getTokenLocation(), Record);
Code = pch::EXPR_GNU_NULL;
Code = serialization::EXPR_GNU_NULL;
}
void ASTStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
@ -750,14 +750,14 @@ void ASTStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
Writer.AddStmt(E->getExpr(I));
Writer.AddSourceLocation(E->getBuiltinLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_SHUFFLE_VECTOR;
Code = serialization::EXPR_SHUFFLE_VECTOR;
}
void ASTStmtWriter::VisitBlockExpr(BlockExpr *E) {
VisitExpr(E);
Writer.AddDeclRef(E->getBlockDecl(), Record);
Record.push_back(E->hasBlockDeclRefExprs());
Code = pch::EXPR_BLOCK;
Code = serialization::EXPR_BLOCK;
}
void ASTStmtWriter::VisitBlockDeclRefExpr(BlockDeclRefExpr *E) {
@ -767,7 +767,7 @@ void ASTStmtWriter::VisitBlockDeclRefExpr(BlockDeclRefExpr *E) {
Record.push_back(E->isByRef());
Record.push_back(E->isConstQualAdded());
Writer.AddStmt(E->getCopyConstructorExpr());
Code = pch::EXPR_BLOCK_DECL_REF;
Code = serialization::EXPR_BLOCK_DECL_REF;
}
//===----------------------------------------------------------------------===//
@ -778,7 +778,7 @@ void ASTStmtWriter::VisitObjCStringLiteral(ObjCStringLiteral *E) {
VisitExpr(E);
Writer.AddStmt(E->getString());
Writer.AddSourceLocation(E->getAtLoc(), Record);
Code = pch::EXPR_OBJC_STRING_LITERAL;
Code = serialization::EXPR_OBJC_STRING_LITERAL;
}
void ASTStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
@ -786,7 +786,7 @@ void ASTStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
Writer.AddTypeSourceInfo(E->getEncodedTypeSourceInfo(), Record);
Writer.AddSourceLocation(E->getAtLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_OBJC_ENCODE;
Code = serialization::EXPR_OBJC_ENCODE;
}
void ASTStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
@ -794,7 +794,7 @@ void ASTStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
Writer.AddSelectorRef(E->getSelector(), Record);
Writer.AddSourceLocation(E->getAtLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_OBJC_SELECTOR_EXPR;
Code = serialization::EXPR_OBJC_SELECTOR_EXPR;
}
void ASTStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
@ -802,7 +802,7 @@ void ASTStmtWriter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
Writer.AddDeclRef(E->getProtocol(), Record);
Writer.AddSourceLocation(E->getAtLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_OBJC_PROTOCOL_EXPR;
Code = serialization::EXPR_OBJC_PROTOCOL_EXPR;
}
void ASTStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
@ -812,7 +812,7 @@ void ASTStmtWriter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
Writer.AddStmt(E->getBase());
Record.push_back(E->isArrow());
Record.push_back(E->isFreeIvar());
Code = pch::EXPR_OBJC_IVAR_REF_EXPR;
Code = serialization::EXPR_OBJC_IVAR_REF_EXPR;
}
void ASTStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
@ -820,7 +820,7 @@ void ASTStmtWriter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
Writer.AddDeclRef(E->getProperty(), Record);
Writer.AddSourceLocation(E->getLocation(), Record);
Writer.AddStmt(E->getBase());
Code = pch::EXPR_OBJC_PROPERTY_REF_EXPR;
Code = serialization::EXPR_OBJC_PROPERTY_REF_EXPR;
}
void ASTStmtWriter::VisitObjCImplicitSetterGetterRefExpr(
@ -834,7 +834,7 @@ void ASTStmtWriter::VisitObjCImplicitSetterGetterRefExpr(
Writer.AddStmt(E->getBase());
Writer.AddSourceLocation(E->getLocation(), Record);
Writer.AddSourceLocation(E->getClassLoc(), Record);
Code = pch::EXPR_OBJC_KVC_REF_EXPR;
Code = serialization::EXPR_OBJC_KVC_REF_EXPR;
}
void ASTStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
@ -871,13 +871,13 @@ void ASTStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
Arg != ArgEnd; ++Arg)
Writer.AddStmt(*Arg);
Code = pch::EXPR_OBJC_MESSAGE_EXPR;
Code = serialization::EXPR_OBJC_MESSAGE_EXPR;
}
void ASTStmtWriter::VisitObjCSuperExpr(ObjCSuperExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getLoc(), Record);
Code = pch::EXPR_OBJC_SUPER_EXPR;
Code = serialization::EXPR_OBJC_SUPER_EXPR;
}
void ASTStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
@ -887,7 +887,7 @@ void ASTStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
Writer.AddStmt(S->getBody());
Writer.AddSourceLocation(S->getForLoc(), Record);
Writer.AddSourceLocation(S->getRParenLoc(), Record);
Code = pch::STMT_OBJC_FOR_COLLECTION;
Code = serialization::STMT_OBJC_FOR_COLLECTION;
}
void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
@ -895,13 +895,13 @@ void ASTStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
Writer.AddDeclRef(S->getCatchParamDecl(), Record);
Writer.AddSourceLocation(S->getAtCatchLoc(), Record);
Writer.AddSourceLocation(S->getRParenLoc(), Record);
Code = pch::STMT_OBJC_CATCH;
Code = serialization::STMT_OBJC_CATCH;
}
void ASTStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
Writer.AddStmt(S->getFinallyBody());
Writer.AddSourceLocation(S->getAtFinallyLoc(), Record);
Code = pch::STMT_OBJC_FINALLY;
Code = serialization::STMT_OBJC_FINALLY;
}
void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
@ -913,20 +913,20 @@ void ASTStmtWriter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
if (S->getFinallyStmt())
Writer.AddStmt(S->getFinallyStmt());
Writer.AddSourceLocation(S->getAtTryLoc(), Record);
Code = pch::STMT_OBJC_AT_TRY;
Code = serialization::STMT_OBJC_AT_TRY;
}
void ASTStmtWriter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
Writer.AddStmt(S->getSynchExpr());
Writer.AddStmt(S->getSynchBody());
Writer.AddSourceLocation(S->getAtSynchronizedLoc(), Record);
Code = pch::STMT_OBJC_AT_SYNCHRONIZED;
Code = serialization::STMT_OBJC_AT_SYNCHRONIZED;
}
void ASTStmtWriter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
Writer.AddStmt(S->getThrowExpr());
Writer.AddSourceLocation(S->getThrowLoc(), Record);
Code = pch::STMT_OBJC_AT_THROW;
Code = serialization::STMT_OBJC_AT_THROW;
}
//===----------------------------------------------------------------------===//
@ -938,7 +938,7 @@ void ASTStmtWriter::VisitCXXCatchStmt(CXXCatchStmt *S) {
Writer.AddSourceLocation(S->getCatchLoc(), Record);
Writer.AddDeclRef(S->getExceptionDecl(), Record);
Writer.AddStmt(S->getHandlerBlock());
Code = pch::STMT_CXX_CATCH;
Code = serialization::STMT_CXX_CATCH;
}
void ASTStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
@ -948,18 +948,18 @@ void ASTStmtWriter::VisitCXXTryStmt(CXXTryStmt *S) {
Writer.AddStmt(S->getTryBlock());
for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
Writer.AddStmt(S->getHandler(i));
Code = pch::STMT_CXX_TRY;
Code = serialization::STMT_CXX_TRY;
}
void ASTStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
VisitCallExpr(E);
Record.push_back(E->getOperator());
Code = pch::EXPR_CXX_OPERATOR_CALL;
Code = serialization::EXPR_CXX_OPERATOR_CALL;
}
void ASTStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
VisitCallExpr(E);
Code = pch::EXPR_CXX_MEMBER_CALL;
Code = serialization::EXPR_CXX_MEMBER_CALL;
}
void ASTStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
@ -972,14 +972,14 @@ void ASTStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
Record.push_back(E->isElidable());
Record.push_back(E->requiresZeroInitialization());
Record.push_back(E->getConstructionKind()); // FIXME: stable encoding
Code = pch::EXPR_CXX_CONSTRUCT;
Code = serialization::EXPR_CXX_CONSTRUCT;
}
void ASTStmtWriter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
VisitCXXConstructExpr(E);
Writer.AddSourceLocation(E->getTypeBeginLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_CXX_TEMPORARY_OBJECT;
Code = serialization::EXPR_CXX_TEMPORARY_OBJECT;
}
void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
@ -989,42 +989,42 @@ void ASTStmtWriter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
void ASTStmtWriter::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
VisitCXXNamedCastExpr(E);
Code = pch::EXPR_CXX_STATIC_CAST;
Code = serialization::EXPR_CXX_STATIC_CAST;
}
void ASTStmtWriter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
VisitCXXNamedCastExpr(E);
Code = pch::EXPR_CXX_DYNAMIC_CAST;
Code = serialization::EXPR_CXX_DYNAMIC_CAST;
}
void ASTStmtWriter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *E) {
VisitCXXNamedCastExpr(E);
Code = pch::EXPR_CXX_REINTERPRET_CAST;
Code = serialization::EXPR_CXX_REINTERPRET_CAST;
}
void ASTStmtWriter::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
VisitCXXNamedCastExpr(E);
Code = pch::EXPR_CXX_CONST_CAST;
Code = serialization::EXPR_CXX_CONST_CAST;
}
void ASTStmtWriter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
VisitExplicitCastExpr(E);
Writer.AddSourceLocation(E->getTypeBeginLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_CXX_FUNCTIONAL_CAST;
Code = serialization::EXPR_CXX_FUNCTIONAL_CAST;
}
void ASTStmtWriter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
VisitExpr(E);
Record.push_back(E->getValue());
Writer.AddSourceLocation(E->getLocation(), Record);
Code = pch::EXPR_CXX_BOOL_LITERAL;
Code = serialization::EXPR_CXX_BOOL_LITERAL;
}
void ASTStmtWriter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getLocation(), Record);
Code = pch::EXPR_CXX_NULL_PTR_LITERAL;
Code = serialization::EXPR_CXX_NULL_PTR_LITERAL;
}
void ASTStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
@ -1032,10 +1032,10 @@ void ASTStmtWriter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
Writer.AddSourceRange(E->getSourceRange(), Record);
if (E->isTypeOperand()) {
Writer.AddTypeSourceInfo(E->getTypeOperandSourceInfo(), Record);
Code = pch::EXPR_CXX_TYPEID_TYPE;
Code = serialization::EXPR_CXX_TYPEID_TYPE;
} else {
Writer.AddStmt(E->getExprOperand());
Code = pch::EXPR_CXX_TYPEID_EXPR;
Code = serialization::EXPR_CXX_TYPEID_EXPR;
}
}
@ -1043,14 +1043,14 @@ void ASTStmtWriter::VisitCXXThisExpr(CXXThisExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getLocation(), Record);
Record.push_back(E->isImplicit());
Code = pch::EXPR_CXX_THIS;
Code = serialization::EXPR_CXX_THIS;
}
void ASTStmtWriter::VisitCXXThrowExpr(CXXThrowExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getThrowLoc(), Record);
Writer.AddStmt(E->getSubExpr());
Code = pch::EXPR_CXX_THROW;
Code = serialization::EXPR_CXX_THROW;
}
void ASTStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
@ -1064,14 +1064,14 @@ void ASTStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
Writer.AddDeclRef(E->getParam(), Record);
Writer.AddSourceLocation(E->getUsedLocation(), Record);
Code = pch::EXPR_CXX_DEFAULT_ARG;
Code = serialization::EXPR_CXX_DEFAULT_ARG;
}
void ASTStmtWriter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
VisitExpr(E);
Writer.AddCXXTemporary(E->getTemporary(), Record);
Writer.AddStmt(E->getSubExpr());
Code = pch::EXPR_CXX_BIND_TEMPORARY;
Code = serialization::EXPR_CXX_BIND_TEMPORARY;
}
void ASTStmtWriter::VisitCXXBindReferenceExpr(CXXBindReferenceExpr *E) {
@ -1079,14 +1079,14 @@ void ASTStmtWriter::VisitCXXBindReferenceExpr(CXXBindReferenceExpr *E) {
Writer.AddStmt(E->getSubExpr());
Record.push_back(E->extendsLifetime());
Record.push_back(E->requiresTemporaryCopy());
Code = pch::EXPR_CXX_BIND_REFERENCE;
Code = serialization::EXPR_CXX_BIND_REFERENCE;
}
void ASTStmtWriter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
VisitExpr(E);
Writer.AddSourceLocation(E->getTypeBeginLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_CXX_SCALAR_VALUE_INIT;
Code = serialization::EXPR_CXX_SCALAR_VALUE_INIT;
}
void ASTStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
@ -1106,7 +1106,7 @@ void ASTStmtWriter::VisitCXXNewExpr(CXXNewExpr *E) {
I != e; ++I)
Writer.AddStmt(*I);
Code = pch::EXPR_CXX_NEW;
Code = serialization::EXPR_CXX_NEW;
}
void ASTStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
@ -1117,7 +1117,7 @@ void ASTStmtWriter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
Writer.AddStmt(E->getArgument());
Writer.AddSourceLocation(E->getSourceRange().getBegin(), Record);
Code = pch::EXPR_CXX_DELETE;
Code = serialization::EXPR_CXX_DELETE;
}
void ASTStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
@ -1139,7 +1139,7 @@ void ASTStmtWriter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
else
Writer.AddTypeSourceInfo(E->getDestroyedTypeInfo(), Record);
Code = pch::EXPR_CXX_PSEUDO_DESTRUCTOR;
Code = serialization::EXPR_CXX_PSEUDO_DESTRUCTOR;
}
void ASTStmtWriter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
@ -1149,7 +1149,7 @@ void ASTStmtWriter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
Writer.AddCXXTemporary(E->getTemporary(i), Record);
Writer.AddStmt(E->getSubExpr());
Code = pch::EXPR_CXX_EXPR_WITH_TEMPORARIES;
Code = serialization::EXPR_CXX_EXPR_WITH_TEMPORARIES;
}
void
@ -1182,7 +1182,7 @@ ASTStmtWriter::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){
// FIXME: write whole DeclarationNameInfo.
Writer.AddDeclarationName(E->getMember(), Record);
Writer.AddSourceLocation(E->getMemberLoc(), Record);
Code = pch::EXPR_CXX_DEPENDENT_SCOPE_MEMBER;
Code = serialization::EXPR_CXX_DEPENDENT_SCOPE_MEMBER;
}
void
@ -1206,7 +1206,7 @@ ASTStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
Writer.AddSourceLocation(E->getLocation(), Record);
Writer.AddSourceRange(E->getQualifierRange(), Record);
Writer.AddNestedNameSpecifier(E->getQualifier(), Record);
Code = pch::EXPR_CXX_DEPENDENT_SCOPE_DECL_REF;
Code = serialization::EXPR_CXX_DEPENDENT_SCOPE_DECL_REF;
}
void
@ -1220,7 +1220,7 @@ ASTStmtWriter::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
Writer.AddTypeRef(E->getTypeAsWritten(), Record);
Writer.AddSourceLocation(E->getLParenLoc(), Record);
Writer.AddSourceLocation(E->getRParenLoc(), Record);
Code = pch::EXPR_CXX_UNRESOLVED_CONSTRUCT;
Code = serialization::EXPR_CXX_UNRESOLVED_CONSTRUCT;
}
void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
@ -1259,7 +1259,7 @@ void ASTStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
Writer.AddStmt(!E->isImplicitAccess() ? E->getBase() : 0);
Writer.AddTypeRef(E->getBaseType(), Record);
Writer.AddSourceLocation(E->getOperatorLoc(), Record);
Code = pch::EXPR_CXX_UNRESOLVED_MEMBER;
Code = serialization::EXPR_CXX_UNRESOLVED_MEMBER;
}
void ASTStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
@ -1267,7 +1267,7 @@ void ASTStmtWriter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
Record.push_back(E->requiresADL());
Record.push_back(E->isOverloaded());
Writer.AddDeclRef(E->getNamingClass(), Record);
Code = pch::EXPR_CXX_UNRESOLVED_LOOKUP;
Code = serialization::EXPR_CXX_UNRESOLVED_LOOKUP;
}
void ASTStmtWriter::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) {
@ -1275,7 +1275,7 @@ void ASTStmtWriter::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) {
Record.push_back(E->getTrait());
Writer.AddSourceRange(E->getSourceRange(), Record);
Writer.AddTypeRef(E->getQueriedType(), Record);
Code = pch::EXPR_CXX_UNARY_TYPE_TRAIT;
Code = serialization::EXPR_CXX_UNARY_TYPE_TRAIT;
}
//===----------------------------------------------------------------------===//
@ -1316,7 +1316,7 @@ void ASTWriter::WriteSubStmt(Stmt *S) {
++NumStatements;
if (!S) {
Stream.EmitRecord(pch::STMT_NULL_PTR, Record);
Stream.EmitRecord(serialization::STMT_NULL_PTR, Record);
return;
}
@ -1324,11 +1324,11 @@ void ASTWriter::WriteSubStmt(Stmt *S) {
llvm::SmallVector<Stmt *, 16> SubStmts;
CollectedStmts = &SubStmts;
Writer.Code = pch::STMT_NULL_PTR;
Writer.Code = serialization::STMT_NULL_PTR;
Writer.Visit(S);
#ifndef NDEBUG
if (Writer.Code == pch::STMT_NULL_PTR) {
if (Writer.Code == serialization::STMT_NULL_PTR) {
SourceManager &SrcMgr
= DeclIDs.begin()->first->getASTContext().getSourceManager();
S->dump(SrcMgr);
@ -1363,7 +1363,7 @@ void ASTWriter::FlushStmts() {
// Note that we are at the end of a full expression. Any
// expression records that follow this one are part of a different
// expression.
Stream.EmitRecord(pch::STMT_STOP, Record);
Stream.EmitRecord(serialization::STMT_STOP, Record);
}
StmtsToEmit.clear();