Skip to content

Commit

Permalink
Fix test breakage in 879e886.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZequanWu committed Jun 15, 2023
1 parent f7679bc commit 9d910b1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions clang/lib/Frontend/LayoutOverrideSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,30 +152,31 @@ LayoutOverrideSource::LayoutOverrideSource(StringRef Filename) {
}
}

// Check for the base offsets.
Pos = LineStr.find("BaseOffsets: [");
// Check for the virtual base offsets.
Pos = LineStr.find("VBaseOffsets: [");
if (Pos != StringRef::npos) {
LineStr = LineStr.substr(Pos + strlen("BaseOffsets: ["));
LineStr = LineStr.substr(Pos + strlen("VBaseOffsets: ["));
while (!LineStr.empty() && isDigit(LineStr[0])) {
unsigned long long Offset = 0;
if (parseUnsigned(LineStr, Offset))
CurrentLayout.BaseOffsets.push_back(CharUnits::fromQuantity(Offset));
CurrentLayout.VBaseOffsets.push_back(CharUnits::fromQuantity(Offset));

// Skip over this offset, the following comma, and any spaces.
LineStr = LineStr.substr(1);
while (!LineStr.empty() && isWhitespace(LineStr[0]))
LineStr = LineStr.substr(1);
}
continue;
}

// Check for the virtual base offsets.
Pos = LineStr.find("VBaseOffsets: [");
// Check for the base offsets.
Pos = LineStr.find("BaseOffsets: [");
if (Pos != StringRef::npos) {
LineStr = LineStr.substr(Pos + strlen("VBaseOffsets: ["));
LineStr = LineStr.substr(Pos + strlen("BaseOffsets: ["));
while (!LineStr.empty() && isDigit(LineStr[0])) {
unsigned long long Offset = 0;
if (parseUnsigned(LineStr, Offset))
CurrentLayout.VBaseOffsets.push_back(CharUnits::fromQuantity(Offset));
CurrentLayout.BaseOffsets.push_back(CharUnits::fromQuantity(Offset));

// Skip over this offset, the following comma, and any spaces.
LineStr = LineStr.substr(1);
Expand Down

0 comments on commit 9d910b1

Please sign in to comment.