mirror of https://github.com/microsoft/clang.git
Thread PerFileData through the ASTReader again, this time with the LLVM changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115625 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4a1bb8c4d7
commit
c3632730cc
|
@ -57,12 +57,15 @@ class GotoStmt;
|
||||||
class LabelStmt;
|
class LabelStmt;
|
||||||
class MacroDefinition;
|
class MacroDefinition;
|
||||||
class NamedDecl;
|
class NamedDecl;
|
||||||
class ASTDeserializationListener;
|
|
||||||
class Preprocessor;
|
class Preprocessor;
|
||||||
class Sema;
|
class Sema;
|
||||||
class SwitchCase;
|
class SwitchCase;
|
||||||
|
class ASTDeserializationListener;
|
||||||
class ASTReader;
|
class ASTReader;
|
||||||
class ASTDeclReader;
|
class ASTDeclReader;
|
||||||
|
class ASTStmtReader;
|
||||||
|
class ASTIdentifierLookupTrait;
|
||||||
|
class TypeLocReader;
|
||||||
struct HeaderFileInfo;
|
struct HeaderFileInfo;
|
||||||
|
|
||||||
struct PCHPredefinesBlock {
|
struct PCHPredefinesBlock {
|
||||||
|
@ -169,6 +172,9 @@ public:
|
||||||
enum ASTReadResult { Success, Failure, IgnorePCH };
|
enum ASTReadResult { Success, Failure, IgnorePCH };
|
||||||
friend class PCHValidator;
|
friend class PCHValidator;
|
||||||
friend class ASTDeclReader;
|
friend class ASTDeclReader;
|
||||||
|
friend class ASTStmtReader;
|
||||||
|
friend class ASTIdentifierLookupTrait;
|
||||||
|
friend class TypeLocReader;
|
||||||
private:
|
private:
|
||||||
/// \brief The receiver of some callbacks invoked by ASTReader.
|
/// \brief The receiver of some callbacks invoked by ASTReader.
|
||||||
llvm::OwningPtr<ASTReaderListener> Listener;
|
llvm::OwningPtr<ASTReaderListener> Listener;
|
||||||
|
@ -289,6 +295,10 @@ private:
|
||||||
/// instance and factory methods.
|
/// instance and factory methods.
|
||||||
void *SelectorLookupTable;
|
void *SelectorLookupTable;
|
||||||
|
|
||||||
|
/// \brief Method selectors used in a @selector expression. Used for
|
||||||
|
/// implementation of -Wselector.
|
||||||
|
llvm::SmallVector<uint64_t, 64> ReferencedSelectorsData;
|
||||||
|
|
||||||
// === Declarations ===
|
// === Declarations ===
|
||||||
|
|
||||||
/// DeclsCursor - This is a cursor to the start of the DECLS_BLOCK block. It
|
/// DeclsCursor - This is a cursor to the start of the DECLS_BLOCK block. It
|
||||||
|
@ -303,6 +313,14 @@ private:
|
||||||
/// by the declaration ID (-1).
|
/// by the declaration ID (-1).
|
||||||
const uint32_t *DeclOffsets;
|
const uint32_t *DeclOffsets;
|
||||||
|
|
||||||
|
/// \brief A snapshot of the pending instantiations in the chain.
|
||||||
|
///
|
||||||
|
/// This record tracks the instantiations that Sema has to perform at the
|
||||||
|
/// end of the TU. It consists of a pair of values for every pending
|
||||||
|
/// instantiation where the first value is the ID of the decl and the second
|
||||||
|
/// is the instantiation location.
|
||||||
|
llvm::SmallVector<uint64_t, 64> PendingInstantiations;
|
||||||
|
|
||||||
// === Types ===
|
// === Types ===
|
||||||
|
|
||||||
/// \brief The number of types in this AST file.
|
/// \brief The number of types in this AST file.
|
||||||
|
@ -474,10 +492,6 @@ private:
|
||||||
/// \brief Fields containing data that is used for generating diagnostics
|
/// \brief Fields containing data that is used for generating diagnostics
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
/// \brief Method selectors used in a @selector expression. Used for
|
|
||||||
/// implementation of -Wselector.
|
|
||||||
llvm::SmallVector<uint64_t, 64> ReferencedSelectorsData;
|
|
||||||
|
|
||||||
/// \brief A snapshot of Sema's unused file-scoped variable tracking, for
|
/// \brief A snapshot of Sema's unused file-scoped variable tracking, for
|
||||||
/// generating warnings.
|
/// generating warnings.
|
||||||
llvm::SmallVector<uint64_t, 16> UnusedFileScopedDecls;
|
llvm::SmallVector<uint64_t, 16> UnusedFileScopedDecls;
|
||||||
|
@ -503,14 +517,6 @@ private:
|
||||||
/// local external declarations.
|
/// local external declarations.
|
||||||
llvm::SmallVector<uint64_t, 16> LocallyScopedExternalDecls;
|
llvm::SmallVector<uint64_t, 16> LocallyScopedExternalDecls;
|
||||||
|
|
||||||
/// \brief A snapshot of the pwnsinf instantiations in the chain.
|
|
||||||
///
|
|
||||||
/// This record tracks the instantiations that Sema has to perform at the end
|
|
||||||
/// of the TU. It consists of a pair of values for every pending instantiation
|
|
||||||
/// where the first value is the ID of the decl and the second is the
|
|
||||||
/// instantiation location.
|
|
||||||
llvm::SmallVector<uint64_t, 64> PendingInstantiations;
|
|
||||||
|
|
||||||
/// \brief The IDs of all dynamic class declarations in the chain.
|
/// \brief The IDs of all dynamic class declarations in the chain.
|
||||||
///
|
///
|
||||||
/// Sema tracks these because it checks for the key functions being defined
|
/// Sema tracks these because it checks for the key functions being defined
|
||||||
|
@ -685,20 +691,26 @@ private:
|
||||||
std::string SuggestedPredefines;
|
std::string SuggestedPredefines;
|
||||||
|
|
||||||
/// \brief Reads a statement from the specified cursor.
|
/// \brief Reads a statement from the specified cursor.
|
||||||
Stmt *ReadStmtFromStream(llvm::BitstreamCursor &Cursor);
|
Stmt *ReadStmtFromStream(PerFileData &F);
|
||||||
|
|
||||||
void MaybeAddSystemRootToFilename(std::string &Filename);
|
void MaybeAddSystemRootToFilename(std::string &Filename);
|
||||||
|
|
||||||
ASTReadResult ReadASTCore(llvm::StringRef FileName);
|
ASTReadResult ReadASTCore(llvm::StringRef FileName);
|
||||||
ASTReadResult ReadASTBlock(PerFileData &F);
|
ASTReadResult ReadASTBlock(PerFileData &F);
|
||||||
bool CheckPredefinesBuffers();
|
bool CheckPredefinesBuffers();
|
||||||
bool ParseLineTable(llvm::SmallVectorImpl<uint64_t> &Record);
|
bool ParseLineTable(PerFileData &F, llvm::SmallVectorImpl<uint64_t> &Record);
|
||||||
ASTReadResult ReadSourceManagerBlock(PerFileData &F);
|
ASTReadResult ReadSourceManagerBlock(PerFileData &F);
|
||||||
ASTReadResult ReadSLocEntryRecord(unsigned ID);
|
ASTReadResult ReadSLocEntryRecord(unsigned ID);
|
||||||
llvm::BitstreamCursor &SLocCursorForID(unsigned ID);
|
PerFileData *SLocCursorForID(unsigned ID);
|
||||||
|
SourceLocation getImportLocation(PerFileData *F);
|
||||||
bool ParseLanguageOptions(const llvm::SmallVectorImpl<uint64_t> &Record);
|
bool ParseLanguageOptions(const llvm::SmallVectorImpl<uint64_t> &Record);
|
||||||
|
|
||||||
typedef std::pair<llvm::BitstreamCursor *, uint64_t> RecordLocation;
|
struct RecordLocation {
|
||||||
|
RecordLocation(PerFileData *M, uint64_t O)
|
||||||
|
: F(M), Offset(O) {}
|
||||||
|
PerFileData *F;
|
||||||
|
uint64_t Offset;
|
||||||
|
};
|
||||||
|
|
||||||
QualType ReadTypeRecord(unsigned Index);
|
QualType ReadTypeRecord(unsigned Index);
|
||||||
RecordLocation TypeCursorForIndex(unsigned Index);
|
RecordLocation TypeCursorForIndex(unsigned Index);
|
||||||
|
@ -837,17 +849,16 @@ public:
|
||||||
/// \brief Reads a TemplateArgumentLocInfo appropriate for the
|
/// \brief Reads a TemplateArgumentLocInfo appropriate for the
|
||||||
/// given TemplateArgument kind.
|
/// given TemplateArgument kind.
|
||||||
TemplateArgumentLocInfo
|
TemplateArgumentLocInfo
|
||||||
GetTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind,
|
GetTemplateArgumentLocInfo(PerFileData &F, TemplateArgument::ArgKind Kind,
|
||||||
llvm::BitstreamCursor &DeclsCursor,
|
|
||||||
const RecordData &Record, unsigned &Idx);
|
const RecordData &Record, unsigned &Idx);
|
||||||
|
|
||||||
/// \brief Reads a TemplateArgumentLoc.
|
/// \brief Reads a TemplateArgumentLoc.
|
||||||
TemplateArgumentLoc
|
TemplateArgumentLoc
|
||||||
ReadTemplateArgumentLoc(llvm::BitstreamCursor &DeclsCursor,
|
ReadTemplateArgumentLoc(PerFileData &F,
|
||||||
const RecordData &Record, unsigned &Idx);
|
const RecordData &Record, unsigned &Idx);
|
||||||
|
|
||||||
/// \brief Reads a declarator info from the given record.
|
/// \brief Reads a declarator info from the given record.
|
||||||
TypeSourceInfo *GetTypeSourceInfo(llvm::BitstreamCursor &DeclsCursor,
|
TypeSourceInfo *GetTypeSourceInfo(PerFileData &F,
|
||||||
const RecordData &Record, unsigned &Idx);
|
const RecordData &Record, unsigned &Idx);
|
||||||
|
|
||||||
/// \brief Resolve and return the translation unit declaration.
|
/// \brief Resolve and return the translation unit declaration.
|
||||||
|
@ -1001,39 +1012,48 @@ public:
|
||||||
TemplateName ReadTemplateName(const RecordData &Record, unsigned &Idx);
|
TemplateName ReadTemplateName(const RecordData &Record, unsigned &Idx);
|
||||||
|
|
||||||
/// \brief Read a template argument.
|
/// \brief Read a template argument.
|
||||||
TemplateArgument ReadTemplateArgument(llvm::BitstreamCursor &DeclsCursor,
|
TemplateArgument ReadTemplateArgument(PerFileData &F,
|
||||||
const RecordData &Record,unsigned &Idx);
|
const RecordData &Record,unsigned &Idx);
|
||||||
|
|
||||||
/// \brief Read a template parameter list.
|
/// \brief Read a template parameter list.
|
||||||
TemplateParameterList *ReadTemplateParameterList(const RecordData &Record,
|
TemplateParameterList *ReadTemplateParameterList(PerFileData &F,
|
||||||
|
const RecordData &Record,
|
||||||
unsigned &Idx);
|
unsigned &Idx);
|
||||||
|
|
||||||
/// \brief Read a template argument array.
|
/// \brief Read a template argument array.
|
||||||
void
|
void
|
||||||
ReadTemplateArgumentList(llvm::SmallVector<TemplateArgument, 8> &TemplArgs,
|
ReadTemplateArgumentList(llvm::SmallVector<TemplateArgument, 8> &TemplArgs,
|
||||||
llvm::BitstreamCursor &DeclsCursor,
|
PerFileData &F, const RecordData &Record,
|
||||||
const RecordData &Record, unsigned &Idx);
|
unsigned &Idx);
|
||||||
|
|
||||||
/// \brief Read a UnresolvedSet structure.
|
/// \brief Read a UnresolvedSet structure.
|
||||||
void ReadUnresolvedSet(UnresolvedSetImpl &Set,
|
void ReadUnresolvedSet(UnresolvedSetImpl &Set,
|
||||||
const RecordData &Record, unsigned &Idx);
|
const RecordData &Record, unsigned &Idx);
|
||||||
|
|
||||||
/// \brief Read a C++ base specifier.
|
/// \brief Read a C++ base specifier.
|
||||||
CXXBaseSpecifier ReadCXXBaseSpecifier(llvm::BitstreamCursor &DeclsCursor,
|
CXXBaseSpecifier ReadCXXBaseSpecifier(PerFileData &F,
|
||||||
const RecordData &Record,unsigned &Idx);
|
const RecordData &Record,unsigned &Idx);
|
||||||
|
|
||||||
/// \brief Read a CXXBaseOrMemberInitializer array.
|
/// \brief Read a CXXBaseOrMemberInitializer array.
|
||||||
std::pair<CXXBaseOrMemberInitializer **, unsigned>
|
std::pair<CXXBaseOrMemberInitializer **, unsigned>
|
||||||
ReadCXXBaseOrMemberInitializers(llvm::BitstreamCursor &DeclsCursor,
|
ReadCXXBaseOrMemberInitializers(PerFileData &F,
|
||||||
const RecordData &Record, unsigned &Idx);
|
const RecordData &Record, unsigned &Idx);
|
||||||
|
|
||||||
|
/// \brief Read a source location from raw form.
|
||||||
|
SourceLocation ReadSourceLocation(PerFileData &Module, unsigned Raw) {
|
||||||
|
(void)Module; // No remapping yet
|
||||||
|
return SourceLocation::getFromRawEncoding(Raw);
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Read a source location.
|
/// \brief Read a source location.
|
||||||
SourceLocation ReadSourceLocation(const RecordData &Record, unsigned& Idx) {
|
SourceLocation ReadSourceLocation(PerFileData &Module,
|
||||||
return SourceLocation::getFromRawEncoding(Record[Idx++]);
|
const RecordData &Record, unsigned& Idx) {
|
||||||
|
return ReadSourceLocation(Module, Record[Idx++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Read a source range.
|
/// \brief Read a source range.
|
||||||
SourceRange ReadSourceRange(const RecordData &Record, unsigned& Idx);
|
SourceRange ReadSourceRange(PerFileData &F,
|
||||||
|
const RecordData &Record, unsigned& Idx);
|
||||||
|
|
||||||
/// \brief Read an integral value
|
/// \brief Read an integral value
|
||||||
llvm::APInt ReadAPInt(const RecordData &Record, unsigned &Idx);
|
llvm::APInt ReadAPInt(const RecordData &Record, unsigned &Idx);
|
||||||
|
@ -1050,13 +1070,13 @@ public:
|
||||||
CXXTemporary *ReadCXXTemporary(const RecordData &Record, unsigned &Idx);
|
CXXTemporary *ReadCXXTemporary(const RecordData &Record, unsigned &Idx);
|
||||||
|
|
||||||
/// \brief Reads attributes from the current stream position.
|
/// \brief Reads attributes from the current stream position.
|
||||||
void ReadAttributes(llvm::BitstreamCursor &DeclsCursor, AttrVec &Attrs);
|
void ReadAttributes(PerFileData &F, AttrVec &Attrs);
|
||||||
|
|
||||||
/// \brief Reads a statement.
|
/// \brief Reads a statement.
|
||||||
Stmt *ReadStmt(llvm::BitstreamCursor &Cursor);
|
Stmt *ReadStmt(PerFileData &F);
|
||||||
|
|
||||||
/// \brief Reads an expression.
|
/// \brief Reads an expression.
|
||||||
Expr *ReadExpr(llvm::BitstreamCursor &Cursor);
|
Expr *ReadExpr(PerFileData &F);
|
||||||
|
|
||||||
/// \brief Reads a sub-statement operand during statement reading.
|
/// \brief Reads a sub-statement operand during statement reading.
|
||||||
Stmt *ReadSubStmt() {
|
Stmt *ReadSubStmt() {
|
||||||
|
@ -1072,7 +1092,7 @@ public:
|
||||||
Expr *ReadSubExpr();
|
Expr *ReadSubExpr();
|
||||||
|
|
||||||
/// \brief Reads the macro record located at the given offset.
|
/// \brief Reads the macro record located at the given offset.
|
||||||
void ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset);
|
void ReadMacroRecord(PerFileData &F, uint64_t Offset);
|
||||||
|
|
||||||
/// \brief Read the set of macros defined by this external macro source.
|
/// \brief Read the set of macros defined by this external macro source.
|
||||||
virtual void ReadDefinedMacros();
|
virtual void ReadDefinedMacros();
|
||||||
|
|
|
@ -567,10 +567,10 @@ public:
|
||||||
typedef OnDiskChainedHashTable<ASTSelectorLookupTrait>
|
typedef OnDiskChainedHashTable<ASTSelectorLookupTrait>
|
||||||
ASTSelectorLookupTable;
|
ASTSelectorLookupTable;
|
||||||
|
|
||||||
namespace {
|
namespace clang {
|
||||||
class ASTIdentifierLookupTrait {
|
class ASTIdentifierLookupTrait {
|
||||||
ASTReader &Reader;
|
ASTReader &Reader;
|
||||||
llvm::BitstreamCursor &Stream;
|
ASTReader::PerFileData &F;
|
||||||
|
|
||||||
// If we know the IdentifierInfo in advance, it is here and we will
|
// If we know the IdentifierInfo in advance, it is here and we will
|
||||||
// not build a new one. Used when deserializing information about an
|
// not build a new one. Used when deserializing information about an
|
||||||
|
@ -584,9 +584,9 @@ public:
|
||||||
|
|
||||||
typedef external_key_type internal_key_type;
|
typedef external_key_type internal_key_type;
|
||||||
|
|
||||||
ASTIdentifierLookupTrait(ASTReader &Reader, llvm::BitstreamCursor &Stream,
|
ASTIdentifierLookupTrait(ASTReader &Reader, ASTReader::PerFileData &F,
|
||||||
IdentifierInfo *II = 0)
|
IdentifierInfo *II = 0)
|
||||||
: Reader(Reader), Stream(Stream), KnownII(II) { }
|
: Reader(Reader), F(F), KnownII(II) { }
|
||||||
|
|
||||||
static bool EqualKey(const internal_key_type& a,
|
static bool EqualKey(const internal_key_type& a,
|
||||||
const internal_key_type& b) {
|
const internal_key_type& b) {
|
||||||
|
@ -678,7 +678,7 @@ public:
|
||||||
// definition.
|
// definition.
|
||||||
if (hasMacroDefinition) {
|
if (hasMacroDefinition) {
|
||||||
uint32_t Offset = ReadUnalignedLE32(d);
|
uint32_t Offset = ReadUnalignedLE32(d);
|
||||||
Reader.ReadMacroRecord(Stream, Offset);
|
Reader.ReadMacroRecord(F, Offset);
|
||||||
DataLen -= 4;
|
DataLen -= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,8 +952,9 @@ bool ASTReader::CheckPredefinesBuffers() {
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// \brief Read the line table in the source manager block.
|
/// \brief Read the line table in the source manager block.
|
||||||
/// \returns true if ther was an error.
|
/// \returns true if there was an error.
|
||||||
bool ASTReader::ParseLineTable(llvm::SmallVectorImpl<uint64_t> &Record) {
|
bool ASTReader::ParseLineTable(PerFileData &F,
|
||||||
|
llvm::SmallVectorImpl<uint64_t> &Record) {
|
||||||
unsigned Idx = 0;
|
unsigned Idx = 0;
|
||||||
LineTableInfo &LineTable = SourceMgr.getLineTable();
|
LineTableInfo &LineTable = SourceMgr.getLineTable();
|
||||||
|
|
||||||
|
@ -1163,7 +1164,7 @@ ASTReader::ASTReadResult ASTReader::ReadSourceManagerBlock(PerFileData &F) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SM_LINE_TABLE:
|
case SM_LINE_TABLE:
|
||||||
if (ParseLineTable(Record))
|
if (ParseLineTable(F, Record))
|
||||||
return Failure;
|
return Failure;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1178,7 +1179,7 @@ ASTReader::ASTReadResult ASTReader::ReadSourceManagerBlock(PerFileData &F) {
|
||||||
|
|
||||||
/// \brief Get a cursor that's correctly positioned for reading the source
|
/// \brief Get a cursor that's correctly positioned for reading the source
|
||||||
/// location entry with the given ID.
|
/// location entry with the given ID.
|
||||||
llvm::BitstreamCursor &ASTReader::SLocCursorForID(unsigned ID) {
|
ASTReader::PerFileData *ASTReader::SLocCursorForID(unsigned ID) {
|
||||||
assert(ID != 0 && ID <= TotalNumSLocEntries &&
|
assert(ID != 0 && ID <= TotalNumSLocEntries &&
|
||||||
"SLocCursorForID should only be called for real IDs.");
|
"SLocCursorForID should only be called for real IDs.");
|
||||||
|
|
||||||
|
@ -1193,7 +1194,7 @@ llvm::BitstreamCursor &ASTReader::SLocCursorForID(unsigned ID) {
|
||||||
assert(F && F->LocalNumSLocEntries > ID && "Chain corrupted");
|
assert(F && F->LocalNumSLocEntries > ID && "Chain corrupted");
|
||||||
|
|
||||||
F->SLocEntryCursor.JumpToBit(F->SLocOffsets[ID]);
|
F->SLocEntryCursor.JumpToBit(F->SLocOffsets[ID]);
|
||||||
return F->SLocEntryCursor;
|
return F;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Read in the source location entry with the given ID.
|
/// \brief Read in the source location entry with the given ID.
|
||||||
|
@ -1206,7 +1207,8 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(unsigned ID) {
|
||||||
return Failure;
|
return Failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::BitstreamCursor &SLocEntryCursor = SLocCursorForID(ID);
|
PerFileData *F = SLocCursorForID(ID);
|
||||||
|
llvm::BitstreamCursor &SLocEntryCursor = F->SLocEntryCursor;
|
||||||
|
|
||||||
++NumSLocEntriesRead;
|
++NumSLocEntriesRead;
|
||||||
unsigned Code = SLocEntryCursor.ReadCode();
|
unsigned Code = SLocEntryCursor.ReadCode();
|
||||||
|
@ -1257,7 +1259,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(unsigned ID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FileID FID = SourceMgr.createFileID(File,
|
FileID FID = SourceMgr.createFileID(File,
|
||||||
SourceLocation::getFromRawEncoding(Record[1]),
|
ReadSourceLocation(*F, Record[1]),
|
||||||
(SrcMgr::CharacteristicKind)Record[2],
|
(SrcMgr::CharacteristicKind)Record[2],
|
||||||
ID, Record[0]);
|
ID, Record[0]);
|
||||||
if (Record[3])
|
if (Record[3])
|
||||||
|
@ -1305,11 +1307,10 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(unsigned ID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case SM_SLOC_INSTANTIATION_ENTRY: {
|
case SM_SLOC_INSTANTIATION_ENTRY: {
|
||||||
SourceLocation SpellingLoc
|
SourceLocation SpellingLoc = ReadSourceLocation(*F, Record[1]);
|
||||||
= SourceLocation::getFromRawEncoding(Record[1]);
|
|
||||||
SourceMgr.createInstantiationLoc(SpellingLoc,
|
SourceMgr.createInstantiationLoc(SpellingLoc,
|
||||||
SourceLocation::getFromRawEncoding(Record[2]),
|
ReadSourceLocation(*F, Record[2]),
|
||||||
SourceLocation::getFromRawEncoding(Record[3]),
|
ReadSourceLocation(*F, Record[3]),
|
||||||
Record[4],
|
Record[4],
|
||||||
ID,
|
ID,
|
||||||
Record[0]);
|
Record[0]);
|
||||||
|
@ -1340,8 +1341,9 @@ bool ASTReader::ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){
|
void ASTReader::ReadMacroRecord(PerFileData &F, uint64_t Offset) {
|
||||||
assert(PP && "Forgot to set Preprocessor ?");
|
assert(PP && "Forgot to set Preprocessor ?");
|
||||||
|
llvm::BitstreamCursor &Stream = F.Stream;
|
||||||
|
|
||||||
// Keep track of where we are in the stream, then jump back there
|
// Keep track of where we are in the stream, then jump back there
|
||||||
// after reading this macro.
|
// after reading this macro.
|
||||||
|
@ -1391,7 +1393,7 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){
|
||||||
Error("macro must have a name in AST file");
|
Error("macro must have a name in AST file");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SourceLocation Loc = SourceLocation::getFromRawEncoding(Record[1]);
|
SourceLocation Loc = ReadSourceLocation(F, Record[1]);
|
||||||
bool isUsed = Record[2];
|
bool isUsed = Record[2];
|
||||||
|
|
||||||
MacroInfo *MI = PP->AllocateMacroInfo(Loc);
|
MacroInfo *MI = PP->AllocateMacroInfo(Loc);
|
||||||
|
@ -1441,7 +1443,7 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){
|
||||||
|
|
||||||
Token Tok;
|
Token Tok;
|
||||||
Tok.startToken();
|
Tok.startToken();
|
||||||
Tok.setLocation(SourceLocation::getFromRawEncoding(Record[0]));
|
Tok.setLocation(ReadSourceLocation(F, Record[0]));
|
||||||
Tok.setLength(Record[1]);
|
Tok.setLength(Record[1]);
|
||||||
if (IdentifierInfo *II = DecodeIdentifierInfo(Record[2]))
|
if (IdentifierInfo *II = DecodeIdentifierInfo(Record[2]))
|
||||||
Tok.setIdentifierInfo(II);
|
Tok.setIdentifierInfo(II);
|
||||||
|
@ -1469,9 +1471,8 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){
|
||||||
|
|
||||||
MacroInstantiation *MI
|
MacroInstantiation *MI
|
||||||
= new (PPRec) MacroInstantiation(DecodeIdentifierInfo(Record[3]),
|
= new (PPRec) MacroInstantiation(DecodeIdentifierInfo(Record[3]),
|
||||||
SourceRange(
|
SourceRange(ReadSourceLocation(F, Record[1]),
|
||||||
SourceLocation::getFromRawEncoding(Record[1]),
|
ReadSourceLocation(F, Record[2])),
|
||||||
SourceLocation::getFromRawEncoding(Record[2])),
|
|
||||||
getMacroDefinition(Record[4]));
|
getMacroDefinition(Record[4]));
|
||||||
PPRec.SetPreallocatedEntity(Record[0], MI);
|
PPRec.SetPreallocatedEntity(Record[0], MI);
|
||||||
return;
|
return;
|
||||||
|
@ -1504,10 +1505,10 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){
|
||||||
if (!MacroDefinitionsLoaded[Record[1] - 1]) {
|
if (!MacroDefinitionsLoaded[Record[1] - 1]) {
|
||||||
MacroDefinition *MD
|
MacroDefinition *MD
|
||||||
= new (PPRec) MacroDefinition(II,
|
= new (PPRec) MacroDefinition(II,
|
||||||
SourceLocation::getFromRawEncoding(Record[5]),
|
ReadSourceLocation(F, Record[5]),
|
||||||
SourceRange(
|
SourceRange(
|
||||||
SourceLocation::getFromRawEncoding(Record[2]),
|
ReadSourceLocation(F, Record[2]),
|
||||||
SourceLocation::getFromRawEncoding(Record[3])));
|
ReadSourceLocation(F, Record[3])));
|
||||||
|
|
||||||
PPRec.SetPreallocatedEntity(Record[0], MD);
|
PPRec.SetPreallocatedEntity(Record[0], MD);
|
||||||
MacroDefinitionsLoaded[Record[1] - 1] = MD;
|
MacroDefinitionsLoaded[Record[1] - 1] = MD;
|
||||||
|
@ -1524,7 +1525,8 @@ void ASTReader::ReadMacroRecord(llvm::BitstreamCursor &Stream, uint64_t Offset){
|
||||||
|
|
||||||
void ASTReader::ReadDefinedMacros() {
|
void ASTReader::ReadDefinedMacros() {
|
||||||
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
|
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
|
||||||
llvm::BitstreamCursor &MacroCursor = Chain[N - I - 1]->MacroCursor;
|
PerFileData &F = *Chain[N - I - 1];
|
||||||
|
llvm::BitstreamCursor &MacroCursor = F.MacroCursor;
|
||||||
|
|
||||||
// If there was no preprocessor block, skip this file.
|
// If there was no preprocessor block, skip this file.
|
||||||
if (!MacroCursor.getBitStreamReader())
|
if (!MacroCursor.getBitStreamReader())
|
||||||
|
@ -1584,7 +1586,7 @@ void ASTReader::ReadDefinedMacros() {
|
||||||
case PP_MACRO_DEFINITION:
|
case PP_MACRO_DEFINITION:
|
||||||
// Read the macro record.
|
// Read the macro record.
|
||||||
// FIXME: That's a stupid way to do this. We should reuse this cursor.
|
// FIXME: That's a stupid way to do this. We should reuse this cursor.
|
||||||
ReadMacroRecord(Chain[N - I - 1]->Stream, Offset);
|
ReadMacroRecord(F, Offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1600,7 +1602,7 @@ MacroDefinition *ASTReader::getMacroDefinition(MacroID ID) {
|
||||||
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
|
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
|
||||||
PerFileData &F = *Chain[N - I - 1];
|
PerFileData &F = *Chain[N - I - 1];
|
||||||
if (Index < F.LocalNumMacroDefinitions) {
|
if (Index < F.LocalNumMacroDefinitions) {
|
||||||
ReadMacroRecord(F.Stream, F.MacroDefinitionOffsets[Index]);
|
ReadMacroRecord(F, F.MacroDefinitionOffsets[Index]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Index -= F.LocalNumMacroDefinitions;
|
Index -= F.LocalNumMacroDefinitions;
|
||||||
|
@ -1713,7 +1715,7 @@ ASTReader::ReadASTBlock(PerFileData &F) {
|
||||||
const char *BlobStart = 0;
|
const char *BlobStart = 0;
|
||||||
unsigned BlobLen = 0;
|
unsigned BlobLen = 0;
|
||||||
switch ((ASTRecordTypes)Stream.ReadRecord(Code, Record,
|
switch ((ASTRecordTypes)Stream.ReadRecord(Code, Record,
|
||||||
&BlobStart, &BlobLen)) {
|
&BlobStart, &BlobLen)) {
|
||||||
default: // Default behavior: ignore.
|
default: // Default behavior: ignore.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1823,7 +1825,7 @@ ASTReader::ReadASTBlock(PerFileData &F) {
|
||||||
= ASTIdentifierLookupTable::Create(
|
= ASTIdentifierLookupTable::Create(
|
||||||
(const unsigned char *)F.IdentifierTableData + Record[0],
|
(const unsigned char *)F.IdentifierTableData + Record[0],
|
||||||
(const unsigned char *)F.IdentifierTableData,
|
(const unsigned char *)F.IdentifierTableData,
|
||||||
ASTIdentifierLookupTrait(*this, F.Stream));
|
ASTIdentifierLookupTrait(*this, F));
|
||||||
if (PP)
|
if (PP)
|
||||||
PP->getIdentifierTable().setExternalIdentifierLookup(this);
|
PP->getIdentifierTable().setExternalIdentifierLookup(this);
|
||||||
}
|
}
|
||||||
|
@ -1911,11 +1913,7 @@ ASTReader::ReadASTBlock(PerFileData &F) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REFERENCED_SELECTOR_POOL:
|
case REFERENCED_SELECTOR_POOL:
|
||||||
if (ReferencedSelectorsData.empty())
|
F.ReferencedSelectorsData.swap(Record);
|
||||||
ReferencedSelectorsData.swap(Record);
|
|
||||||
else
|
|
||||||
ReferencedSelectorsData.insert(ReferencedSelectorsData.end(),
|
|
||||||
Record.begin(), Record.end());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PP_COUNTER_VALUE:
|
case PP_COUNTER_VALUE:
|
||||||
|
@ -1971,12 +1969,7 @@ ASTReader::ReadASTBlock(PerFileData &F) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PENDING_IMPLICIT_INSTANTIATIONS:
|
case PENDING_IMPLICIT_INSTANTIATIONS:
|
||||||
// Optimization for the first block.
|
F.PendingInstantiations.swap(Record);
|
||||||
if (PendingInstantiations.empty())
|
|
||||||
PendingInstantiations.swap(Record);
|
|
||||||
else
|
|
||||||
PendingInstantiations.insert(PendingInstantiations.end(),
|
|
||||||
Record.begin(), Record.end());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SEMA_DECL_REFS:
|
case SEMA_DECL_REFS:
|
||||||
|
@ -2112,7 +2105,7 @@ ASTReader::ASTReadResult ASTReader::ReadAST(const std::string &FileName) {
|
||||||
for (unsigned I = 0, N = Identifiers.size(); I != N; ++I) {
|
for (unsigned I = 0, N = Identifiers.size(); I != N; ++I) {
|
||||||
IdentifierInfo *II = Identifiers[I];
|
IdentifierInfo *II = Identifiers[I];
|
||||||
// Look in the on-disk hash tables for an entry for this identifier
|
// Look in the on-disk hash tables for an entry for this identifier
|
||||||
ASTIdentifierLookupTrait Info(*this, Chain[J]->Stream, II);
|
ASTIdentifierLookupTrait Info(*this, *Chain[J], II);
|
||||||
std::pair<const char*,unsigned> Key(II->getNameStart(),II->getLength());
|
std::pair<const char*,unsigned> Key(II->getNameStart(),II->getLength());
|
||||||
ASTIdentifierLookupTable::iterator Pos = IdTable->find(Key, &Info);
|
ASTIdentifierLookupTable::iterator Pos = IdTable->find(Key, &Info);
|
||||||
if (Pos == IdTable->end())
|
if (Pos == IdTable->end())
|
||||||
|
@ -2518,7 +2511,7 @@ ASTReader::RecordLocation ASTReader::TypeCursorForIndex(unsigned Index) {
|
||||||
Index -= F->LocalNumTypes;
|
Index -= F->LocalNumTypes;
|
||||||
}
|
}
|
||||||
assert(F && F->LocalNumTypes > Index && "Broken chain");
|
assert(F && F->LocalNumTypes > Index && "Broken chain");
|
||||||
return RecordLocation(&F->DeclsCursor, F->TypeOffsets[Index]);
|
return RecordLocation(F, F->TypeOffsets[Index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Read and return the type with the given index..
|
/// \brief Read and return the type with the given index..
|
||||||
|
@ -2529,7 +2522,7 @@ ASTReader::RecordLocation ASTReader::TypeCursorForIndex(unsigned Index) {
|
||||||
/// IDs.
|
/// IDs.
|
||||||
QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
RecordLocation Loc = TypeCursorForIndex(Index);
|
RecordLocation Loc = TypeCursorForIndex(Index);
|
||||||
llvm::BitstreamCursor &DeclsCursor = *Loc.first;
|
llvm::BitstreamCursor &DeclsCursor = Loc.F->DeclsCursor;
|
||||||
|
|
||||||
// Keep track of where we are in the stream, then jump back there
|
// Keep track of where we are in the stream, then jump back there
|
||||||
// after reading this type.
|
// after reading this type.
|
||||||
|
@ -2540,7 +2533,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
// Note that we are loading a type record.
|
// Note that we are loading a type record.
|
||||||
Deserializing AType(this);
|
Deserializing AType(this);
|
||||||
|
|
||||||
DeclsCursor.JumpToBit(Loc.second);
|
DeclsCursor.JumpToBit(Loc.Offset);
|
||||||
RecordData Record;
|
RecordData Record;
|
||||||
unsigned Code = DeclsCursor.ReadCode();
|
unsigned Code = DeclsCursor.ReadCode();
|
||||||
switch ((TypeCode)DeclsCursor.ReadRecord(Code, Record)) {
|
switch ((TypeCode)DeclsCursor.ReadRecord(Code, Record)) {
|
||||||
|
@ -2630,9 +2623,9 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
QualType ElementType = GetType(Record[0]);
|
QualType ElementType = GetType(Record[0]);
|
||||||
ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1];
|
ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1];
|
||||||
unsigned IndexTypeQuals = Record[2];
|
unsigned IndexTypeQuals = Record[2];
|
||||||
SourceLocation LBLoc = SourceLocation::getFromRawEncoding(Record[3]);
|
SourceLocation LBLoc = ReadSourceLocation(*Loc.F, Record[3]);
|
||||||
SourceLocation RBLoc = SourceLocation::getFromRawEncoding(Record[4]);
|
SourceLocation RBLoc = ReadSourceLocation(*Loc.F, Record[4]);
|
||||||
return Context->getVariableArrayType(ElementType, ReadExpr(DeclsCursor),
|
return Context->getVariableArrayType(ElementType, ReadExpr(*Loc.F),
|
||||||
ASM, IndexTypeQuals,
|
ASM, IndexTypeQuals,
|
||||||
SourceRange(LBLoc, RBLoc));
|
SourceRange(LBLoc, RBLoc));
|
||||||
}
|
}
|
||||||
|
@ -2712,7 +2705,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_TYPEOF_EXPR:
|
case TYPE_TYPEOF_EXPR:
|
||||||
return Context->getTypeOfExprType(ReadExpr(DeclsCursor));
|
return Context->getTypeOfExprType(ReadExpr(*Loc.F));
|
||||||
|
|
||||||
case TYPE_TYPEOF: {
|
case TYPE_TYPEOF: {
|
||||||
if (Record.size() != 1) {
|
if (Record.size() != 1) {
|
||||||
|
@ -2724,7 +2717,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_DECLTYPE:
|
case TYPE_DECLTYPE:
|
||||||
return Context->getDecltypeType(ReadExpr(DeclsCursor));
|
return Context->getDecltypeType(ReadExpr(*Loc.F));
|
||||||
|
|
||||||
case TYPE_RECORD: {
|
case TYPE_RECORD: {
|
||||||
if (Record.size() != 2) {
|
if (Record.size() != 2) {
|
||||||
|
@ -2823,7 +2816,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
llvm::SmallVector<TemplateArgument, 8> Args;
|
llvm::SmallVector<TemplateArgument, 8> Args;
|
||||||
Args.reserve(NumArgs);
|
Args.reserve(NumArgs);
|
||||||
while (NumArgs--)
|
while (NumArgs--)
|
||||||
Args.push_back(ReadTemplateArgument(DeclsCursor, Record, Idx));
|
Args.push_back(ReadTemplateArgument(*Loc.F, Record, Idx));
|
||||||
return Context->getDependentTemplateSpecializationType(Keyword, NNS, Name,
|
return Context->getDependentTemplateSpecializationType(Keyword, NNS, Name,
|
||||||
Args.size(), Args.data());
|
Args.size(), Args.data());
|
||||||
}
|
}
|
||||||
|
@ -2838,8 +2831,8 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
unsigned IndexTypeQuals = Record[Idx++];
|
unsigned IndexTypeQuals = Record[Idx++];
|
||||||
|
|
||||||
// DependentSizedArrayType
|
// DependentSizedArrayType
|
||||||
Expr *NumElts = ReadExpr(DeclsCursor);
|
Expr *NumElts = ReadExpr(*Loc.F);
|
||||||
SourceRange Brackets = ReadSourceRange(Record, Idx);
|
SourceRange Brackets = ReadSourceRange(*Loc.F, Record, Idx);
|
||||||
|
|
||||||
return Context->getDependentSizedArrayType(ElementType, NumElts, ASM,
|
return Context->getDependentSizedArrayType(ElementType, NumElts, ASM,
|
||||||
IndexTypeQuals, Brackets);
|
IndexTypeQuals, Brackets);
|
||||||
|
@ -2850,7 +2843,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
bool IsDependent = Record[Idx++];
|
bool IsDependent = Record[Idx++];
|
||||||
TemplateName Name = ReadTemplateName(Record, Idx);
|
TemplateName Name = ReadTemplateName(Record, Idx);
|
||||||
llvm::SmallVector<TemplateArgument, 8> Args;
|
llvm::SmallVector<TemplateArgument, 8> Args;
|
||||||
ReadTemplateArgumentList(Args, DeclsCursor, Record, Idx);
|
ReadTemplateArgumentList(Args, *Loc.F, Record, Idx);
|
||||||
QualType Canon = GetType(Record[Idx++]);
|
QualType Canon = GetType(Record[Idx++]);
|
||||||
QualType T;
|
QualType T;
|
||||||
if (Canon.isNull())
|
if (Canon.isNull())
|
||||||
|
@ -2867,18 +2860,23 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
return QualType();
|
return QualType();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
class clang::TypeLocReader : public TypeLocVisitor<TypeLocReader> {
|
||||||
|
|
||||||
class TypeLocReader : public TypeLocVisitor<TypeLocReader> {
|
|
||||||
ASTReader &Reader;
|
ASTReader &Reader;
|
||||||
|
ASTReader::PerFileData &F;
|
||||||
llvm::BitstreamCursor &DeclsCursor;
|
llvm::BitstreamCursor &DeclsCursor;
|
||||||
const ASTReader::RecordData &Record;
|
const ASTReader::RecordData &Record;
|
||||||
unsigned &Idx;
|
unsigned &Idx;
|
||||||
|
|
||||||
|
SourceLocation ReadSourceLocation(const ASTReader::RecordData &R,
|
||||||
|
unsigned &I) {
|
||||||
|
return Reader.ReadSourceLocation(F, R, I);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TypeLocReader(ASTReader &Reader, llvm::BitstreamCursor &Cursor,
|
TypeLocReader(ASTReader &Reader, ASTReader::PerFileData &F,
|
||||||
const ASTReader::RecordData &Record, unsigned &Idx)
|
const ASTReader::RecordData &Record, unsigned &Idx)
|
||||||
: Reader(Reader), DeclsCursor(Cursor), Record(Record), Idx(Idx) { }
|
: Reader(Reader), F(F), DeclsCursor(F.DeclsCursor), Record(Record), Idx(Idx)
|
||||||
|
{ }
|
||||||
|
|
||||||
// We want compile-time assurance that we've enumerated all of
|
// We want compile-time assurance that we've enumerated all of
|
||||||
// these, so unfortunately we have to declare them first, then
|
// these, so unfortunately we have to declare them first, then
|
||||||
|
@ -2892,13 +2890,11 @@ public:
|
||||||
void VisitArrayTypeLoc(ArrayTypeLoc);
|
void VisitArrayTypeLoc(ArrayTypeLoc);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void TypeLocReader::VisitQualifiedTypeLoc(QualifiedTypeLoc TL) {
|
void TypeLocReader::VisitQualifiedTypeLoc(QualifiedTypeLoc TL) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitBuiltinTypeLoc(BuiltinTypeLoc TL) {
|
void TypeLocReader::VisitBuiltinTypeLoc(BuiltinTypeLoc TL) {
|
||||||
TL.setBuiltinLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setBuiltinLoc(ReadSourceLocation(Record, Idx));
|
||||||
if (TL.needsExtraLocalData()) {
|
if (TL.needsExtraLocalData()) {
|
||||||
TL.setWrittenTypeSpec(static_cast<DeclSpec::TST>(Record[Idx++]));
|
TL.setWrittenTypeSpec(static_cast<DeclSpec::TST>(Record[Idx++]));
|
||||||
TL.setWrittenSignSpec(static_cast<DeclSpec::TSS>(Record[Idx++]));
|
TL.setWrittenSignSpec(static_cast<DeclSpec::TSS>(Record[Idx++]));
|
||||||
|
@ -2907,28 +2903,28 @@ void TypeLocReader::VisitBuiltinTypeLoc(BuiltinTypeLoc TL) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitComplexTypeLoc(ComplexTypeLoc TL) {
|
void TypeLocReader::VisitComplexTypeLoc(ComplexTypeLoc TL) {
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitPointerTypeLoc(PointerTypeLoc TL) {
|
void TypeLocReader::VisitPointerTypeLoc(PointerTypeLoc TL) {
|
||||||
TL.setStarLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setStarLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitBlockPointerTypeLoc(BlockPointerTypeLoc TL) {
|
void TypeLocReader::VisitBlockPointerTypeLoc(BlockPointerTypeLoc TL) {
|
||||||
TL.setCaretLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setCaretLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitLValueReferenceTypeLoc(LValueReferenceTypeLoc TL) {
|
void TypeLocReader::VisitLValueReferenceTypeLoc(LValueReferenceTypeLoc TL) {
|
||||||
TL.setAmpLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setAmpLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitRValueReferenceTypeLoc(RValueReferenceTypeLoc TL) {
|
void TypeLocReader::VisitRValueReferenceTypeLoc(RValueReferenceTypeLoc TL) {
|
||||||
TL.setAmpAmpLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setAmpAmpLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitMemberPointerTypeLoc(MemberPointerTypeLoc TL) {
|
void TypeLocReader::VisitMemberPointerTypeLoc(MemberPointerTypeLoc TL) {
|
||||||
TL.setStarLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setStarLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitArrayTypeLoc(ArrayTypeLoc TL) {
|
void TypeLocReader::VisitArrayTypeLoc(ArrayTypeLoc TL) {
|
||||||
TL.setLBracketLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setLBracketLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setRBracketLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setRBracketLoc(ReadSourceLocation(Record, Idx));
|
||||||
if (Record[Idx++])
|
if (Record[Idx++])
|
||||||
TL.setSizeExpr(Reader.ReadExpr(DeclsCursor));
|
TL.setSizeExpr(Reader.ReadExpr(F));
|
||||||
else
|
else
|
||||||
TL.setSizeExpr(0);
|
TL.setSizeExpr(0);
|
||||||
}
|
}
|
||||||
|
@ -2947,17 +2943,17 @@ void TypeLocReader::VisitDependentSizedArrayTypeLoc(
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitDependentSizedExtVectorTypeLoc(
|
void TypeLocReader::VisitDependentSizedExtVectorTypeLoc(
|
||||||
DependentSizedExtVectorTypeLoc TL) {
|
DependentSizedExtVectorTypeLoc TL) {
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitVectorTypeLoc(VectorTypeLoc TL) {
|
void TypeLocReader::VisitVectorTypeLoc(VectorTypeLoc TL) {
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitExtVectorTypeLoc(ExtVectorTypeLoc TL) {
|
void TypeLocReader::VisitExtVectorTypeLoc(ExtVectorTypeLoc TL) {
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitFunctionTypeLoc(FunctionTypeLoc TL) {
|
void TypeLocReader::VisitFunctionTypeLoc(FunctionTypeLoc TL) {
|
||||||
TL.setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setLParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setTrailingReturn(Record[Idx++]);
|
TL.setTrailingReturn(Record[Idx++]);
|
||||||
for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i) {
|
for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i) {
|
||||||
TL.setArg(i, cast_or_null<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
|
TL.setArg(i, cast_or_null<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
|
@ -2970,87 +2966,89 @@ void TypeLocReader::VisitFunctionNoProtoTypeLoc(FunctionNoProtoTypeLoc TL) {
|
||||||
VisitFunctionTypeLoc(TL);
|
VisitFunctionTypeLoc(TL);
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitUnresolvedUsingTypeLoc(UnresolvedUsingTypeLoc TL) {
|
void TypeLocReader::VisitUnresolvedUsingTypeLoc(UnresolvedUsingTypeLoc TL) {
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitTypedefTypeLoc(TypedefTypeLoc TL) {
|
void TypeLocReader::VisitTypedefTypeLoc(TypedefTypeLoc TL) {
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitTypeOfExprTypeLoc(TypeOfExprTypeLoc TL) {
|
void TypeLocReader::VisitTypeOfExprTypeLoc(TypeOfExprTypeLoc TL) {
|
||||||
TL.setTypeofLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setTypeofLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setLParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitTypeOfTypeLoc(TypeOfTypeLoc TL) {
|
void TypeLocReader::VisitTypeOfTypeLoc(TypeOfTypeLoc TL) {
|
||||||
TL.setTypeofLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setTypeofLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setLParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setUnderlyingTInfo(Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx));
|
TL.setUnderlyingTInfo(Reader.GetTypeSourceInfo(F, Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitDecltypeTypeLoc(DecltypeTypeLoc TL) {
|
void TypeLocReader::VisitDecltypeTypeLoc(DecltypeTypeLoc TL) {
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitRecordTypeLoc(RecordTypeLoc TL) {
|
void TypeLocReader::VisitRecordTypeLoc(RecordTypeLoc TL) {
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitEnumTypeLoc(EnumTypeLoc TL) {
|
void TypeLocReader::VisitEnumTypeLoc(EnumTypeLoc TL) {
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) {
|
void TypeLocReader::VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) {
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitSubstTemplateTypeParmTypeLoc(
|
void TypeLocReader::VisitSubstTemplateTypeParmTypeLoc(
|
||||||
SubstTemplateTypeParmTypeLoc TL) {
|
SubstTemplateTypeParmTypeLoc TL) {
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitTemplateSpecializationTypeLoc(
|
void TypeLocReader::VisitTemplateSpecializationTypeLoc(
|
||||||
TemplateSpecializationTypeLoc TL) {
|
TemplateSpecializationTypeLoc TL) {
|
||||||
TL.setTemplateNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setTemplateNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setLAngleLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setLAngleLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setRAngleLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setRAngleLoc(ReadSourceLocation(Record, Idx));
|
||||||
for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i)
|
for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i)
|
||||||
TL.setArgLocInfo(i,
|
TL.setArgLocInfo(i,
|
||||||
Reader.GetTemplateArgumentLocInfo(TL.getTypePtr()->getArg(i).getKind(),
|
Reader.GetTemplateArgumentLocInfo(F,
|
||||||
DeclsCursor, Record, Idx));
|
TL.getTypePtr()->getArg(i).getKind(),
|
||||||
|
Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) {
|
void TypeLocReader::VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) {
|
||||||
TL.setKeywordLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setKeywordLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setQualifierRange(Reader.ReadSourceRange(Record, Idx));
|
TL.setQualifierRange(Reader.ReadSourceRange(F, Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitInjectedClassNameTypeLoc(InjectedClassNameTypeLoc TL) {
|
void TypeLocReader::VisitInjectedClassNameTypeLoc(InjectedClassNameTypeLoc TL) {
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitDependentNameTypeLoc(DependentNameTypeLoc TL) {
|
void TypeLocReader::VisitDependentNameTypeLoc(DependentNameTypeLoc TL) {
|
||||||
TL.setKeywordLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setKeywordLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setQualifierRange(Reader.ReadSourceRange(Record, Idx));
|
TL.setQualifierRange(Reader.ReadSourceRange(F, Record, Idx));
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitDependentTemplateSpecializationTypeLoc(
|
void TypeLocReader::VisitDependentTemplateSpecializationTypeLoc(
|
||||||
DependentTemplateSpecializationTypeLoc TL) {
|
DependentTemplateSpecializationTypeLoc TL) {
|
||||||
TL.setKeywordLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setKeywordLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setQualifierRange(Reader.ReadSourceRange(Record, Idx));
|
TL.setQualifierRange(Reader.ReadSourceRange(F, Record, Idx));
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setLAngleLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setLAngleLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setRAngleLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setRAngleLoc(ReadSourceLocation(Record, Idx));
|
||||||
for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I)
|
for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I)
|
||||||
TL.setArgLocInfo(I,
|
TL.setArgLocInfo(I,
|
||||||
Reader.GetTemplateArgumentLocInfo(TL.getTypePtr()->getArg(I).getKind(),
|
Reader.GetTemplateArgumentLocInfo(F,
|
||||||
DeclsCursor, Record, Idx));
|
TL.getTypePtr()->getArg(I).getKind(),
|
||||||
|
Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL) {
|
void TypeLocReader::VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL) {
|
||||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitObjCObjectTypeLoc(ObjCObjectTypeLoc TL) {
|
void TypeLocReader::VisitObjCObjectTypeLoc(ObjCObjectTypeLoc TL) {
|
||||||
TL.setHasBaseTypeAsWritten(Record[Idx++]);
|
TL.setHasBaseTypeAsWritten(Record[Idx++]);
|
||||||
TL.setLAngleLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setLAngleLoc(ReadSourceLocation(Record, Idx));
|
||||||
TL.setRAngleLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setRAngleLoc(ReadSourceLocation(Record, Idx));
|
||||||
for (unsigned i = 0, e = TL.getNumProtocols(); i != e; ++i)
|
for (unsigned i = 0, e = TL.getNumProtocols(); i != e; ++i)
|
||||||
TL.setProtocolLoc(i, SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setProtocolLoc(i, ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitObjCObjectPointerTypeLoc(ObjCObjectPointerTypeLoc TL) {
|
void TypeLocReader::VisitObjCObjectPointerTypeLoc(ObjCObjectPointerTypeLoc TL) {
|
||||||
TL.setStarLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TL.setStarLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeSourceInfo *ASTReader::GetTypeSourceInfo(llvm::BitstreamCursor &DeclsCursor,
|
TypeSourceInfo *ASTReader::GetTypeSourceInfo(PerFileData &F,
|
||||||
const RecordData &Record,
|
const RecordData &Record,
|
||||||
unsigned &Idx) {
|
unsigned &Idx) {
|
||||||
QualType InfoTy = GetType(Record[Idx++]);
|
QualType InfoTy = GetType(Record[Idx++]);
|
||||||
|
@ -3058,7 +3056,7 @@ TypeSourceInfo *ASTReader::GetTypeSourceInfo(llvm::BitstreamCursor &DeclsCursor,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
TypeSourceInfo *TInfo = getContext()->CreateTypeSourceInfo(InfoTy);
|
TypeSourceInfo *TInfo = getContext()->CreateTypeSourceInfo(InfoTy);
|
||||||
TypeLocReader TLR(*this, DeclsCursor, Record, Idx);
|
TypeLocReader TLR(*this, F, Record, Idx);
|
||||||
for (TypeLoc TL = TInfo->getTypeLoc(); !TL.isNull(); TL = TL.getNextTypeLoc())
|
for (TypeLoc TL = TInfo->getTypeLoc(); !TL.isNull(); TL = TL.getNextTypeLoc())
|
||||||
TLR.Visit(TL);
|
TLR.Visit(TL);
|
||||||
return TInfo;
|
return TInfo;
|
||||||
|
@ -3147,18 +3145,18 @@ TypeIdx ASTReader::GetTypeIdx(QualType T) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
TemplateArgumentLocInfo
|
TemplateArgumentLocInfo
|
||||||
ASTReader::GetTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind,
|
ASTReader::GetTemplateArgumentLocInfo(PerFileData &F,
|
||||||
llvm::BitstreamCursor &DeclsCursor,
|
TemplateArgument::ArgKind Kind,
|
||||||
const RecordData &Record,
|
const RecordData &Record,
|
||||||
unsigned &Index) {
|
unsigned &Index) {
|
||||||
switch (Kind) {
|
switch (Kind) {
|
||||||
case TemplateArgument::Expression:
|
case TemplateArgument::Expression:
|
||||||
return ReadExpr(DeclsCursor);
|
return ReadExpr(F);
|
||||||
case TemplateArgument::Type:
|
case TemplateArgument::Type:
|
||||||
return GetTypeSourceInfo(DeclsCursor, Record, Index);
|
return GetTypeSourceInfo(F, Record, Index);
|
||||||
case TemplateArgument::Template: {
|
case TemplateArgument::Template: {
|
||||||
SourceRange QualifierRange = ReadSourceRange(Record, Index);
|
SourceRange QualifierRange = ReadSourceRange(F, Record, Index);
|
||||||
SourceLocation TemplateNameLoc = ReadSourceLocation(Record, Index);
|
SourceLocation TemplateNameLoc = ReadSourceLocation(F, Record, Index);
|
||||||
return TemplateArgumentLocInfo(QualifierRange, TemplateNameLoc);
|
return TemplateArgumentLocInfo(QualifierRange, TemplateNameLoc);
|
||||||
}
|
}
|
||||||
case TemplateArgument::Null:
|
case TemplateArgument::Null:
|
||||||
|
@ -3172,16 +3170,15 @@ ASTReader::GetTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind,
|
||||||
}
|
}
|
||||||
|
|
||||||
TemplateArgumentLoc
|
TemplateArgumentLoc
|
||||||
ASTReader::ReadTemplateArgumentLoc(llvm::BitstreamCursor &DeclsCursor,
|
ASTReader::ReadTemplateArgumentLoc(PerFileData &F,
|
||||||
const RecordData &Record, unsigned &Index) {
|
const RecordData &Record, unsigned &Index) {
|
||||||
TemplateArgument Arg = ReadTemplateArgument(DeclsCursor, Record, Index);
|
TemplateArgument Arg = ReadTemplateArgument(F, Record, Index);
|
||||||
|
|
||||||
if (Arg.getKind() == TemplateArgument::Expression) {
|
if (Arg.getKind() == TemplateArgument::Expression) {
|
||||||
if (Record[Index++]) // bool InfoHasSameExpr.
|
if (Record[Index++]) // bool InfoHasSameExpr.
|
||||||
return TemplateArgumentLoc(Arg, TemplateArgumentLocInfo(Arg.getAsExpr()));
|
return TemplateArgumentLoc(Arg, TemplateArgumentLocInfo(Arg.getAsExpr()));
|
||||||
}
|
}
|
||||||
return TemplateArgumentLoc(Arg, GetTemplateArgumentLocInfo(Arg.getKind(),
|
return TemplateArgumentLoc(Arg, GetTemplateArgumentLocInfo(F, Arg.getKind(),
|
||||||
DeclsCursor,
|
|
||||||
Record, Index));
|
Record, Index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3231,7 +3228,7 @@ Stmt *ASTReader::GetExternalDeclStmt(uint64_t Offset) {
|
||||||
// Since we know that this statement is part of a decl, make sure to use
|
// Since we know that this statement is part of a decl, make sure to use
|
||||||
// the decl cursor to read it.
|
// the decl cursor to read it.
|
||||||
F.DeclsCursor.JumpToBit(Offset);
|
F.DeclsCursor.JumpToBit(Offset);
|
||||||
return ReadStmtFromStream(F.DeclsCursor);
|
return ReadStmtFromStream(F);
|
||||||
}
|
}
|
||||||
Offset -= F.SizeInBits;
|
Offset -= F.SizeInBits;
|
||||||
}
|
}
|
||||||
|
@ -3453,21 +3450,6 @@ void ASTReader::InitializeSema(Sema &S) {
|
||||||
SemaObj->UnusedFileScopedDecls.push_back(D);
|
SemaObj->UnusedFileScopedDecls.push_back(D);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there were any weak undeclared identifiers, deserialize them and add to
|
|
||||||
// Sema's list of weak undeclared identifiers.
|
|
||||||
if (!WeakUndeclaredIdentifiers.empty()) {
|
|
||||||
unsigned Idx = 0;
|
|
||||||
for (unsigned I = 0, N = WeakUndeclaredIdentifiers[Idx++]; I != N; ++I) {
|
|
||||||
IdentifierInfo *WeakId = GetIdentifierInfo(WeakUndeclaredIdentifiers,Idx);
|
|
||||||
IdentifierInfo *AliasId=GetIdentifierInfo(WeakUndeclaredIdentifiers,Idx);
|
|
||||||
SourceLocation Loc = ReadSourceLocation(WeakUndeclaredIdentifiers, Idx);
|
|
||||||
bool Used = WeakUndeclaredIdentifiers[Idx++];
|
|
||||||
Sema::WeakInfo WI(AliasId, Loc);
|
|
||||||
WI.setUsed(Used);
|
|
||||||
SemaObj->WeakUndeclaredIdentifiers.insert(std::make_pair(WeakId, WI));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there were any locally-scoped external declarations,
|
// If there were any locally-scoped external declarations,
|
||||||
// deserialize them and add them to Sema's table of locally-scoped
|
// deserialize them and add them to Sema's table of locally-scoped
|
||||||
// external declarations.
|
// external declarations.
|
||||||
|
@ -3485,34 +3467,12 @@ void ASTReader::InitializeSema(Sema &S) {
|
||||||
// FIXME: Do VTable uses and dynamic classes deserialize too much ?
|
// FIXME: Do VTable uses and dynamic classes deserialize too much ?
|
||||||
// Can we cut them down before writing them ?
|
// Can we cut them down before writing them ?
|
||||||
|
|
||||||
// If there were any VTable uses, deserialize the information and add it
|
|
||||||
// to Sema's vector and map of VTable uses.
|
|
||||||
if (!VTableUses.empty()) {
|
|
||||||
unsigned Idx = 0;
|
|
||||||
for (unsigned I = 0, N = VTableUses[Idx++]; I != N; ++I) {
|
|
||||||
CXXRecordDecl *Class = cast<CXXRecordDecl>(GetDecl(VTableUses[Idx++]));
|
|
||||||
SourceLocation Loc = ReadSourceLocation(VTableUses, Idx);
|
|
||||||
bool DefinitionRequired = VTableUses[Idx++];
|
|
||||||
SemaObj->VTableUses.push_back(std::make_pair(Class, Loc));
|
|
||||||
SemaObj->VTablesUsed[Class] = DefinitionRequired;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there were any dynamic classes declarations, deserialize them
|
// If there were any dynamic classes declarations, deserialize them
|
||||||
// and add them to Sema's vector of such declarations.
|
// and add them to Sema's vector of such declarations.
|
||||||
for (unsigned I = 0, N = DynamicClasses.size(); I != N; ++I)
|
for (unsigned I = 0, N = DynamicClasses.size(); I != N; ++I)
|
||||||
SemaObj->DynamicClasses.push_back(
|
SemaObj->DynamicClasses.push_back(
|
||||||
cast<CXXRecordDecl>(GetDecl(DynamicClasses[I])));
|
cast<CXXRecordDecl>(GetDecl(DynamicClasses[I])));
|
||||||
|
|
||||||
// If there were any pending implicit instantiations, deserialize them
|
|
||||||
// and add them to Sema's queue of such instantiations.
|
|
||||||
assert(PendingInstantiations.size() % 2 == 0 && "Expected pairs of entries");
|
|
||||||
for (unsigned Idx = 0, N = PendingInstantiations.size(); Idx < N;) {
|
|
||||||
ValueDecl *D=cast<ValueDecl>(GetDecl(PendingInstantiations[Idx++]));
|
|
||||||
SourceLocation Loc = ReadSourceLocation(PendingInstantiations, Idx);
|
|
||||||
SemaObj->PendingInstantiations.push_back(std::make_pair(D, Loc));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the offsets of the declarations that Sema references.
|
// Load the offsets of the declarations that Sema references.
|
||||||
// They will be lazily deserialized when needed.
|
// They will be lazily deserialized when needed.
|
||||||
if (!SemaDeclRefs.empty()) {
|
if (!SemaDeclRefs.empty()) {
|
||||||
|
@ -3521,16 +3481,61 @@ void ASTReader::InitializeSema(Sema &S) {
|
||||||
SemaObj->StdBadAlloc = SemaDeclRefs[1];
|
SemaObj->StdBadAlloc = SemaDeclRefs[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are @selector references added them to its pool. This is for
|
for (PerFileData *F = FirstInSource; F; F = F->NextInSource) {
|
||||||
// implementation of -Wselector.
|
|
||||||
if (!ReferencedSelectorsData.empty()) {
|
// If there are @selector references added them to its pool. This is for
|
||||||
unsigned int DataSize = ReferencedSelectorsData.size()-1;
|
// implementation of -Wselector.
|
||||||
unsigned I = 0;
|
if (!F->ReferencedSelectorsData.empty()) {
|
||||||
while (I < DataSize) {
|
unsigned int DataSize = F->ReferencedSelectorsData.size()-1;
|
||||||
Selector Sel = DecodeSelector(ReferencedSelectorsData[I++]);
|
unsigned I = 0;
|
||||||
SourceLocation SelLoc =
|
while (I < DataSize) {
|
||||||
SourceLocation::getFromRawEncoding(ReferencedSelectorsData[I++]);
|
Selector Sel = DecodeSelector(F->ReferencedSelectorsData[I++]);
|
||||||
SemaObj->ReferencedSelectors.insert(std::make_pair(Sel, SelLoc));
|
SourceLocation SelLoc = ReadSourceLocation(
|
||||||
|
*F, F->ReferencedSelectorsData, I);
|
||||||
|
SemaObj->ReferencedSelectors.insert(std::make_pair(Sel, SelLoc));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there were any pending implicit instantiations, deserialize them
|
||||||
|
// and add them to Sema's queue of such instantiations.
|
||||||
|
assert(F->PendingInstantiations.size() % 2 == 0 &&
|
||||||
|
"Expected pairs of entries");
|
||||||
|
for (unsigned Idx = 0, N = F->PendingInstantiations.size(); Idx < N;) {
|
||||||
|
ValueDecl *D=cast<ValueDecl>(GetDecl(F->PendingInstantiations[Idx++]));
|
||||||
|
SourceLocation Loc = ReadSourceLocation(*F, F->PendingInstantiations,Idx);
|
||||||
|
SemaObj->PendingInstantiations.push_back(std::make_pair(D, Loc));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The two special data sets below always come from the most recent PCH,
|
||||||
|
// which is at the front of the chain.
|
||||||
|
PerFileData &F = *Chain.front();
|
||||||
|
|
||||||
|
// If there were any weak undeclared identifiers, deserialize them and add to
|
||||||
|
// Sema's list of weak undeclared identifiers.
|
||||||
|
if (!WeakUndeclaredIdentifiers.empty()) {
|
||||||
|
unsigned Idx = 0;
|
||||||
|
for (unsigned I = 0, N = WeakUndeclaredIdentifiers[Idx++]; I != N; ++I) {
|
||||||
|
IdentifierInfo *WeakId = GetIdentifierInfo(WeakUndeclaredIdentifiers,Idx);
|
||||||
|
IdentifierInfo *AliasId= GetIdentifierInfo(WeakUndeclaredIdentifiers,Idx);
|
||||||
|
SourceLocation Loc = ReadSourceLocation(F, WeakUndeclaredIdentifiers,Idx);
|
||||||
|
bool Used = WeakUndeclaredIdentifiers[Idx++];
|
||||||
|
Sema::WeakInfo WI(AliasId, Loc);
|
||||||
|
WI.setUsed(Used);
|
||||||
|
SemaObj->WeakUndeclaredIdentifiers.insert(std::make_pair(WeakId, WI));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there were any VTable uses, deserialize the information and add it
|
||||||
|
// to Sema's vector and map of VTable uses.
|
||||||
|
if (!VTableUses.empty()) {
|
||||||
|
unsigned Idx = 0;
|
||||||
|
for (unsigned I = 0, N = VTableUses[Idx++]; I != N; ++I) {
|
||||||
|
CXXRecordDecl *Class = cast<CXXRecordDecl>(GetDecl(VTableUses[Idx++]));
|
||||||
|
SourceLocation Loc = ReadSourceLocation(F, VTableUses, Idx);
|
||||||
|
bool DefinitionRequired = VTableUses[Idx++];
|
||||||
|
SemaObj->VTableUses.push_back(std::make_pair(Class, Loc));
|
||||||
|
SemaObj->VTablesUsed[Class] = DefinitionRequired;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3806,7 +3811,7 @@ ASTReader::ReadTemplateName(const RecordData &Record, unsigned &Idx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TemplateArgument
|
TemplateArgument
|
||||||
ASTReader::ReadTemplateArgument(llvm::BitstreamCursor &DeclsCursor,
|
ASTReader::ReadTemplateArgument(PerFileData &F,
|
||||||
const RecordData &Record, unsigned &Idx) {
|
const RecordData &Record, unsigned &Idx) {
|
||||||
switch ((TemplateArgument::ArgKind)Record[Idx++]) {
|
switch ((TemplateArgument::ArgKind)Record[Idx++]) {
|
||||||
case TemplateArgument::Null:
|
case TemplateArgument::Null:
|
||||||
|
@ -3823,13 +3828,13 @@ ASTReader::ReadTemplateArgument(llvm::BitstreamCursor &DeclsCursor,
|
||||||
case TemplateArgument::Template:
|
case TemplateArgument::Template:
|
||||||
return TemplateArgument(ReadTemplateName(Record, Idx));
|
return TemplateArgument(ReadTemplateName(Record, Idx));
|
||||||
case TemplateArgument::Expression:
|
case TemplateArgument::Expression:
|
||||||
return TemplateArgument(ReadExpr(DeclsCursor));
|
return TemplateArgument(ReadExpr(F));
|
||||||
case TemplateArgument::Pack: {
|
case TemplateArgument::Pack: {
|
||||||
unsigned NumArgs = Record[Idx++];
|
unsigned NumArgs = Record[Idx++];
|
||||||
llvm::SmallVector<TemplateArgument, 8> Args;
|
llvm::SmallVector<TemplateArgument, 8> Args;
|
||||||
Args.reserve(NumArgs);
|
Args.reserve(NumArgs);
|
||||||
while (NumArgs--)
|
while (NumArgs--)
|
||||||
Args.push_back(ReadTemplateArgument(DeclsCursor, Record, Idx));
|
Args.push_back(ReadTemplateArgument(F, Record, Idx));
|
||||||
TemplateArgument TemplArg;
|
TemplateArgument TemplArg;
|
||||||
TemplArg.setArgumentPack(Args.data(), Args.size(), /*CopyArgs=*/true);
|
TemplArg.setArgumentPack(Args.data(), Args.size(), /*CopyArgs=*/true);
|
||||||
return TemplArg;
|
return TemplArg;
|
||||||
|
@ -3841,10 +3846,11 @@ ASTReader::ReadTemplateArgument(llvm::BitstreamCursor &DeclsCursor,
|
||||||
}
|
}
|
||||||
|
|
||||||
TemplateParameterList *
|
TemplateParameterList *
|
||||||
ASTReader::ReadTemplateParameterList(const RecordData &Record, unsigned &Idx) {
|
ASTReader::ReadTemplateParameterList(PerFileData &F,
|
||||||
SourceLocation TemplateLoc = ReadSourceLocation(Record, Idx);
|
const RecordData &Record, unsigned &Idx) {
|
||||||
SourceLocation LAngleLoc = ReadSourceLocation(Record, Idx);
|
SourceLocation TemplateLoc = ReadSourceLocation(F, Record, Idx);
|
||||||
SourceLocation RAngleLoc = ReadSourceLocation(Record, Idx);
|
SourceLocation LAngleLoc = ReadSourceLocation(F, Record, Idx);
|
||||||
|
SourceLocation RAngleLoc = ReadSourceLocation(F, Record, Idx);
|
||||||
|
|
||||||
unsigned NumParams = Record[Idx++];
|
unsigned NumParams = Record[Idx++];
|
||||||
llvm::SmallVector<NamedDecl *, 16> Params;
|
llvm::SmallVector<NamedDecl *, 16> Params;
|
||||||
|
@ -3861,12 +3867,12 @@ ASTReader::ReadTemplateParameterList(const RecordData &Record, unsigned &Idx) {
|
||||||
void
|
void
|
||||||
ASTReader::
|
ASTReader::
|
||||||
ReadTemplateArgumentList(llvm::SmallVector<TemplateArgument, 8> &TemplArgs,
|
ReadTemplateArgumentList(llvm::SmallVector<TemplateArgument, 8> &TemplArgs,
|
||||||
llvm::BitstreamCursor &DeclsCursor,
|
PerFileData &F, const RecordData &Record,
|
||||||
const RecordData &Record, unsigned &Idx) {
|
unsigned &Idx) {
|
||||||
unsigned NumTemplateArgs = Record[Idx++];
|
unsigned NumTemplateArgs = Record[Idx++];
|
||||||
TemplArgs.reserve(NumTemplateArgs);
|
TemplArgs.reserve(NumTemplateArgs);
|
||||||
while (NumTemplateArgs--)
|
while (NumTemplateArgs--)
|
||||||
TemplArgs.push_back(ReadTemplateArgument(DeclsCursor, Record, Idx));
|
TemplArgs.push_back(ReadTemplateArgument(F, Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Read a UnresolvedSet structure.
|
/// \brief Read a UnresolvedSet structure.
|
||||||
|
@ -3881,18 +3887,18 @@ void ASTReader::ReadUnresolvedSet(UnresolvedSetImpl &Set,
|
||||||
}
|
}
|
||||||
|
|
||||||
CXXBaseSpecifier
|
CXXBaseSpecifier
|
||||||
ASTReader::ReadCXXBaseSpecifier(llvm::BitstreamCursor &DeclsCursor,
|
ASTReader::ReadCXXBaseSpecifier(PerFileData &F,
|
||||||
const RecordData &Record, unsigned &Idx) {
|
const RecordData &Record, unsigned &Idx) {
|
||||||
bool isVirtual = static_cast<bool>(Record[Idx++]);
|
bool isVirtual = static_cast<bool>(Record[Idx++]);
|
||||||
bool isBaseOfClass = static_cast<bool>(Record[Idx++]);
|
bool isBaseOfClass = static_cast<bool>(Record[Idx++]);
|
||||||
AccessSpecifier AS = static_cast<AccessSpecifier>(Record[Idx++]);
|
AccessSpecifier AS = static_cast<AccessSpecifier>(Record[Idx++]);
|
||||||
TypeSourceInfo *TInfo = GetTypeSourceInfo(DeclsCursor, Record, Idx);
|
TypeSourceInfo *TInfo = GetTypeSourceInfo(F, Record, Idx);
|
||||||
SourceRange Range = ReadSourceRange(Record, Idx);
|
SourceRange Range = ReadSourceRange(F, Record, Idx);
|
||||||
return CXXBaseSpecifier(Range, isVirtual, isBaseOfClass, AS, TInfo);
|
return CXXBaseSpecifier(Range, isVirtual, isBaseOfClass, AS, TInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<CXXBaseOrMemberInitializer **, unsigned>
|
std::pair<CXXBaseOrMemberInitializer **, unsigned>
|
||||||
ASTReader::ReadCXXBaseOrMemberInitializers(llvm::BitstreamCursor &Cursor,
|
ASTReader::ReadCXXBaseOrMemberInitializers(PerFileData &F,
|
||||||
const RecordData &Record,
|
const RecordData &Record,
|
||||||
unsigned &Idx) {
|
unsigned &Idx) {
|
||||||
CXXBaseOrMemberInitializer **BaseOrMemberInitializers = 0;
|
CXXBaseOrMemberInitializer **BaseOrMemberInitializers = 0;
|
||||||
|
@ -3909,17 +3915,17 @@ ASTReader::ReadCXXBaseOrMemberInitializers(llvm::BitstreamCursor &Cursor,
|
||||||
|
|
||||||
bool IsBaseInitializer = Record[Idx++];
|
bool IsBaseInitializer = Record[Idx++];
|
||||||
if (IsBaseInitializer) {
|
if (IsBaseInitializer) {
|
||||||
BaseClassInfo = GetTypeSourceInfo(Cursor, Record, Idx);
|
BaseClassInfo = GetTypeSourceInfo(F, Record, Idx);
|
||||||
IsBaseVirtual = Record[Idx++];
|
IsBaseVirtual = Record[Idx++];
|
||||||
} else {
|
} else {
|
||||||
Member = cast<FieldDecl>(GetDecl(Record[Idx++]));
|
Member = cast<FieldDecl>(GetDecl(Record[Idx++]));
|
||||||
}
|
}
|
||||||
SourceLocation MemberLoc = ReadSourceLocation(Record, Idx);
|
SourceLocation MemberLoc = ReadSourceLocation(F, Record, Idx);
|
||||||
Expr *Init = ReadExpr(Cursor);
|
Expr *Init = ReadExpr(F);
|
||||||
FieldDecl *AnonUnionMember
|
FieldDecl *AnonUnionMember
|
||||||
= cast_or_null<FieldDecl>(GetDecl(Record[Idx++]));
|
= cast_or_null<FieldDecl>(GetDecl(Record[Idx++]));
|
||||||
SourceLocation LParenLoc = ReadSourceLocation(Record, Idx);
|
SourceLocation LParenLoc = ReadSourceLocation(F, Record, Idx);
|
||||||
SourceLocation RParenLoc = ReadSourceLocation(Record, Idx);
|
SourceLocation RParenLoc = ReadSourceLocation(F, Record, Idx);
|
||||||
bool IsWritten = Record[Idx++];
|
bool IsWritten = Record[Idx++];
|
||||||
unsigned SourceOrderOrNumArrayIndices;
|
unsigned SourceOrderOrNumArrayIndices;
|
||||||
llvm::SmallVector<VarDecl *, 8> Indices;
|
llvm::SmallVector<VarDecl *, 8> Indices;
|
||||||
|
@ -3997,9 +4003,10 @@ ASTReader::ReadNestedNameSpecifier(const RecordData &Record, unsigned &Idx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceRange
|
SourceRange
|
||||||
ASTReader::ReadSourceRange(const RecordData &Record, unsigned &Idx) {
|
ASTReader::ReadSourceRange(PerFileData &F, const RecordData &Record,
|
||||||
SourceLocation beg = SourceLocation::getFromRawEncoding(Record[Idx++]);
|
unsigned &Idx) {
|
||||||
SourceLocation end = SourceLocation::getFromRawEncoding(Record[Idx++]);
|
SourceLocation beg = ReadSourceLocation(F, Record, Idx);
|
||||||
|
SourceLocation end = ReadSourceLocation(F, Record, Idx);
|
||||||
return SourceRange(beg, end);
|
return SourceRange(beg, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ using namespace clang::serialization;
|
||||||
namespace clang {
|
namespace clang {
|
||||||
class ASTDeclReader : public DeclVisitor<ASTDeclReader, void> {
|
class ASTDeclReader : public DeclVisitor<ASTDeclReader, void> {
|
||||||
ASTReader &Reader;
|
ASTReader &Reader;
|
||||||
|
ASTReader::PerFileData &F;
|
||||||
llvm::BitstreamCursor &Cursor;
|
llvm::BitstreamCursor &Cursor;
|
||||||
const DeclID ThisDeclID;
|
const DeclID ThisDeclID;
|
||||||
const ASTReader::RecordData &Record;
|
const ASTReader::RecordData &Record;
|
||||||
|
@ -37,13 +38,24 @@ namespace clang {
|
||||||
TypeID TypeIDForTypeDecl;
|
TypeID TypeIDForTypeDecl;
|
||||||
|
|
||||||
uint64_t GetCurrentCursorOffset();
|
uint64_t GetCurrentCursorOffset();
|
||||||
|
SourceLocation ReadSourceLocation(const ASTReader::RecordData &R,
|
||||||
|
unsigned &I) {
|
||||||
|
return Reader.ReadSourceLocation(F, R, I);
|
||||||
|
}
|
||||||
|
SourceRange ReadSourceRange(const ASTReader::RecordData &R, unsigned &I) {
|
||||||
|
return Reader.ReadSourceRange(F, R, I);
|
||||||
|
}
|
||||||
|
TypeSourceInfo *GetTypeSourceInfo(const ASTReader::RecordData &R,
|
||||||
|
unsigned &I) {
|
||||||
|
return Reader.GetTypeSourceInfo(F, R, I);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ASTDeclReader(ASTReader &Reader, llvm::BitstreamCursor &Cursor,
|
ASTDeclReader(ASTReader &Reader, ASTReader::PerFileData &F,
|
||||||
DeclID thisDeclID, const ASTReader::RecordData &Record,
|
llvm::BitstreamCursor &Cursor, DeclID thisDeclID,
|
||||||
unsigned &Idx)
|
const ASTReader::RecordData &Record, unsigned &Idx)
|
||||||
: Reader(Reader), Cursor(Cursor), ThisDeclID(thisDeclID), Record(Record),
|
: Reader(Reader), F(F), Cursor(Cursor), ThisDeclID(thisDeclID),
|
||||||
Idx(Idx), TypeIDForTypeDecl(0) { }
|
Record(Record), Idx(Idx), TypeIDForTypeDecl(0) { }
|
||||||
|
|
||||||
void Visit(Decl *D);
|
void Visit(Decl *D);
|
||||||
|
|
||||||
|
@ -146,11 +158,11 @@ void ASTDeclReader::VisitDecl(Decl *D) {
|
||||||
D->setDeclContext(cast_or_null<DeclContext>(Reader.GetDecl(Record[Idx++])));
|
D->setDeclContext(cast_or_null<DeclContext>(Reader.GetDecl(Record[Idx++])));
|
||||||
D->setLexicalDeclContext(
|
D->setLexicalDeclContext(
|
||||||
cast_or_null<DeclContext>(Reader.GetDecl(Record[Idx++])));
|
cast_or_null<DeclContext>(Reader.GetDecl(Record[Idx++])));
|
||||||
D->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
D->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
D->setInvalidDecl(Record[Idx++]);
|
D->setInvalidDecl(Record[Idx++]);
|
||||||
if (Record[Idx++]) {
|
if (Record[Idx++]) {
|
||||||
AttrVec Attrs;
|
AttrVec Attrs;
|
||||||
Reader.ReadAttributes(Cursor, Attrs);
|
Reader.ReadAttributes(F, Attrs);
|
||||||
D->setAttrs(Attrs);
|
D->setAttrs(Attrs);
|
||||||
}
|
}
|
||||||
D->setImplicit(Record[Idx++]);
|
D->setImplicit(Record[Idx++]);
|
||||||
|
@ -178,7 +190,7 @@ void ASTDeclReader::VisitTypeDecl(TypeDecl *TD) {
|
||||||
|
|
||||||
void ASTDeclReader::VisitTypedefDecl(TypedefDecl *TD) {
|
void ASTDeclReader::VisitTypedefDecl(TypedefDecl *TD) {
|
||||||
VisitTypeDecl(TD);
|
VisitTypeDecl(TD);
|
||||||
TD->setTypeSourceInfo(Reader.GetTypeSourceInfo(Cursor, Record, Idx));
|
TD->setTypeSourceInfo(GetTypeSourceInfo(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitTagDecl(TagDecl *TD) {
|
void ASTDeclReader::VisitTagDecl(TagDecl *TD) {
|
||||||
|
@ -188,8 +200,8 @@ void ASTDeclReader::VisitTagDecl(TagDecl *TD) {
|
||||||
TD->setTagKind((TagDecl::TagKind)Record[Idx++]);
|
TD->setTagKind((TagDecl::TagKind)Record[Idx++]);
|
||||||
TD->setDefinition(Record[Idx++]);
|
TD->setDefinition(Record[Idx++]);
|
||||||
TD->setEmbeddedInDeclarator(Record[Idx++]);
|
TD->setEmbeddedInDeclarator(Record[Idx++]);
|
||||||
TD->setRBraceLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TD->setRBraceLoc(ReadSourceLocation(Record, Idx));
|
||||||
TD->setTagKeywordLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TD->setTagKeywordLoc(ReadSourceLocation(Record, Idx));
|
||||||
// FIXME: maybe read optional qualifier and its range.
|
// FIXME: maybe read optional qualifier and its range.
|
||||||
TD->setTypedefForAnonDecl(
|
TD->setTypedefForAnonDecl(
|
||||||
cast_or_null<TypedefDecl>(Reader.GetDecl(Record[Idx++])));
|
cast_or_null<TypedefDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
|
@ -220,13 +232,13 @@ void ASTDeclReader::VisitValueDecl(ValueDecl *VD) {
|
||||||
void ASTDeclReader::VisitEnumConstantDecl(EnumConstantDecl *ECD) {
|
void ASTDeclReader::VisitEnumConstantDecl(EnumConstantDecl *ECD) {
|
||||||
VisitValueDecl(ECD);
|
VisitValueDecl(ECD);
|
||||||
if (Record[Idx++])
|
if (Record[Idx++])
|
||||||
ECD->setInitExpr(Reader.ReadExpr(Cursor));
|
ECD->setInitExpr(Reader.ReadExpr(F));
|
||||||
ECD->setInitVal(Reader.ReadAPSInt(Record, Idx));
|
ECD->setInitVal(Reader.ReadAPSInt(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitDeclaratorDecl(DeclaratorDecl *DD) {
|
void ASTDeclReader::VisitDeclaratorDecl(DeclaratorDecl *DD) {
|
||||||
VisitValueDecl(DD);
|
VisitValueDecl(DD);
|
||||||
TypeSourceInfo *TInfo = Reader.GetTypeSourceInfo(Cursor, Record, Idx);
|
TypeSourceInfo *TInfo = GetTypeSourceInfo(Record, Idx);
|
||||||
if (TInfo)
|
if (TInfo)
|
||||||
DD->setTypeSourceInfo(TInfo);
|
DD->setTypeSourceInfo(TInfo);
|
||||||
// FIXME: read optional qualifier and its range.
|
// FIXME: read optional qualifier and its range.
|
||||||
|
@ -250,7 +262,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
|
||||||
case FunctionDecl::TK_MemberSpecialization: {
|
case FunctionDecl::TK_MemberSpecialization: {
|
||||||
FunctionDecl *InstFD = cast<FunctionDecl>(Reader.GetDecl(Record[Idx++]));
|
FunctionDecl *InstFD = cast<FunctionDecl>(Reader.GetDecl(Record[Idx++]));
|
||||||
TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
|
TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
|
||||||
SourceLocation POI = Reader.ReadSourceLocation(Record, Idx);
|
SourceLocation POI = ReadSourceLocation(Record, Idx);
|
||||||
FD->setInstantiationOfMemberFunction(*Reader.getContext(), InstFD, TSK);
|
FD->setInstantiationOfMemberFunction(*Reader.getContext(), InstFD, TSK);
|
||||||
FD->getMemberSpecializationInfo()->setPointOfInstantiation(POI);
|
FD->getMemberSpecializationInfo()->setPointOfInstantiation(POI);
|
||||||
break;
|
break;
|
||||||
|
@ -262,7 +274,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
|
||||||
|
|
||||||
// Template arguments.
|
// Template arguments.
|
||||||
llvm::SmallVector<TemplateArgument, 8> TemplArgs;
|
llvm::SmallVector<TemplateArgument, 8> TemplArgs;
|
||||||
Reader.ReadTemplateArgumentList(TemplArgs, Cursor, Record, Idx);
|
Reader.ReadTemplateArgumentList(TemplArgs, F, Record, Idx);
|
||||||
|
|
||||||
// Template args as written.
|
// Template args as written.
|
||||||
llvm::SmallVector<TemplateArgumentLoc, 8> TemplArgLocs;
|
llvm::SmallVector<TemplateArgumentLoc, 8> TemplArgLocs;
|
||||||
|
@ -272,13 +284,13 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
|
||||||
TemplArgLocs.reserve(NumTemplateArgLocs);
|
TemplArgLocs.reserve(NumTemplateArgLocs);
|
||||||
for (unsigned i=0; i != NumTemplateArgLocs; ++i)
|
for (unsigned i=0; i != NumTemplateArgLocs; ++i)
|
||||||
TemplArgLocs.push_back(
|
TemplArgLocs.push_back(
|
||||||
Reader.ReadTemplateArgumentLoc(Cursor, Record, Idx));
|
Reader.ReadTemplateArgumentLoc(F, Record, Idx));
|
||||||
|
|
||||||
LAngleLoc = Reader.ReadSourceLocation(Record, Idx);
|
LAngleLoc = ReadSourceLocation(Record, Idx);
|
||||||
RAngleLoc = Reader.ReadSourceLocation(Record, Idx);
|
RAngleLoc = ReadSourceLocation(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceLocation POI = Reader.ReadSourceLocation(Record, Idx);
|
SourceLocation POI = ReadSourceLocation(Record, Idx);
|
||||||
|
|
||||||
ASTContext &C = *Reader.getContext();
|
ASTContext &C = *Reader.getContext();
|
||||||
TemplateArgumentList *TemplArgList
|
TemplateArgumentList *TemplArgList
|
||||||
|
@ -324,9 +336,9 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
|
||||||
TemplateArgumentListInfo TemplArgs;
|
TemplateArgumentListInfo TemplArgs;
|
||||||
unsigned NumArgs = Record[Idx++];
|
unsigned NumArgs = Record[Idx++];
|
||||||
while (NumArgs--)
|
while (NumArgs--)
|
||||||
TemplArgs.addArgument(Reader.ReadTemplateArgumentLoc(Cursor,Record, Idx));
|
TemplArgs.addArgument(Reader.ReadTemplateArgumentLoc(F, Record, Idx));
|
||||||
TemplArgs.setLAngleLoc(Reader.ReadSourceLocation(Record, Idx));
|
TemplArgs.setLAngleLoc(ReadSourceLocation(Record, Idx));
|
||||||
TemplArgs.setRAngleLoc(Reader.ReadSourceLocation(Record, Idx));
|
TemplArgs.setRAngleLoc(ReadSourceLocation(Record, Idx));
|
||||||
|
|
||||||
FD->setDependentTemplateSpecialization(*Reader.getContext(),
|
FD->setDependentTemplateSpecialization(*Reader.getContext(),
|
||||||
TemplDecls, TemplArgs);
|
TemplDecls, TemplArgs);
|
||||||
|
@ -347,7 +359,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
|
||||||
FD->setDeleted(Record[Idx++]);
|
FD->setDeleted(Record[Idx++]);
|
||||||
FD->setTrivial(Record[Idx++]);
|
FD->setTrivial(Record[Idx++]);
|
||||||
FD->setHasImplicitReturnZero(Record[Idx++]);
|
FD->setHasImplicitReturnZero(Record[Idx++]);
|
||||||
FD->setLocEnd(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
FD->setLocEnd(ReadSourceLocation(Record, Idx));
|
||||||
|
|
||||||
// Read in the parameters.
|
// Read in the parameters.
|
||||||
unsigned NumParams = Record[Idx++];
|
unsigned NumParams = Record[Idx++];
|
||||||
|
@ -363,7 +375,7 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) {
|
||||||
if (Record[Idx++]) {
|
if (Record[Idx++]) {
|
||||||
// In practice, this won't be executed (since method definitions
|
// In practice, this won't be executed (since method definitions
|
||||||
// don't occur in header files).
|
// don't occur in header files).
|
||||||
MD->setBody(Reader.ReadStmt(Cursor));
|
MD->setBody(Reader.ReadStmt(F));
|
||||||
MD->setSelfDecl(cast<ImplicitParamDecl>(Reader.GetDecl(Record[Idx++])));
|
MD->setSelfDecl(cast<ImplicitParamDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
MD->setCmdDecl(cast<ImplicitParamDecl>(Reader.GetDecl(Record[Idx++])));
|
MD->setCmdDecl(cast<ImplicitParamDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
}
|
}
|
||||||
|
@ -375,8 +387,8 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) {
|
||||||
MD->setObjCDeclQualifier((Decl::ObjCDeclQualifier)Record[Idx++]);
|
MD->setObjCDeclQualifier((Decl::ObjCDeclQualifier)Record[Idx++]);
|
||||||
MD->setNumSelectorArgs(unsigned(Record[Idx++]));
|
MD->setNumSelectorArgs(unsigned(Record[Idx++]));
|
||||||
MD->setResultType(Reader.GetType(Record[Idx++]));
|
MD->setResultType(Reader.GetType(Record[Idx++]));
|
||||||
MD->setResultTypeSourceInfo(Reader.GetTypeSourceInfo(Cursor, Record, Idx));
|
MD->setResultTypeSourceInfo(GetTypeSourceInfo(Record, Idx));
|
||||||
MD->setEndLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
MD->setEndLoc(ReadSourceLocation(Record, Idx));
|
||||||
unsigned NumParams = Record[Idx++];
|
unsigned NumParams = Record[Idx++];
|
||||||
llvm::SmallVector<ParmVarDecl *, 16> Params;
|
llvm::SmallVector<ParmVarDecl *, 16> Params;
|
||||||
Params.reserve(NumParams);
|
Params.reserve(NumParams);
|
||||||
|
@ -388,8 +400,8 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) {
|
||||||
|
|
||||||
void ASTDeclReader::VisitObjCContainerDecl(ObjCContainerDecl *CD) {
|
void ASTDeclReader::VisitObjCContainerDecl(ObjCContainerDecl *CD) {
|
||||||
VisitNamedDecl(CD);
|
VisitNamedDecl(CD);
|
||||||
SourceLocation A = SourceLocation::getFromRawEncoding(Record[Idx++]);
|
SourceLocation A = ReadSourceLocation(Record, Idx);
|
||||||
SourceLocation B = SourceLocation::getFromRawEncoding(Record[Idx++]);
|
SourceLocation B = ReadSourceLocation(Record, Idx);
|
||||||
CD->setAtEndRange(SourceRange(A, B));
|
CD->setAtEndRange(SourceRange(A, B));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +420,7 @@ void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) {
|
||||||
llvm::SmallVector<SourceLocation, 16> ProtoLocs;
|
llvm::SmallVector<SourceLocation, 16> ProtoLocs;
|
||||||
ProtoLocs.reserve(NumProtocols);
|
ProtoLocs.reserve(NumProtocols);
|
||||||
for (unsigned I = 0; I != NumProtocols; ++I)
|
for (unsigned I = 0; I != NumProtocols; ++I)
|
||||||
ProtoLocs.push_back(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
ProtoLocs.push_back(ReadSourceLocation(Record, Idx));
|
||||||
ID->setProtocolList(Protocols.data(), NumProtocols, ProtoLocs.data(),
|
ID->setProtocolList(Protocols.data(), NumProtocols, ProtoLocs.data(),
|
||||||
*Reader.getContext());
|
*Reader.getContext());
|
||||||
|
|
||||||
|
@ -433,9 +445,9 @@ void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) {
|
||||||
ID->setIvarList(0);
|
ID->setIvarList(0);
|
||||||
ID->setForwardDecl(Record[Idx++]);
|
ID->setForwardDecl(Record[Idx++]);
|
||||||
ID->setImplicitInterfaceDecl(Record[Idx++]);
|
ID->setImplicitInterfaceDecl(Record[Idx++]);
|
||||||
ID->setClassLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
ID->setClassLoc(ReadSourceLocation(Record, Idx));
|
||||||
ID->setSuperClassLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
ID->setSuperClassLoc(ReadSourceLocation(Record, Idx));
|
||||||
ID->setLocEnd(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
ID->setLocEnd(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitObjCIvarDecl(ObjCIvarDecl *IVD) {
|
void ASTDeclReader::VisitObjCIvarDecl(ObjCIvarDecl *IVD) {
|
||||||
|
@ -450,7 +462,7 @@ void ASTDeclReader::VisitObjCIvarDecl(ObjCIvarDecl *IVD) {
|
||||||
void ASTDeclReader::VisitObjCProtocolDecl(ObjCProtocolDecl *PD) {
|
void ASTDeclReader::VisitObjCProtocolDecl(ObjCProtocolDecl *PD) {
|
||||||
VisitObjCContainerDecl(PD);
|
VisitObjCContainerDecl(PD);
|
||||||
PD->setForwardDecl(Record[Idx++]);
|
PD->setForwardDecl(Record[Idx++]);
|
||||||
PD->setLocEnd(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
PD->setLocEnd(ReadSourceLocation(Record, Idx));
|
||||||
unsigned NumProtoRefs = Record[Idx++];
|
unsigned NumProtoRefs = Record[Idx++];
|
||||||
llvm::SmallVector<ObjCProtocolDecl *, 16> ProtoRefs;
|
llvm::SmallVector<ObjCProtocolDecl *, 16> ProtoRefs;
|
||||||
ProtoRefs.reserve(NumProtoRefs);
|
ProtoRefs.reserve(NumProtoRefs);
|
||||||
|
@ -459,7 +471,7 @@ void ASTDeclReader::VisitObjCProtocolDecl(ObjCProtocolDecl *PD) {
|
||||||
llvm::SmallVector<SourceLocation, 16> ProtoLocs;
|
llvm::SmallVector<SourceLocation, 16> ProtoLocs;
|
||||||
ProtoLocs.reserve(NumProtoRefs);
|
ProtoLocs.reserve(NumProtoRefs);
|
||||||
for (unsigned I = 0; I != NumProtoRefs; ++I)
|
for (unsigned I = 0; I != NumProtoRefs; ++I)
|
||||||
ProtoLocs.push_back(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
ProtoLocs.push_back(ReadSourceLocation(Record, Idx));
|
||||||
PD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(),
|
PD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(),
|
||||||
*Reader.getContext());
|
*Reader.getContext());
|
||||||
}
|
}
|
||||||
|
@ -478,7 +490,7 @@ void ASTDeclReader::VisitObjCClassDecl(ObjCClassDecl *CD) {
|
||||||
llvm::SmallVector<SourceLocation, 16> SLocs;
|
llvm::SmallVector<SourceLocation, 16> SLocs;
|
||||||
SLocs.reserve(NumClassRefs);
|
SLocs.reserve(NumClassRefs);
|
||||||
for (unsigned I = 0; I != NumClassRefs; ++I)
|
for (unsigned I = 0; I != NumClassRefs; ++I)
|
||||||
SLocs.push_back(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
SLocs.push_back(ReadSourceLocation(Record, Idx));
|
||||||
CD->setClassList(*Reader.getContext(), ClassRefs.data(), SLocs.data(),
|
CD->setClassList(*Reader.getContext(), ClassRefs.data(), SLocs.data(),
|
||||||
NumClassRefs);
|
NumClassRefs);
|
||||||
}
|
}
|
||||||
|
@ -493,7 +505,7 @@ void ASTDeclReader::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *FPD) {
|
||||||
llvm::SmallVector<SourceLocation, 16> ProtoLocs;
|
llvm::SmallVector<SourceLocation, 16> ProtoLocs;
|
||||||
ProtoLocs.reserve(NumProtoRefs);
|
ProtoLocs.reserve(NumProtoRefs);
|
||||||
for (unsigned I = 0; I != NumProtoRefs; ++I)
|
for (unsigned I = 0; I != NumProtoRefs; ++I)
|
||||||
ProtoLocs.push_back(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
ProtoLocs.push_back(ReadSourceLocation(Record, Idx));
|
||||||
FPD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(),
|
FPD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(),
|
||||||
*Reader.getContext());
|
*Reader.getContext());
|
||||||
}
|
}
|
||||||
|
@ -509,13 +521,13 @@ void ASTDeclReader::VisitObjCCategoryDecl(ObjCCategoryDecl *CD) {
|
||||||
llvm::SmallVector<SourceLocation, 16> ProtoLocs;
|
llvm::SmallVector<SourceLocation, 16> ProtoLocs;
|
||||||
ProtoLocs.reserve(NumProtoRefs);
|
ProtoLocs.reserve(NumProtoRefs);
|
||||||
for (unsigned I = 0; I != NumProtoRefs; ++I)
|
for (unsigned I = 0; I != NumProtoRefs; ++I)
|
||||||
ProtoLocs.push_back(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
ProtoLocs.push_back(ReadSourceLocation(Record, Idx));
|
||||||
CD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(),
|
CD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(),
|
||||||
*Reader.getContext());
|
*Reader.getContext());
|
||||||
CD->setNextClassCategory(cast_or_null<ObjCCategoryDecl>(Reader.GetDecl(Record[Idx++])));
|
CD->setNextClassCategory(cast_or_null<ObjCCategoryDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
CD->setHasSynthBitfield(Record[Idx++]);
|
CD->setHasSynthBitfield(Record[Idx++]);
|
||||||
CD->setAtLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
CD->setAtLoc(ReadSourceLocation(Record, Idx));
|
||||||
CD->setCategoryNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
CD->setCategoryNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *CAD) {
|
void ASTDeclReader::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *CAD) {
|
||||||
|
@ -525,8 +537,8 @@ void ASTDeclReader::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *CAD) {
|
||||||
|
|
||||||
void ASTDeclReader::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
|
void ASTDeclReader::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
|
||||||
VisitNamedDecl(D);
|
VisitNamedDecl(D);
|
||||||
D->setAtLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
D->setAtLoc(ReadSourceLocation(Record, Idx));
|
||||||
D->setType(Reader.GetTypeSourceInfo(Cursor, Record, Idx));
|
D->setType(GetTypeSourceInfo(Record, Idx));
|
||||||
// FIXME: stable encoding
|
// FIXME: stable encoding
|
||||||
D->setPropertyAttributes(
|
D->setPropertyAttributes(
|
||||||
(ObjCPropertyDecl::PropertyAttributeKind)Record[Idx++]);
|
(ObjCPropertyDecl::PropertyAttributeKind)Record[Idx++]);
|
||||||
|
@ -561,27 +573,27 @@ void ASTDeclReader::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
|
||||||
D->setSuperClass(
|
D->setSuperClass(
|
||||||
cast_or_null<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
|
cast_or_null<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
llvm::tie(D->IvarInitializers, D->NumIvarInitializers)
|
llvm::tie(D->IvarInitializers, D->NumIvarInitializers)
|
||||||
= Reader.ReadCXXBaseOrMemberInitializers(Cursor, Record, Idx);
|
= Reader.ReadCXXBaseOrMemberInitializers(F, Record, Idx);
|
||||||
D->setHasSynthBitfield(Record[Idx++]);
|
D->setHasSynthBitfield(Record[Idx++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ASTDeclReader::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
|
void ASTDeclReader::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
|
||||||
VisitDecl(D);
|
VisitDecl(D);
|
||||||
D->setAtLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
D->setAtLoc(ReadSourceLocation(Record, Idx));
|
||||||
D->setPropertyDecl(
|
D->setPropertyDecl(
|
||||||
cast_or_null<ObjCPropertyDecl>(Reader.GetDecl(Record[Idx++])));
|
cast_or_null<ObjCPropertyDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
D->setPropertyIvarDecl(
|
D->setPropertyIvarDecl(
|
||||||
cast_or_null<ObjCIvarDecl>(Reader.GetDecl(Record[Idx++])));
|
cast_or_null<ObjCIvarDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
D->setGetterCXXConstructor(Reader.ReadExpr(Cursor));
|
D->setGetterCXXConstructor(Reader.ReadExpr(F));
|
||||||
D->setSetterCXXAssignment(Reader.ReadExpr(Cursor));
|
D->setSetterCXXAssignment(Reader.ReadExpr(F));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitFieldDecl(FieldDecl *FD) {
|
void ASTDeclReader::VisitFieldDecl(FieldDecl *FD) {
|
||||||
VisitDeclaratorDecl(FD);
|
VisitDeclaratorDecl(FD);
|
||||||
FD->setMutable(Record[Idx++]);
|
FD->setMutable(Record[Idx++]);
|
||||||
if (Record[Idx++])
|
if (Record[Idx++])
|
||||||
FD->setBitWidth(Reader.ReadExpr(Cursor));
|
FD->setBitWidth(Reader.ReadExpr(F));
|
||||||
if (!FD->getDeclName()) {
|
if (!FD->getDeclName()) {
|
||||||
FieldDecl *Tmpl = cast_or_null<FieldDecl>(Reader.GetDecl(Record[Idx++]));
|
FieldDecl *Tmpl = cast_or_null<FieldDecl>(Reader.GetDecl(Record[Idx++]));
|
||||||
if (Tmpl)
|
if (Tmpl)
|
||||||
|
@ -599,12 +611,12 @@ void ASTDeclReader::VisitVarDecl(VarDecl *VD) {
|
||||||
VD->setExceptionVariable(Record[Idx++]);
|
VD->setExceptionVariable(Record[Idx++]);
|
||||||
VD->setNRVOVariable(Record[Idx++]);
|
VD->setNRVOVariable(Record[Idx++]);
|
||||||
if (Record[Idx++])
|
if (Record[Idx++])
|
||||||
VD->setInit(Reader.ReadExpr(Cursor));
|
VD->setInit(Reader.ReadExpr(F));
|
||||||
|
|
||||||
if (Record[Idx++]) { // HasMemberSpecializationInfo.
|
if (Record[Idx++]) { // HasMemberSpecializationInfo.
|
||||||
VarDecl *Tmpl = cast<VarDecl>(Reader.GetDecl(Record[Idx++]));
|
VarDecl *Tmpl = cast<VarDecl>(Reader.GetDecl(Record[Idx++]));
|
||||||
TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
|
TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
|
||||||
SourceLocation POI = Reader.ReadSourceLocation(Record, Idx);
|
SourceLocation POI = ReadSourceLocation(Record, Idx);
|
||||||
Reader.getContext()->setInstantiatedFromStaticDataMember(VD, Tmpl, TSK,POI);
|
Reader.getContext()->setInstantiatedFromStaticDataMember(VD, Tmpl, TSK,POI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,18 +630,18 @@ void ASTDeclReader::VisitParmVarDecl(ParmVarDecl *PD) {
|
||||||
PD->setObjCDeclQualifier((Decl::ObjCDeclQualifier)Record[Idx++]);
|
PD->setObjCDeclQualifier((Decl::ObjCDeclQualifier)Record[Idx++]);
|
||||||
PD->setHasInheritedDefaultArg(Record[Idx++]);
|
PD->setHasInheritedDefaultArg(Record[Idx++]);
|
||||||
if (Record[Idx++]) // hasUninstantiatedDefaultArg.
|
if (Record[Idx++]) // hasUninstantiatedDefaultArg.
|
||||||
PD->setUninstantiatedDefaultArg(Reader.ReadExpr(Cursor));
|
PD->setUninstantiatedDefaultArg(Reader.ReadExpr(F));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitFileScopeAsmDecl(FileScopeAsmDecl *AD) {
|
void ASTDeclReader::VisitFileScopeAsmDecl(FileScopeAsmDecl *AD) {
|
||||||
VisitDecl(AD);
|
VisitDecl(AD);
|
||||||
AD->setAsmString(cast<StringLiteral>(Reader.ReadExpr(Cursor)));
|
AD->setAsmString(cast<StringLiteral>(Reader.ReadExpr(F)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitBlockDecl(BlockDecl *BD) {
|
void ASTDeclReader::VisitBlockDecl(BlockDecl *BD) {
|
||||||
VisitDecl(BD);
|
VisitDecl(BD);
|
||||||
BD->setBody(cast_or_null<CompoundStmt>(Reader.ReadStmt(Cursor)));
|
BD->setBody(cast_or_null<CompoundStmt>(Reader.ReadStmt(F)));
|
||||||
BD->setSignatureAsWritten(Reader.GetTypeSourceInfo(Cursor, Record, Idx));
|
BD->setSignatureAsWritten(GetTypeSourceInfo(Record, Idx));
|
||||||
unsigned NumParams = Record[Idx++];
|
unsigned NumParams = Record[Idx++];
|
||||||
llvm::SmallVector<ParmVarDecl *, 16> Params;
|
llvm::SmallVector<ParmVarDecl *, 16> Params;
|
||||||
Params.reserve(NumParams);
|
Params.reserve(NumParams);
|
||||||
|
@ -646,8 +658,8 @@ void ASTDeclReader::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
|
||||||
|
|
||||||
void ASTDeclReader::VisitNamespaceDecl(NamespaceDecl *D) {
|
void ASTDeclReader::VisitNamespaceDecl(NamespaceDecl *D) {
|
||||||
VisitNamedDecl(D);
|
VisitNamedDecl(D);
|
||||||
D->setLBracLoc(Reader.ReadSourceLocation(Record, Idx));
|
D->setLBracLoc(ReadSourceLocation(Record, Idx));
|
||||||
D->setRBracLoc(Reader.ReadSourceLocation(Record, Idx));
|
D->setRBracLoc(ReadSourceLocation(Record, Idx));
|
||||||
D->setNextNamespace(
|
D->setNextNamespace(
|
||||||
cast_or_null<NamespaceDecl>(Reader.GetDecl(Record[Idx++])));
|
cast_or_null<NamespaceDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
|
|
||||||
|
@ -659,17 +671,17 @@ void ASTDeclReader::VisitNamespaceDecl(NamespaceDecl *D) {
|
||||||
|
|
||||||
void ASTDeclReader::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
|
void ASTDeclReader::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
|
||||||
VisitNamedDecl(D);
|
VisitNamedDecl(D);
|
||||||
D->NamespaceLoc = Reader.ReadSourceLocation(Record, Idx);
|
D->NamespaceLoc = ReadSourceLocation(Record, Idx);
|
||||||
D->setQualifierRange(Reader.ReadSourceRange(Record, Idx));
|
D->setQualifierRange(ReadSourceRange(Record, Idx));
|
||||||
D->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
D->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
||||||
D->IdentLoc = Reader.ReadSourceLocation(Record, Idx);
|
D->IdentLoc = ReadSourceLocation(Record, Idx);
|
||||||
D->Namespace = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
D->Namespace = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitUsingDecl(UsingDecl *D) {
|
void ASTDeclReader::VisitUsingDecl(UsingDecl *D) {
|
||||||
VisitNamedDecl(D);
|
VisitNamedDecl(D);
|
||||||
D->setUsingLocation(Reader.ReadSourceLocation(Record, Idx));
|
D->setUsingLocation(ReadSourceLocation(Record, Idx));
|
||||||
D->setNestedNameRange(Reader.ReadSourceRange(Record, Idx));
|
D->setNestedNameRange(ReadSourceRange(Record, Idx));
|
||||||
D->setTargetNestedNameDecl(Reader.ReadNestedNameSpecifier(Record, Idx));
|
D->setTargetNestedNameDecl(Reader.ReadNestedNameSpecifier(Record, Idx));
|
||||||
// FIXME: read the DNLoc component.
|
// FIXME: read the DNLoc component.
|
||||||
|
|
||||||
|
@ -700,9 +712,9 @@ void ASTDeclReader::VisitUsingShadowDecl(UsingShadowDecl *D) {
|
||||||
|
|
||||||
void ASTDeclReader::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
|
void ASTDeclReader::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
|
||||||
VisitNamedDecl(D);
|
VisitNamedDecl(D);
|
||||||
D->UsingLoc = Reader.ReadSourceLocation(Record, Idx);
|
D->UsingLoc = ReadSourceLocation(Record, Idx);
|
||||||
D->NamespaceLoc = Reader.ReadSourceLocation(Record, Idx);
|
D->NamespaceLoc = ReadSourceLocation(Record, Idx);
|
||||||
D->QualifierRange = Reader.ReadSourceRange(Record, Idx);
|
D->QualifierRange = ReadSourceRange(Record, Idx);
|
||||||
D->Qualifier = Reader.ReadNestedNameSpecifier(Record, Idx);
|
D->Qualifier = Reader.ReadNestedNameSpecifier(Record, Idx);
|
||||||
D->NominatedNamespace = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
D->NominatedNamespace = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
||||||
D->CommonAncestor = cast_or_null<DeclContext>(Reader.GetDecl(Record[Idx++]));
|
D->CommonAncestor = cast_or_null<DeclContext>(Reader.GetDecl(Record[Idx++]));
|
||||||
|
@ -710,8 +722,8 @@ void ASTDeclReader::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
|
||||||
|
|
||||||
void ASTDeclReader::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
|
void ASTDeclReader::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
|
||||||
VisitValueDecl(D);
|
VisitValueDecl(D);
|
||||||
D->setTargetNestedNameRange(Reader.ReadSourceRange(Record, Idx));
|
D->setTargetNestedNameRange(ReadSourceRange(Record, Idx));
|
||||||
D->setUsingLoc(Reader.ReadSourceLocation(Record, Idx));
|
D->setUsingLoc(ReadSourceLocation(Record, Idx));
|
||||||
D->setTargetNestedNameSpecifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
D->setTargetNestedNameSpecifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
||||||
// FIXME: read the DNLoc component.
|
// FIXME: read the DNLoc component.
|
||||||
}
|
}
|
||||||
|
@ -719,9 +731,9 @@ void ASTDeclReader::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
|
||||||
void ASTDeclReader::VisitUnresolvedUsingTypenameDecl(
|
void ASTDeclReader::VisitUnresolvedUsingTypenameDecl(
|
||||||
UnresolvedUsingTypenameDecl *D) {
|
UnresolvedUsingTypenameDecl *D) {
|
||||||
VisitTypeDecl(D);
|
VisitTypeDecl(D);
|
||||||
D->TargetNestedNameRange = Reader.ReadSourceRange(Record, Idx);
|
D->TargetNestedNameRange = ReadSourceRange(Record, Idx);
|
||||||
D->UsingLocation = Reader.ReadSourceLocation(Record, Idx);
|
D->UsingLocation = ReadSourceLocation(Record, Idx);
|
||||||
D->TypenameLocation = Reader.ReadSourceLocation(Record, Idx);
|
D->TypenameLocation = ReadSourceLocation(Record, Idx);
|
||||||
D->TargetNestedNameSpecifier = Reader.ReadNestedNameSpecifier(Record, Idx);
|
D->TargetNestedNameSpecifier = Reader.ReadNestedNameSpecifier(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -778,13 +790,13 @@ void ASTDeclReader::VisitCXXRecordDecl(CXXRecordDecl *D) {
|
||||||
Data.NumBases = Record[Idx++];
|
Data.NumBases = Record[Idx++];
|
||||||
Data.Bases = new(C) CXXBaseSpecifier [Data.NumBases];
|
Data.Bases = new(C) CXXBaseSpecifier [Data.NumBases];
|
||||||
for (unsigned i = 0; i != Data.NumBases; ++i)
|
for (unsigned i = 0; i != Data.NumBases; ++i)
|
||||||
Data.Bases[i] = Reader.ReadCXXBaseSpecifier(Cursor, Record, Idx);
|
Data.Bases[i] = Reader.ReadCXXBaseSpecifier(F, Record, Idx);
|
||||||
|
|
||||||
// FIXME: Make VBases lazily computed when needed to avoid storing them.
|
// FIXME: Make VBases lazily computed when needed to avoid storing them.
|
||||||
Data.NumVBases = Record[Idx++];
|
Data.NumVBases = Record[Idx++];
|
||||||
Data.VBases = new(C) CXXBaseSpecifier [Data.NumVBases];
|
Data.VBases = new(C) CXXBaseSpecifier [Data.NumVBases];
|
||||||
for (unsigned i = 0; i != Data.NumVBases; ++i)
|
for (unsigned i = 0; i != Data.NumVBases; ++i)
|
||||||
Data.VBases[i] = Reader.ReadCXXBaseSpecifier(Cursor, Record, Idx);
|
Data.VBases[i] = Reader.ReadCXXBaseSpecifier(F, Record, Idx);
|
||||||
|
|
||||||
Reader.ReadUnresolvedSet(Data.Conversions, Record, Idx);
|
Reader.ReadUnresolvedSet(Data.Conversions, Record, Idx);
|
||||||
Reader.ReadUnresolvedSet(Data.VisibleConversions, Record, Idx);
|
Reader.ReadUnresolvedSet(Data.VisibleConversions, Record, Idx);
|
||||||
|
@ -808,7 +820,7 @@ void ASTDeclReader::VisitCXXRecordDecl(CXXRecordDecl *D) {
|
||||||
case CXXRecMemberSpecialization: {
|
case CXXRecMemberSpecialization: {
|
||||||
CXXRecordDecl *RD = cast<CXXRecordDecl>(Reader.GetDecl(Record[Idx++]));
|
CXXRecordDecl *RD = cast<CXXRecordDecl>(Reader.GetDecl(Record[Idx++]));
|
||||||
TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
|
TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
|
||||||
SourceLocation POI = Reader.ReadSourceLocation(Record, Idx);
|
SourceLocation POI = ReadSourceLocation(Record, Idx);
|
||||||
MemberSpecializationInfo *MSI = new (C) MemberSpecializationInfo(RD, TSK);
|
MemberSpecializationInfo *MSI = new (C) MemberSpecializationInfo(RD, TSK);
|
||||||
MSI->setPointOfInstantiation(POI);
|
MSI->setPointOfInstantiation(POI);
|
||||||
D->TemplateOrInstantiation = MSI;
|
D->TemplateOrInstantiation = MSI;
|
||||||
|
@ -834,7 +846,7 @@ void ASTDeclReader::VisitCXXConstructorDecl(CXXConstructorDecl *D) {
|
||||||
D->IsExplicitSpecified = Record[Idx++];
|
D->IsExplicitSpecified = Record[Idx++];
|
||||||
D->ImplicitlyDefined = Record[Idx++];
|
D->ImplicitlyDefined = Record[Idx++];
|
||||||
llvm::tie(D->BaseOrMemberInitializers, D->NumBaseOrMemberInitializers)
|
llvm::tie(D->BaseOrMemberInitializers, D->NumBaseOrMemberInitializers)
|
||||||
= Reader.ReadCXXBaseOrMemberInitializers(Cursor, Record, Idx);
|
= Reader.ReadCXXBaseOrMemberInitializers(F, Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitCXXDestructorDecl(CXXDestructorDecl *D) {
|
void ASTDeclReader::VisitCXXDestructorDecl(CXXDestructorDecl *D) {
|
||||||
|
@ -851,17 +863,17 @@ void ASTDeclReader::VisitCXXConversionDecl(CXXConversionDecl *D) {
|
||||||
|
|
||||||
void ASTDeclReader::VisitAccessSpecDecl(AccessSpecDecl *D) {
|
void ASTDeclReader::VisitAccessSpecDecl(AccessSpecDecl *D) {
|
||||||
VisitDecl(D);
|
VisitDecl(D);
|
||||||
D->setColonLoc(Reader.ReadSourceLocation(Record, Idx));
|
D->setColonLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitFriendDecl(FriendDecl *D) {
|
void ASTDeclReader::VisitFriendDecl(FriendDecl *D) {
|
||||||
VisitDecl(D);
|
VisitDecl(D);
|
||||||
if (Record[Idx++])
|
if (Record[Idx++])
|
||||||
D->Friend = Reader.GetTypeSourceInfo(Cursor, Record, Idx);
|
D->Friend = GetTypeSourceInfo(Record, Idx);
|
||||||
else
|
else
|
||||||
D->Friend = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
D->Friend = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
||||||
D->NextFriend = cast_or_null<FriendDecl>(Reader.GetDecl(Record[Idx++]));
|
D->NextFriend = cast_or_null<FriendDecl>(Reader.GetDecl(Record[Idx++]));
|
||||||
D->FriendLoc = Reader.ReadSourceLocation(Record, Idx);
|
D->FriendLoc = ReadSourceLocation(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
|
void ASTDeclReader::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
|
||||||
|
@ -870,12 +882,12 @@ void ASTDeclReader::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
|
||||||
D->NumParams = NumParams;
|
D->NumParams = NumParams;
|
||||||
D->Params = new TemplateParameterList*[NumParams];
|
D->Params = new TemplateParameterList*[NumParams];
|
||||||
for (unsigned i = 0; i != NumParams; ++i)
|
for (unsigned i = 0; i != NumParams; ++i)
|
||||||
D->Params[i] = Reader.ReadTemplateParameterList(Record, Idx);
|
D->Params[i] = Reader.ReadTemplateParameterList(F, Record, Idx);
|
||||||
if (Record[Idx++]) // HasFriendDecl
|
if (Record[Idx++]) // HasFriendDecl
|
||||||
D->Friend = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
D->Friend = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
||||||
else
|
else
|
||||||
D->Friend = Reader.GetTypeSourceInfo(Cursor, Record, Idx);
|
D->Friend = GetTypeSourceInfo(Record, Idx);
|
||||||
D->FriendLoc = Reader.ReadSourceLocation(Record, Idx);
|
D->FriendLoc = ReadSourceLocation(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitTemplateDecl(TemplateDecl *D) {
|
void ASTDeclReader::VisitTemplateDecl(TemplateDecl *D) {
|
||||||
|
@ -884,7 +896,7 @@ void ASTDeclReader::VisitTemplateDecl(TemplateDecl *D) {
|
||||||
NamedDecl *TemplatedDecl
|
NamedDecl *TemplatedDecl
|
||||||
= cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
= cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
||||||
TemplateParameterList* TemplateParams
|
TemplateParameterList* TemplateParams
|
||||||
= Reader.ReadTemplateParameterList(Record, Idx);
|
= Reader.ReadTemplateParameterList(F, Record, Idx);
|
||||||
D->init(TemplatedDecl, TemplateParams);
|
D->init(TemplatedDecl, TemplateParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -969,7 +981,7 @@ void ASTDeclReader::VisitClassTemplateSpecializationDecl(
|
||||||
D->SpecializedTemplate = CTD;
|
D->SpecializedTemplate = CTD;
|
||||||
} else {
|
} else {
|
||||||
llvm::SmallVector<TemplateArgument, 8> TemplArgs;
|
llvm::SmallVector<TemplateArgument, 8> TemplArgs;
|
||||||
Reader.ReadTemplateArgumentList(TemplArgs, Cursor, Record, Idx);
|
Reader.ReadTemplateArgumentList(TemplArgs, F, Record, Idx);
|
||||||
TemplateArgumentList *ArgList
|
TemplateArgumentList *ArgList
|
||||||
= new (C) TemplateArgumentList(C, TemplArgs.data(), TemplArgs.size());
|
= new (C) TemplateArgumentList(C, TemplArgs.data(), TemplArgs.size());
|
||||||
ClassTemplateSpecializationDecl::SpecializedPartialSpecialization *PS
|
ClassTemplateSpecializationDecl::SpecializedPartialSpecialization *PS
|
||||||
|
@ -983,19 +995,19 @@ void ASTDeclReader::VisitClassTemplateSpecializationDecl(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicit info.
|
// Explicit info.
|
||||||
if (TypeSourceInfo *TyInfo = Reader.GetTypeSourceInfo(Cursor, Record, Idx)) {
|
if (TypeSourceInfo *TyInfo = GetTypeSourceInfo(Record, Idx)) {
|
||||||
ClassTemplateSpecializationDecl::ExplicitSpecializationInfo *ExplicitInfo
|
ClassTemplateSpecializationDecl::ExplicitSpecializationInfo *ExplicitInfo
|
||||||
= new (C) ClassTemplateSpecializationDecl::ExplicitSpecializationInfo;
|
= new (C) ClassTemplateSpecializationDecl::ExplicitSpecializationInfo;
|
||||||
ExplicitInfo->TypeAsWritten = TyInfo;
|
ExplicitInfo->TypeAsWritten = TyInfo;
|
||||||
ExplicitInfo->ExternLoc = Reader.ReadSourceLocation(Record, Idx);
|
ExplicitInfo->ExternLoc = ReadSourceLocation(Record, Idx);
|
||||||
ExplicitInfo->TemplateKeywordLoc = Reader.ReadSourceLocation(Record, Idx);
|
ExplicitInfo->TemplateKeywordLoc = ReadSourceLocation(Record, Idx);
|
||||||
D->ExplicitInfo = ExplicitInfo;
|
D->ExplicitInfo = ExplicitInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::SmallVector<TemplateArgument, 8> TemplArgs;
|
llvm::SmallVector<TemplateArgument, 8> TemplArgs;
|
||||||
Reader.ReadTemplateArgumentList(TemplArgs, Cursor, Record, Idx);
|
Reader.ReadTemplateArgumentList(TemplArgs, F, Record, Idx);
|
||||||
D->TemplateArgs.init(C, TemplArgs.data(), TemplArgs.size());
|
D->TemplateArgs.init(C, TemplArgs.data(), TemplArgs.size());
|
||||||
D->PointOfInstantiation = Reader.ReadSourceLocation(Record, Idx);
|
D->PointOfInstantiation = ReadSourceLocation(Record, Idx);
|
||||||
D->SpecializationKind = (TemplateSpecializationKind)Record[Idx++];
|
D->SpecializationKind = (TemplateSpecializationKind)Record[Idx++];
|
||||||
|
|
||||||
if (D->isCanonicalDecl()) { // It's kept in the folding set.
|
if (D->isCanonicalDecl()) { // It's kept in the folding set.
|
||||||
|
@ -1015,14 +1027,14 @@ void ASTDeclReader::VisitClassTemplatePartialSpecializationDecl(
|
||||||
VisitClassTemplateSpecializationDecl(D);
|
VisitClassTemplateSpecializationDecl(D);
|
||||||
|
|
||||||
ASTContext &C = *Reader.getContext();
|
ASTContext &C = *Reader.getContext();
|
||||||
D->TemplateParams = Reader.ReadTemplateParameterList(Record, Idx);
|
D->TemplateParams = Reader.ReadTemplateParameterList(F, Record, Idx);
|
||||||
|
|
||||||
unsigned NumArgs = Record[Idx++];
|
unsigned NumArgs = Record[Idx++];
|
||||||
if (NumArgs) {
|
if (NumArgs) {
|
||||||
D->NumArgsAsWritten = NumArgs;
|
D->NumArgsAsWritten = NumArgs;
|
||||||
D->ArgsAsWritten = new (C) TemplateArgumentLoc[NumArgs];
|
D->ArgsAsWritten = new (C) TemplateArgumentLoc[NumArgs];
|
||||||
for (unsigned i=0; i != NumArgs; ++i)
|
for (unsigned i=0; i != NumArgs; ++i)
|
||||||
D->ArgsAsWritten[i] = Reader.ReadTemplateArgumentLoc(Cursor, Record, Idx);
|
D->ArgsAsWritten[i] = Reader.ReadTemplateArgumentLoc(F, Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
D->SequenceNumber = Record[Idx++];
|
D->SequenceNumber = Record[Idx++];
|
||||||
|
@ -1058,7 +1070,7 @@ void ASTDeclReader::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
|
||||||
D->setParameterPack(Record[Idx++]);
|
D->setParameterPack(Record[Idx++]);
|
||||||
|
|
||||||
bool Inherited = Record[Idx++];
|
bool Inherited = Record[Idx++];
|
||||||
TypeSourceInfo *DefArg = Reader.GetTypeSourceInfo(Cursor, Record, Idx);
|
TypeSourceInfo *DefArg = GetTypeSourceInfo(Record, Idx);
|
||||||
D->setDefaultArgument(DefArg, Inherited);
|
D->setDefaultArgument(DefArg, Inherited);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1069,7 +1081,7 @@ void ASTDeclReader::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {
|
||||||
D->setPosition(Record[Idx++]);
|
D->setPosition(Record[Idx++]);
|
||||||
// Rest of NonTypeTemplateParmDecl.
|
// Rest of NonTypeTemplateParmDecl.
|
||||||
if (Record[Idx++]) {
|
if (Record[Idx++]) {
|
||||||
Expr *DefArg = Reader.ReadExpr(Cursor);
|
Expr *DefArg = Reader.ReadExpr(F);
|
||||||
bool Inherited = Record[Idx++];
|
bool Inherited = Record[Idx++];
|
||||||
D->setDefaultArgument(DefArg, Inherited);
|
D->setDefaultArgument(DefArg, Inherited);
|
||||||
}
|
}
|
||||||
|
@ -1081,15 +1093,15 @@ void ASTDeclReader::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) {
|
||||||
D->setDepth(Record[Idx++]);
|
D->setDepth(Record[Idx++]);
|
||||||
D->setPosition(Record[Idx++]);
|
D->setPosition(Record[Idx++]);
|
||||||
// Rest of TemplateTemplateParmDecl.
|
// Rest of TemplateTemplateParmDecl.
|
||||||
TemplateArgumentLoc Arg = Reader.ReadTemplateArgumentLoc(Cursor, Record, Idx);
|
TemplateArgumentLoc Arg = Reader.ReadTemplateArgumentLoc(F, Record, Idx);
|
||||||
bool IsInherited = Record[Idx++];
|
bool IsInherited = Record[Idx++];
|
||||||
D->setDefaultArgument(Arg, IsInherited);
|
D->setDefaultArgument(Arg, IsInherited);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitStaticAssertDecl(StaticAssertDecl *D) {
|
void ASTDeclReader::VisitStaticAssertDecl(StaticAssertDecl *D) {
|
||||||
VisitDecl(D);
|
VisitDecl(D);
|
||||||
D->AssertExpr = Reader.ReadExpr(Cursor);
|
D->AssertExpr = Reader.ReadExpr(F);
|
||||||
D->Message = cast<StringLiteral>(Reader.ReadExpr(Cursor));
|
D->Message = cast<StringLiteral>(Reader.ReadExpr(F));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<uint64_t, uint64_t>
|
std::pair<uint64_t, uint64_t>
|
||||||
|
@ -1152,8 +1164,8 @@ void ASTDeclReader::VisitRedeclarable(Redeclarable<T> *D) {
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// \brief Reads attributes from the current stream position.
|
/// \brief Reads attributes from the current stream position.
|
||||||
void ASTReader::ReadAttributes(llvm::BitstreamCursor &DeclsCursor,
|
void ASTReader::ReadAttributes(PerFileData &F, AttrVec &Attrs) {
|
||||||
AttrVec &Attrs) {
|
llvm::BitstreamCursor &DeclsCursor = F.DeclsCursor;
|
||||||
unsigned Code = DeclsCursor.ReadCode();
|
unsigned Code = DeclsCursor.ReadCode();
|
||||||
assert(Code == llvm::bitc::UNABBREV_RECORD &&
|
assert(Code == llvm::bitc::UNABBREV_RECORD &&
|
||||||
"Expected unabbreviated record"); (void)Code;
|
"Expected unabbreviated record"); (void)Code;
|
||||||
|
@ -1167,7 +1179,7 @@ void ASTReader::ReadAttributes(llvm::BitstreamCursor &DeclsCursor,
|
||||||
while (Idx < Record.size()) {
|
while (Idx < Record.size()) {
|
||||||
Attr *New = 0;
|
Attr *New = 0;
|
||||||
attr::Kind Kind = (attr::Kind)Record[Idx++];
|
attr::Kind Kind = (attr::Kind)Record[Idx++];
|
||||||
SourceLocation Loc = SourceLocation::getFromRawEncoding(Record[Idx++]);
|
SourceLocation Loc = ReadSourceLocation(F, Record, Idx);
|
||||||
bool isInherited = Record[Idx++];
|
bool isInherited = Record[Idx++];
|
||||||
|
|
||||||
#include "clang/Serialization/AttrPCHRead.inc"
|
#include "clang/Serialization/AttrPCHRead.inc"
|
||||||
|
@ -1217,7 +1229,7 @@ ASTReader::DeclCursorForIndex(unsigned Index, DeclID ID) {
|
||||||
// See if there's an override.
|
// See if there's an override.
|
||||||
DeclReplacementMap::iterator It = ReplacedDecls.find(ID);
|
DeclReplacementMap::iterator It = ReplacedDecls.find(ID);
|
||||||
if (It != ReplacedDecls.end())
|
if (It != ReplacedDecls.end())
|
||||||
return RecordLocation(&It->second.first->DeclsCursor, It->second.second);
|
return RecordLocation(It->second.first, It->second.second);
|
||||||
|
|
||||||
PerFileData *F = 0;
|
PerFileData *F = 0;
|
||||||
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
|
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
|
||||||
|
@ -1227,13 +1239,13 @@ ASTReader::DeclCursorForIndex(unsigned Index, DeclID ID) {
|
||||||
Index -= F->LocalNumDecls;
|
Index -= F->LocalNumDecls;
|
||||||
}
|
}
|
||||||
assert(F && F->LocalNumDecls > Index && "Broken chain");
|
assert(F && F->LocalNumDecls > Index && "Broken chain");
|
||||||
return RecordLocation(&F->DeclsCursor, F->DeclOffsets[Index]);
|
return RecordLocation(F, F->DeclOffsets[Index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Read the declaration at the given offset from the AST file.
|
/// \brief Read the declaration at the given offset from the AST file.
|
||||||
Decl *ASTReader::ReadDeclRecord(unsigned Index, DeclID ID) {
|
Decl *ASTReader::ReadDeclRecord(unsigned Index, DeclID ID) {
|
||||||
RecordLocation Loc = DeclCursorForIndex(Index, ID);
|
RecordLocation Loc = DeclCursorForIndex(Index, ID);
|
||||||
llvm::BitstreamCursor &DeclsCursor = *Loc.first;
|
llvm::BitstreamCursor &DeclsCursor = Loc.F->DeclsCursor;
|
||||||
// Keep track of where we are in the stream, then jump back there
|
// Keep track of where we are in the stream, then jump back there
|
||||||
// after reading this declaration.
|
// after reading this declaration.
|
||||||
SavedStreamPosition SavedPosition(DeclsCursor);
|
SavedStreamPosition SavedPosition(DeclsCursor);
|
||||||
|
@ -1243,11 +1255,11 @@ Decl *ASTReader::ReadDeclRecord(unsigned Index, DeclID ID) {
|
||||||
// Note that we are loading a declaration record.
|
// Note that we are loading a declaration record.
|
||||||
Deserializing ADecl(this);
|
Deserializing ADecl(this);
|
||||||
|
|
||||||
DeclsCursor.JumpToBit(Loc.second);
|
DeclsCursor.JumpToBit(Loc.Offset);
|
||||||
RecordData Record;
|
RecordData Record;
|
||||||
unsigned Code = DeclsCursor.ReadCode();
|
unsigned Code = DeclsCursor.ReadCode();
|
||||||
unsigned Idx = 0;
|
unsigned Idx = 0;
|
||||||
ASTDeclReader Reader(*this, DeclsCursor, ID, Record, Idx);
|
ASTDeclReader Reader(*this, *Loc.F, DeclsCursor, ID, Record, Idx);
|
||||||
|
|
||||||
Decl *D = 0;
|
Decl *D = 0;
|
||||||
switch ((DeclCode)DeclsCursor.ReadRecord(Code, Record)) {
|
switch ((DeclCode)DeclsCursor.ReadRecord(Code, Record)) {
|
||||||
|
|
|
@ -22,14 +22,28 @@ namespace clang {
|
||||||
|
|
||||||
class ASTStmtReader : public StmtVisitor<ASTStmtReader> {
|
class ASTStmtReader : public StmtVisitor<ASTStmtReader> {
|
||||||
ASTReader &Reader;
|
ASTReader &Reader;
|
||||||
|
ASTReader::PerFileData &F;
|
||||||
llvm::BitstreamCursor &DeclsCursor;
|
llvm::BitstreamCursor &DeclsCursor;
|
||||||
const ASTReader::RecordData &Record;
|
const ASTReader::RecordData &Record;
|
||||||
unsigned &Idx;
|
unsigned &Idx;
|
||||||
|
|
||||||
|
SourceLocation ReadSourceLocation(const ASTReader::RecordData &R,
|
||||||
|
unsigned &I) {
|
||||||
|
return Reader.ReadSourceLocation(F, R, I);
|
||||||
|
}
|
||||||
|
SourceRange ReadSourceRange(const ASTReader::RecordData &R, unsigned &I) {
|
||||||
|
return Reader.ReadSourceRange(F, R, I);
|
||||||
|
}
|
||||||
|
TypeSourceInfo *GetTypeSourceInfo(const ASTReader::RecordData &R,
|
||||||
|
unsigned &I) {
|
||||||
|
return Reader.GetTypeSourceInfo(F, R, I);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ASTStmtReader(ASTReader &Reader, llvm::BitstreamCursor &Cursor,
|
ASTStmtReader(ASTReader &Reader, ASTReader::PerFileData &F,
|
||||||
|
llvm::BitstreamCursor &Cursor,
|
||||||
const ASTReader::RecordData &Record, unsigned &Idx)
|
const ASTReader::RecordData &Record, unsigned &Idx)
|
||||||
: Reader(Reader), DeclsCursor(Cursor), Record(Record), Idx(Idx) { }
|
: Reader(Reader), F(F), DeclsCursor(Cursor), Record(Record), Idx(Idx) { }
|
||||||
|
|
||||||
/// \brief The number of record fields required for the Stmt class
|
/// \brief The number of record fields required for the Stmt class
|
||||||
/// itself.
|
/// itself.
|
||||||
|
@ -164,11 +178,11 @@ void ASTStmtReader::
|
||||||
ReadExplicitTemplateArgumentList(ExplicitTemplateArgumentList &ArgList,
|
ReadExplicitTemplateArgumentList(ExplicitTemplateArgumentList &ArgList,
|
||||||
unsigned NumTemplateArgs) {
|
unsigned NumTemplateArgs) {
|
||||||
TemplateArgumentListInfo ArgInfo;
|
TemplateArgumentListInfo ArgInfo;
|
||||||
ArgInfo.setLAngleLoc(Reader.ReadSourceLocation(Record, Idx));
|
ArgInfo.setLAngleLoc(ReadSourceLocation(Record, Idx));
|
||||||
ArgInfo.setRAngleLoc(Reader.ReadSourceLocation(Record, Idx));
|
ArgInfo.setRAngleLoc(ReadSourceLocation(Record, Idx));
|
||||||
for (unsigned i = 0; i != NumTemplateArgs; ++i)
|
for (unsigned i = 0; i != NumTemplateArgs; ++i)
|
||||||
ArgInfo.addArgument(
|
ArgInfo.addArgument(
|
||||||
Reader.ReadTemplateArgumentLoc(DeclsCursor, Record, Idx));
|
Reader.ReadTemplateArgumentLoc(F, Record, Idx));
|
||||||
ArgList.initializeFrom(ArgInfo);
|
ArgList.initializeFrom(ArgInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +192,7 @@ void ASTStmtReader::VisitStmt(Stmt *S) {
|
||||||
|
|
||||||
void ASTStmtReader::VisitNullStmt(NullStmt *S) {
|
void ASTStmtReader::VisitNullStmt(NullStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setSemiLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setSemiLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) {
|
void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) {
|
||||||
|
@ -188,8 +202,8 @@ void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) {
|
||||||
while (NumStmts--)
|
while (NumStmts--)
|
||||||
Stmts.push_back(Reader.ReadSubStmt());
|
Stmts.push_back(Reader.ReadSubStmt());
|
||||||
S->setStmts(*Reader.getContext(), Stmts.data(), Stmts.size());
|
S->setStmts(*Reader.getContext(), Stmts.data(), Stmts.size());
|
||||||
S->setLBracLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setLBracLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setRBracLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setRBracLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitSwitchCase(SwitchCase *S) {
|
void ASTStmtReader::VisitSwitchCase(SwitchCase *S) {
|
||||||
|
@ -202,23 +216,23 @@ void ASTStmtReader::VisitCaseStmt(CaseStmt *S) {
|
||||||
S->setLHS(Reader.ReadSubExpr());
|
S->setLHS(Reader.ReadSubExpr());
|
||||||
S->setRHS(Reader.ReadSubExpr());
|
S->setRHS(Reader.ReadSubExpr());
|
||||||
S->setSubStmt(Reader.ReadSubStmt());
|
S->setSubStmt(Reader.ReadSubStmt());
|
||||||
S->setCaseLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setCaseLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setEllipsisLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setEllipsisLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setColonLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setColonLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) {
|
void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) {
|
||||||
VisitSwitchCase(S);
|
VisitSwitchCase(S);
|
||||||
S->setSubStmt(Reader.ReadSubStmt());
|
S->setSubStmt(Reader.ReadSubStmt());
|
||||||
S->setDefaultLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setDefaultLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setColonLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setColonLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
|
void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setID(Reader.GetIdentifierInfo(Record, Idx));
|
S->setID(Reader.GetIdentifierInfo(Record, Idx));
|
||||||
S->setSubStmt(Reader.ReadSubStmt());
|
S->setSubStmt(Reader.ReadSubStmt());
|
||||||
S->setIdentLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setIdentLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setUsed(Record[Idx++]);
|
S->setUsed(Record[Idx++]);
|
||||||
S->setUnusedAttribute(Record[Idx++]);
|
S->setUnusedAttribute(Record[Idx++]);
|
||||||
Reader.RecordLabelStmt(S, Record[Idx++]);
|
Reader.RecordLabelStmt(S, Record[Idx++]);
|
||||||
|
@ -231,8 +245,8 @@ void ASTStmtReader::VisitIfStmt(IfStmt *S) {
|
||||||
S->setCond(Reader.ReadSubExpr());
|
S->setCond(Reader.ReadSubExpr());
|
||||||
S->setThen(Reader.ReadSubStmt());
|
S->setThen(Reader.ReadSubStmt());
|
||||||
S->setElse(Reader.ReadSubStmt());
|
S->setElse(Reader.ReadSubStmt());
|
||||||
S->setIfLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setIfLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setElseLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setElseLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
|
void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
|
||||||
|
@ -241,7 +255,7 @@ void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
|
||||||
cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
S->setCond(Reader.ReadSubExpr());
|
S->setCond(Reader.ReadSubExpr());
|
||||||
S->setBody(Reader.ReadSubStmt());
|
S->setBody(Reader.ReadSubStmt());
|
||||||
S->setSwitchLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setSwitchLoc(ReadSourceLocation(Record, Idx));
|
||||||
if (Record[Idx++])
|
if (Record[Idx++])
|
||||||
S->setAllEnumCasesCovered();
|
S->setAllEnumCasesCovered();
|
||||||
|
|
||||||
|
@ -266,16 +280,16 @@ void ASTStmtReader::VisitWhileStmt(WhileStmt *S) {
|
||||||
cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
S->setCond(Reader.ReadSubExpr());
|
S->setCond(Reader.ReadSubExpr());
|
||||||
S->setBody(Reader.ReadSubStmt());
|
S->setBody(Reader.ReadSubStmt());
|
||||||
S->setWhileLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setWhileLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitDoStmt(DoStmt *S) {
|
void ASTStmtReader::VisitDoStmt(DoStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setCond(Reader.ReadSubExpr());
|
S->setCond(Reader.ReadSubExpr());
|
||||||
S->setBody(Reader.ReadSubStmt());
|
S->setBody(Reader.ReadSubStmt());
|
||||||
S->setDoLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setDoLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setWhileLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setWhileLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitForStmt(ForStmt *S) {
|
void ASTStmtReader::VisitForStmt(ForStmt *S) {
|
||||||
|
@ -286,46 +300,46 @@ void ASTStmtReader::VisitForStmt(ForStmt *S) {
|
||||||
cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
S->setInc(Reader.ReadSubExpr());
|
S->setInc(Reader.ReadSubExpr());
|
||||||
S->setBody(Reader.ReadSubStmt());
|
S->setBody(Reader.ReadSubStmt());
|
||||||
S->setForLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setForLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setLParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitGotoStmt(GotoStmt *S) {
|
void ASTStmtReader::VisitGotoStmt(GotoStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
Reader.SetLabelOf(S, Record[Idx++]);
|
Reader.SetLabelOf(S, Record[Idx++]);
|
||||||
S->setGotoLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setGotoLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setLabelLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setLabelLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
|
void ASTStmtReader::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setGotoLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setGotoLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setStarLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setStarLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setTarget(Reader.ReadSubExpr());
|
S->setTarget(Reader.ReadSubExpr());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitContinueStmt(ContinueStmt *S) {
|
void ASTStmtReader::VisitContinueStmt(ContinueStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setContinueLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setContinueLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitBreakStmt(BreakStmt *S) {
|
void ASTStmtReader::VisitBreakStmt(BreakStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setBreakLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setBreakLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) {
|
void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setRetValue(Reader.ReadSubExpr());
|
S->setRetValue(Reader.ReadSubExpr());
|
||||||
S->setReturnLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setReturnLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setNRVOCandidate(cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
S->setNRVOCandidate(cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitDeclStmt(DeclStmt *S) {
|
void ASTStmtReader::VisitDeclStmt(DeclStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setStartLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setStartLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setEndLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setEndLoc(ReadSourceLocation(Record, Idx));
|
||||||
|
|
||||||
if (Idx + 1 == Record.size()) {
|
if (Idx + 1 == Record.size()) {
|
||||||
// Single declaration
|
// Single declaration
|
||||||
|
@ -346,8 +360,8 @@ void ASTStmtReader::VisitAsmStmt(AsmStmt *S) {
|
||||||
unsigned NumOutputs = Record[Idx++];
|
unsigned NumOutputs = Record[Idx++];
|
||||||
unsigned NumInputs = Record[Idx++];
|
unsigned NumInputs = Record[Idx++];
|
||||||
unsigned NumClobbers = Record[Idx++];
|
unsigned NumClobbers = Record[Idx++];
|
||||||
S->setAsmLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setAsmLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setVolatile(Record[Idx++]);
|
S->setVolatile(Record[Idx++]);
|
||||||
S->setSimple(Record[Idx++]);
|
S->setSimple(Record[Idx++]);
|
||||||
S->setMSAsm(Record[Idx++]);
|
S->setMSAsm(Record[Idx++]);
|
||||||
|
@ -385,7 +399,7 @@ void ASTStmtReader::VisitExpr(Expr *E) {
|
||||||
|
|
||||||
void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) {
|
void ASTStmtReader::VisitPredefinedExpr(PredefinedExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
E->setIdentType((PredefinedExpr::IdentType)Record[Idx++]);
|
E->setIdentType((PredefinedExpr::IdentType)Record[Idx++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +414,7 @@ void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
|
||||||
|
|
||||||
if (HasQualifier) {
|
if (HasQualifier) {
|
||||||
E->getNameQualifier()->NNS = Reader.ReadNestedNameSpecifier(Record, Idx);
|
E->getNameQualifier()->NNS = Reader.ReadNestedNameSpecifier(Record, Idx);
|
||||||
E->getNameQualifier()->Range = Reader.ReadSourceRange(Record, Idx);
|
E->getNameQualifier()->Range = ReadSourceRange(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NumTemplateArgs)
|
if (NumTemplateArgs)
|
||||||
|
@ -409,12 +423,12 @@ void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
|
||||||
|
|
||||||
E->setDecl(cast<ValueDecl>(Reader.GetDecl(Record[Idx++])));
|
E->setDecl(cast<ValueDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
// FIXME: read DeclarationNameLoc.
|
// FIXME: read DeclarationNameLoc.
|
||||||
E->setLocation(Reader.ReadSourceLocation(Record, Idx));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) {
|
void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
E->setValue(*Reader.getContext(), Reader.ReadAPInt(Record, Idx));
|
E->setValue(*Reader.getContext(), Reader.ReadAPInt(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +436,7 @@ void ASTStmtReader::VisitFloatingLiteral(FloatingLiteral *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setValue(*Reader.getContext(), Reader.ReadAPFloat(Record, Idx));
|
E->setValue(*Reader.getContext(), Reader.ReadAPFloat(Record, Idx));
|
||||||
E->setExact(Record[Idx++]);
|
E->setExact(Record[Idx++]);
|
||||||
E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) {
|
void ASTStmtReader::VisitImaginaryLiteral(ImaginaryLiteral *E) {
|
||||||
|
@ -445,20 +459,20 @@ void ASTStmtReader::VisitStringLiteral(StringLiteral *E) {
|
||||||
|
|
||||||
// Read source locations
|
// Read source locations
|
||||||
for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
|
for (unsigned I = 0, N = E->getNumConcatenated(); I != N; ++I)
|
||||||
E->setStrTokenLoc(I, SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setStrTokenLoc(I, ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) {
|
void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setValue(Record[Idx++]);
|
E->setValue(Record[Idx++]);
|
||||||
E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
E->setWide(Record[Idx++]);
|
E->setWide(Record[Idx++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitParenExpr(ParenExpr *E) {
|
void ASTStmtReader::VisitParenExpr(ParenExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setLParen(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLParen(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParen(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRParen(ReadSourceLocation(Record, Idx));
|
||||||
E->setSubExpr(Reader.ReadSubExpr());
|
E->setSubExpr(Reader.ReadSubExpr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,15 +483,15 @@ void ASTStmtReader::VisitParenListExpr(ParenListExpr *E) {
|
||||||
for (unsigned i = 0; i != NumExprs; ++i)
|
for (unsigned i = 0; i != NumExprs; ++i)
|
||||||
E->Exprs[i] = Reader.ReadSubStmt();
|
E->Exprs[i] = Reader.ReadSubStmt();
|
||||||
E->NumExprs = NumExprs;
|
E->NumExprs = NumExprs;
|
||||||
E->LParenLoc = Reader.ReadSourceLocation(Record, Idx);
|
E->LParenLoc = ReadSourceLocation(Record, Idx);
|
||||||
E->RParenLoc = Reader.ReadSourceLocation(Record, Idx);
|
E->RParenLoc = ReadSourceLocation(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) {
|
void ASTStmtReader::VisitUnaryOperator(UnaryOperator *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setSubExpr(Reader.ReadSubExpr());
|
E->setSubExpr(Reader.ReadSubExpr());
|
||||||
E->setOpcode((UnaryOperator::Opcode)Record[Idx++]);
|
E->setOpcode((UnaryOperator::Opcode)Record[Idx++]);
|
||||||
E->setOperatorLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setOperatorLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
|
void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
|
||||||
|
@ -487,13 +501,13 @@ void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
|
||||||
++Idx;
|
++Idx;
|
||||||
assert(E->getNumExpressions() == Record[Idx]);
|
assert(E->getNumExpressions() == Record[Idx]);
|
||||||
++Idx;
|
++Idx;
|
||||||
E->setOperatorLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setOperatorLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setTypeSourceInfo(Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx));
|
E->setTypeSourceInfo(GetTypeSourceInfo(Record, Idx));
|
||||||
for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
|
for (unsigned I = 0, N = E->getNumComponents(); I != N; ++I) {
|
||||||
Node::Kind Kind = static_cast<Node::Kind>(Record[Idx++]);
|
Node::Kind Kind = static_cast<Node::Kind>(Record[Idx++]);
|
||||||
SourceLocation Start = SourceLocation::getFromRawEncoding(Record[Idx++]);
|
SourceLocation Start = ReadSourceLocation(Record, Idx);
|
||||||
SourceLocation End = SourceLocation::getFromRawEncoding(Record[Idx++]);
|
SourceLocation End = ReadSourceLocation(Record, Idx);
|
||||||
switch (Kind) {
|
switch (Kind) {
|
||||||
case Node::Array:
|
case Node::Array:
|
||||||
E->setComponent(I, Node(Start, Record[Idx++], End));
|
E->setComponent(I, Node(Start, Record[Idx++], End));
|
||||||
|
@ -512,7 +526,7 @@ void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
|
||||||
|
|
||||||
case Node::Base: {
|
case Node::Base: {
|
||||||
CXXBaseSpecifier *Base = new (*Reader.getContext()) CXXBaseSpecifier();
|
CXXBaseSpecifier *Base = new (*Reader.getContext()) CXXBaseSpecifier();
|
||||||
*Base = Reader.ReadCXXBaseSpecifier(DeclsCursor, Record, Idx);
|
*Base = Reader.ReadCXXBaseSpecifier(F, Record, Idx);
|
||||||
E->setComponent(I, Node(Base));
|
E->setComponent(I, Node(Base));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -530,23 +544,23 @@ void ASTStmtReader::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
|
||||||
E->setArgument(Reader.ReadSubExpr());
|
E->setArgument(Reader.ReadSubExpr());
|
||||||
++Idx;
|
++Idx;
|
||||||
} else {
|
} else {
|
||||||
E->setArgument(Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx));
|
E->setArgument(GetTypeSourceInfo(Record, Idx));
|
||||||
}
|
}
|
||||||
E->setOperatorLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setOperatorLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
|
void ASTStmtReader::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setLHS(Reader.ReadSubExpr());
|
E->setLHS(Reader.ReadSubExpr());
|
||||||
E->setRHS(Reader.ReadSubExpr());
|
E->setRHS(Reader.ReadSubExpr());
|
||||||
E->setRBracketLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRBracketLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCallExpr(CallExpr *E) {
|
void ASTStmtReader::VisitCallExpr(CallExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setNumArgs(*Reader.getContext(), Record[Idx++]);
|
E->setNumArgs(*Reader.getContext(), Record[Idx++]);
|
||||||
E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setCallee(Reader.ReadSubExpr());
|
E->setCallee(Reader.ReadSubExpr());
|
||||||
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
|
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
|
||||||
E->setArg(I, Reader.ReadSubExpr());
|
E->setArg(I, Reader.ReadSubExpr());
|
||||||
|
@ -561,7 +575,7 @@ void ASTStmtReader::VisitMemberExpr(MemberExpr *E) {
|
||||||
void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) {
|
void ASTStmtReader::VisitObjCIsaExpr(ObjCIsaExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setBase(Reader.ReadSubExpr());
|
E->setBase(Reader.ReadSubExpr());
|
||||||
E->setIsaMemberLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setIsaMemberLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setArrow(Record[Idx++]);
|
E->setArrow(Record[Idx++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,7 +588,7 @@ void ASTStmtReader::VisitCastExpr(CastExpr *E) {
|
||||||
CastExpr::path_iterator BaseI = E->path_begin();
|
CastExpr::path_iterator BaseI = E->path_begin();
|
||||||
while (NumBaseSpecs--) {
|
while (NumBaseSpecs--) {
|
||||||
CXXBaseSpecifier *BaseSpec = new (*Reader.getContext()) CXXBaseSpecifier;
|
CXXBaseSpecifier *BaseSpec = new (*Reader.getContext()) CXXBaseSpecifier;
|
||||||
*BaseSpec = Reader.ReadCXXBaseSpecifier(DeclsCursor, Record, Idx);
|
*BaseSpec = Reader.ReadCXXBaseSpecifier(F, Record, Idx);
|
||||||
*BaseI++ = BaseSpec;
|
*BaseI++ = BaseSpec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -584,7 +598,7 @@ void ASTStmtReader::VisitBinaryOperator(BinaryOperator *E) {
|
||||||
E->setLHS(Reader.ReadSubExpr());
|
E->setLHS(Reader.ReadSubExpr());
|
||||||
E->setRHS(Reader.ReadSubExpr());
|
E->setRHS(Reader.ReadSubExpr());
|
||||||
E->setOpcode((BinaryOperator::Opcode)Record[Idx++]);
|
E->setOpcode((BinaryOperator::Opcode)Record[Idx++]);
|
||||||
E->setOperatorLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setOperatorLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
|
void ASTStmtReader::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
|
||||||
|
@ -599,8 +613,8 @@ void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) {
|
||||||
E->setLHS(Reader.ReadSubExpr());
|
E->setLHS(Reader.ReadSubExpr());
|
||||||
E->setRHS(Reader.ReadSubExpr());
|
E->setRHS(Reader.ReadSubExpr());
|
||||||
E->setSAVE(Reader.ReadSubExpr());
|
E->setSAVE(Reader.ReadSubExpr());
|
||||||
E->setQuestionLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setQuestionLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setColonLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setColonLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
|
void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
|
||||||
|
@ -610,19 +624,19 @@ void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
|
||||||
|
|
||||||
void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
|
void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
|
||||||
VisitCastExpr(E);
|
VisitCastExpr(E);
|
||||||
E->setTypeInfoAsWritten(Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx));
|
E->setTypeInfoAsWritten(GetTypeSourceInfo(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) {
|
void ASTStmtReader::VisitCStyleCastExpr(CStyleCastExpr *E) {
|
||||||
VisitExplicitCastExpr(E);
|
VisitExplicitCastExpr(E);
|
||||||
E->setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
|
void ASTStmtReader::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setTypeSourceInfo(Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx));
|
E->setTypeSourceInfo(GetTypeSourceInfo(Record, Idx));
|
||||||
E->setInitializer(Reader.ReadSubExpr());
|
E->setInitializer(Reader.ReadSubExpr());
|
||||||
E->setFileScope(Record[Idx++]);
|
E->setFileScope(Record[Idx++]);
|
||||||
}
|
}
|
||||||
|
@ -631,7 +645,7 @@ void ASTStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setBase(Reader.ReadSubExpr());
|
E->setBase(Reader.ReadSubExpr());
|
||||||
E->setAccessor(Reader.GetIdentifierInfo(Record, Idx));
|
E->setAccessor(Reader.GetIdentifierInfo(Record, Idx));
|
||||||
E->setAccessorLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setAccessorLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
|
void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
|
||||||
|
@ -641,8 +655,8 @@ void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
|
||||||
for (unsigned I = 0; I != NumInits; ++I)
|
for (unsigned I = 0; I != NumInits; ++I)
|
||||||
E->updateInit(*Reader.getContext(), I, Reader.ReadSubExpr());
|
E->updateInit(*Reader.getContext(), I, Reader.ReadSubExpr());
|
||||||
E->setSyntacticForm(cast_or_null<InitListExpr>(Reader.ReadSubStmt()));
|
E->setSyntacticForm(cast_or_null<InitListExpr>(Reader.ReadSubStmt()));
|
||||||
E->setLBraceLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLBraceLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRBraceLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRBraceLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setInitializedFieldInUnion(
|
E->setInitializedFieldInUnion(
|
||||||
cast_or_null<FieldDecl>(Reader.GetDecl(Record[Idx++])));
|
cast_or_null<FieldDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
E->sawArrayRangeDesignator(Record[Idx++]);
|
E->sawArrayRangeDesignator(Record[Idx++]);
|
||||||
|
@ -656,7 +670,7 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
|
||||||
assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs");
|
assert(NumSubExprs == E->getNumSubExprs() && "Wrong number of subexprs");
|
||||||
for (unsigned I = 0; I != NumSubExprs; ++I)
|
for (unsigned I = 0; I != NumSubExprs; ++I)
|
||||||
E->setSubExpr(I, Reader.ReadSubExpr());
|
E->setSubExpr(I, Reader.ReadSubExpr());
|
||||||
E->setEqualOrColonLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setEqualOrColonLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setGNUSyntax(Record[Idx++]);
|
E->setGNUSyntax(Record[Idx++]);
|
||||||
|
|
||||||
llvm::SmallVector<Designator, 4> Designators;
|
llvm::SmallVector<Designator, 4> Designators;
|
||||||
|
@ -665,9 +679,9 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
|
||||||
case DESIG_FIELD_DECL: {
|
case DESIG_FIELD_DECL: {
|
||||||
FieldDecl *Field = cast<FieldDecl>(Reader.GetDecl(Record[Idx++]));
|
FieldDecl *Field = cast<FieldDecl>(Reader.GetDecl(Record[Idx++]));
|
||||||
SourceLocation DotLoc
|
SourceLocation DotLoc
|
||||||
= SourceLocation::getFromRawEncoding(Record[Idx++]);
|
= ReadSourceLocation(Record, Idx);
|
||||||
SourceLocation FieldLoc
|
SourceLocation FieldLoc
|
||||||
= SourceLocation::getFromRawEncoding(Record[Idx++]);
|
= ReadSourceLocation(Record, Idx);
|
||||||
Designators.push_back(Designator(Field->getIdentifier(), DotLoc,
|
Designators.push_back(Designator(Field->getIdentifier(), DotLoc,
|
||||||
FieldLoc));
|
FieldLoc));
|
||||||
Designators.back().setField(Field);
|
Designators.back().setField(Field);
|
||||||
|
@ -677,9 +691,9 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
|
||||||
case DESIG_FIELD_NAME: {
|
case DESIG_FIELD_NAME: {
|
||||||
const IdentifierInfo *Name = Reader.GetIdentifierInfo(Record, Idx);
|
const IdentifierInfo *Name = Reader.GetIdentifierInfo(Record, Idx);
|
||||||
SourceLocation DotLoc
|
SourceLocation DotLoc
|
||||||
= SourceLocation::getFromRawEncoding(Record[Idx++]);
|
= ReadSourceLocation(Record, Idx);
|
||||||
SourceLocation FieldLoc
|
SourceLocation FieldLoc
|
||||||
= SourceLocation::getFromRawEncoding(Record[Idx++]);
|
= ReadSourceLocation(Record, Idx);
|
||||||
Designators.push_back(Designator(Name, DotLoc, FieldLoc));
|
Designators.push_back(Designator(Name, DotLoc, FieldLoc));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -687,9 +701,9 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
|
||||||
case DESIG_ARRAY: {
|
case DESIG_ARRAY: {
|
||||||
unsigned Index = Record[Idx++];
|
unsigned Index = Record[Idx++];
|
||||||
SourceLocation LBracketLoc
|
SourceLocation LBracketLoc
|
||||||
= SourceLocation::getFromRawEncoding(Record[Idx++]);
|
= ReadSourceLocation(Record, Idx);
|
||||||
SourceLocation RBracketLoc
|
SourceLocation RBracketLoc
|
||||||
= SourceLocation::getFromRawEncoding(Record[Idx++]);
|
= ReadSourceLocation(Record, Idx);
|
||||||
Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc));
|
Designators.push_back(Designator(Index, LBracketLoc, RBracketLoc));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -697,11 +711,11 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
|
||||||
case DESIG_ARRAY_RANGE: {
|
case DESIG_ARRAY_RANGE: {
|
||||||
unsigned Index = Record[Idx++];
|
unsigned Index = Record[Idx++];
|
||||||
SourceLocation LBracketLoc
|
SourceLocation LBracketLoc
|
||||||
= SourceLocation::getFromRawEncoding(Record[Idx++]);
|
= ReadSourceLocation(Record, Idx);
|
||||||
SourceLocation EllipsisLoc
|
SourceLocation EllipsisLoc
|
||||||
= SourceLocation::getFromRawEncoding(Record[Idx++]);
|
= ReadSourceLocation(Record, Idx);
|
||||||
SourceLocation RBracketLoc
|
SourceLocation RBracketLoc
|
||||||
= SourceLocation::getFromRawEncoding(Record[Idx++]);
|
= ReadSourceLocation(Record, Idx);
|
||||||
Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc,
|
Designators.push_back(Designator(Index, LBracketLoc, EllipsisLoc,
|
||||||
RBracketLoc));
|
RBracketLoc));
|
||||||
break;
|
break;
|
||||||
|
@ -719,31 +733,31 @@ void ASTStmtReader::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {
|
||||||
void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) {
|
void ASTStmtReader::VisitVAArgExpr(VAArgExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setSubExpr(Reader.ReadSubExpr());
|
E->setSubExpr(Reader.ReadSubExpr());
|
||||||
E->setWrittenTypeInfo(Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx));
|
E->setWrittenTypeInfo(GetTypeSourceInfo(Record, Idx));
|
||||||
E->setBuiltinLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setBuiltinLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
|
void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setAmpAmpLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setAmpAmpLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setLabelLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLabelLoc(ReadSourceLocation(Record, Idx));
|
||||||
Reader.SetLabelOf(E, Record[Idx++]);
|
Reader.SetLabelOf(E, Record[Idx++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
|
void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setSubStmt(cast_or_null<CompoundStmt>(Reader.ReadSubStmt()));
|
E->setSubStmt(cast_or_null<CompoundStmt>(Reader.ReadSubStmt()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) {
|
void ASTStmtReader::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setArgTInfo1(Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx));
|
E->setArgTInfo1(GetTypeSourceInfo(Record, Idx));
|
||||||
E->setArgTInfo2(Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx));
|
E->setArgTInfo2(GetTypeSourceInfo(Record, Idx));
|
||||||
E->setBuiltinLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setBuiltinLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
|
void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
|
||||||
|
@ -751,13 +765,13 @@ void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
|
||||||
E->setCond(Reader.ReadSubExpr());
|
E->setCond(Reader.ReadSubExpr());
|
||||||
E->setLHS(Reader.ReadSubExpr());
|
E->setLHS(Reader.ReadSubExpr());
|
||||||
E->setRHS(Reader.ReadSubExpr());
|
E->setRHS(Reader.ReadSubExpr());
|
||||||
E->setBuiltinLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setBuiltinLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) {
|
void ASTStmtReader::VisitGNUNullExpr(GNUNullExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setTokenLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setTokenLocation(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
|
void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
|
||||||
|
@ -767,8 +781,8 @@ void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
|
||||||
while (NumExprs--)
|
while (NumExprs--)
|
||||||
Exprs.push_back(Reader.ReadSubExpr());
|
Exprs.push_back(Reader.ReadSubExpr());
|
||||||
E->setExprs(*Reader.getContext(), Exprs.data(), Exprs.size());
|
E->setExprs(*Reader.getContext(), Exprs.data(), Exprs.size());
|
||||||
E->setBuiltinLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setBuiltinLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
|
void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
|
||||||
|
@ -780,7 +794,7 @@ void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
|
||||||
void ASTStmtReader::VisitBlockDeclRefExpr(BlockDeclRefExpr *E) {
|
void ASTStmtReader::VisitBlockDeclRefExpr(BlockDeclRefExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setDecl(cast<ValueDecl>(Reader.GetDecl(Record[Idx++])));
|
E->setDecl(cast<ValueDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
E->setByRef(Record[Idx++]);
|
E->setByRef(Record[Idx++]);
|
||||||
E->setConstQualAdded(Record[Idx++]);
|
E->setConstQualAdded(Record[Idx++]);
|
||||||
E->setCopyConstructorExpr(Reader.ReadSubExpr());
|
E->setCopyConstructorExpr(Reader.ReadSubExpr());
|
||||||
|
@ -792,34 +806,34 @@ void ASTStmtReader::VisitBlockDeclRefExpr(BlockDeclRefExpr *E) {
|
||||||
void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) {
|
void ASTStmtReader::VisitObjCStringLiteral(ObjCStringLiteral *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setString(cast<StringLiteral>(Reader.ReadSubStmt()));
|
E->setString(cast<StringLiteral>(Reader.ReadSubStmt()));
|
||||||
E->setAtLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setAtLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
|
void ASTStmtReader::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setEncodedTypeSourceInfo(Reader.GetTypeSourceInfo(DeclsCursor,Record,Idx));
|
E->setEncodedTypeSourceInfo(GetTypeSourceInfo(Record, Idx));
|
||||||
E->setAtLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setAtLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
|
void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setSelector(Reader.GetSelector(Record, Idx));
|
E->setSelector(Reader.GetSelector(Record, Idx));
|
||||||
E->setAtLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setAtLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
|
void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setProtocol(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++])));
|
E->setProtocol(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
E->setAtLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setAtLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
|
void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setDecl(cast<ObjCIvarDecl>(Reader.GetDecl(Record[Idx++])));
|
E->setDecl(cast<ObjCIvarDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
E->setBase(Reader.ReadSubExpr());
|
E->setBase(Reader.ReadSubExpr());
|
||||||
E->setIsArrow(Record[Idx++]);
|
E->setIsArrow(Record[Idx++]);
|
||||||
E->setIsFreeIvar(Record[Idx++]);
|
E->setIsFreeIvar(Record[Idx++]);
|
||||||
|
@ -828,7 +842,7 @@ void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
|
||||||
void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
|
void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setProperty(cast<ObjCPropertyDecl>(Reader.GetDecl(Record[Idx++])));
|
E->setProperty(cast<ObjCPropertyDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
E->setBase(Reader.ReadSubExpr());
|
E->setBase(Reader.ReadSubExpr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -842,8 +856,8 @@ void ASTStmtReader::VisitObjCImplicitSetterGetterRefExpr(
|
||||||
E->setInterfaceDecl(
|
E->setInterfaceDecl(
|
||||||
cast_or_null<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
|
cast_or_null<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
E->setBase(Reader.ReadSubExpr());
|
E->setBase(Reader.ReadSubExpr());
|
||||||
E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
E->setClassLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setClassLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
|
void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
|
||||||
|
@ -858,13 +872,13 @@ void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ObjCMessageExpr::Class:
|
case ObjCMessageExpr::Class:
|
||||||
E->setClassReceiver(Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx));
|
E->setClassReceiver(GetTypeSourceInfo(Record, Idx));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ObjCMessageExpr::SuperClass:
|
case ObjCMessageExpr::SuperClass:
|
||||||
case ObjCMessageExpr::SuperInstance: {
|
case ObjCMessageExpr::SuperInstance: {
|
||||||
QualType T = Reader.GetType(Record[Idx++]);
|
QualType T = Reader.GetType(Record[Idx++]);
|
||||||
SourceLocation SuperLoc = SourceLocation::getFromRawEncoding(Record[Idx++]);
|
SourceLocation SuperLoc = ReadSourceLocation(Record, Idx);
|
||||||
E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance);
|
E->setSuper(SuperLoc, T, Kind == ObjCMessageExpr::SuperInstance);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -877,8 +891,8 @@ void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
|
||||||
else
|
else
|
||||||
E->setSelector(Reader.GetSelector(Record, Idx));
|
E->setSelector(Reader.GetSelector(Record, Idx));
|
||||||
|
|
||||||
E->setLeftLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLeftLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRightLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRightLoc(ReadSourceLocation(Record, Idx));
|
||||||
|
|
||||||
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
|
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
|
||||||
E->setArg(I, Reader.ReadSubExpr());
|
E->setArg(I, Reader.ReadSubExpr());
|
||||||
|
@ -886,7 +900,7 @@ void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
|
||||||
|
|
||||||
void ASTStmtReader::VisitObjCSuperExpr(ObjCSuperExpr *E) {
|
void ASTStmtReader::VisitObjCSuperExpr(ObjCSuperExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
|
void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
|
||||||
|
@ -894,22 +908,22 @@ void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
|
||||||
S->setElement(Reader.ReadSubStmt());
|
S->setElement(Reader.ReadSubStmt());
|
||||||
S->setCollection(Reader.ReadSubExpr());
|
S->setCollection(Reader.ReadSubExpr());
|
||||||
S->setBody(Reader.ReadSubStmt());
|
S->setBody(Reader.ReadSubStmt());
|
||||||
S->setForLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setForLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
|
void ASTStmtReader::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setCatchBody(Reader.ReadSubStmt());
|
S->setCatchBody(Reader.ReadSubStmt());
|
||||||
S->setCatchParamDecl(cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
S->setCatchParamDecl(cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
S->setAtCatchLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setAtCatchLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
|
void ASTStmtReader::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setFinallyBody(Reader.ReadSubStmt());
|
S->setFinallyBody(Reader.ReadSubStmt());
|
||||||
S->setAtFinallyLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setAtFinallyLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
|
void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
|
||||||
|
@ -923,20 +937,20 @@ void ASTStmtReader::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
|
||||||
|
|
||||||
if (HasFinally)
|
if (HasFinally)
|
||||||
S->setFinallyStmt(Reader.ReadSubStmt());
|
S->setFinallyStmt(Reader.ReadSubStmt());
|
||||||
S->setAtTryLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setAtTryLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
|
void ASTStmtReader::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setSynchExpr(Reader.ReadSubStmt());
|
S->setSynchExpr(Reader.ReadSubStmt());
|
||||||
S->setSynchBody(Reader.ReadSubStmt());
|
S->setSynchBody(Reader.ReadSubStmt());
|
||||||
S->setAtSynchronizedLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setAtSynchronizedLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
|
void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setThrowExpr(Reader.ReadSubStmt());
|
S->setThrowExpr(Reader.ReadSubStmt());
|
||||||
S->setThrowLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
S->setThrowLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -945,7 +959,7 @@ void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
|
void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->CatchLoc = Reader.ReadSourceLocation(Record, Idx);
|
S->CatchLoc = ReadSourceLocation(Record, Idx);
|
||||||
S->ExceptionDecl = cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++]));
|
S->ExceptionDecl = cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++]));
|
||||||
S->HandlerBlock = Reader.ReadSubStmt();
|
S->HandlerBlock = Reader.ReadSubStmt();
|
||||||
}
|
}
|
||||||
|
@ -954,7 +968,7 @@ void ASTStmtReader::VisitCXXTryStmt(CXXTryStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
assert(Record[Idx] == S->getNumHandlers() && "NumStmtFields is wrong ?");
|
assert(Record[Idx] == S->getNumHandlers() && "NumStmtFields is wrong ?");
|
||||||
++Idx;
|
++Idx;
|
||||||
S->TryLoc = Reader.ReadSourceLocation(Record, Idx);
|
S->TryLoc = ReadSourceLocation(Record, Idx);
|
||||||
S->getStmts()[0] = Reader.ReadSubStmt();
|
S->getStmts()[0] = Reader.ReadSubStmt();
|
||||||
for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
|
for (unsigned i = 0, e = S->getNumHandlers(); i != e; ++i)
|
||||||
S->getStmts()[i + 1] = Reader.ReadSubStmt();
|
S->getStmts()[i + 1] = Reader.ReadSubStmt();
|
||||||
|
@ -973,7 +987,7 @@ void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
|
||||||
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
|
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I)
|
||||||
E->setArg(I, Reader.ReadSubExpr());
|
E->setArg(I, Reader.ReadSubExpr());
|
||||||
E->setConstructor(cast<CXXConstructorDecl>(Reader.GetDecl(Record[Idx++])));
|
E->setConstructor(cast<CXXConstructorDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
E->setElidable(Record[Idx++]);
|
E->setElidable(Record[Idx++]);
|
||||||
E->setRequiresZeroInitialization(Record[Idx++]);
|
E->setRequiresZeroInitialization(Record[Idx++]);
|
||||||
E->setConstructionKind((CXXConstructExpr::ConstructionKind)Record[Idx++]);
|
E->setConstructionKind((CXXConstructExpr::ConstructionKind)Record[Idx++]);
|
||||||
|
@ -981,13 +995,13 @@ void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
|
void ASTStmtReader::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
|
||||||
VisitCXXConstructExpr(E);
|
VisitCXXConstructExpr(E);
|
||||||
E->Type = Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx);
|
E->Type = GetTypeSourceInfo(Record, Idx);
|
||||||
E->RParenLoc = Reader.ReadSourceLocation(Record, Idx);
|
E->RParenLoc = ReadSourceLocation(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
|
void ASTStmtReader::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
|
||||||
VisitExplicitCastExpr(E);
|
VisitExplicitCastExpr(E);
|
||||||
E->setOperatorLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setOperatorLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
|
void ASTStmtReader::VisitCXXStaticCastExpr(CXXStaticCastExpr *E) {
|
||||||
|
@ -1008,27 +1022,27 @@ void ASTStmtReader::VisitCXXConstCastExpr(CXXConstCastExpr *E) {
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
|
void ASTStmtReader::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E) {
|
||||||
VisitExplicitCastExpr(E);
|
VisitExplicitCastExpr(E);
|
||||||
E->setTypeBeginLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setTypeBeginLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
|
void ASTStmtReader::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setValue(Record[Idx++]);
|
E->setValue(Record[Idx++]);
|
||||||
E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
|
void ASTStmtReader::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
|
void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setSourceRange(Reader.ReadSourceRange(Record, Idx));
|
E->setSourceRange(ReadSourceRange(Record, Idx));
|
||||||
if (E->isTypeOperand()) { // typeid(int)
|
if (E->isTypeOperand()) { // typeid(int)
|
||||||
E->setTypeOperandSourceInfo(
|
E->setTypeOperandSourceInfo(
|
||||||
Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx));
|
GetTypeSourceInfo(Record, Idx));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1037,10 +1051,10 @@ void ASTStmtReader::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
|
||||||
}
|
}
|
||||||
void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
|
void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setSourceRange(Reader.ReadSourceRange(Record, Idx));
|
E->setSourceRange(ReadSourceRange(Record, Idx));
|
||||||
if (E->isTypeOperand()) { // __uuidof(ComType)
|
if (E->isTypeOperand()) { // __uuidof(ComType)
|
||||||
E->setTypeOperandSourceInfo(
|
E->setTypeOperandSourceInfo(
|
||||||
Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx));
|
GetTypeSourceInfo(Record, Idx));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1050,13 +1064,13 @@ void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) {
|
void ASTStmtReader::VisitCXXThisExpr(CXXThisExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setLocation(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
E->setImplicit(Record[Idx++]);
|
E->setImplicit(Record[Idx++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) {
|
void ASTStmtReader::VisitCXXThrowExpr(CXXThrowExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setThrowLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setThrowLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setSubExpr(Reader.ReadSubExpr());
|
E->setSubExpr(Reader.ReadSubExpr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1066,7 +1080,7 @@ void ASTStmtReader::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
|
||||||
assert(Record[Idx] == E->Param.getInt() && "We messed up at creation ?");
|
assert(Record[Idx] == E->Param.getInt() && "We messed up at creation ?");
|
||||||
++Idx; // HasOtherExprStored and SubExpr was handled during creation.
|
++Idx; // HasOtherExprStored and SubExpr was handled during creation.
|
||||||
E->Param.setPointer(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
|
E->Param.setPointer(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
E->Loc = Reader.ReadSourceLocation(Record, Idx);
|
E->Loc = ReadSourceLocation(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
|
void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
|
||||||
|
@ -1077,8 +1091,8 @@ void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
|
void ASTStmtReader::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->TypeInfo = Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx);
|
E->TypeInfo = GetTypeSourceInfo(Record, Idx);
|
||||||
E->RParenLoc = SourceLocation::getFromRawEncoding(Record[Idx++]);
|
E->RParenLoc = ReadSourceLocation(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
|
void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
|
||||||
|
@ -1093,13 +1107,13 @@ void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
|
||||||
cast_or_null<FunctionDecl>(Reader.GetDecl(Record[Idx++])));
|
cast_or_null<FunctionDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
E->setConstructor(
|
E->setConstructor(
|
||||||
cast_or_null<CXXConstructorDecl>(Reader.GetDecl(Record[Idx++])));
|
cast_or_null<CXXConstructorDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
E->AllocatedTypeInfo = Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx);
|
E->AllocatedTypeInfo = GetTypeSourceInfo(Record, Idx);
|
||||||
SourceRange TypeIdParens;
|
SourceRange TypeIdParens;
|
||||||
TypeIdParens.setBegin(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TypeIdParens.setBegin(ReadSourceLocation(Record, Idx));
|
||||||
TypeIdParens.setEnd(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
TypeIdParens.setEnd(ReadSourceLocation(Record, Idx));
|
||||||
E->TypeIdParens = TypeIdParens;
|
E->TypeIdParens = TypeIdParens;
|
||||||
E->setStartLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setStartLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setEndLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
E->setEndLoc(ReadSourceLocation(Record, Idx));
|
||||||
|
|
||||||
E->AllocateArgsArray(*Reader.getContext(), isArray, NumPlacementArgs,
|
E->AllocateArgsArray(*Reader.getContext(), isArray, NumPlacementArgs,
|
||||||
NumCtorArgs);
|
NumCtorArgs);
|
||||||
|
@ -1117,7 +1131,7 @@ void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
|
||||||
E->ArrayFormAsWritten = Record[Idx++];
|
E->ArrayFormAsWritten = Record[Idx++];
|
||||||
E->OperatorDelete = cast_or_null<FunctionDecl>(Reader.GetDecl(Record[Idx++]));
|
E->OperatorDelete = cast_or_null<FunctionDecl>(Reader.GetDecl(Record[Idx++]));
|
||||||
E->Argument = Reader.ReadSubExpr();
|
E->Argument = Reader.ReadSubExpr();
|
||||||
E->Loc = Reader.ReadSourceLocation(Record, Idx);
|
E->Loc = ReadSourceLocation(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
|
void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
|
||||||
|
@ -1125,18 +1139,18 @@ void ASTStmtReader::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
|
||||||
|
|
||||||
E->setBase(Reader.ReadSubExpr());
|
E->setBase(Reader.ReadSubExpr());
|
||||||
E->setArrow(Record[Idx++]);
|
E->setArrow(Record[Idx++]);
|
||||||
E->setOperatorLoc(Reader.ReadSourceLocation(Record, Idx));
|
E->setOperatorLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
E->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
||||||
E->setQualifierRange(Reader.ReadSourceRange(Record, Idx));
|
E->setQualifierRange(ReadSourceRange(Record, Idx));
|
||||||
E->setScopeTypeInfo(Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx));
|
E->setScopeTypeInfo(GetTypeSourceInfo(Record, Idx));
|
||||||
E->setColonColonLoc(Reader.ReadSourceLocation(Record, Idx));
|
E->setColonColonLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setTildeLoc(Reader.ReadSourceLocation(Record, Idx));
|
E->setTildeLoc(ReadSourceLocation(Record, Idx));
|
||||||
|
|
||||||
IdentifierInfo *II = Reader.GetIdentifierInfo(Record, Idx);
|
IdentifierInfo *II = Reader.GetIdentifierInfo(Record, Idx);
|
||||||
if (II)
|
if (II)
|
||||||
E->setDestroyedType(II, Reader.ReadSourceLocation(Record, Idx));
|
E->setDestroyedType(II, ReadSourceLocation(Record, Idx));
|
||||||
else
|
else
|
||||||
E->setDestroyedType(Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx));
|
E->setDestroyedType(GetTypeSourceInfo(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
|
void ASTStmtReader::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
|
||||||
|
@ -1164,14 +1178,14 @@ ASTStmtReader::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){
|
||||||
E->setBase(Reader.ReadSubExpr());
|
E->setBase(Reader.ReadSubExpr());
|
||||||
E->setBaseType(Reader.GetType(Record[Idx++]));
|
E->setBaseType(Reader.GetType(Record[Idx++]));
|
||||||
E->setArrow(Record[Idx++]);
|
E->setArrow(Record[Idx++]);
|
||||||
E->setOperatorLoc(Reader.ReadSourceLocation(Record, Idx));
|
E->setOperatorLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
E->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
||||||
E->setQualifierRange(Reader.ReadSourceRange(Record, Idx));
|
E->setQualifierRange(ReadSourceRange(Record, Idx));
|
||||||
E->setFirstQualifierFoundInScope(
|
E->setFirstQualifierFoundInScope(
|
||||||
cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++])));
|
cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++])));
|
||||||
// FIXME: read whole DeclarationNameInfo.
|
// FIXME: read whole DeclarationNameInfo.
|
||||||
E->setMember(Reader.ReadDeclarationName(Record, Idx));
|
E->setMember(Reader.ReadDeclarationName(Record, Idx));
|
||||||
E->setMemberLoc(Reader.ReadSourceLocation(Record, Idx));
|
E->setMemberLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1187,8 +1201,8 @@ ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
|
||||||
|
|
||||||
// FIXME: read whole DeclarationNameInfo.
|
// FIXME: read whole DeclarationNameInfo.
|
||||||
E->setDeclName(Reader.ReadDeclarationName(Record, Idx));
|
E->setDeclName(Reader.ReadDeclarationName(Record, Idx));
|
||||||
E->setLocation(Reader.ReadSourceLocation(Record, Idx));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
E->setQualifierRange(Reader.ReadSourceRange(Record, Idx));
|
E->setQualifierRange(ReadSourceRange(Record, Idx));
|
||||||
E->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
E->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1199,9 +1213,9 @@ ASTStmtReader::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E) {
|
||||||
++Idx; // NumArgs;
|
++Idx; // NumArgs;
|
||||||
for (unsigned I = 0, N = E->arg_size(); I != N; ++I)
|
for (unsigned I = 0, N = E->arg_size(); I != N; ++I)
|
||||||
E->setArg(I, Reader.ReadSubExpr());
|
E->setArg(I, Reader.ReadSubExpr());
|
||||||
E->Type = Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx);
|
E->Type = GetTypeSourceInfo(Record, Idx);
|
||||||
E->setLParenLoc(Reader.ReadSourceLocation(Record, Idx));
|
E->setLParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParenLoc(Reader.ReadSourceLocation(Record, Idx));
|
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
|
void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
|
||||||
|
@ -1226,8 +1240,8 @@ void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
|
||||||
// FIXME: read whole DeclarationNameInfo.
|
// FIXME: read whole DeclarationNameInfo.
|
||||||
E->setName(Reader.ReadDeclarationName(Record, Idx));
|
E->setName(Reader.ReadDeclarationName(Record, Idx));
|
||||||
E->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
E->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
||||||
E->setQualifierRange(Reader.ReadSourceRange(Record, Idx));
|
E->setQualifierRange(ReadSourceRange(Record, Idx));
|
||||||
E->setNameLoc(Reader.ReadSourceLocation(Record, Idx));
|
E->setNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
|
void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
|
||||||
|
@ -1236,7 +1250,7 @@ void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
|
||||||
E->setHasUnresolvedUsing(Record[Idx++]);
|
E->setHasUnresolvedUsing(Record[Idx++]);
|
||||||
E->setBase(Reader.ReadSubExpr());
|
E->setBase(Reader.ReadSubExpr());
|
||||||
E->setBaseType(Reader.GetType(Record[Idx++]));
|
E->setBaseType(Reader.GetType(Record[Idx++]));
|
||||||
E->setOperatorLoc(Reader.ReadSourceLocation(Record, Idx));
|
E->setOperatorLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
|
void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
|
||||||
|
@ -1250,24 +1264,24 @@ void ASTStmtReader::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->UTT = (UnaryTypeTrait)Record[Idx++];
|
E->UTT = (UnaryTypeTrait)Record[Idx++];
|
||||||
E->Value = (bool)Record[Idx++];
|
E->Value = (bool)Record[Idx++];
|
||||||
SourceRange Range = Reader.ReadSourceRange(Record, Idx);
|
SourceRange Range = ReadSourceRange(Record, Idx);
|
||||||
E->Loc = Range.getBegin();
|
E->Loc = Range.getBegin();
|
||||||
E->RParen = Range.getEnd();
|
E->RParen = Range.getEnd();
|
||||||
E->QueriedType = Reader.GetTypeSourceInfo(DeclsCursor, Record, Idx);
|
E->QueriedType = GetTypeSourceInfo(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
|
void ASTStmtReader::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->Value = (bool)Record[Idx++];
|
E->Value = (bool)Record[Idx++];
|
||||||
E->Range = Reader.ReadSourceRange(Record, Idx);
|
E->Range = ReadSourceRange(Record, Idx);
|
||||||
E->Operand = Reader.ReadSubExpr();
|
E->Operand = Reader.ReadSubExpr();
|
||||||
}
|
}
|
||||||
|
|
||||||
Stmt *ASTReader::ReadStmt(llvm::BitstreamCursor &Cursor) {
|
Stmt *ASTReader::ReadStmt(PerFileData &F) {
|
||||||
switch (ReadingKind) {
|
switch (ReadingKind) {
|
||||||
case Read_Decl:
|
case Read_Decl:
|
||||||
case Read_Type:
|
case Read_Type:
|
||||||
return ReadStmtFromStream(Cursor);
|
return ReadStmtFromStream(F);
|
||||||
case Read_Stmt:
|
case Read_Stmt:
|
||||||
return ReadSubStmt();
|
return ReadSubStmt();
|
||||||
}
|
}
|
||||||
|
@ -1276,8 +1290,8 @@ Stmt *ASTReader::ReadStmt(llvm::BitstreamCursor &Cursor) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expr *ASTReader::ReadExpr(llvm::BitstreamCursor &Cursor) {
|
Expr *ASTReader::ReadExpr(PerFileData &F) {
|
||||||
return cast_or_null<Expr>(ReadStmt(Cursor));
|
return cast_or_null<Expr>(ReadStmt(F));
|
||||||
}
|
}
|
||||||
|
|
||||||
Expr *ASTReader::ReadSubExpr() {
|
Expr *ASTReader::ReadSubExpr() {
|
||||||
|
@ -1291,9 +1305,10 @@ Expr *ASTReader::ReadSubExpr() {
|
||||||
// the stack, with expressions having operands removing those operands from the
|
// the stack, with expressions having operands removing those operands from the
|
||||||
// stack. Evaluation terminates when we see a STMT_STOP record, and
|
// stack. Evaluation terminates when we see a STMT_STOP record, and
|
||||||
// the single remaining expression on the stack is our result.
|
// the single remaining expression on the stack is our result.
|
||||||
Stmt *ASTReader::ReadStmtFromStream(llvm::BitstreamCursor &Cursor) {
|
Stmt *ASTReader::ReadStmtFromStream(PerFileData &F) {
|
||||||
|
|
||||||
ReadingKindTracker ReadingKind(Read_Stmt, *this);
|
ReadingKindTracker ReadingKind(Read_Stmt, *this);
|
||||||
|
llvm::BitstreamCursor &Cursor = F.DeclsCursor;
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
unsigned PrevNumStmts = StmtStack.size();
|
unsigned PrevNumStmts = StmtStack.size();
|
||||||
|
@ -1301,7 +1316,7 @@ Stmt *ASTReader::ReadStmtFromStream(llvm::BitstreamCursor &Cursor) {
|
||||||
|
|
||||||
RecordData Record;
|
RecordData Record;
|
||||||
unsigned Idx;
|
unsigned Idx;
|
||||||
ASTStmtReader Reader(*this, Cursor, Record, Idx);
|
ASTStmtReader Reader(*this, F, Cursor, Record, Idx);
|
||||||
Stmt::EmptyShell Empty;
|
Stmt::EmptyShell Empty;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -1481,16 +1496,16 @@ Stmt *ASTReader::ReadStmtFromStream(llvm::BitstreamCursor &Cursor) {
|
||||||
SourceRange QualifierRange;
|
SourceRange QualifierRange;
|
||||||
if (Record[Idx++]) { // HasQualifier.
|
if (Record[Idx++]) { // HasQualifier.
|
||||||
NNS = ReadNestedNameSpecifier(Record, Idx);
|
NNS = ReadNestedNameSpecifier(Record, Idx);
|
||||||
QualifierRange = ReadSourceRange(Record, Idx);
|
QualifierRange = ReadSourceRange(F, Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
TemplateArgumentListInfo ArgInfo;
|
TemplateArgumentListInfo ArgInfo;
|
||||||
unsigned NumTemplateArgs = Record[Idx++];
|
unsigned NumTemplateArgs = Record[Idx++];
|
||||||
if (NumTemplateArgs) {
|
if (NumTemplateArgs) {
|
||||||
ArgInfo.setLAngleLoc(ReadSourceLocation(Record, Idx));
|
ArgInfo.setLAngleLoc(ReadSourceLocation(F, Record, Idx));
|
||||||
ArgInfo.setRAngleLoc(ReadSourceLocation(Record, Idx));
|
ArgInfo.setRAngleLoc(ReadSourceLocation(F, Record, Idx));
|
||||||
for (unsigned i = 0; i != NumTemplateArgs; ++i)
|
for (unsigned i = 0; i != NumTemplateArgs; ++i)
|
||||||
ArgInfo.addArgument(ReadTemplateArgumentLoc(Cursor, Record, Idx));
|
ArgInfo.addArgument(ReadTemplateArgumentLoc(F, Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
NamedDecl *FoundD = cast_or_null<NamedDecl>(GetDecl(Record[Idx++]));
|
NamedDecl *FoundD = cast_or_null<NamedDecl>(GetDecl(Record[Idx++]));
|
||||||
|
@ -1501,7 +1516,7 @@ Stmt *ASTReader::ReadStmtFromStream(llvm::BitstreamCursor &Cursor) {
|
||||||
Expr *Base = ReadSubExpr();
|
Expr *Base = ReadSubExpr();
|
||||||
ValueDecl *MemberD = cast<ValueDecl>(GetDecl(Record[Idx++]));
|
ValueDecl *MemberD = cast<ValueDecl>(GetDecl(Record[Idx++]));
|
||||||
// FIXME: read DeclarationNameLoc.
|
// FIXME: read DeclarationNameLoc.
|
||||||
SourceLocation MemberLoc = ReadSourceLocation(Record, Idx);
|
SourceLocation MemberLoc = ReadSourceLocation(F, Record, Idx);
|
||||||
DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc);
|
DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc);
|
||||||
bool IsArrow = Record[Idx++];
|
bool IsArrow = Record[Idx++];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue