[PATCH] D118077: Print C-string literals in mapfile
Roger Kim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 10 17:20:47 PST 2022
Roger marked an inline comment as done.
Roger added a comment.
> it wouldn't hurt to assert that the offset is indeed zero.
I realized this is not necessary as the function `CStringInputSection::getStringRef` should handle any complexities around offsets. Looking at that `getStringRef`'s code right now, the logic actually assumes that there is no tail merging as it does the following:
StringRef getStringRef(size_t i) const {
size_t begin = pieces[i].inSecOff;
size_t end =
(pieces.size() - 1 == i) ? data.size() : pieces[i + 1].inSecOff;
return toStringRef(data.slice(begin, end - begin));
}
You can see that it uses the start of the next StringPiece to determine the end of the current StringPiece. This implies that StringPieces do not overlap (assuming they are ordered by their starting location and that there is 1:1 relationship between strings and StringPieces).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118077/new/
https://reviews.llvm.org/D118077
More information about the llvm-commits
mailing list