In the ASTReader, factor out the loading of (local) declaration IDs,
such that every declaration ID loaded from an AST file will go through a central local -> global mapping function. At present, this change does nothing, since the local -> global mapping function is the identity function. This is the mechanical part of the refactoring; a follow-up patch will address a few remaining areas where it's not obvious whether we're dealing with local or global IDs. llvm-svn: 135711
This commit is contained in:
parent
2a22c06267
commit
7fb091977d
|
@ -224,6 +224,7 @@ private:
|
||||||
/// First (not depending on another) PCH in chain is in front.
|
/// First (not depending on another) PCH in chain is in front.
|
||||||
std::vector<llvm::MemoryBuffer *> ASTBuffers;
|
std::vector<llvm::MemoryBuffer *> ASTBuffers;
|
||||||
|
|
||||||
|
public:
|
||||||
/// \brief Information that is needed for every module.
|
/// \brief Information that is needed for every module.
|
||||||
struct PerFileData {
|
struct PerFileData {
|
||||||
PerFileData(ASTFileType Ty);
|
PerFileData(ASTFileType Ty);
|
||||||
|
@ -436,7 +437,8 @@ private:
|
||||||
/// directly loaded modules.
|
/// directly loaded modules.
|
||||||
SmallVector<PerFileData *, 1> Loaders;
|
SmallVector<PerFileData *, 1> Loaders;
|
||||||
};
|
};
|
||||||
|
private:
|
||||||
|
|
||||||
/// \brief All loaded modules, indexed by name.
|
/// \brief All loaded modules, indexed by name.
|
||||||
llvm::StringMap<PerFileData*> Modules;
|
llvm::StringMap<PerFileData*> Modules;
|
||||||
|
|
||||||
|
@ -1121,11 +1123,51 @@ public:
|
||||||
/// marked as "doesn't exist in AST".
|
/// marked as "doesn't exist in AST".
|
||||||
serialization::TypeIdx GetTypeIdx(QualType T) const;
|
serialization::TypeIdx GetTypeIdx(QualType T) const;
|
||||||
|
|
||||||
|
/// \brief Map from a local declaration ID within a given module to a
|
||||||
|
/// global declaration ID.
|
||||||
|
serialization::DeclID getGlobalDeclID(PerFileData &F, unsigned LocalID) const;
|
||||||
|
|
||||||
/// \brief Resolve a declaration ID into a declaration, potentially
|
/// \brief Resolve a declaration ID into a declaration, potentially
|
||||||
/// building a new declaration.
|
/// building a new declaration.
|
||||||
Decl *GetDecl(serialization::DeclID ID);
|
Decl *GetDecl(serialization::DeclID ID);
|
||||||
virtual Decl *GetExternalDecl(uint32_t ID);
|
virtual Decl *GetExternalDecl(uint32_t ID);
|
||||||
|
|
||||||
|
/// \brief Reads a declaration with the given local ID in the give module.
|
||||||
|
Decl *GetLocalDecl(PerFileData &F, uint32_t LocalID) {
|
||||||
|
return GetDecl(getGlobalDeclID(F, LocalID));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// \brief Reads a declaration with the given local ID in the give module.
|
||||||
|
///
|
||||||
|
/// \returns The requested declaration, casted to the given return type.
|
||||||
|
template<typename T>
|
||||||
|
T *GetLocalDeclAs(PerFileData &F, uint32_t LocalID) {
|
||||||
|
return cast_or_null<T>(GetLocalDecl(F, LocalID));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// \brief Reads a declaration ID from the given position in a record in the
|
||||||
|
/// given module.
|
||||||
|
///
|
||||||
|
/// \returns The declaration ID read from the record, adjusted to a global ID.
|
||||||
|
serialization::DeclID ReadDeclID(PerFileData &F, const RecordData &Record,
|
||||||
|
unsigned &Idx);
|
||||||
|
|
||||||
|
/// \brief Reads a declaration from the given position in a record in the
|
||||||
|
/// given module.
|
||||||
|
Decl *ReadDecl(PerFileData &F, const RecordData &R, unsigned &I) {
|
||||||
|
return GetDecl(ReadDeclID(F, R, I));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// \brief Reads a declaration from the given position in a record in the
|
||||||
|
/// given module.
|
||||||
|
///
|
||||||
|
/// \returns The declaration read from this location, casted to the given
|
||||||
|
/// result type.
|
||||||
|
template<typename T>
|
||||||
|
T *ReadDeclAs(PerFileData &F, const RecordData &R, unsigned &I) {
|
||||||
|
return cast_or_null<T>(GetDecl(ReadDeclID(F, R, I)));
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Resolve a CXXBaseSpecifiers ID into an offset into the chain
|
/// \brief Resolve a CXXBaseSpecifiers ID into an offset into the chain
|
||||||
/// of loaded AST files.
|
/// of loaded AST files.
|
||||||
uint64_t GetCXXBaseSpecifiersOffset(serialization::CXXBaseSpecifiersID ID);
|
uint64_t GetCXXBaseSpecifiersOffset(serialization::CXXBaseSpecifiersID ID);
|
||||||
|
@ -1279,7 +1321,8 @@ public:
|
||||||
void ReadQualifierInfo(PerFileData &F, QualifierInfo &Info,
|
void ReadQualifierInfo(PerFileData &F, QualifierInfo &Info,
|
||||||
const RecordData &Record, unsigned &Idx);
|
const RecordData &Record, unsigned &Idx);
|
||||||
|
|
||||||
NestedNameSpecifier *ReadNestedNameSpecifier(const RecordData &Record,
|
NestedNameSpecifier *ReadNestedNameSpecifier(PerFileData &F,
|
||||||
|
const RecordData &Record,
|
||||||
unsigned &Idx);
|
unsigned &Idx);
|
||||||
|
|
||||||
NestedNameSpecifierLoc ReadNestedNameSpecifierLoc(PerFileData &F,
|
NestedNameSpecifierLoc ReadNestedNameSpecifierLoc(PerFileData &F,
|
||||||
|
@ -1306,7 +1349,7 @@ public:
|
||||||
unsigned &Idx);
|
unsigned &Idx);
|
||||||
|
|
||||||
/// \brief Read a UnresolvedSet structure.
|
/// \brief Read a UnresolvedSet structure.
|
||||||
void ReadUnresolvedSet(UnresolvedSetImpl &Set,
|
void ReadUnresolvedSet(PerFileData &F, UnresolvedSetImpl &Set,
|
||||||
const RecordData &Record, unsigned &Idx);
|
const RecordData &Record, unsigned &Idx);
|
||||||
|
|
||||||
/// \brief Read a C++ base specifier.
|
/// \brief Read a C++ base specifier.
|
||||||
|
@ -1356,7 +1399,8 @@ public:
|
||||||
/// \brief Read a version tuple.
|
/// \brief Read a version tuple.
|
||||||
VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx);
|
VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx);
|
||||||
|
|
||||||
CXXTemporary *ReadCXXTemporary(const RecordData &Record, unsigned &Idx);
|
CXXTemporary *ReadCXXTemporary(PerFileData &F, const RecordData &Record,
|
||||||
|
unsigned &Idx);
|
||||||
|
|
||||||
/// \brief Reads attributes from the current stream position.
|
/// \brief Reads attributes from the current stream position.
|
||||||
void ReadAttributes(PerFileData &F, AttrVec &Attrs,
|
void ReadAttributes(PerFileData &F, AttrVec &Attrs,
|
||||||
|
|
|
@ -483,7 +483,8 @@ ASTReader::setDeserializationListener(ASTDeserializationListener *Listener) {
|
||||||
namespace {
|
namespace {
|
||||||
class ASTSelectorLookupTrait {
|
class ASTSelectorLookupTrait {
|
||||||
ASTReader &Reader;
|
ASTReader &Reader;
|
||||||
|
ASTReader::PerFileData &F;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct data_type {
|
struct data_type {
|
||||||
SelectorID ID;
|
SelectorID ID;
|
||||||
|
@ -493,7 +494,8 @@ public:
|
||||||
typedef Selector external_key_type;
|
typedef Selector external_key_type;
|
||||||
typedef external_key_type internal_key_type;
|
typedef external_key_type internal_key_type;
|
||||||
|
|
||||||
explicit ASTSelectorLookupTrait(ASTReader &Reader) : Reader(Reader) { }
|
ASTSelectorLookupTrait(ASTReader &Reader, ASTReader::PerFileData &F)
|
||||||
|
: Reader(Reader), F(F) { }
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -548,7 +550,7 @@ public:
|
||||||
ObjCMethodList *Prev = 0;
|
ObjCMethodList *Prev = 0;
|
||||||
for (unsigned I = 0; I != NumInstanceMethods; ++I) {
|
for (unsigned I = 0; I != NumInstanceMethods; ++I) {
|
||||||
ObjCMethodDecl *Method
|
ObjCMethodDecl *Method
|
||||||
= cast<ObjCMethodDecl>(Reader.GetDecl(ReadUnalignedLE32(d)));
|
= Reader.GetLocalDeclAs<ObjCMethodDecl>(F, ReadUnalignedLE32(d));
|
||||||
if (!Result.Instance.Method) {
|
if (!Result.Instance.Method) {
|
||||||
// This is the first method, which is the easy case.
|
// This is the first method, which is the easy case.
|
||||||
Result.Instance.Method = Method;
|
Result.Instance.Method = Method;
|
||||||
|
@ -566,7 +568,7 @@ public:
|
||||||
Prev = 0;
|
Prev = 0;
|
||||||
for (unsigned I = 0; I != NumFactoryMethods; ++I) {
|
for (unsigned I = 0; I != NumFactoryMethods; ++I) {
|
||||||
ObjCMethodDecl *Method
|
ObjCMethodDecl *Method
|
||||||
= cast<ObjCMethodDecl>(Reader.GetDecl(ReadUnalignedLE32(d)));
|
= Reader.GetLocalDeclAs<ObjCMethodDecl>(F, ReadUnalignedLE32(d));
|
||||||
if (!Result.Factory.Method) {
|
if (!Result.Factory.Method) {
|
||||||
// This is the first method, which is the easy case.
|
// This is the first method, which is the easy case.
|
||||||
Result.Factory.Method = Method;
|
Result.Factory.Method = Method;
|
||||||
|
@ -2135,12 +2137,8 @@ ASTReader::ReadASTBlock(PerFileData &F) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXTERNAL_DEFINITIONS:
|
case EXTERNAL_DEFINITIONS:
|
||||||
// Optimization for the first block.
|
for (unsigned I = 0, N = Record.size(); I != N; ++I)
|
||||||
if (ExternalDefinitions.empty())
|
ExternalDefinitions.push_back(getGlobalDeclID(F, Record[I]));
|
||||||
ExternalDefinitions.swap(Record);
|
|
||||||
else
|
|
||||||
ExternalDefinitions.insert(ExternalDefinitions.end(),
|
|
||||||
Record.begin(), Record.end());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPECIAL_TYPES:
|
case SPECIAL_TYPES:
|
||||||
|
@ -2159,21 +2157,13 @@ ASTReader::ReadASTBlock(PerFileData &F) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UNUSED_FILESCOPED_DECLS:
|
case UNUSED_FILESCOPED_DECLS:
|
||||||
// Optimization for the first block.
|
for (unsigned I = 0, N = Record.size(); I != N; ++I)
|
||||||
if (UnusedFileScopedDecls.empty())
|
UnusedFileScopedDecls.push_back(getGlobalDeclID(F, Record[I]));
|
||||||
UnusedFileScopedDecls.swap(Record);
|
|
||||||
else
|
|
||||||
UnusedFileScopedDecls.insert(UnusedFileScopedDecls.end(),
|
|
||||||
Record.begin(), Record.end());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DELEGATING_CTORS:
|
case DELEGATING_CTORS:
|
||||||
// Optimization for the first block.
|
for (unsigned I = 0, N = Record.size(); I != N; ++I)
|
||||||
if (DelegatingCtorDecls.empty())
|
DelegatingCtorDecls.push_back(getGlobalDeclID(F, Record[I]));
|
||||||
DelegatingCtorDecls.swap(Record);
|
|
||||||
else
|
|
||||||
DelegatingCtorDecls.insert(DelegatingCtorDecls.end(),
|
|
||||||
Record.begin(), Record.end());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WEAK_UNDECLARED_IDENTIFIERS:
|
case WEAK_UNDECLARED_IDENTIFIERS:
|
||||||
|
@ -2182,12 +2172,8 @@ ASTReader::ReadASTBlock(PerFileData &F) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOCALLY_SCOPED_EXTERNAL_DECLS:
|
case LOCALLY_SCOPED_EXTERNAL_DECLS:
|
||||||
// Optimization for the first block.
|
for (unsigned I = 0, N = Record.size(); I != N; ++I)
|
||||||
if (LocallyScopedExternalDecls.empty())
|
LocallyScopedExternalDecls.push_back(getGlobalDeclID(F, Record[I]));
|
||||||
LocallyScopedExternalDecls.swap(Record);
|
|
||||||
else
|
|
||||||
LocallyScopedExternalDecls.insert(LocallyScopedExternalDecls.end(),
|
|
||||||
Record.begin(), Record.end());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SELECTOR_OFFSETS:
|
case SELECTOR_OFFSETS:
|
||||||
|
@ -2210,7 +2196,7 @@ ASTReader::ReadASTBlock(PerFileData &F) {
|
||||||
= ASTSelectorLookupTable::Create(
|
= ASTSelectorLookupTable::Create(
|
||||||
F.SelectorLookupTableData + Record[0],
|
F.SelectorLookupTableData + Record[0],
|
||||||
F.SelectorLookupTableData,
|
F.SelectorLookupTableData,
|
||||||
ASTSelectorLookupTrait(*this));
|
ASTSelectorLookupTrait(*this, F));
|
||||||
TotalNumMethodPoolEntries += Record[1];
|
TotalNumMethodPoolEntries += Record[1];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2301,35 +2287,34 @@ ASTReader::ReadASTBlock(PerFileData &F) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case EXT_VECTOR_DECLS:
|
case EXT_VECTOR_DECLS:
|
||||||
// Optimization for the first block.
|
for (unsigned I = 0, N = Record.size(); I != N; ++I)
|
||||||
if (ExtVectorDecls.empty())
|
ExtVectorDecls.push_back(getGlobalDeclID(F, Record[I]));
|
||||||
ExtVectorDecls.swap(Record);
|
|
||||||
else
|
|
||||||
ExtVectorDecls.insert(ExtVectorDecls.end(),
|
|
||||||
Record.begin(), Record.end());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VTABLE_USES:
|
case VTABLE_USES:
|
||||||
// Later tables overwrite earlier ones.
|
// Later tables overwrite earlier ones.
|
||||||
VTableUses.swap(Record);
|
// FIXME: Modules will have some trouble with this.
|
||||||
|
VTableUses.clear();
|
||||||
|
for (unsigned I = 0, N = Record.size(); I != N; ++I)
|
||||||
|
VTableUses.push_back(getGlobalDeclID(F, Record[I]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DYNAMIC_CLASSES:
|
case DYNAMIC_CLASSES:
|
||||||
// Optimization for the first block.
|
for (unsigned I = 0, N = Record.size(); I != N; ++I)
|
||||||
if (DynamicClasses.empty())
|
DynamicClasses.push_back(getGlobalDeclID(F, Record[I]));
|
||||||
DynamicClasses.swap(Record);
|
|
||||||
else
|
|
||||||
DynamicClasses.insert(DynamicClasses.end(),
|
|
||||||
Record.begin(), Record.end());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PENDING_IMPLICIT_INSTANTIATIONS:
|
case PENDING_IMPLICIT_INSTANTIATIONS:
|
||||||
F.PendingInstantiations.swap(Record);
|
for (unsigned I = 0, N = Record.size(); I != N; ++I)
|
||||||
|
F.PendingInstantiations.push_back(getGlobalDeclID(F, Record[I]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SEMA_DECL_REFS:
|
case SEMA_DECL_REFS:
|
||||||
// Later tables overwrite earlier ones.
|
// Later tables overwrite earlier ones.
|
||||||
SemaDeclRefs.swap(Record);
|
// FIXME: Modules will have some trouble with this.
|
||||||
|
SemaDeclRefs.clear();
|
||||||
|
for (unsigned I = 0, N = Record.size(); I != N; ++I)
|
||||||
|
SemaDeclRefs.push_back(getGlobalDeclID(F, Record[I]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORIGINAL_FILE_NAME:
|
case ORIGINAL_FILE_NAME:
|
||||||
|
@ -2456,7 +2441,10 @@ ASTReader::ReadASTBlock(PerFileData &F) {
|
||||||
|
|
||||||
case CUDA_SPECIAL_DECL_REFS:
|
case CUDA_SPECIAL_DECL_REFS:
|
||||||
// Later tables overwrite earlier ones.
|
// Later tables overwrite earlier ones.
|
||||||
CUDASpecialDeclRefs.swap(Record);
|
// FIXME: Modules will have trouble with this.
|
||||||
|
CUDASpecialDeclRefs.clear();
|
||||||
|
for (unsigned I = 0, N = Record.size(); I != N; ++I)
|
||||||
|
CUDASpecialDeclRefs.push_back(getGlobalDeclID(F, Record[I]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HEADER_SEARCH_TABLE:
|
case HEADER_SEARCH_TABLE:
|
||||||
|
@ -2483,21 +2471,13 @@ ASTReader::ReadASTBlock(PerFileData &F) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TENTATIVE_DEFINITIONS:
|
case TENTATIVE_DEFINITIONS:
|
||||||
// Optimization for the first block.
|
for (unsigned I = 0, N = Record.size(); I != N; ++I)
|
||||||
if (TentativeDefinitions.empty())
|
TentativeDefinitions.push_back(getGlobalDeclID(F, Record[I]));
|
||||||
TentativeDefinitions.swap(Record);
|
|
||||||
else
|
|
||||||
TentativeDefinitions.insert(TentativeDefinitions.end(),
|
|
||||||
Record.begin(), Record.end());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KNOWN_NAMESPACES:
|
case KNOWN_NAMESPACES:
|
||||||
// Optimization for the first block.
|
for (unsigned I = 0, N = Record.size(); I != N; ++I)
|
||||||
if (KnownNamespaces.empty())
|
KnownNamespaces.push_back(getGlobalDeclID(F, Record[I]));
|
||||||
KnownNamespaces.swap(Record);
|
|
||||||
else
|
|
||||||
KnownNamespaces.insert(KnownNamespaces.end(),
|
|
||||||
Record.begin(), Record.end());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
First = false;
|
First = false;
|
||||||
|
@ -3377,16 +3357,19 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
EPI);
|
EPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_UNRESOLVED_USING:
|
case TYPE_UNRESOLVED_USING: {
|
||||||
|
unsigned Idx = 0;
|
||||||
return Context->getTypeDeclType(
|
return Context->getTypeDeclType(
|
||||||
cast<UnresolvedUsingTypenameDecl>(GetDecl(Record[0])));
|
ReadDeclAs<UnresolvedUsingTypenameDecl>(*Loc.F, Record, Idx));
|
||||||
|
}
|
||||||
|
|
||||||
case TYPE_TYPEDEF: {
|
case TYPE_TYPEDEF: {
|
||||||
if (Record.size() != 2) {
|
if (Record.size() != 2) {
|
||||||
Error("incorrect encoding of typedef type");
|
Error("incorrect encoding of typedef type");
|
||||||
return QualType();
|
return QualType();
|
||||||
}
|
}
|
||||||
TypedefNameDecl *Decl = cast<TypedefNameDecl>(GetDecl(Record[0]));
|
unsigned Idx = 0;
|
||||||
|
TypedefNameDecl *Decl = ReadDeclAs<TypedefNameDecl>(*Loc.F, Record, Idx);
|
||||||
QualType Canonical = GetType(Record[1]);
|
QualType Canonical = GetType(Record[1]);
|
||||||
if (!Canonical.isNull())
|
if (!Canonical.isNull())
|
||||||
Canonical = Context->getCanonicalType(Canonical);
|
Canonical = Context->getCanonicalType(Canonical);
|
||||||
|
@ -3423,8 +3406,10 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
Error("incorrect encoding of record type");
|
Error("incorrect encoding of record type");
|
||||||
return QualType();
|
return QualType();
|
||||||
}
|
}
|
||||||
bool IsDependent = Record[0];
|
unsigned Idx = 0;
|
||||||
QualType T = Context->getRecordType(cast<RecordDecl>(GetDecl(Record[1])));
|
bool IsDependent = Record[Idx++];
|
||||||
|
QualType T
|
||||||
|
= Context->getRecordType(ReadDeclAs<RecordDecl>(*Loc.F, Record, Idx));
|
||||||
const_cast<Type*>(T.getTypePtr())->setDependent(IsDependent);
|
const_cast<Type*>(T.getTypePtr())->setDependent(IsDependent);
|
||||||
return T;
|
return T;
|
||||||
}
|
}
|
||||||
|
@ -3434,8 +3419,10 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
Error("incorrect encoding of enum type");
|
Error("incorrect encoding of enum type");
|
||||||
return QualType();
|
return QualType();
|
||||||
}
|
}
|
||||||
bool IsDependent = Record[0];
|
unsigned Idx = 0;
|
||||||
QualType T = Context->getEnumType(cast<EnumDecl>(GetDecl(Record[1])));
|
bool IsDependent = Record[Idx++];
|
||||||
|
QualType T
|
||||||
|
= Context->getEnumType(ReadDeclAs<EnumDecl>(*Loc.F, Record, Idx));
|
||||||
const_cast<Type*>(T.getTypePtr())->setDependent(IsDependent);
|
const_cast<Type*>(T.getTypePtr())->setDependent(IsDependent);
|
||||||
return T;
|
return T;
|
||||||
}
|
}
|
||||||
|
@ -3477,14 +3464,15 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
case TYPE_ELABORATED: {
|
case TYPE_ELABORATED: {
|
||||||
unsigned Idx = 0;
|
unsigned Idx = 0;
|
||||||
ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
|
ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
|
||||||
NestedNameSpecifier *NNS = ReadNestedNameSpecifier(Record, Idx);
|
NestedNameSpecifier *NNS = ReadNestedNameSpecifier(*Loc.F, Record, Idx);
|
||||||
QualType NamedType = GetType(Record[Idx++]);
|
QualType NamedType = GetType(Record[Idx++]);
|
||||||
return Context->getElaboratedType(Keyword, NNS, NamedType);
|
return Context->getElaboratedType(Keyword, NNS, NamedType);
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_OBJC_INTERFACE: {
|
case TYPE_OBJC_INTERFACE: {
|
||||||
unsigned Idx = 0;
|
unsigned Idx = 0;
|
||||||
ObjCInterfaceDecl *ItfD = cast<ObjCInterfaceDecl>(GetDecl(Record[Idx++]));
|
ObjCInterfaceDecl *ItfD
|
||||||
|
= ReadDeclAs<ObjCInterfaceDecl>(*Loc.F, Record, Idx);
|
||||||
return Context->getObjCInterfaceType(ItfD);
|
return Context->getObjCInterfaceType(ItfD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3494,7 +3482,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
unsigned NumProtos = Record[Idx++];
|
unsigned NumProtos = Record[Idx++];
|
||||||
llvm::SmallVector<ObjCProtocolDecl*, 4> Protos;
|
llvm::SmallVector<ObjCProtocolDecl*, 4> Protos;
|
||||||
for (unsigned I = 0; I != NumProtos; ++I)
|
for (unsigned I = 0; I != NumProtos; ++I)
|
||||||
Protos.push_back(cast<ObjCProtocolDecl>(GetDecl(Record[Idx++])));
|
Protos.push_back(ReadDeclAs<ObjCProtocolDecl>(*Loc.F, Record, Idx));
|
||||||
return Context->getObjCObjectType(Base, Protos.data(), NumProtos);
|
return Context->getObjCObjectType(Base, Protos.data(), NumProtos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3523,7 +3511,8 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_INJECTED_CLASS_NAME: {
|
case TYPE_INJECTED_CLASS_NAME: {
|
||||||
CXXRecordDecl *D = cast<CXXRecordDecl>(GetDecl(Record[0]));
|
unsigned Idx = 0;
|
||||||
|
CXXRecordDecl *D = ReadDeclAs<CXXRecordDecl>(*Loc.F, Record, Idx);
|
||||||
QualType TST = GetType(Record[1]); // probably derivable
|
QualType TST = GetType(Record[1]); // probably derivable
|
||||||
// FIXME: ASTContext::getInjectedClassNameType is not currently suitable
|
// FIXME: ASTContext::getInjectedClassNameType is not currently suitable
|
||||||
// for AST reading, too much interdependencies.
|
// for AST reading, too much interdependencies.
|
||||||
|
@ -3536,15 +3525,15 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
unsigned Depth = Record[Idx++];
|
unsigned Depth = Record[Idx++];
|
||||||
unsigned Index = Record[Idx++];
|
unsigned Index = Record[Idx++];
|
||||||
bool Pack = Record[Idx++];
|
bool Pack = Record[Idx++];
|
||||||
TemplateTypeParmDecl *D =
|
TemplateTypeParmDecl *D
|
||||||
cast_or_null<TemplateTypeParmDecl>(GetDecl(Record[Idx++]));
|
= ReadDeclAs<TemplateTypeParmDecl>(*Loc.F, Record, Idx);
|
||||||
return Context->getTemplateTypeParmType(Depth, Index, Pack, D);
|
return Context->getTemplateTypeParmType(Depth, Index, Pack, D);
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_DEPENDENT_NAME: {
|
case TYPE_DEPENDENT_NAME: {
|
||||||
unsigned Idx = 0;
|
unsigned Idx = 0;
|
||||||
ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
|
ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
|
||||||
NestedNameSpecifier *NNS = ReadNestedNameSpecifier(Record, Idx);
|
NestedNameSpecifier *NNS = ReadNestedNameSpecifier(*Loc.F, Record, Idx);
|
||||||
const IdentifierInfo *Name = this->GetIdentifierInfo(Record, Idx);
|
const IdentifierInfo *Name = this->GetIdentifierInfo(Record, Idx);
|
||||||
QualType Canon = GetType(Record[Idx++]);
|
QualType Canon = GetType(Record[Idx++]);
|
||||||
if (!Canon.isNull())
|
if (!Canon.isNull())
|
||||||
|
@ -3555,7 +3544,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) {
|
||||||
case TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION: {
|
case TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION: {
|
||||||
unsigned Idx = 0;
|
unsigned Idx = 0;
|
||||||
ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
|
ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
|
||||||
NestedNameSpecifier *NNS = ReadNestedNameSpecifier(Record, Idx);
|
NestedNameSpecifier *NNS = ReadNestedNameSpecifier(*Loc.F, Record, Idx);
|
||||||
const IdentifierInfo *Name = this->GetIdentifierInfo(Record, Idx);
|
const IdentifierInfo *Name = this->GetIdentifierInfo(Record, Idx);
|
||||||
unsigned NumArgs = Record[Idx++];
|
unsigned NumArgs = Record[Idx++];
|
||||||
llvm::SmallVector<TemplateArgument, 8> Args;
|
llvm::SmallVector<TemplateArgument, 8> Args;
|
||||||
|
@ -3617,6 +3606,11 @@ class clang::TypeLocReader : public TypeLocVisitor<TypeLocReader> {
|
||||||
return Reader.ReadSourceLocation(F, R, I);
|
return Reader.ReadSourceLocation(F, R, I);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
T *ReadDeclAs(const ASTReader::RecordData &Record, unsigned &Idx) {
|
||||||
|
return Reader.ReadDeclAs<T>(F, Record, Idx);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TypeLocReader(ASTReader &Reader, ASTReader::PerFileData &F,
|
TypeLocReader(ASTReader &Reader, ASTReader::PerFileData &F,
|
||||||
const ASTReader::RecordData &Record, unsigned &Idx)
|
const ASTReader::RecordData &Record, unsigned &Idx)
|
||||||
|
@ -3702,7 +3696,7 @@ void TypeLocReader::VisitFunctionTypeLoc(FunctionTypeLoc TL) {
|
||||||
TL.setLocalRangeEnd(ReadSourceLocation(Record, Idx));
|
TL.setLocalRangeEnd(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, ReadDeclAs<ParmVarDecl>(Record, Idx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void TypeLocReader::VisitFunctionProtoTypeLoc(FunctionProtoTypeLoc TL) {
|
void TypeLocReader::VisitFunctionProtoTypeLoc(FunctionProtoTypeLoc TL) {
|
||||||
|
@ -4048,6 +4042,12 @@ TranslationUnitDecl *ASTReader::GetTranslationUnitDecl() {
|
||||||
return cast<TranslationUnitDecl>(DeclsLoaded[0]);
|
return cast<TranslationUnitDecl>(DeclsLoaded[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serialization::DeclID
|
||||||
|
ASTReader::getGlobalDeclID(PerFileData &F, unsigned LocalID) const {
|
||||||
|
// FIXME: Perform local -> global remapping for declarations.
|
||||||
|
return LocalID;
|
||||||
|
}
|
||||||
|
|
||||||
Decl *ASTReader::GetDecl(DeclID ID) {
|
Decl *ASTReader::GetDecl(DeclID ID) {
|
||||||
if (ID == 0)
|
if (ID == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4067,6 +4067,17 @@ Decl *ASTReader::GetDecl(DeclID ID) {
|
||||||
return DeclsLoaded[Index];
|
return DeclsLoaded[Index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serialization::DeclID ASTReader::ReadDeclID(PerFileData &F,
|
||||||
|
const RecordData &Record,
|
||||||
|
unsigned &Idx) {
|
||||||
|
if (Idx >= Record.size()) {
|
||||||
|
Error("Corrupted AST file");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getGlobalDeclID(F, Record[Idx++]);
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Resolve the offset of a statement into a statement.
|
/// \brief Resolve the offset of a statement into a statement.
|
||||||
///
|
///
|
||||||
/// This operation will read a new statement from the external
|
/// This operation will read a new statement from the external
|
||||||
|
@ -4109,7 +4120,9 @@ ExternalLoadResult ASTReader::FindExternalLexicalDecls(const DeclContext *DC,
|
||||||
*IDE = ID + I->NumLexicalDecls; ID != IDE; ++ID) {
|
*IDE = ID + I->NumLexicalDecls; ID != IDE; ++ID) {
|
||||||
if (isKindWeWant && !isKindWeWant((Decl::Kind)ID->first))
|
if (isKindWeWant && !isKindWeWant((Decl::Kind)ID->first))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// FIXME: Modules need to know whether this is already mapped to a
|
||||||
|
// global ID or not.
|
||||||
Decl *D = GetDecl(ID->second);
|
Decl *D = GetDecl(ID->second);
|
||||||
assert(D && "Null decl in lexical decls");
|
assert(D && "Null decl in lexical decls");
|
||||||
Decls.push_back(D);
|
Decls.push_back(D);
|
||||||
|
@ -4145,6 +4158,8 @@ ASTReader::FindExternalVisibleDeclsByName(const DeclContext *DC,
|
||||||
if (Pos == LookupTable->end())
|
if (Pos == LookupTable->end())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// FIXME: Modules need to know whether this is already mapped to a
|
||||||
|
// global ID or not.
|
||||||
ASTDeclContextNameLookupTrait::data_type Data = *Pos;
|
ASTDeclContextNameLookupTrait::data_type Data = *Pos;
|
||||||
for (; Data.first != Data.second; ++Data.first)
|
for (; Data.first != Data.second; ++Data.first)
|
||||||
Decls.push_back(cast<NamedDecl>(GetDecl(*Data.first)));
|
Decls.push_back(cast<NamedDecl>(GetDecl(*Data.first)));
|
||||||
|
@ -4179,6 +4194,8 @@ void ASTReader::MaterializeVisibleDecls(const DeclContext *DC) {
|
||||||
= *ItemI;
|
= *ItemI;
|
||||||
ASTDeclContextNameLookupTrait::data_type Data = Val.second;
|
ASTDeclContextNameLookupTrait::data_type Data = Val.second;
|
||||||
Decls.clear();
|
Decls.clear();
|
||||||
|
// FIXME: Modules need to know whether this is already mapped to a
|
||||||
|
// global ID or not.
|
||||||
for (; Data.first != Data.second; ++Data.first)
|
for (; Data.first != Data.second; ++Data.first)
|
||||||
Decls.push_back(cast<NamedDecl>(GetDecl(*Data.first)));
|
Decls.push_back(cast<NamedDecl>(GetDecl(*Data.first)));
|
||||||
MaterializeVisibleDeclsForName(DC, Val.first, Decls);
|
MaterializeVisibleDeclsForName(DC, Val.first, Decls);
|
||||||
|
@ -4647,6 +4664,7 @@ ASTReader::SetGloballyVisibleDecls(IdentifierInfo *II,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned I = 0, N = DeclIDs.size(); I != N; ++I) {
|
for (unsigned I = 0, N = DeclIDs.size(); I != N; ++I) {
|
||||||
|
// FIXME: Are these IDs local or global? It's not clear!
|
||||||
NamedDecl *D = cast<NamedDecl>(GetDecl(DeclIDs[I]));
|
NamedDecl *D = cast<NamedDecl>(GetDecl(DeclIDs[I]));
|
||||||
if (SemaObj) {
|
if (SemaObj) {
|
||||||
if (SemaObj->TUScope) {
|
if (SemaObj->TUScope) {
|
||||||
|
@ -4717,8 +4735,8 @@ Selector ASTReader::DecodeSelector(unsigned ID) {
|
||||||
// Load this selector from the selector table.
|
// Load this selector from the selector table.
|
||||||
GlobalSelectorMapType::iterator I = GlobalSelectorMap.find(ID);
|
GlobalSelectorMapType::iterator I = GlobalSelectorMap.find(ID);
|
||||||
assert(I != GlobalSelectorMap.end() && "Corrupted global selector map");
|
assert(I != GlobalSelectorMap.end() && "Corrupted global selector map");
|
||||||
ASTSelectorLookupTrait Trait(*this);
|
|
||||||
PerFileData &F = *I->second.first;
|
PerFileData &F = *I->second.first;
|
||||||
|
ASTSelectorLookupTrait Trait(*this, F);
|
||||||
unsigned Idx = ID - 1 + I->second.second;
|
unsigned Idx = ID - 1 + I->second.second;
|
||||||
SelectorsLoaded[ID - 1] =
|
SelectorsLoaded[ID - 1] =
|
||||||
Trait.ReadKey(F.SelectorLookupTableData + F.SelectorOffsets[Idx], 0);
|
Trait.ReadKey(F.SelectorLookupTableData + F.SelectorOffsets[Idx], 0);
|
||||||
|
@ -4838,26 +4856,26 @@ ASTReader::ReadTemplateName(PerFileData &F, const RecordData &Record,
|
||||||
TemplateName::NameKind Kind = (TemplateName::NameKind)Record[Idx++];
|
TemplateName::NameKind Kind = (TemplateName::NameKind)Record[Idx++];
|
||||||
switch (Kind) {
|
switch (Kind) {
|
||||||
case TemplateName::Template:
|
case TemplateName::Template:
|
||||||
return TemplateName(cast_or_null<TemplateDecl>(GetDecl(Record[Idx++])));
|
return TemplateName(ReadDeclAs<TemplateDecl>(F, Record, Idx));
|
||||||
|
|
||||||
case TemplateName::OverloadedTemplate: {
|
case TemplateName::OverloadedTemplate: {
|
||||||
unsigned size = Record[Idx++];
|
unsigned size = Record[Idx++];
|
||||||
UnresolvedSet<8> Decls;
|
UnresolvedSet<8> Decls;
|
||||||
while (size--)
|
while (size--)
|
||||||
Decls.addDecl(cast<NamedDecl>(GetDecl(Record[Idx++])));
|
Decls.addDecl(ReadDeclAs<NamedDecl>(F, Record, Idx));
|
||||||
|
|
||||||
return Context->getOverloadedTemplateName(Decls.begin(), Decls.end());
|
return Context->getOverloadedTemplateName(Decls.begin(), Decls.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
case TemplateName::QualifiedTemplate: {
|
case TemplateName::QualifiedTemplate: {
|
||||||
NestedNameSpecifier *NNS = ReadNestedNameSpecifier(Record, Idx);
|
NestedNameSpecifier *NNS = ReadNestedNameSpecifier(F, Record, Idx);
|
||||||
bool hasTemplKeyword = Record[Idx++];
|
bool hasTemplKeyword = Record[Idx++];
|
||||||
TemplateDecl *Template = cast<TemplateDecl>(GetDecl(Record[Idx++]));
|
TemplateDecl *Template = ReadDeclAs<TemplateDecl>(F, Record, Idx);
|
||||||
return Context->getQualifiedTemplateName(NNS, hasTemplKeyword, Template);
|
return Context->getQualifiedTemplateName(NNS, hasTemplKeyword, Template);
|
||||||
}
|
}
|
||||||
|
|
||||||
case TemplateName::DependentTemplate: {
|
case TemplateName::DependentTemplate: {
|
||||||
NestedNameSpecifier *NNS = ReadNestedNameSpecifier(Record, Idx);
|
NestedNameSpecifier *NNS = ReadNestedNameSpecifier(F, Record, Idx);
|
||||||
if (Record[Idx++]) // isIdentifier
|
if (Record[Idx++]) // isIdentifier
|
||||||
return Context->getDependentTemplateName(NNS,
|
return Context->getDependentTemplateName(NNS,
|
||||||
GetIdentifierInfo(Record, Idx));
|
GetIdentifierInfo(Record, Idx));
|
||||||
|
@ -4867,7 +4885,7 @@ ASTReader::ReadTemplateName(PerFileData &F, const RecordData &Record,
|
||||||
|
|
||||||
case TemplateName::SubstTemplateTemplateParm: {
|
case TemplateName::SubstTemplateTemplateParm: {
|
||||||
TemplateTemplateParmDecl *param
|
TemplateTemplateParmDecl *param
|
||||||
= cast_or_null<TemplateTemplateParmDecl>(GetDecl(Record[Idx++]));
|
= ReadDeclAs<TemplateTemplateParmDecl>(F, Record, Idx);
|
||||||
if (!param) return TemplateName();
|
if (!param) return TemplateName();
|
||||||
TemplateName replacement = ReadTemplateName(F, Record, Idx);
|
TemplateName replacement = ReadTemplateName(F, Record, Idx);
|
||||||
return Context->getSubstTemplateTemplateParm(param, replacement);
|
return Context->getSubstTemplateTemplateParm(param, replacement);
|
||||||
|
@ -4875,7 +4893,7 @@ ASTReader::ReadTemplateName(PerFileData &F, const RecordData &Record,
|
||||||
|
|
||||||
case TemplateName::SubstTemplateTemplateParmPack: {
|
case TemplateName::SubstTemplateTemplateParmPack: {
|
||||||
TemplateTemplateParmDecl *Param
|
TemplateTemplateParmDecl *Param
|
||||||
= cast_or_null<TemplateTemplateParmDecl>(GetDecl(Record[Idx++]));
|
= ReadDeclAs<TemplateTemplateParmDecl>(F, Record, Idx);
|
||||||
if (!Param)
|
if (!Param)
|
||||||
return TemplateName();
|
return TemplateName();
|
||||||
|
|
||||||
|
@ -4901,7 +4919,7 @@ ASTReader::ReadTemplateArgument(PerFileData &F,
|
||||||
case TemplateArgument::Type:
|
case TemplateArgument::Type:
|
||||||
return TemplateArgument(GetType(Record[Idx++]));
|
return TemplateArgument(GetType(Record[Idx++]));
|
||||||
case TemplateArgument::Declaration:
|
case TemplateArgument::Declaration:
|
||||||
return TemplateArgument(GetDecl(Record[Idx++]));
|
return TemplateArgument(ReadDecl(F, Record, Idx));
|
||||||
case TemplateArgument::Integral: {
|
case TemplateArgument::Integral: {
|
||||||
llvm::APSInt Value = ReadAPSInt(Record, Idx);
|
llvm::APSInt Value = ReadAPSInt(Record, Idx);
|
||||||
QualType T = GetType(Record[Idx++]);
|
QualType T = GetType(Record[Idx++]);
|
||||||
|
@ -4942,7 +4960,7 @@ ASTReader::ReadTemplateParameterList(PerFileData &F,
|
||||||
llvm::SmallVector<NamedDecl *, 16> Params;
|
llvm::SmallVector<NamedDecl *, 16> Params;
|
||||||
Params.reserve(NumParams);
|
Params.reserve(NumParams);
|
||||||
while (NumParams--)
|
while (NumParams--)
|
||||||
Params.push_back(cast<NamedDecl>(GetDecl(Record[Idx++])));
|
Params.push_back(ReadDeclAs<NamedDecl>(F, Record, Idx));
|
||||||
|
|
||||||
TemplateParameterList* TemplateParams =
|
TemplateParameterList* TemplateParams =
|
||||||
TemplateParameterList::Create(*Context, TemplateLoc, LAngleLoc,
|
TemplateParameterList::Create(*Context, TemplateLoc, LAngleLoc,
|
||||||
|
@ -4962,11 +4980,11 @@ ReadTemplateArgumentList(llvm::SmallVector<TemplateArgument, 8> &TemplArgs,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Read a UnresolvedSet structure.
|
/// \brief Read a UnresolvedSet structure.
|
||||||
void ASTReader::ReadUnresolvedSet(UnresolvedSetImpl &Set,
|
void ASTReader::ReadUnresolvedSet(PerFileData &F, UnresolvedSetImpl &Set,
|
||||||
const RecordData &Record, unsigned &Idx) {
|
const RecordData &Record, unsigned &Idx) {
|
||||||
unsigned NumDecls = Record[Idx++];
|
unsigned NumDecls = Record[Idx++];
|
||||||
while (NumDecls--) {
|
while (NumDecls--) {
|
||||||
NamedDecl *D = cast<NamedDecl>(GetDecl(Record[Idx++]));
|
NamedDecl *D = ReadDeclAs<NamedDecl>(F, Record, Idx);
|
||||||
AccessSpecifier AS = (AccessSpecifier)Record[Idx++];
|
AccessSpecifier AS = (AccessSpecifier)Record[Idx++];
|
||||||
Set.addDecl(D, AS);
|
Set.addDecl(D, AS);
|
||||||
}
|
}
|
||||||
|
@ -5013,15 +5031,15 @@ ASTReader::ReadCXXCtorInitializers(PerFileData &F, const RecordData &Record,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTOR_INITIALIZER_DELEGATING:
|
case CTOR_INITIALIZER_DELEGATING:
|
||||||
Target = cast<CXXConstructorDecl>(GetDecl(Record[Idx++]));
|
Target = ReadDeclAs<CXXConstructorDecl>(F, Record, Idx);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTOR_INITIALIZER_MEMBER:
|
case CTOR_INITIALIZER_MEMBER:
|
||||||
Member = cast<FieldDecl>(GetDecl(Record[Idx++]));
|
Member = ReadDeclAs<FieldDecl>(F, Record, Idx);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTOR_INITIALIZER_INDIRECT_MEMBER:
|
case CTOR_INITIALIZER_INDIRECT_MEMBER:
|
||||||
IndirectMember = cast<IndirectFieldDecl>(GetDecl(Record[Idx++]));
|
IndirectMember = ReadDeclAs<IndirectFieldDecl>(F, Record, Idx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5038,7 +5056,7 @@ ASTReader::ReadCXXCtorInitializers(PerFileData &F, const RecordData &Record,
|
||||||
SourceOrderOrNumArrayIndices = Record[Idx++];
|
SourceOrderOrNumArrayIndices = Record[Idx++];
|
||||||
Indices.reserve(SourceOrderOrNumArrayIndices);
|
Indices.reserve(SourceOrderOrNumArrayIndices);
|
||||||
for (unsigned i=0; i != SourceOrderOrNumArrayIndices; ++i)
|
for (unsigned i=0; i != SourceOrderOrNumArrayIndices; ++i)
|
||||||
Indices.push_back(cast<VarDecl>(GetDecl(Record[Idx++])));
|
Indices.push_back(ReadDeclAs<VarDecl>(F, Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
CXXCtorInitializer *BOMInit;
|
CXXCtorInitializer *BOMInit;
|
||||||
|
@ -5073,7 +5091,8 @@ ASTReader::ReadCXXCtorInitializers(PerFileData &F, const RecordData &Record,
|
||||||
}
|
}
|
||||||
|
|
||||||
NestedNameSpecifier *
|
NestedNameSpecifier *
|
||||||
ASTReader::ReadNestedNameSpecifier(const RecordData &Record, unsigned &Idx) {
|
ASTReader::ReadNestedNameSpecifier(PerFileData &F,
|
||||||
|
const RecordData &Record, unsigned &Idx) {
|
||||||
unsigned N = Record[Idx++];
|
unsigned N = Record[Idx++];
|
||||||
NestedNameSpecifier *NNS = 0, *Prev = 0;
|
NestedNameSpecifier *NNS = 0, *Prev = 0;
|
||||||
for (unsigned I = 0; I != N; ++I) {
|
for (unsigned I = 0; I != N; ++I) {
|
||||||
|
@ -5087,14 +5106,13 @@ ASTReader::ReadNestedNameSpecifier(const RecordData &Record, unsigned &Idx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case NestedNameSpecifier::Namespace: {
|
case NestedNameSpecifier::Namespace: {
|
||||||
NamespaceDecl *NS = cast<NamespaceDecl>(GetDecl(Record[Idx++]));
|
NamespaceDecl *NS = ReadDeclAs<NamespaceDecl>(F, Record, Idx);
|
||||||
NNS = NestedNameSpecifier::Create(*Context, Prev, NS);
|
NNS = NestedNameSpecifier::Create(*Context, Prev, NS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case NestedNameSpecifier::NamespaceAlias: {
|
case NestedNameSpecifier::NamespaceAlias: {
|
||||||
NamespaceAliasDecl *Alias
|
NamespaceAliasDecl *Alias =ReadDeclAs<NamespaceAliasDecl>(F, Record, Idx);
|
||||||
= cast<NamespaceAliasDecl>(GetDecl(Record[Idx++]));
|
|
||||||
NNS = NestedNameSpecifier::Create(*Context, Prev, Alias);
|
NNS = NestedNameSpecifier::Create(*Context, Prev, Alias);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -5138,15 +5156,14 @@ ASTReader::ReadNestedNameSpecifierLoc(PerFileData &F, const RecordData &Record,
|
||||||
}
|
}
|
||||||
|
|
||||||
case NestedNameSpecifier::Namespace: {
|
case NestedNameSpecifier::Namespace: {
|
||||||
NamespaceDecl *NS = cast<NamespaceDecl>(GetDecl(Record[Idx++]));
|
NamespaceDecl *NS = ReadDeclAs<NamespaceDecl>(F, Record, Idx);
|
||||||
SourceRange Range = ReadSourceRange(F, Record, Idx);
|
SourceRange Range = ReadSourceRange(F, Record, Idx);
|
||||||
Builder.Extend(*Context, NS, Range.getBegin(), Range.getEnd());
|
Builder.Extend(*Context, NS, Range.getBegin(), Range.getEnd());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case NestedNameSpecifier::NamespaceAlias: {
|
case NestedNameSpecifier::NamespaceAlias: {
|
||||||
NamespaceAliasDecl *Alias
|
NamespaceAliasDecl *Alias =ReadDeclAs<NamespaceAliasDecl>(F, Record, Idx);
|
||||||
= cast<NamespaceAliasDecl>(GetDecl(Record[Idx++]));
|
|
||||||
SourceRange Range = ReadSourceRange(F, Record, Idx);
|
SourceRange Range = ReadSourceRange(F, Record, Idx);
|
||||||
Builder.Extend(*Context, Alias, Range.getBegin(), Range.getEnd());
|
Builder.Extend(*Context, Alias, Range.getBegin(), Range.getEnd());
|
||||||
break;
|
break;
|
||||||
|
@ -5226,9 +5243,10 @@ VersionTuple ASTReader::ReadVersionTuple(const RecordData &Record,
|
||||||
return VersionTuple(Major, Minor - 1, Subminor - 1);
|
return VersionTuple(Major, Minor - 1, Subminor - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CXXTemporary *ASTReader::ReadCXXTemporary(const RecordData &Record,
|
CXXTemporary *ASTReader::ReadCXXTemporary(PerFileData &F,
|
||||||
|
const RecordData &Record,
|
||||||
unsigned &Idx) {
|
unsigned &Idx) {
|
||||||
CXXDestructorDecl *Decl = cast<CXXDestructorDecl>(GetDecl(Record[Idx++]));
|
CXXDestructorDecl *Decl = ReadDeclAs<CXXDestructorDecl>(F, Record, Idx);
|
||||||
return CXXTemporary::Create(*Context, Decl);
|
return CXXTemporary::Create(*Context, Decl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,23 +43,42 @@ namespace clang {
|
||||||
DeclID LexicalDeclContextIDForTemplateParmDecl;
|
DeclID LexicalDeclContextIDForTemplateParmDecl;
|
||||||
|
|
||||||
uint64_t GetCurrentCursorOffset();
|
uint64_t GetCurrentCursorOffset();
|
||||||
|
|
||||||
SourceLocation ReadSourceLocation(const RecordData &R, unsigned &I) {
|
SourceLocation ReadSourceLocation(const RecordData &R, unsigned &I) {
|
||||||
return Reader.ReadSourceLocation(F, R, I);
|
return Reader.ReadSourceLocation(F, R, I);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceRange ReadSourceRange(const RecordData &R, unsigned &I) {
|
SourceRange ReadSourceRange(const RecordData &R, unsigned &I) {
|
||||||
return Reader.ReadSourceRange(F, R, I);
|
return Reader.ReadSourceRange(F, R, I);
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeSourceInfo *GetTypeSourceInfo(const RecordData &R, unsigned &I) {
|
TypeSourceInfo *GetTypeSourceInfo(const RecordData &R, unsigned &I) {
|
||||||
return Reader.GetTypeSourceInfo(F, R, I);
|
return Reader.GetTypeSourceInfo(F, R, I);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serialization::DeclID ReadDeclID(const RecordData &R, unsigned &I) {
|
||||||
|
return Reader.ReadDeclID(F, R, I);
|
||||||
|
}
|
||||||
|
|
||||||
|
Decl *ReadDecl(const RecordData &R, unsigned &I) {
|
||||||
|
return Reader.ReadDecl(F, R, I);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
T *ReadDeclAs(const RecordData &R, unsigned &I) {
|
||||||
|
return Reader.ReadDeclAs<T>(F, R, I);
|
||||||
|
}
|
||||||
|
|
||||||
void ReadQualifierInfo(QualifierInfo &Info,
|
void ReadQualifierInfo(QualifierInfo &Info,
|
||||||
const RecordData &R, unsigned &I) {
|
const RecordData &R, unsigned &I) {
|
||||||
Reader.ReadQualifierInfo(F, Info, R, I);
|
Reader.ReadQualifierInfo(F, Info, R, I);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadDeclarationNameLoc(DeclarationNameLoc &DNLoc, DeclarationName Name,
|
void ReadDeclarationNameLoc(DeclarationNameLoc &DNLoc, DeclarationName Name,
|
||||||
const RecordData &R, unsigned &I) {
|
const RecordData &R, unsigned &I) {
|
||||||
Reader.ReadDeclarationNameLoc(F, DNLoc, Name, R, I);
|
Reader.ReadDeclarationNameLoc(F, DNLoc, Name, R, I);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadDeclarationNameInfo(DeclarationNameInfo &NameInfo,
|
void ReadDeclarationNameInfo(DeclarationNameInfo &NameInfo,
|
||||||
const RecordData &R, unsigned &I) {
|
const RecordData &R, unsigned &I) {
|
||||||
Reader.ReadDeclarationNameInfo(F, NameInfo, R, I);
|
Reader.ReadDeclarationNameInfo(F, NameInfo, R, I);
|
||||||
|
@ -211,13 +230,12 @@ void ASTDeclReader::VisitDecl(Decl *D) {
|
||||||
// parameter immediately, because the template parameter might be
|
// parameter immediately, because the template parameter might be
|
||||||
// used in the formulation of its DeclContext. Use the translation
|
// used in the formulation of its DeclContext. Use the translation
|
||||||
// unit DeclContext as a placeholder.
|
// unit DeclContext as a placeholder.
|
||||||
DeclContextIDForTemplateParmDecl = Record[Idx++];
|
DeclContextIDForTemplateParmDecl = ReadDeclID(Record, Idx);
|
||||||
LexicalDeclContextIDForTemplateParmDecl = Record[Idx++];
|
LexicalDeclContextIDForTemplateParmDecl = ReadDeclID(Record, Idx);
|
||||||
D->setDeclContext(Reader.getContext()->getTranslationUnitDecl());
|
D->setDeclContext(Reader.getContext()->getTranslationUnitDecl());
|
||||||
} else {
|
} else {
|
||||||
D->setDeclContext(cast_or_null<DeclContext>(Reader.GetDecl(Record[Idx++])));
|
D->setDeclContext(ReadDeclAs<DeclContext>(Record, Idx));
|
||||||
D->setLexicalDeclContext(
|
D->setLexicalDeclContext(ReadDeclAs<DeclContext>(Record, Idx));
|
||||||
cast_or_null<DeclContext>(Reader.GetDecl(Record[Idx++])));
|
|
||||||
}
|
}
|
||||||
D->setLocation(ReadSourceLocation(Record, Idx));
|
D->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
D->setInvalidDecl(Record[Idx++]);
|
D->setInvalidDecl(Record[Idx++]);
|
||||||
|
@ -235,8 +253,7 @@ void ASTDeclReader::VisitDecl(Decl *D) {
|
||||||
|
|
||||||
void ASTDeclReader::VisitTranslationUnitDecl(TranslationUnitDecl *TU) {
|
void ASTDeclReader::VisitTranslationUnitDecl(TranslationUnitDecl *TU) {
|
||||||
VisitDecl(TU);
|
VisitDecl(TU);
|
||||||
TU->setAnonymousNamespace(
|
TU->setAnonymousNamespace(ReadDeclAs<NamespaceDecl>(Record, Idx));
|
||||||
cast_or_null<NamespaceDecl>(Reader.GetDecl(Record[Idx++])));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitNamedDecl(NamedDecl *ND) {
|
void ASTDeclReader::VisitNamedDecl(NamedDecl *ND) {
|
||||||
|
@ -274,8 +291,7 @@ void ASTDeclReader::VisitTagDecl(TagDecl *TD) {
|
||||||
ReadQualifierInfo(*Info, Record, Idx);
|
ReadQualifierInfo(*Info, Record, Idx);
|
||||||
TD->TypedefNameDeclOrQualifier = Info;
|
TD->TypedefNameDeclOrQualifier = Info;
|
||||||
} else
|
} else
|
||||||
TD->setTypedefNameForAnonDecl(
|
TD->setTypedefNameForAnonDecl(ReadDeclAs<TypedefNameDecl>(Record, Idx));
|
||||||
cast_or_null<TypedefNameDecl>(Reader.GetDecl(Record[Idx++])));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitEnumDecl(EnumDecl *ED) {
|
void ASTDeclReader::VisitEnumDecl(EnumDecl *ED) {
|
||||||
|
@ -290,8 +306,7 @@ void ASTDeclReader::VisitEnumDecl(EnumDecl *ED) {
|
||||||
ED->IsScoped = Record[Idx++];
|
ED->IsScoped = Record[Idx++];
|
||||||
ED->IsScopedUsingClassTag = Record[Idx++];
|
ED->IsScopedUsingClassTag = Record[Idx++];
|
||||||
ED->IsFixed = Record[Idx++];
|
ED->IsFixed = Record[Idx++];
|
||||||
ED->setInstantiationOfMemberEnum(
|
ED->setInstantiationOfMemberEnum(ReadDeclAs<EnumDecl>(Record, Idx));
|
||||||
cast_or_null<EnumDecl>(Reader.GetDecl(Record[Idx++])));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitRecordDecl(RecordDecl *RD) {
|
void ASTDeclReader::VisitRecordDecl(RecordDecl *RD) {
|
||||||
|
@ -336,11 +351,11 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
|
||||||
case FunctionDecl::TK_NonTemplate:
|
case FunctionDecl::TK_NonTemplate:
|
||||||
break;
|
break;
|
||||||
case FunctionDecl::TK_FunctionTemplate:
|
case FunctionDecl::TK_FunctionTemplate:
|
||||||
FD->setDescribedFunctionTemplate(
|
FD->setDescribedFunctionTemplate(ReadDeclAs<FunctionTemplateDecl>(Record,
|
||||||
cast<FunctionTemplateDecl>(Reader.GetDecl(Record[Idx++])));
|
Idx));
|
||||||
break;
|
break;
|
||||||
case FunctionDecl::TK_MemberSpecialization: {
|
case FunctionDecl::TK_MemberSpecialization: {
|
||||||
FunctionDecl *InstFD = cast<FunctionDecl>(Reader.GetDecl(Record[Idx++]));
|
FunctionDecl *InstFD = ReadDeclAs<FunctionDecl>(Record, Idx);
|
||||||
TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
|
TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
|
||||||
SourceLocation POI = ReadSourceLocation(Record, Idx);
|
SourceLocation POI = ReadSourceLocation(Record, Idx);
|
||||||
FD->setInstantiationOfMemberFunction(*Reader.getContext(), InstFD, TSK);
|
FD->setInstantiationOfMemberFunction(*Reader.getContext(), InstFD, TSK);
|
||||||
|
@ -348,8 +363,8 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FunctionDecl::TK_FunctionTemplateSpecialization: {
|
case FunctionDecl::TK_FunctionTemplateSpecialization: {
|
||||||
FunctionTemplateDecl *Template
|
FunctionTemplateDecl *Template = ReadDeclAs<FunctionTemplateDecl>(Record,
|
||||||
= cast<FunctionTemplateDecl>(Reader.GetDecl(Record[Idx++]));
|
Idx);
|
||||||
TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
|
TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
|
||||||
|
|
||||||
// Template arguments.
|
// Template arguments.
|
||||||
|
@ -389,7 +404,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
|
||||||
// The template that contains the specializations set. It's not safe to
|
// The template that contains the specializations set. It's not safe to
|
||||||
// use getCanonicalDecl on Template since it may still be initializing.
|
// use getCanonicalDecl on Template since it may still be initializing.
|
||||||
FunctionTemplateDecl *CanonTemplate
|
FunctionTemplateDecl *CanonTemplate
|
||||||
= cast<FunctionTemplateDecl>(Reader.GetDecl(Record[Idx++]));
|
= ReadDeclAs<FunctionTemplateDecl>(Record, Idx);
|
||||||
// Get the InsertPos by FindNodeOrInsertPos() instead of calling
|
// Get the InsertPos by FindNodeOrInsertPos() instead of calling
|
||||||
// InsertNode(FTInfo) directly to avoid the getASTContext() call in
|
// InsertNode(FTInfo) directly to avoid the getASTContext() call in
|
||||||
// FunctionTemplateSpecializationInfo's Profile().
|
// FunctionTemplateSpecializationInfo's Profile().
|
||||||
|
@ -410,7 +425,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
|
||||||
UnresolvedSet<8> TemplDecls;
|
UnresolvedSet<8> TemplDecls;
|
||||||
unsigned NumTemplates = Record[Idx++];
|
unsigned NumTemplates = Record[Idx++];
|
||||||
while (NumTemplates--)
|
while (NumTemplates--)
|
||||||
TemplDecls.addDecl(cast<NamedDecl>(Reader.GetDecl(Record[Idx++])));
|
TemplDecls.addDecl(ReadDeclAs<NamedDecl>(Record, Idx));
|
||||||
|
|
||||||
// Templates args.
|
// Templates args.
|
||||||
TemplateArgumentListInfo TemplArgs;
|
TemplateArgumentListInfo TemplArgs;
|
||||||
|
@ -449,7 +464,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
|
||||||
llvm::SmallVector<ParmVarDecl *, 16> Params;
|
llvm::SmallVector<ParmVarDecl *, 16> Params;
|
||||||
Params.reserve(NumParams);
|
Params.reserve(NumParams);
|
||||||
for (unsigned I = 0; I != NumParams; ++I)
|
for (unsigned I = 0; I != NumParams; ++I)
|
||||||
Params.push_back(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
|
Params.push_back(ReadDeclAs<ParmVarDecl>(Record, Idx));
|
||||||
FD->setParams(*Reader.getContext(), Params.data(), NumParams);
|
FD->setParams(*Reader.getContext(), Params.data(), NumParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,8 +474,8 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) {
|
||||||
// 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(F));
|
MD->setBody(Reader.ReadStmt(F));
|
||||||
MD->setSelfDecl(cast<ImplicitParamDecl>(Reader.GetDecl(Record[Idx++])));
|
MD->setSelfDecl(ReadDeclAs<ImplicitParamDecl>(Record, Idx));
|
||||||
MD->setCmdDecl(cast<ImplicitParamDecl>(Reader.GetDecl(Record[Idx++])));
|
MD->setCmdDecl(ReadDeclAs<ImplicitParamDecl>(Record, Idx));
|
||||||
}
|
}
|
||||||
MD->setInstanceMethod(Record[Idx++]);
|
MD->setInstanceMethod(Record[Idx++]);
|
||||||
MD->setVariadic(Record[Idx++]);
|
MD->setVariadic(Record[Idx++]);
|
||||||
|
@ -477,7 +492,7 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) {
|
||||||
llvm::SmallVector<ParmVarDecl *, 16> Params;
|
llvm::SmallVector<ParmVarDecl *, 16> Params;
|
||||||
Params.reserve(NumParams);
|
Params.reserve(NumParams);
|
||||||
for (unsigned I = 0; I != NumParams; ++I)
|
for (unsigned I = 0; I != NumParams; ++I)
|
||||||
Params.push_back(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
|
Params.push_back(ReadDeclAs<ParmVarDecl>(Record, Idx));
|
||||||
MD->setMethodParams(*Reader.getContext(), Params.data(), NumParams,
|
MD->setMethodParams(*Reader.getContext(), Params.data(), NumParams,
|
||||||
NumParams);
|
NumParams);
|
||||||
}
|
}
|
||||||
|
@ -492,15 +507,14 @@ void ASTDeclReader::VisitObjCContainerDecl(ObjCContainerDecl *CD) {
|
||||||
void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) {
|
void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) {
|
||||||
VisitObjCContainerDecl(ID);
|
VisitObjCContainerDecl(ID);
|
||||||
ID->setTypeForDecl(Reader.GetType(Record[Idx++]).getTypePtrOrNull());
|
ID->setTypeForDecl(Reader.GetType(Record[Idx++]).getTypePtrOrNull());
|
||||||
ID->setSuperClass(cast_or_null<ObjCInterfaceDecl>
|
ID->setSuperClass(ReadDeclAs<ObjCInterfaceDecl>(Record, Idx));
|
||||||
(Reader.GetDecl(Record[Idx++])));
|
|
||||||
|
|
||||||
// Read the directly referenced protocols and their SourceLocations.
|
// Read the directly referenced protocols and their SourceLocations.
|
||||||
unsigned NumProtocols = Record[Idx++];
|
unsigned NumProtocols = Record[Idx++];
|
||||||
llvm::SmallVector<ObjCProtocolDecl *, 16> Protocols;
|
llvm::SmallVector<ObjCProtocolDecl *, 16> Protocols;
|
||||||
Protocols.reserve(NumProtocols);
|
Protocols.reserve(NumProtocols);
|
||||||
for (unsigned I = 0; I != NumProtocols; ++I)
|
for (unsigned I = 0; I != NumProtocols; ++I)
|
||||||
Protocols.push_back(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++])));
|
Protocols.push_back(ReadDeclAs<ObjCProtocolDecl>(Record, Idx));
|
||||||
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)
|
||||||
|
@ -513,7 +527,7 @@ void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) {
|
||||||
Protocols.clear();
|
Protocols.clear();
|
||||||
Protocols.reserve(NumProtocols);
|
Protocols.reserve(NumProtocols);
|
||||||
for (unsigned I = 0; I != NumProtocols; ++I)
|
for (unsigned I = 0; I != NumProtocols; ++I)
|
||||||
Protocols.push_back(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++])));
|
Protocols.push_back(ReadDeclAs<ObjCProtocolDecl>(Record, Idx));
|
||||||
ID->AllReferencedProtocols.set(Protocols.data(), NumProtocols,
|
ID->AllReferencedProtocols.set(Protocols.data(), NumProtocols,
|
||||||
*Reader.getContext());
|
*Reader.getContext());
|
||||||
|
|
||||||
|
@ -522,9 +536,9 @@ void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) {
|
||||||
llvm::SmallVector<ObjCIvarDecl *, 16> IVars;
|
llvm::SmallVector<ObjCIvarDecl *, 16> IVars;
|
||||||
IVars.reserve(NumIvars);
|
IVars.reserve(NumIvars);
|
||||||
for (unsigned I = 0; I != NumIvars; ++I)
|
for (unsigned I = 0; I != NumIvars; ++I)
|
||||||
IVars.push_back(cast<ObjCIvarDecl>(Reader.GetDecl(Record[Idx++])));
|
IVars.push_back(ReadDeclAs<ObjCIvarDecl>(Record, Idx));
|
||||||
ID->setCategoryList(
|
ID->setCategoryList(ReadDeclAs<ObjCCategoryDecl>(Record, Idx));
|
||||||
cast_or_null<ObjCCategoryDecl>(Reader.GetDecl(Record[Idx++])));
|
|
||||||
// We will rebuild this list lazily.
|
// We will rebuild this list lazily.
|
||||||
ID->setIvarList(0);
|
ID->setIvarList(0);
|
||||||
ID->setForwardDecl(Record[Idx++]);
|
ID->setForwardDecl(Record[Idx++]);
|
||||||
|
@ -551,7 +565,7 @@ void ASTDeclReader::VisitObjCProtocolDecl(ObjCProtocolDecl *PD) {
|
||||||
llvm::SmallVector<ObjCProtocolDecl *, 16> ProtoRefs;
|
llvm::SmallVector<ObjCProtocolDecl *, 16> ProtoRefs;
|
||||||
ProtoRefs.reserve(NumProtoRefs);
|
ProtoRefs.reserve(NumProtoRefs);
|
||||||
for (unsigned I = 0; I != NumProtoRefs; ++I)
|
for (unsigned I = 0; I != NumProtoRefs; ++I)
|
||||||
ProtoRefs.push_back(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++])));
|
ProtoRefs.push_back(ReadDeclAs<ObjCProtocolDecl>(Record, Idx));
|
||||||
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)
|
||||||
|
@ -570,7 +584,7 @@ void ASTDeclReader::VisitObjCClassDecl(ObjCClassDecl *CD) {
|
||||||
llvm::SmallVector<ObjCInterfaceDecl *, 16> ClassRefs;
|
llvm::SmallVector<ObjCInterfaceDecl *, 16> ClassRefs;
|
||||||
ClassRefs.reserve(NumClassRefs);
|
ClassRefs.reserve(NumClassRefs);
|
||||||
for (unsigned I = 0; I != NumClassRefs; ++I)
|
for (unsigned I = 0; I != NumClassRefs; ++I)
|
||||||
ClassRefs.push_back(cast<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
|
ClassRefs.push_back(ReadDeclAs<ObjCInterfaceDecl>(Record, Idx));
|
||||||
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)
|
||||||
|
@ -585,7 +599,7 @@ void ASTDeclReader::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *FPD) {
|
||||||
llvm::SmallVector<ObjCProtocolDecl *, 16> ProtoRefs;
|
llvm::SmallVector<ObjCProtocolDecl *, 16> ProtoRefs;
|
||||||
ProtoRefs.reserve(NumProtoRefs);
|
ProtoRefs.reserve(NumProtoRefs);
|
||||||
for (unsigned I = 0; I != NumProtoRefs; ++I)
|
for (unsigned I = 0; I != NumProtoRefs; ++I)
|
||||||
ProtoRefs.push_back(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++])));
|
ProtoRefs.push_back(ReadDeclAs<ObjCProtocolDecl>(Record, Idx));
|
||||||
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)
|
||||||
|
@ -596,19 +610,19 @@ void ASTDeclReader::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *FPD) {
|
||||||
|
|
||||||
void ASTDeclReader::VisitObjCCategoryDecl(ObjCCategoryDecl *CD) {
|
void ASTDeclReader::VisitObjCCategoryDecl(ObjCCategoryDecl *CD) {
|
||||||
VisitObjCContainerDecl(CD);
|
VisitObjCContainerDecl(CD);
|
||||||
CD->setClassInterface(cast<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
|
CD->setClassInterface(ReadDeclAs<ObjCInterfaceDecl>(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);
|
||||||
for (unsigned I = 0; I != NumProtoRefs; ++I)
|
for (unsigned I = 0; I != NumProtoRefs; ++I)
|
||||||
ProtoRefs.push_back(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++])));
|
ProtoRefs.push_back(ReadDeclAs<ObjCProtocolDecl>(Record, Idx));
|
||||||
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(ReadSourceLocation(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(ReadDeclAs<ObjCCategoryDecl>(Record, Idx));
|
||||||
CD->setHasSynthBitfield(Record[Idx++]);
|
CD->setHasSynthBitfield(Record[Idx++]);
|
||||||
CD->setAtLoc(ReadSourceLocation(Record, Idx));
|
CD->setAtLoc(ReadSourceLocation(Record, Idx));
|
||||||
CD->setCategoryNameLoc(ReadSourceLocation(Record, Idx));
|
CD->setCategoryNameLoc(ReadSourceLocation(Record, Idx));
|
||||||
|
@ -616,7 +630,7 @@ void ASTDeclReader::VisitObjCCategoryDecl(ObjCCategoryDecl *CD) {
|
||||||
|
|
||||||
void ASTDeclReader::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *CAD) {
|
void ASTDeclReader::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *CAD) {
|
||||||
VisitNamedDecl(CAD);
|
VisitNamedDecl(CAD);
|
||||||
CAD->setClassInterface(cast<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
|
CAD->setClassInterface(ReadDeclAs<ObjCInterfaceDecl>(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
|
void ASTDeclReader::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
|
||||||
|
@ -633,18 +647,14 @@ void ASTDeclReader::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
|
||||||
(ObjCPropertyDecl::PropertyControl)Record[Idx++]);
|
(ObjCPropertyDecl::PropertyControl)Record[Idx++]);
|
||||||
D->setGetterName(Reader.ReadDeclarationName(Record, Idx).getObjCSelector());
|
D->setGetterName(Reader.ReadDeclarationName(Record, Idx).getObjCSelector());
|
||||||
D->setSetterName(Reader.ReadDeclarationName(Record, Idx).getObjCSelector());
|
D->setSetterName(Reader.ReadDeclarationName(Record, Idx).getObjCSelector());
|
||||||
D->setGetterMethodDecl(
|
D->setGetterMethodDecl(ReadDeclAs<ObjCMethodDecl>(Record, Idx));
|
||||||
cast_or_null<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++])));
|
D->setSetterMethodDecl(ReadDeclAs<ObjCMethodDecl>(Record, Idx));
|
||||||
D->setSetterMethodDecl(
|
D->setPropertyIvarDecl(ReadDeclAs<ObjCIvarDecl>(Record, Idx));
|
||||||
cast_or_null<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++])));
|
|
||||||
D->setPropertyIvarDecl(
|
|
||||||
cast_or_null<ObjCIvarDecl>(Reader.GetDecl(Record[Idx++])));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitObjCImplDecl(ObjCImplDecl *D) {
|
void ASTDeclReader::VisitObjCImplDecl(ObjCImplDecl *D) {
|
||||||
VisitObjCContainerDecl(D);
|
VisitObjCContainerDecl(D);
|
||||||
D->setClassInterface(
|
D->setClassInterface(ReadDeclAs<ObjCInterfaceDecl>(Record, Idx));
|
||||||
cast_or_null<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) {
|
void ASTDeclReader::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) {
|
||||||
|
@ -654,8 +664,7 @@ void ASTDeclReader::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) {
|
||||||
|
|
||||||
void ASTDeclReader::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
|
void ASTDeclReader::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
|
||||||
VisitObjCImplDecl(D);
|
VisitObjCImplDecl(D);
|
||||||
D->setSuperClass(
|
D->setSuperClass(ReadDeclAs<ObjCInterfaceDecl>(Record, Idx));
|
||||||
cast_or_null<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
|
|
||||||
llvm::tie(D->IvarInitializers, D->NumIvarInitializers)
|
llvm::tie(D->IvarInitializers, D->NumIvarInitializers)
|
||||||
= Reader.ReadCXXCtorInitializers(F, Record, Idx);
|
= Reader.ReadCXXCtorInitializers(F, Record, Idx);
|
||||||
D->setHasSynthBitfield(Record[Idx++]);
|
D->setHasSynthBitfield(Record[Idx++]);
|
||||||
|
@ -665,10 +674,8 @@ void ASTDeclReader::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
|
||||||
void ASTDeclReader::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
|
void ASTDeclReader::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
|
||||||
VisitDecl(D);
|
VisitDecl(D);
|
||||||
D->setAtLoc(ReadSourceLocation(Record, Idx));
|
D->setAtLoc(ReadSourceLocation(Record, Idx));
|
||||||
D->setPropertyDecl(
|
D->setPropertyDecl(ReadDeclAs<ObjCPropertyDecl>(Record, Idx));
|
||||||
cast_or_null<ObjCPropertyDecl>(Reader.GetDecl(Record[Idx++])));
|
D->PropertyIvarDecl = ReadDeclAs<ObjCIvarDecl>(Record, Idx);
|
||||||
D->PropertyIvarDecl =
|
|
||||||
cast_or_null<ObjCIvarDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
D->IvarLoc = ReadSourceLocation(Record, Idx);
|
D->IvarLoc = ReadSourceLocation(Record, Idx);
|
||||||
D->setGetterCXXConstructor(Reader.ReadExpr(F));
|
D->setGetterCXXConstructor(Reader.ReadExpr(F));
|
||||||
D->setSetterCXXAssignment(Reader.ReadExpr(F));
|
D->setSetterCXXAssignment(Reader.ReadExpr(F));
|
||||||
|
@ -683,8 +690,7 @@ void ASTDeclReader::VisitFieldDecl(FieldDecl *FD) {
|
||||||
else if (BitWidthOrInitializer == 2)
|
else if (BitWidthOrInitializer == 2)
|
||||||
FD->setInClassInitializer(Reader.ReadExpr(F));
|
FD->setInClassInitializer(Reader.ReadExpr(F));
|
||||||
if (!FD->getDeclName()) {
|
if (!FD->getDeclName()) {
|
||||||
FieldDecl *Tmpl = cast_or_null<FieldDecl>(Reader.GetDecl(Record[Idx++]));
|
if (FieldDecl *Tmpl = ReadDeclAs<FieldDecl>(Record, Idx))
|
||||||
if (Tmpl)
|
|
||||||
Reader.getContext()->setInstantiatedFromUnnamedFieldDecl(FD, Tmpl);
|
Reader.getContext()->setInstantiatedFromUnnamedFieldDecl(FD, Tmpl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -697,7 +703,7 @@ void ASTDeclReader::VisitIndirectFieldDecl(IndirectFieldDecl *FD) {
|
||||||
FD->Chaining = new (*Reader.getContext())NamedDecl*[FD->ChainingSize];
|
FD->Chaining = new (*Reader.getContext())NamedDecl*[FD->ChainingSize];
|
||||||
|
|
||||||
for (unsigned I = 0; I != FD->ChainingSize; ++I)
|
for (unsigned I = 0; I != FD->ChainingSize; ++I)
|
||||||
FD->Chaining[I] = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
FD->Chaining[I] = ReadDeclAs<NamedDecl>(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitVarDecl(VarDecl *VD) {
|
void ASTDeclReader::VisitVarDecl(VarDecl *VD) {
|
||||||
|
@ -715,7 +721,7 @@ void ASTDeclReader::VisitVarDecl(VarDecl *VD) {
|
||||||
VD->setInit(Reader.ReadExpr(F));
|
VD->setInit(Reader.ReadExpr(F));
|
||||||
|
|
||||||
if (Record[Idx++]) { // HasMemberSpecializationInfo.
|
if (Record[Idx++]) { // HasMemberSpecializationInfo.
|
||||||
VarDecl *Tmpl = cast<VarDecl>(Reader.GetDecl(Record[Idx++]));
|
VarDecl *Tmpl = ReadDeclAs<VarDecl>(Record, Idx);
|
||||||
TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
|
TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
|
||||||
SourceLocation POI = ReadSourceLocation(Record, Idx);
|
SourceLocation POI = ReadSourceLocation(Record, Idx);
|
||||||
Reader.getContext()->setInstantiatedFromStaticDataMember(VD, Tmpl, TSK,POI);
|
Reader.getContext()->setInstantiatedFromStaticDataMember(VD, Tmpl, TSK,POI);
|
||||||
|
@ -759,7 +765,7 @@ void ASTDeclReader::VisitBlockDecl(BlockDecl *BD) {
|
||||||
llvm::SmallVector<ParmVarDecl *, 16> Params;
|
llvm::SmallVector<ParmVarDecl *, 16> Params;
|
||||||
Params.reserve(NumParams);
|
Params.reserve(NumParams);
|
||||||
for (unsigned I = 0; I != NumParams; ++I)
|
for (unsigned I = 0; I != NumParams; ++I)
|
||||||
Params.push_back(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
|
Params.push_back(ReadDeclAs<ParmVarDecl>(Record, Idx));
|
||||||
BD->setParams(Params.data(), NumParams);
|
BD->setParams(Params.data(), NumParams);
|
||||||
|
|
||||||
bool capturesCXXThis = Record[Idx++];
|
bool capturesCXXThis = Record[Idx++];
|
||||||
|
@ -767,7 +773,7 @@ void ASTDeclReader::VisitBlockDecl(BlockDecl *BD) {
|
||||||
llvm::SmallVector<BlockDecl::Capture, 16> captures;
|
llvm::SmallVector<BlockDecl::Capture, 16> captures;
|
||||||
captures.reserve(numCaptures);
|
captures.reserve(numCaptures);
|
||||||
for (unsigned i = 0; i != numCaptures; ++i) {
|
for (unsigned i = 0; i != numCaptures; ++i) {
|
||||||
VarDecl *decl = cast<VarDecl>(Reader.GetDecl(Record[Idx++]));
|
VarDecl *decl = ReadDeclAs<VarDecl>(Record, Idx);
|
||||||
unsigned flags = Record[Idx++];
|
unsigned flags = Record[Idx++];
|
||||||
bool byRef = (flags & 1);
|
bool byRef = (flags & 1);
|
||||||
bool nested = (flags & 2);
|
bool nested = (flags & 2);
|
||||||
|
@ -800,9 +806,10 @@ void ASTDeclReader::VisitNamespaceDecl(NamespaceDecl *D) {
|
||||||
D->NextNamespace = Record[Idx++];
|
D->NextNamespace = Record[Idx++];
|
||||||
|
|
||||||
bool IsOriginal = Record[Idx++];
|
bool IsOriginal = Record[Idx++];
|
||||||
|
// FIXME: Modules will likely have trouble with pointing directly at
|
||||||
|
// the original namespace.
|
||||||
D->OrigOrAnonNamespace.setInt(IsOriginal);
|
D->OrigOrAnonNamespace.setInt(IsOriginal);
|
||||||
D->OrigOrAnonNamespace.setPointer(
|
D->OrigOrAnonNamespace.setPointer(ReadDeclAs<NamespaceDecl>(Record, Idx));
|
||||||
cast_or_null<NamespaceDecl>(Reader.GetDecl(Record[Idx++])));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
|
void ASTDeclReader::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
|
||||||
|
@ -810,7 +817,7 @@ void ASTDeclReader::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
|
||||||
D->NamespaceLoc = ReadSourceLocation(Record, Idx);
|
D->NamespaceLoc = ReadSourceLocation(Record, Idx);
|
||||||
D->IdentLoc = ReadSourceLocation(Record, Idx);
|
D->IdentLoc = ReadSourceLocation(Record, Idx);
|
||||||
D->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
|
D->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
|
||||||
D->Namespace = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
D->Namespace = ReadDeclAs<NamedDecl>(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitUsingDecl(UsingDecl *D) {
|
void ASTDeclReader::VisitUsingDecl(UsingDecl *D) {
|
||||||
|
@ -818,19 +825,17 @@ void ASTDeclReader::VisitUsingDecl(UsingDecl *D) {
|
||||||
D->setUsingLocation(ReadSourceLocation(Record, Idx));
|
D->setUsingLocation(ReadSourceLocation(Record, Idx));
|
||||||
D->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
|
D->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
|
||||||
ReadDeclarationNameLoc(D->DNLoc, D->getDeclName(), Record, Idx);
|
ReadDeclarationNameLoc(D->DNLoc, D->getDeclName(), Record, Idx);
|
||||||
D->FirstUsingShadow = cast_or_null<UsingShadowDecl>(Reader.GetDecl(Record[Idx++]));
|
D->FirstUsingShadow = ReadDeclAs<UsingShadowDecl>(Record, Idx);
|
||||||
D->setTypeName(Record[Idx++]);
|
D->setTypeName(Record[Idx++]);
|
||||||
NamedDecl *Pattern = cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
if (NamedDecl *Pattern = ReadDeclAs<NamedDecl>(Record, Idx))
|
||||||
if (Pattern)
|
|
||||||
Reader.getContext()->setInstantiatedFromUsingDecl(D, Pattern);
|
Reader.getContext()->setInstantiatedFromUsingDecl(D, Pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitUsingShadowDecl(UsingShadowDecl *D) {
|
void ASTDeclReader::VisitUsingShadowDecl(UsingShadowDecl *D) {
|
||||||
VisitNamedDecl(D);
|
VisitNamedDecl(D);
|
||||||
D->setTargetDecl(cast<NamedDecl>(Reader.GetDecl(Record[Idx++])));
|
D->setTargetDecl(ReadDeclAs<NamedDecl>(Record, Idx));
|
||||||
D->UsingOrNextShadow = cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
D->UsingOrNextShadow = ReadDeclAs<NamedDecl>(Record, Idx);
|
||||||
UsingShadowDecl *Pattern
|
UsingShadowDecl *Pattern = ReadDeclAs<UsingShadowDecl>(Record, Idx);
|
||||||
= cast_or_null<UsingShadowDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
if (Pattern)
|
if (Pattern)
|
||||||
Reader.getContext()->setInstantiatedFromUsingShadowDecl(D, Pattern);
|
Reader.getContext()->setInstantiatedFromUsingShadowDecl(D, Pattern);
|
||||||
}
|
}
|
||||||
|
@ -840,8 +845,8 @@ void ASTDeclReader::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
|
||||||
D->UsingLoc = ReadSourceLocation(Record, Idx);
|
D->UsingLoc = ReadSourceLocation(Record, Idx);
|
||||||
D->NamespaceLoc = ReadSourceLocation(Record, Idx);
|
D->NamespaceLoc = ReadSourceLocation(Record, Idx);
|
||||||
D->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
|
D->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
|
||||||
D->NominatedNamespace = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
D->NominatedNamespace = ReadDeclAs<NamedDecl>(Record, Idx);
|
||||||
D->CommonAncestor = cast_or_null<DeclContext>(Reader.GetDecl(Record[Idx++]));
|
D->CommonAncestor = ReadDeclAs<DeclContext>(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
|
void ASTDeclReader::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
|
||||||
|
@ -898,11 +903,10 @@ void ASTDeclReader::ReadCXXDefinitionData(
|
||||||
if (Data.NumVBases)
|
if (Data.NumVBases)
|
||||||
Data.VBases = Reader.GetCXXBaseSpecifiersOffset(Record[Idx++]);
|
Data.VBases = Reader.GetCXXBaseSpecifiersOffset(Record[Idx++]);
|
||||||
|
|
||||||
Reader.ReadUnresolvedSet(Data.Conversions, Record, Idx);
|
Reader.ReadUnresolvedSet(F, Data.Conversions, Record, Idx);
|
||||||
Reader.ReadUnresolvedSet(Data.VisibleConversions, Record, Idx);
|
Reader.ReadUnresolvedSet(F, Data.VisibleConversions, Record, Idx);
|
||||||
assert(Data.Definition && "Data.Definition should be already set!");
|
assert(Data.Definition && "Data.Definition should be already set!");
|
||||||
Data.FirstFriend
|
Data.FirstFriend = ReadDeclAs<FriendDecl>(Record, Idx);
|
||||||
= cast_or_null<FriendDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::InitializeCXXDefinitionData(CXXRecordDecl *D,
|
void ASTDeclReader::InitializeCXXDefinitionData(CXXRecordDecl *D,
|
||||||
|
@ -942,8 +946,7 @@ void ASTDeclReader::InitializeCXXDefinitionData(CXXRecordDecl *D,
|
||||||
void ASTDeclReader::VisitCXXRecordDecl(CXXRecordDecl *D) {
|
void ASTDeclReader::VisitCXXRecordDecl(CXXRecordDecl *D) {
|
||||||
VisitRecordDecl(D);
|
VisitRecordDecl(D);
|
||||||
|
|
||||||
CXXRecordDecl *DefinitionDecl
|
CXXRecordDecl *DefinitionDecl = ReadDeclAs<CXXRecordDecl>(Record, Idx);
|
||||||
= cast_or_null<CXXRecordDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
InitializeCXXDefinitionData(D, DefinitionDecl, Record, Idx);
|
InitializeCXXDefinitionData(D, DefinitionDecl, Record, Idx);
|
||||||
|
|
||||||
ASTContext &C = *Reader.getContext();
|
ASTContext &C = *Reader.getContext();
|
||||||
|
@ -957,11 +960,10 @@ void ASTDeclReader::VisitCXXRecordDecl(CXXRecordDecl *D) {
|
||||||
case CXXRecNotTemplate:
|
case CXXRecNotTemplate:
|
||||||
break;
|
break;
|
||||||
case CXXRecTemplate:
|
case CXXRecTemplate:
|
||||||
D->TemplateOrInstantiation
|
D->TemplateOrInstantiation = ReadDeclAs<ClassTemplateDecl>(Record, Idx);
|
||||||
= cast<ClassTemplateDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
break;
|
break;
|
||||||
case CXXRecMemberSpecialization: {
|
case CXXRecMemberSpecialization: {
|
||||||
CXXRecordDecl *RD = cast<CXXRecordDecl>(Reader.GetDecl(Record[Idx++]));
|
CXXRecordDecl *RD = ReadDeclAs<CXXRecordDecl>(Record, Idx);
|
||||||
TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
|
TemplateSpecializationKind TSK = (TemplateSpecializationKind)Record[Idx++];
|
||||||
SourceLocation POI = ReadSourceLocation(Record, Idx);
|
SourceLocation POI = ReadSourceLocation(Record, Idx);
|
||||||
MemberSpecializationInfo *MSI = new (C) MemberSpecializationInfo(RD, TSK);
|
MemberSpecializationInfo *MSI = new (C) MemberSpecializationInfo(RD, TSK);
|
||||||
|
@ -974,9 +976,7 @@ void ASTDeclReader::VisitCXXRecordDecl(CXXRecordDecl *D) {
|
||||||
// Load the key function to avoid deserializing every method so we can
|
// Load the key function to avoid deserializing every method so we can
|
||||||
// compute it.
|
// compute it.
|
||||||
if (D->IsDefinition) {
|
if (D->IsDefinition) {
|
||||||
CXXMethodDecl *Key
|
if (CXXMethodDecl *Key = ReadDeclAs<CXXMethodDecl>(Record, Idx))
|
||||||
= cast_or_null<CXXMethodDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
if (Key)
|
|
||||||
C.KeyFunctions[D] = Key;
|
C.KeyFunctions[D] = Key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -985,10 +985,10 @@ void ASTDeclReader::VisitCXXMethodDecl(CXXMethodDecl *D) {
|
||||||
VisitFunctionDecl(D);
|
VisitFunctionDecl(D);
|
||||||
unsigned NumOverridenMethods = Record[Idx++];
|
unsigned NumOverridenMethods = Record[Idx++];
|
||||||
while (NumOverridenMethods--) {
|
while (NumOverridenMethods--) {
|
||||||
CXXMethodDecl *MD = cast<CXXMethodDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
// Avoid invariant checking of CXXMethodDecl::addOverriddenMethod,
|
// Avoid invariant checking of CXXMethodDecl::addOverriddenMethod,
|
||||||
// MD may be initializing.
|
// MD may be initializing.
|
||||||
Reader.getContext()->addOverriddenMethod(D, MD);
|
if (CXXMethodDecl *MD = ReadDeclAs<CXXMethodDecl>(Record, Idx))
|
||||||
|
Reader.getContext()->addOverriddenMethod(D, MD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1005,7 +1005,7 @@ void ASTDeclReader::VisitCXXDestructorDecl(CXXDestructorDecl *D) {
|
||||||
VisitCXXMethodDecl(D);
|
VisitCXXMethodDecl(D);
|
||||||
|
|
||||||
D->ImplicitlyDefined = Record[Idx++];
|
D->ImplicitlyDefined = Record[Idx++];
|
||||||
D->OperatorDelete = cast_or_null<FunctionDecl>(Reader.GetDecl(Record[Idx++]));
|
D->OperatorDelete = ReadDeclAs<FunctionDecl>(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTDeclReader::VisitCXXConversionDecl(CXXConversionDecl *D) {
|
void ASTDeclReader::VisitCXXConversionDecl(CXXConversionDecl *D) {
|
||||||
|
@ -1023,7 +1023,7 @@ void ASTDeclReader::VisitFriendDecl(FriendDecl *D) {
|
||||||
if (Record[Idx++])
|
if (Record[Idx++])
|
||||||
D->Friend = GetTypeSourceInfo(Record, Idx);
|
D->Friend = GetTypeSourceInfo(Record, Idx);
|
||||||
else
|
else
|
||||||
D->Friend = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
D->Friend = ReadDeclAs<NamedDecl>(Record, Idx);
|
||||||
D->NextFriend = Record[Idx++];
|
D->NextFriend = Record[Idx++];
|
||||||
D->UnsupportedFriend = (Record[Idx++] != 0);
|
D->UnsupportedFriend = (Record[Idx++] != 0);
|
||||||
D->FriendLoc = ReadSourceLocation(Record, Idx);
|
D->FriendLoc = ReadSourceLocation(Record, Idx);
|
||||||
|
@ -1037,7 +1037,7 @@ void ASTDeclReader::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
|
||||||
for (unsigned i = 0; i != NumParams; ++i)
|
for (unsigned i = 0; i != NumParams; ++i)
|
||||||
D->Params[i] = Reader.ReadTemplateParameterList(F, 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 = ReadDeclAs<NamedDecl>(Record, Idx);
|
||||||
else
|
else
|
||||||
D->Friend = GetTypeSourceInfo(Record, Idx);
|
D->Friend = GetTypeSourceInfo(Record, Idx);
|
||||||
D->FriendLoc = ReadSourceLocation(Record, Idx);
|
D->FriendLoc = ReadSourceLocation(Record, Idx);
|
||||||
|
@ -1046,8 +1046,7 @@ void ASTDeclReader::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
|
||||||
void ASTDeclReader::VisitTemplateDecl(TemplateDecl *D) {
|
void ASTDeclReader::VisitTemplateDecl(TemplateDecl *D) {
|
||||||
VisitNamedDecl(D);
|
VisitNamedDecl(D);
|
||||||
|
|
||||||
NamedDecl *TemplatedDecl
|
NamedDecl *TemplatedDecl = ReadDeclAs<NamedDecl>(Record, Idx);
|
||||||
= cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
TemplateParameterList* TemplateParams
|
TemplateParameterList* TemplateParams
|
||||||
= Reader.ReadTemplateParameterList(F, Record, Idx);
|
= Reader.ReadTemplateParameterList(F, Record, Idx);
|
||||||
D->init(TemplatedDecl, TemplateParams);
|
D->init(TemplatedDecl, TemplateParams);
|
||||||
|
@ -1058,8 +1057,8 @@ void ASTDeclReader::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {
|
||||||
// can be used while this is still initializing.
|
// can be used while this is still initializing.
|
||||||
|
|
||||||
assert(D->CommonOrPrev.isNull() && "getCommonPtr was called earlier on this");
|
assert(D->CommonOrPrev.isNull() && "getCommonPtr was called earlier on this");
|
||||||
DeclID PreviousDeclID = Record[Idx++];
|
DeclID PreviousDeclID = ReadDeclID(Record, Idx);
|
||||||
DeclID FirstDeclID = PreviousDeclID ? Record[Idx++] : 0;
|
DeclID FirstDeclID = PreviousDeclID ? ReadDeclID(Record, Idx) : 0;
|
||||||
// We delay loading of the redeclaration chain to avoid deeply nested calls.
|
// We delay loading of the redeclaration chain to avoid deeply nested calls.
|
||||||
// We temporarily set the first (canonical) declaration as the previous one
|
// We temporarily set the first (canonical) declaration as the previous one
|
||||||
// which is the one that matters and mark the real previous DeclID to be
|
// which is the one that matters and mark the real previous DeclID to be
|
||||||
|
@ -1076,7 +1075,7 @@ void ASTDeclReader::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {
|
||||||
} else {
|
} else {
|
||||||
D->CommonOrPrev = D->newCommon(*Reader.getContext());
|
D->CommonOrPrev = D->newCommon(*Reader.getContext());
|
||||||
if (RedeclarableTemplateDecl *RTD
|
if (RedeclarableTemplateDecl *RTD
|
||||||
= cast_or_null<RedeclarableTemplateDecl>(Reader.GetDecl(Record[Idx++]))) {
|
= ReadDeclAs<RedeclarableTemplateDecl>(Record, Idx)) {
|
||||||
assert(RTD->getKind() == D->getKind() &&
|
assert(RTD->getKind() == D->getKind() &&
|
||||||
"InstantiatedFromMemberTemplate kind mismatch");
|
"InstantiatedFromMemberTemplate kind mismatch");
|
||||||
D->setInstantiatedFromMemberTemplateImpl(RTD);
|
D->setInstantiatedFromMemberTemplateImpl(RTD);
|
||||||
|
@ -1084,8 +1083,8 @@ void ASTDeclReader::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {
|
||||||
D->setMemberSpecialization();
|
D->setMemberSpecialization();
|
||||||
}
|
}
|
||||||
|
|
||||||
RedeclarableTemplateDecl *LatestDecl =
|
RedeclarableTemplateDecl *LatestDecl
|
||||||
cast_or_null<RedeclarableTemplateDecl>(Reader.GetDecl(Record[Idx++]));
|
= ReadDeclAs<RedeclarableTemplateDecl>(Record, Idx);
|
||||||
|
|
||||||
// This decl is a first one and the latest declaration that it points to is
|
// This decl is a first one and the latest declaration that it points to is
|
||||||
// in the same AST file. However, if this actually needs to point to a
|
// in the same AST file. However, if this actually needs to point to a
|
||||||
|
@ -1125,14 +1124,14 @@ void ASTDeclReader::VisitClassTemplateDecl(ClassTemplateDecl *D) {
|
||||||
// Specializations.
|
// Specializations.
|
||||||
unsigned Size = Record[Idx++];
|
unsigned Size = Record[Idx++];
|
||||||
SpecIDs[0] += Size;
|
SpecIDs[0] += Size;
|
||||||
SpecIDs.append(Record.begin() + Idx, Record.begin() + Idx + Size);
|
for (unsigned I = 0; I != Size; ++I)
|
||||||
Idx += Size;
|
SpecIDs.push_back(ReadDeclID(Record, Idx));
|
||||||
|
|
||||||
// Partial specializations.
|
// Partial specializations.
|
||||||
Size = Record[Idx++];
|
Size = Record[Idx++];
|
||||||
SpecIDs[0] += Size;
|
SpecIDs[0] += Size;
|
||||||
SpecIDs.append(Record.begin() + Idx, Record.begin() + Idx + Size);
|
for (unsigned I = 0; I != Size; ++I)
|
||||||
Idx += Size;
|
SpecIDs.push_back(ReadDeclID(Record, Idx));
|
||||||
|
|
||||||
if (SpecIDs[0]) {
|
if (SpecIDs[0]) {
|
||||||
typedef serialization::DeclID DeclID;
|
typedef serialization::DeclID DeclID;
|
||||||
|
@ -1153,7 +1152,7 @@ void ASTDeclReader::VisitClassTemplateSpecializationDecl(
|
||||||
VisitCXXRecordDecl(D);
|
VisitCXXRecordDecl(D);
|
||||||
|
|
||||||
ASTContext &C = *Reader.getContext();
|
ASTContext &C = *Reader.getContext();
|
||||||
if (Decl *InstD = Reader.GetDecl(Record[Idx++])) {
|
if (Decl *InstD = ReadDecl(Record, Idx)) {
|
||||||
if (ClassTemplateDecl *CTD = dyn_cast<ClassTemplateDecl>(InstD)) {
|
if (ClassTemplateDecl *CTD = dyn_cast<ClassTemplateDecl>(InstD)) {
|
||||||
D->SpecializedTemplate = CTD;
|
D->SpecializedTemplate = CTD;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1190,8 +1189,7 @@ void ASTDeclReader::VisitClassTemplateSpecializationDecl(
|
||||||
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.
|
||||||
ClassTemplateDecl *CanonPattern
|
ClassTemplateDecl *CanonPattern = ReadDeclAs<ClassTemplateDecl>(Record,Idx);
|
||||||
= cast<ClassTemplateDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
if (ClassTemplatePartialSpecializationDecl *Partial
|
if (ClassTemplatePartialSpecializationDecl *Partial
|
||||||
= dyn_cast<ClassTemplatePartialSpecializationDecl>(D)) {
|
= dyn_cast<ClassTemplatePartialSpecializationDecl>(D)) {
|
||||||
CanonPattern->getCommonPtr()->PartialSpecializations.InsertNode(Partial);
|
CanonPattern->getCommonPtr()->PartialSpecializations.InsertNode(Partial);
|
||||||
|
@ -1221,8 +1219,7 @@ void ASTDeclReader::VisitClassTemplatePartialSpecializationDecl(
|
||||||
// These are read/set from/to the first declaration.
|
// These are read/set from/to the first declaration.
|
||||||
if (D->getPreviousDeclaration() == 0) {
|
if (D->getPreviousDeclaration() == 0) {
|
||||||
D->InstantiatedFromMember.setPointer(
|
D->InstantiatedFromMember.setPointer(
|
||||||
cast_or_null<ClassTemplatePartialSpecializationDecl>(
|
ReadDeclAs<ClassTemplatePartialSpecializationDecl>(Record, Idx));
|
||||||
Reader.GetDecl(Record[Idx++])));
|
|
||||||
D->InstantiatedFromMember.setInt(Record[Idx++]);
|
D->InstantiatedFromMember.setInt(Record[Idx++]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1238,7 +1235,7 @@ void ASTDeclReader::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
|
||||||
// when reading the specialized FunctionDecl.
|
// when reading the specialized FunctionDecl.
|
||||||
unsigned NumSpecs = Record[Idx++];
|
unsigned NumSpecs = Record[Idx++];
|
||||||
while (NumSpecs--)
|
while (NumSpecs--)
|
||||||
Reader.GetDecl(Record[Idx++]);
|
(void)ReadDecl(Record, Idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1315,8 +1312,8 @@ void ASTDeclReader::VisitRedeclarable(Redeclarable<T> *D) {
|
||||||
case NoRedeclaration:
|
case NoRedeclaration:
|
||||||
break;
|
break;
|
||||||
case PointsToPrevious: {
|
case PointsToPrevious: {
|
||||||
DeclID PreviousDeclID = Record[Idx++];
|
DeclID PreviousDeclID = ReadDeclID(Record, Idx);
|
||||||
DeclID FirstDeclID = Record[Idx++];
|
DeclID FirstDeclID = ReadDeclID(Record, Idx);
|
||||||
// We delay loading of the redeclaration chain to avoid deeply nested calls.
|
// We delay loading of the redeclaration chain to avoid deeply nested calls.
|
||||||
// We temporarily set the first (canonical) declaration as the previous one
|
// We temporarily set the first (canonical) declaration as the previous one
|
||||||
// which is the one that matters and mark the real previous DeclID to be
|
// which is the one that matters and mark the real previous DeclID to be
|
||||||
|
@ -1330,7 +1327,7 @@ void ASTDeclReader::VisitRedeclarable(Redeclarable<T> *D) {
|
||||||
}
|
}
|
||||||
case PointsToLatest:
|
case PointsToLatest:
|
||||||
D->RedeclLink = typename Redeclarable<T>::LatestDeclLink(
|
D->RedeclLink = typename Redeclarable<T>::LatestDeclLink(
|
||||||
cast_or_null<T>(Reader.GetDecl(Record[Idx++])));
|
ReadDeclAs<T>(Record, Idx));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1761,24 +1758,23 @@ void ASTDeclReader::UpdateDecl(Decl *D, ASTReader::PerFileData &Module,
|
||||||
switch ((DeclUpdateKind)Record[Idx++]) {
|
switch ((DeclUpdateKind)Record[Idx++]) {
|
||||||
case UPD_CXX_SET_DEFINITIONDATA: {
|
case UPD_CXX_SET_DEFINITIONDATA: {
|
||||||
CXXRecordDecl *RD = cast<CXXRecordDecl>(D);
|
CXXRecordDecl *RD = cast<CXXRecordDecl>(D);
|
||||||
CXXRecordDecl *
|
CXXRecordDecl *DefinitionDecl = ReadDeclAs<CXXRecordDecl>(Record, Idx);
|
||||||
DefinitionDecl = cast<CXXRecordDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
assert(!RD->DefinitionData && "DefinitionData is already set!");
|
assert(!RD->DefinitionData && "DefinitionData is already set!");
|
||||||
InitializeCXXDefinitionData(RD, DefinitionDecl, Record, Idx);
|
InitializeCXXDefinitionData(RD, DefinitionDecl, Record, Idx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case UPD_CXX_ADDED_IMPLICIT_MEMBER:
|
case UPD_CXX_ADDED_IMPLICIT_MEMBER:
|
||||||
cast<CXXRecordDecl>(D)->addedMember(Reader.GetDecl(Record[Idx++]));
|
cast<CXXRecordDecl>(D)->addedMember(ReadDecl(Record, Idx));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION:
|
case UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION:
|
||||||
// It will be added to the template's specializations set when loaded.
|
// It will be added to the template's specializations set when loaded.
|
||||||
Reader.GetDecl(Record[Idx++]);
|
(void)ReadDecl(Record, Idx);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPD_CXX_ADDED_ANONYMOUS_NAMESPACE: {
|
case UPD_CXX_ADDED_ANONYMOUS_NAMESPACE: {
|
||||||
NamespaceDecl *Anon = cast<NamespaceDecl>(Reader.GetDecl(Record[Idx++]));
|
NamespaceDecl *Anon = ReadDeclAs<NamespaceDecl>(Record, Idx);
|
||||||
// Guard against these being loaded out of original order. Don't use
|
// Guard against these being loaded out of original order. Don't use
|
||||||
// getNextNamespace(), since it tries to access the context and can't in
|
// getNextNamespace(), since it tries to access the context and can't in
|
||||||
// the middle of deserialization.
|
// the middle of deserialization.
|
||||||
|
|
|
@ -22,27 +22,44 @@ using namespace clang::serialization;
|
||||||
namespace clang {
|
namespace clang {
|
||||||
|
|
||||||
class ASTStmtReader : public StmtVisitor<ASTStmtReader> {
|
class ASTStmtReader : public StmtVisitor<ASTStmtReader> {
|
||||||
|
typedef ASTReader::RecordData RecordData;
|
||||||
|
|
||||||
ASTReader &Reader;
|
ASTReader &Reader;
|
||||||
ASTReader::PerFileData &F;
|
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,
|
SourceLocation ReadSourceLocation(const RecordData &R, unsigned &I) {
|
||||||
unsigned &I) {
|
|
||||||
return Reader.ReadSourceLocation(F, R, I);
|
return Reader.ReadSourceLocation(F, R, I);
|
||||||
}
|
}
|
||||||
SourceRange ReadSourceRange(const ASTReader::RecordData &R, unsigned &I) {
|
|
||||||
|
SourceRange ReadSourceRange(const RecordData &R, unsigned &I) {
|
||||||
return Reader.ReadSourceRange(F, R, I);
|
return Reader.ReadSourceRange(F, R, I);
|
||||||
}
|
}
|
||||||
TypeSourceInfo *GetTypeSourceInfo(const ASTReader::RecordData &R,
|
|
||||||
unsigned &I) {
|
TypeSourceInfo *GetTypeSourceInfo(const RecordData &R, unsigned &I) {
|
||||||
return Reader.GetTypeSourceInfo(F, R, I);
|
return Reader.GetTypeSourceInfo(F, R, I);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serialization::DeclID ReadDeclID(const RecordData &R, unsigned &I) {
|
||||||
|
return Reader.ReadDeclID(F, R, I);
|
||||||
|
}
|
||||||
|
|
||||||
|
Decl *ReadDecl(const RecordData &R, unsigned &I) {
|
||||||
|
return Reader.ReadDecl(F, R, I);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
T *ReadDeclAs(const RecordData &R, unsigned &I) {
|
||||||
|
return Reader.ReadDeclAs<T>(F, R, I);
|
||||||
|
}
|
||||||
|
|
||||||
void ReadDeclarationNameLoc(DeclarationNameLoc &DNLoc, DeclarationName Name,
|
void ReadDeclarationNameLoc(DeclarationNameLoc &DNLoc, DeclarationName Name,
|
||||||
const ASTReader::RecordData &R, unsigned &I) {
|
const ASTReader::RecordData &R, unsigned &I) {
|
||||||
Reader.ReadDeclarationNameLoc(F, DNLoc, Name, R, I);
|
Reader.ReadDeclarationNameLoc(F, DNLoc, Name, R, I);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadDeclarationNameInfo(DeclarationNameInfo &NameInfo,
|
void ReadDeclarationNameInfo(DeclarationNameInfo &NameInfo,
|
||||||
const ASTReader::RecordData &R, unsigned &I) {
|
const ASTReader::RecordData &R, unsigned &I) {
|
||||||
Reader.ReadDeclarationNameInfo(F, NameInfo, R, I);
|
Reader.ReadDeclarationNameInfo(F, NameInfo, R, I);
|
||||||
|
@ -130,7 +147,7 @@ void ASTStmtReader::VisitDefaultStmt(DefaultStmt *S) {
|
||||||
|
|
||||||
void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
|
void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
LabelDecl *LD = cast<LabelDecl>(Reader.GetDecl(Record[Idx++]));
|
LabelDecl *LD = ReadDeclAs<LabelDecl>(Record, Idx);
|
||||||
LD->setStmt(S);
|
LD->setStmt(S);
|
||||||
S->setDecl(LD);
|
S->setDecl(LD);
|
||||||
S->setSubStmt(Reader.ReadSubStmt());
|
S->setSubStmt(Reader.ReadSubStmt());
|
||||||
|
@ -139,8 +156,8 @@ void ASTStmtReader::VisitLabelStmt(LabelStmt *S) {
|
||||||
|
|
||||||
void ASTStmtReader::VisitIfStmt(IfStmt *S) {
|
void ASTStmtReader::VisitIfStmt(IfStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setConditionVariable(*Reader.getContext(),
|
S->setConditionVariable(*Reader.getContext(),
|
||||||
cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
ReadDeclAs<VarDecl>(Record, Idx));
|
||||||
S->setCond(Reader.ReadSubExpr());
|
S->setCond(Reader.ReadSubExpr());
|
||||||
S->setThen(Reader.ReadSubStmt());
|
S->setThen(Reader.ReadSubStmt());
|
||||||
S->setElse(Reader.ReadSubStmt());
|
S->setElse(Reader.ReadSubStmt());
|
||||||
|
@ -151,7 +168,7 @@ void ASTStmtReader::VisitIfStmt(IfStmt *S) {
|
||||||
void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
|
void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setConditionVariable(*Reader.getContext(),
|
S->setConditionVariable(*Reader.getContext(),
|
||||||
cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
ReadDeclAs<VarDecl>(Record, Idx));
|
||||||
S->setCond(Reader.ReadSubExpr());
|
S->setCond(Reader.ReadSubExpr());
|
||||||
S->setBody(Reader.ReadSubStmt());
|
S->setBody(Reader.ReadSubStmt());
|
||||||
S->setSwitchLoc(ReadSourceLocation(Record, Idx));
|
S->setSwitchLoc(ReadSourceLocation(Record, Idx));
|
||||||
|
@ -173,7 +190,8 @@ void ASTStmtReader::VisitSwitchStmt(SwitchStmt *S) {
|
||||||
void ASTStmtReader::VisitWhileStmt(WhileStmt *S) {
|
void ASTStmtReader::VisitWhileStmt(WhileStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setConditionVariable(*Reader.getContext(),
|
S->setConditionVariable(*Reader.getContext(),
|
||||||
cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
ReadDeclAs<VarDecl>(Record, Idx));
|
||||||
|
|
||||||
S->setCond(Reader.ReadSubExpr());
|
S->setCond(Reader.ReadSubExpr());
|
||||||
S->setBody(Reader.ReadSubStmt());
|
S->setBody(Reader.ReadSubStmt());
|
||||||
S->setWhileLoc(ReadSourceLocation(Record, Idx));
|
S->setWhileLoc(ReadSourceLocation(Record, Idx));
|
||||||
|
@ -193,7 +211,7 @@ void ASTStmtReader::VisitForStmt(ForStmt *S) {
|
||||||
S->setInit(Reader.ReadSubStmt());
|
S->setInit(Reader.ReadSubStmt());
|
||||||
S->setCond(Reader.ReadSubExpr());
|
S->setCond(Reader.ReadSubExpr());
|
||||||
S->setConditionVariable(*Reader.getContext(),
|
S->setConditionVariable(*Reader.getContext(),
|
||||||
cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
ReadDeclAs<VarDecl>(Record, Idx));
|
||||||
S->setInc(Reader.ReadSubExpr());
|
S->setInc(Reader.ReadSubExpr());
|
||||||
S->setBody(Reader.ReadSubStmt());
|
S->setBody(Reader.ReadSubStmt());
|
||||||
S->setForLoc(ReadSourceLocation(Record, Idx));
|
S->setForLoc(ReadSourceLocation(Record, Idx));
|
||||||
|
@ -203,7 +221,7 @@ void ASTStmtReader::VisitForStmt(ForStmt *S) {
|
||||||
|
|
||||||
void ASTStmtReader::VisitGotoStmt(GotoStmt *S) {
|
void ASTStmtReader::VisitGotoStmt(GotoStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setLabel(cast<LabelDecl>(Reader.GetDecl(Record[Idx++])));
|
S->setLabel(ReadDeclAs<LabelDecl>(Record, Idx));
|
||||||
S->setGotoLoc(ReadSourceLocation(Record, Idx));
|
S->setGotoLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setLabelLoc(ReadSourceLocation(Record, Idx));
|
S->setLabelLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
@ -229,7 +247,7 @@ void ASTStmtReader::VisitReturnStmt(ReturnStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->setRetValue(Reader.ReadSubExpr());
|
S->setRetValue(Reader.ReadSubExpr());
|
||||||
S->setReturnLoc(ReadSourceLocation(Record, Idx));
|
S->setReturnLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setNRVOCandidate(cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
S->setNRVOCandidate(ReadDeclAs<VarDecl>(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitDeclStmt(DeclStmt *S) {
|
void ASTStmtReader::VisitDeclStmt(DeclStmt *S) {
|
||||||
|
@ -239,12 +257,12 @@ void ASTStmtReader::VisitDeclStmt(DeclStmt *S) {
|
||||||
|
|
||||||
if (Idx + 1 == Record.size()) {
|
if (Idx + 1 == Record.size()) {
|
||||||
// Single declaration
|
// Single declaration
|
||||||
S->setDeclGroup(DeclGroupRef(Reader.GetDecl(Record[Idx++])));
|
S->setDeclGroup(DeclGroupRef(ReadDecl(Record, Idx)));
|
||||||
} else {
|
} else {
|
||||||
llvm::SmallVector<Decl *, 16> Decls;
|
llvm::SmallVector<Decl *, 16> Decls;
|
||||||
Decls.reserve(Record.size() - Idx);
|
Decls.reserve(Record.size() - Idx);
|
||||||
for (unsigned N = Record.size(); Idx != N; ++Idx)
|
for (unsigned N = Record.size(); Idx != N; )
|
||||||
Decls.push_back(Reader.GetDecl(Record[Idx]));
|
Decls.push_back(ReadDecl(Record, Idx));
|
||||||
S->setDeclGroup(DeclGroupRef(DeclGroup::Create(*Reader.getContext(),
|
S->setDeclGroup(DeclGroupRef(DeclGroup::Create(*Reader.getContext(),
|
||||||
Decls.data(),
|
Decls.data(),
|
||||||
Decls.size())));
|
Decls.size())));
|
||||||
|
@ -318,13 +336,13 @@ void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
|
||||||
= Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
|
= Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
|
||||||
|
|
||||||
if (E->hasFoundDecl())
|
if (E->hasFoundDecl())
|
||||||
E->getInternalFoundDecl() = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
E->getInternalFoundDecl() = ReadDeclAs<NamedDecl>(Record, Idx);
|
||||||
|
|
||||||
if (E->hasExplicitTemplateArgs())
|
if (E->hasExplicitTemplateArgs())
|
||||||
ReadExplicitTemplateArgumentList(E->getExplicitTemplateArgs(),
|
ReadExplicitTemplateArgumentList(E->getExplicitTemplateArgs(),
|
||||||
NumTemplateArgs);
|
NumTemplateArgs);
|
||||||
|
|
||||||
E->setDecl(cast<ValueDecl>(Reader.GetDecl(Record[Idx++])));
|
E->setDecl(ReadDeclAs<ValueDecl>(Record, Idx));
|
||||||
E->setLocation(ReadSourceLocation(Record, Idx));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
ReadDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName(), Record, Idx);
|
ReadDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName(), Record, Idx);
|
||||||
}
|
}
|
||||||
|
@ -418,10 +436,7 @@ void ASTStmtReader::VisitOffsetOfExpr(OffsetOfExpr *E) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Node::Field:
|
case Node::Field:
|
||||||
E->setComponent(I,
|
E->setComponent(I, Node(Start, ReadDeclAs<FieldDecl>(Record, Idx), End));
|
||||||
Node(Start,
|
|
||||||
dyn_cast_or_null<FieldDecl>(Reader.GetDecl(Record[Idx++])),
|
|
||||||
End));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Node::Identifier:
|
case Node::Identifier:
|
||||||
|
@ -593,8 +608,7 @@ void ASTStmtReader::VisitInitListExpr(InitListExpr *E) {
|
||||||
filler = Reader.ReadSubExpr();
|
filler = Reader.ReadSubExpr();
|
||||||
E->ArrayFillerOrUnionFieldInit = filler;
|
E->ArrayFillerOrUnionFieldInit = filler;
|
||||||
} else
|
} else
|
||||||
E->ArrayFillerOrUnionFieldInit
|
E->ArrayFillerOrUnionFieldInit = ReadDeclAs<FieldDecl>(Record, Idx);
|
||||||
= cast_or_null<FieldDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
E->sawArrayRangeDesignator(Record[Idx++]);
|
E->sawArrayRangeDesignator(Record[Idx++]);
|
||||||
unsigned NumInits = Record[Idx++];
|
unsigned NumInits = Record[Idx++];
|
||||||
E->reserveInits(*Reader.getContext(), NumInits);
|
E->reserveInits(*Reader.getContext(), NumInits);
|
||||||
|
@ -624,7 +638,7 @@ void ASTStmtReader::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
|
||||||
while (Idx < Record.size()) {
|
while (Idx < Record.size()) {
|
||||||
switch ((DesignatorTypes)Record[Idx++]) {
|
switch ((DesignatorTypes)Record[Idx++]) {
|
||||||
case DESIG_FIELD_DECL: {
|
case DESIG_FIELD_DECL: {
|
||||||
FieldDecl *Field = cast<FieldDecl>(Reader.GetDecl(Record[Idx++]));
|
FieldDecl *Field = ReadDeclAs<FieldDecl>(Record, Idx);
|
||||||
SourceLocation DotLoc
|
SourceLocation DotLoc
|
||||||
= ReadSourceLocation(Record, Idx);
|
= ReadSourceLocation(Record, Idx);
|
||||||
SourceLocation FieldLoc
|
SourceLocation FieldLoc
|
||||||
|
@ -689,7 +703,7 @@ void ASTStmtReader::VisitAddrLabelExpr(AddrLabelExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setAmpAmpLoc(ReadSourceLocation(Record, Idx));
|
E->setAmpAmpLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setLabelLoc(ReadSourceLocation(Record, Idx));
|
E->setLabelLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setLabel(cast<LabelDecl>(Reader.GetDecl(Record[Idx++])));
|
E->setLabel(ReadDeclAs<LabelDecl>(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
|
void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
|
||||||
|
@ -726,12 +740,12 @@ void ASTStmtReader::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {
|
||||||
|
|
||||||
void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
|
void ASTStmtReader::VisitBlockExpr(BlockExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setBlockDecl(cast_or_null<BlockDecl>(Reader.GetDecl(Record[Idx++])));
|
E->setBlockDecl(ReadDeclAs<BlockDecl>(Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitBlockDeclRefExpr(BlockDeclRefExpr *E) {
|
void ASTStmtReader::VisitBlockDeclRefExpr(BlockDeclRefExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setDecl(cast<VarDecl>(Reader.GetDecl(Record[Idx++])));
|
E->setDecl(ReadDeclAs<VarDecl>(Record, Idx));
|
||||||
E->setLocation(ReadSourceLocation(Record, Idx));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
E->setByRef(Record[Idx++]);
|
E->setByRef(Record[Idx++]);
|
||||||
E->setConstQualAdded(Record[Idx++]);
|
E->setConstQualAdded(Record[Idx++]);
|
||||||
|
@ -781,14 +795,14 @@ void ASTStmtReader::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
|
||||||
|
|
||||||
void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
|
void ASTStmtReader::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setProtocol(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++])));
|
E->setProtocol(ReadDeclAs<ObjCProtocolDecl>(Record, Idx));
|
||||||
E->setAtLoc(ReadSourceLocation(Record, Idx));
|
E->setAtLoc(ReadSourceLocation(Record, Idx));
|
||||||
E->setRParenLoc(ReadSourceLocation(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(ReadDeclAs<ObjCIvarDecl>(Record, Idx));
|
||||||
E->setLocation(ReadSourceLocation(Record, Idx));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
E->setBase(Reader.ReadSubExpr());
|
E->setBase(Reader.ReadSubExpr());
|
||||||
E->setIsArrow(Record[Idx++]);
|
E->setIsArrow(Record[Idx++]);
|
||||||
|
@ -799,14 +813,11 @@ void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
bool Implicit = Record[Idx++] != 0;
|
bool Implicit = Record[Idx++] != 0;
|
||||||
if (Implicit) {
|
if (Implicit) {
|
||||||
ObjCMethodDecl *Getter =
|
ObjCMethodDecl *Getter = ReadDeclAs<ObjCMethodDecl>(Record, Idx);
|
||||||
cast<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++]));
|
ObjCMethodDecl *Setter = ReadDeclAs<ObjCMethodDecl>(Record, Idx);
|
||||||
ObjCMethodDecl *Setter =
|
|
||||||
cast<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
E->setImplicitProperty(Getter, Setter);
|
E->setImplicitProperty(Getter, Setter);
|
||||||
} else {
|
} else {
|
||||||
E->setExplicitProperty(
|
E->setExplicitProperty(ReadDeclAs<ObjCPropertyDecl>(Record, Idx));
|
||||||
cast<ObjCPropertyDecl>(Reader.GetDecl(Record[Idx++])));
|
|
||||||
}
|
}
|
||||||
E->setLocation(ReadSourceLocation(Record, Idx));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
E->setReceiverLocation(ReadSourceLocation(Record, Idx));
|
E->setReceiverLocation(ReadSourceLocation(Record, Idx));
|
||||||
|
@ -818,8 +829,7 @@ void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
|
||||||
E->setSuperReceiver(Reader.GetType(Record[Idx++]));
|
E->setSuperReceiver(Reader.GetType(Record[Idx++]));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
E->setClassReceiver(
|
E->setClassReceiver(ReadDeclAs<ObjCInterfaceDecl>(Record, Idx));
|
||||||
cast<ObjCInterfaceDecl>(Reader.GetDecl(Record[Idx++])));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -852,7 +862,7 @@ void ASTStmtReader::VisitObjCMessageExpr(ObjCMessageExpr *E) {
|
||||||
assert(Kind == E->getReceiverKind());
|
assert(Kind == E->getReceiverKind());
|
||||||
|
|
||||||
if (Record[Idx++])
|
if (Record[Idx++])
|
||||||
E->setMethodDecl(cast_or_null<ObjCMethodDecl>(Reader.GetDecl(Record[Idx++])));
|
E->setMethodDecl(ReadDeclAs<ObjCMethodDecl>(Record, Idx));
|
||||||
else
|
else
|
||||||
E->setSelector(Reader.GetSelector(Record, Idx));
|
E->setSelector(Reader.GetSelector(Record, Idx));
|
||||||
|
|
||||||
|
@ -876,7 +886,7 @@ void ASTStmtReader::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
|
||||||
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(ReadDeclAs<VarDecl>(Record, Idx));
|
||||||
S->setAtCatchLoc(ReadSourceLocation(Record, Idx));
|
S->setAtCatchLoc(ReadSourceLocation(Record, Idx));
|
||||||
S->setRParenLoc(ReadSourceLocation(Record, Idx));
|
S->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||||
}
|
}
|
||||||
|
@ -927,7 +937,7 @@ void ASTStmtReader::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
|
||||||
void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
|
void ASTStmtReader::VisitCXXCatchStmt(CXXCatchStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
S->CatchLoc = ReadSourceLocation(Record, Idx);
|
S->CatchLoc = ReadSourceLocation(Record, Idx);
|
||||||
S->ExceptionDecl = cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++]));
|
S->ExceptionDecl = ReadDeclAs<VarDecl>(Record, Idx);
|
||||||
S->HandlerBlock = Reader.ReadSubStmt();
|
S->HandlerBlock = Reader.ReadSubStmt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -966,7 +976,7 @@ void ASTStmtReader::VisitCXXConstructExpr(CXXConstructExpr *E) {
|
||||||
E->Args = new (*Reader.getContext()) Stmt*[E->NumArgs];
|
E->Args = new (*Reader.getContext()) Stmt*[E->NumArgs];
|
||||||
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(ReadDeclAs<CXXConstructorDecl>(Record, Idx));
|
||||||
E->setLocation(ReadSourceLocation(Record, Idx));
|
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||||
E->setElidable(Record[Idx++]);
|
E->setElidable(Record[Idx++]);
|
||||||
E->setRequiresZeroInitialization(Record[Idx++]);
|
E->setRequiresZeroInitialization(Record[Idx++]);
|
||||||
|
@ -1050,13 +1060,13 @@ 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(ReadDeclAs<ParmVarDecl>(Record, Idx));
|
||||||
E->Loc = ReadSourceLocation(Record, Idx);
|
E->Loc = ReadSourceLocation(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
|
void ASTStmtReader::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->setTemporary(Reader.ReadCXXTemporary(Record, Idx));
|
E->setTemporary(Reader.ReadCXXTemporary(F, Record, Idx));
|
||||||
E->setSubExpr(Reader.ReadSubExpr());
|
E->setSubExpr(Reader.ReadSubExpr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1074,11 +1084,9 @@ void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
|
||||||
bool isArray = Record[Idx++];
|
bool isArray = Record[Idx++];
|
||||||
unsigned NumPlacementArgs = Record[Idx++];
|
unsigned NumPlacementArgs = Record[Idx++];
|
||||||
unsigned NumCtorArgs = Record[Idx++];
|
unsigned NumCtorArgs = Record[Idx++];
|
||||||
E->setOperatorNew(cast_or_null<FunctionDecl>(Reader.GetDecl(Record[Idx++])));
|
E->setOperatorNew(ReadDeclAs<FunctionDecl>(Record, Idx));
|
||||||
E->setOperatorDelete(
|
E->setOperatorDelete(ReadDeclAs<FunctionDecl>(Record, Idx));
|
||||||
cast_or_null<FunctionDecl>(Reader.GetDecl(Record[Idx++])));
|
E->setConstructor(ReadDeclAs<CXXConstructorDecl>(Record, Idx));
|
||||||
E->setConstructor(
|
|
||||||
cast_or_null<CXXConstructorDecl>(Reader.GetDecl(Record[Idx++])));
|
|
||||||
E->AllocatedTypeInfo = GetTypeSourceInfo(Record, Idx);
|
E->AllocatedTypeInfo = GetTypeSourceInfo(Record, Idx);
|
||||||
SourceRange TypeIdParens;
|
SourceRange TypeIdParens;
|
||||||
TypeIdParens.setBegin(ReadSourceLocation(Record, Idx));
|
TypeIdParens.setBegin(ReadSourceLocation(Record, Idx));
|
||||||
|
@ -1104,7 +1112,7 @@ void ASTStmtReader::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
|
||||||
E->ArrayForm = Record[Idx++];
|
E->ArrayForm = Record[Idx++];
|
||||||
E->ArrayFormAsWritten = Record[Idx++];
|
E->ArrayFormAsWritten = Record[Idx++];
|
||||||
E->UsualArrayDeleteWantsSize = Record[Idx++];
|
E->UsualArrayDeleteWantsSize = Record[Idx++];
|
||||||
E->OperatorDelete = cast_or_null<FunctionDecl>(Reader.GetDecl(Record[Idx++]));
|
E->OperatorDelete = ReadDeclAs<FunctionDecl>(Record, Idx);
|
||||||
E->Argument = Reader.ReadSubExpr();
|
E->Argument = Reader.ReadSubExpr();
|
||||||
E->Loc = ReadSourceLocation(Record, Idx);
|
E->Loc = ReadSourceLocation(Record, Idx);
|
||||||
}
|
}
|
||||||
|
@ -1133,7 +1141,7 @@ void ASTStmtReader::VisitExprWithCleanups(ExprWithCleanups *E) {
|
||||||
if (NumTemps) {
|
if (NumTemps) {
|
||||||
E->setNumTemporaries(*Reader.getContext(), NumTemps);
|
E->setNumTemporaries(*Reader.getContext(), NumTemps);
|
||||||
for (unsigned i = 0; i != NumTemps; ++i)
|
for (unsigned i = 0; i != NumTemps; ++i)
|
||||||
E->setTemporary(i, Reader.ReadCXXTemporary(Record, Idx));
|
E->setTemporary(i, Reader.ReadCXXTemporary(F, Record, Idx));
|
||||||
}
|
}
|
||||||
E->setSubExpr(Reader.ReadSubExpr());
|
E->setSubExpr(Reader.ReadSubExpr());
|
||||||
}
|
}
|
||||||
|
@ -1151,8 +1159,7 @@ ASTStmtReader::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){
|
||||||
E->IsArrow = Record[Idx++];
|
E->IsArrow = Record[Idx++];
|
||||||
E->OperatorLoc = ReadSourceLocation(Record, Idx);
|
E->OperatorLoc = ReadSourceLocation(Record, Idx);
|
||||||
E->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
|
E->QualifierLoc = Reader.ReadNestedNameSpecifierLoc(F, Record, Idx);
|
||||||
E->FirstQualifierFoundInScope
|
E->FirstQualifierFoundInScope = ReadDeclAs<NamedDecl>(Record, Idx);
|
||||||
= cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
ReadDeclarationNameInfo(E->MemberNameInfo, Record, Idx);
|
ReadDeclarationNameInfo(E->MemberNameInfo, Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1191,7 +1198,7 @@ void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
|
||||||
unsigned NumDecls = Record[Idx++];
|
unsigned NumDecls = Record[Idx++];
|
||||||
UnresolvedSet<8> Decls;
|
UnresolvedSet<8> Decls;
|
||||||
for (unsigned i = 0; i != NumDecls; ++i) {
|
for (unsigned i = 0; i != NumDecls; ++i) {
|
||||||
NamedDecl *D = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
NamedDecl *D = ReadDeclAs<NamedDecl>(Record, Idx);
|
||||||
AccessSpecifier AS = (AccessSpecifier)Record[Idx++];
|
AccessSpecifier AS = (AccessSpecifier)Record[Idx++];
|
||||||
Decls.addDecl(D, AS);
|
Decls.addDecl(D, AS);
|
||||||
}
|
}
|
||||||
|
@ -1216,7 +1223,7 @@ void ASTStmtReader::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
|
||||||
if (E->RequiresADL)
|
if (E->RequiresADL)
|
||||||
E->StdIsAssociatedNamespace = Record[Idx++];
|
E->StdIsAssociatedNamespace = Record[Idx++];
|
||||||
E->Overloaded = Record[Idx++];
|
E->Overloaded = Record[Idx++];
|
||||||
E->NamingClass = cast_or_null<CXXRecordDecl>(Reader.GetDecl(Record[Idx++]));
|
E->NamingClass = ReadDeclAs<CXXRecordDecl>(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) {
|
void ASTStmtReader::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) {
|
||||||
|
@ -1280,14 +1287,13 @@ void ASTStmtReader::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
|
||||||
E->PackLoc = ReadSourceLocation(Record, Idx);
|
E->PackLoc = ReadSourceLocation(Record, Idx);
|
||||||
E->RParenLoc = ReadSourceLocation(Record, Idx);
|
E->RParenLoc = ReadSourceLocation(Record, Idx);
|
||||||
E->Length = Record[Idx++];
|
E->Length = Record[Idx++];
|
||||||
E->Pack = cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++]));
|
E->Pack = ReadDeclAs<NamedDecl>(Record, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
|
void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
|
||||||
SubstNonTypeTemplateParmExpr *E) {
|
SubstNonTypeTemplateParmExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->Param
|
E->Param = ReadDeclAs<NonTypeTemplateParmDecl>(Record, Idx);
|
||||||
= cast_or_null<NonTypeTemplateParmDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
E->NameLoc = ReadSourceLocation(Record, Idx);
|
E->NameLoc = ReadSourceLocation(Record, Idx);
|
||||||
E->Replacement = Reader.ReadSubExpr();
|
E->Replacement = Reader.ReadSubExpr();
|
||||||
}
|
}
|
||||||
|
@ -1295,8 +1301,7 @@ void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
|
||||||
void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
|
void ASTStmtReader::VisitSubstNonTypeTemplateParmPackExpr(
|
||||||
SubstNonTypeTemplateParmPackExpr *E) {
|
SubstNonTypeTemplateParmPackExpr *E) {
|
||||||
VisitExpr(E);
|
VisitExpr(E);
|
||||||
E->Param
|
E->Param = ReadDeclAs<NonTypeTemplateParmDecl>(Record, Idx);
|
||||||
= cast_or_null<NonTypeTemplateParmDecl>(Reader.GetDecl(Record[Idx++]));
|
|
||||||
TemplateArgument ArgPack = Reader.ReadTemplateArgument(F, Record, Idx);
|
TemplateArgument ArgPack = Reader.ReadTemplateArgument(F, Record, Idx);
|
||||||
if (ArgPack.getKind() != TemplateArgument::Pack)
|
if (ArgPack.getKind() != TemplateArgument::Pack)
|
||||||
return;
|
return;
|
||||||
|
@ -1611,7 +1616,7 @@ Stmt *ASTReader::ReadStmtFromStream(PerFileData &F) {
|
||||||
ArgInfo.addArgument(ReadTemplateArgumentLoc(F, Record, Idx));
|
ArgInfo.addArgument(ReadTemplateArgumentLoc(F, Record, Idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
NamedDecl *FoundD = cast_or_null<NamedDecl>(GetDecl(Record[Idx++]));
|
NamedDecl *FoundD = ReadDeclAs<NamedDecl>(F, Record, Idx);
|
||||||
AccessSpecifier AS = (AccessSpecifier)Record[Idx++];
|
AccessSpecifier AS = (AccessSpecifier)Record[Idx++];
|
||||||
DeclAccessPair FoundDecl = DeclAccessPair::make(FoundD, AS);
|
DeclAccessPair FoundDecl = DeclAccessPair::make(FoundD, AS);
|
||||||
|
|
||||||
|
@ -1619,7 +1624,7 @@ Stmt *ASTReader::ReadStmtFromStream(PerFileData &F) {
|
||||||
ExprValueKind VK = static_cast<ExprValueKind>(Record[Idx++]);
|
ExprValueKind VK = static_cast<ExprValueKind>(Record[Idx++]);
|
||||||
ExprObjectKind OK = static_cast<ExprObjectKind>(Record[Idx++]);
|
ExprObjectKind OK = static_cast<ExprObjectKind>(Record[Idx++]);
|
||||||
Expr *Base = ReadSubExpr();
|
Expr *Base = ReadSubExpr();
|
||||||
ValueDecl *MemberD = cast<ValueDecl>(GetDecl(Record[Idx++]));
|
ValueDecl *MemberD = ReadDeclAs<ValueDecl>(F, Record, Idx);
|
||||||
SourceLocation MemberLoc = ReadSourceLocation(F, 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