--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");
// 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;
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
template <typename T> struct TS2 { };
+struct TestBaseSpecifiers3 { };
+struct TestBaseSpecifiers4 : TestBaseSpecifiers3 { };
+
struct A { };
struct B : A { };