Skip to content

Commit 29ab49f

Browse files
committed
SerializeLoc: add an assertion to ensure we can use USR id as an index to access basic location records
1 parent dec8783 commit 29ab49f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/Serialization/SerializeDoc.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,8 @@ Result.X.Column = Locs->X.Column;
702702
auto LocData = getLocData(D);
703703
if (!USR.hasValue() || !LocData.hasValue())
704704
return true;
705+
assert(*USR * sizeof(DeclLocationsTableData) == Buffer.size() &&
706+
"USR id is used as an index to access basic location array");
705707
appendToBuffer(*LocData);
706708
return true;
707709
}

0 commit comments

Comments
 (0)