зеркало из https://github.com/microsoft/clang-1.git
When deserializing CXXBaseSpecifiers (and offsets), make sure to walk the chain in the correct order.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127315 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
d26bc76c98
Коммит
f25330bd88
|
@ -3730,11 +3730,13 @@ ASTReader::GetCXXBaseSpecifiersOffset(serialization::CXXBaseSpecifiersID ID) {
|
|||
--ID;
|
||||
uint64_t Offset = 0;
|
||||
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
|
||||
if (ID < Chain[I]->LocalNumCXXBaseSpecifiers)
|
||||
return Offset + Chain[I]->CXXBaseSpecifiersOffsets[ID];
|
||||
PerFileData &F = *Chain[N - I - 1];
|
||||
|
||||
if (ID < F.LocalNumCXXBaseSpecifiers)
|
||||
return Offset + F.CXXBaseSpecifiersOffsets[ID];
|
||||
|
||||
ID -= Chain[I]->LocalNumCXXBaseSpecifiers;
|
||||
Offset += Chain[I]->SizeInBits;
|
||||
ID -= F.LocalNumCXXBaseSpecifiers;
|
||||
Offset += F.SizeInBits;
|
||||
}
|
||||
|
||||
assert(false && "CXXBaseSpecifiers not found");
|
||||
|
@ -3745,14 +3747,14 @@ CXXBaseSpecifier *ASTReader::GetExternalCXXBaseSpecifiers(uint64_t Offset) {
|
|||
// Figure out which AST file contains this offset.
|
||||
PerFileData *F = 0;
|
||||
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
|
||||
if (Offset < Chain[I]->SizeInBits) {
|
||||
F = Chain[I];
|
||||
if (Offset < Chain[N - I - 1]->SizeInBits) {
|
||||
F = Chain[N - I - 1];
|
||||
break;
|
||||
}
|
||||
|
||||
Offset -= Chain[I]->SizeInBits;
|
||||
Offset -= Chain[N - I - 1]->SizeInBits;
|
||||
}
|
||||
|
||||
|
||||
if (!F) {
|
||||
Error("Malformed AST file: C++ base specifiers at impossible offset");
|
||||
return 0;
|
||||
|
|
|
@ -34,6 +34,9 @@ struct S<T *> { typedef int H; };
|
|||
template <typename T> struct TS2;
|
||||
typedef TS2<int> TS2int;
|
||||
|
||||
template <typename T> struct TestBaseSpecifiers { };
|
||||
template<typename T> struct TestBaseSpecifiers2 : TestBaseSpecifiers<T> { };
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
#elif not defined(HEADER2)
|
||||
#define HEADER2
|
||||
|
@ -73,6 +76,9 @@ struct S<int &> { typedef int L; };
|
|||
|
||||
template <typename T> struct TS2 { };
|
||||
|
||||
struct TestBaseSpecifiers3 { };
|
||||
struct TestBaseSpecifiers4 : TestBaseSpecifiers3 { };
|
||||
|
||||
struct A { };
|
||||
struct B : A { };
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче