File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -1422,11 +1422,13 @@ StringRef ModuleFileSharedCore::getIdentifierText(IdentifierID IID) const {
14221422
14231423 assert (!IdentifierData.empty () && " no identifier data in module" );
14241424
1425- StringRef rawStrPtr = IdentifierData.substr (offset);
1426- size_t terminatorOffset = rawStrPtr.find (' \0 ' );
1427- assert (terminatorOffset != StringRef::npos &&
1425+ size_t endOffset = ((rawID + 1 < Identifiers.size ()) ?
1426+ Identifiers[rawID + 1 ] : IdentifierData.size ()) - 1 ;
1427+
1428+ ASSERT (IdentifierData[endOffset] == ' \0 ' &&
14281429 " unterminated identifier string data" );
1429- return rawStrPtr.slice (0 , terminatorOffset);
1430+
1431+ return IdentifierData.slice (offset, endOffset);
14301432}
14311433
14321434ModuleFileSharedCore::ModuleFileSharedCore (
Original file line number Diff line number Diff line change 1414 %4 = string_literal bytes "ABCD"
1515// CHECK: string_literal oslog "os log section"
1616 %5 = string_literal oslog "os log section"
17- %6 = tuple ()
18- return %6 : $()
17+ // CHECK: string_literal utf8 "abc\0def"
18+ %6 = string_literal utf8 "abc\0def"
19+ // CHECK: string_literal utf8 "xyz\0"
20+ %7 = string_literal utf8 "xyz\0"
21+ %8 = tuple ()
22+ return %8 : $()
1923}
You can’t perform that action at this time.
0 commit comments