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 {
1422
1422
1423
1423
assert (!IdentifierData.empty () && " no identifier data in module" );
1424
1424
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 ' &&
1428
1429
" unterminated identifier string data" );
1429
- return rawStrPtr.slice (0 , terminatorOffset);
1430
+
1431
+ return IdentifierData.slice (offset, endOffset);
1430
1432
}
1431
1433
1432
1434
ModuleFileSharedCore::ModuleFileSharedCore (
Original file line number Diff line number Diff line change 14
14
%4 = string_literal bytes "ABCD"
15
15
// CHECK: string_literal oslog "os log section"
16
16
%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 : $()
19
23
}
You can’t perform that action at this time.
0 commit comments