[PATCH] D117570: Handle whitespace in symbol list
Chris Bieneman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 18 09:15:46 PST 2022
beanz created this revision.
beanz added reviewers: MaskRay, rnk.
beanz requested review of this revision.
Herald added a project: LLVM.
Trimming whitespace or carriage returns from symbols allows this code
to work on Windows and makes it match other places symbol lists are
handled.
No test provided because
test/Transforms/SampleProfile/uncompressed-profile-symbol-list.ll fails
on Windows if the git checkout uses CRLF line endings.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D117570
Files:
llvm/tools/llvm-profdata/llvm-profdata.cpp
Index: llvm/tools/llvm-profdata/llvm-profdata.cpp
===================================================================
--- llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -661,8 +661,10 @@
StringRef Data = Buffer->getBuffer();
Data.split(SymbolVec, '\n', /*MaxSplit=*/-1, /*KeepEmpty=*/false);
- for (StringRef symbol : SymbolVec)
- PSL.add(symbol);
+ for (StringRef SymbolStr : SymbolVec) {
+ StringRef SanitizedSymbol = SymbolStr.trim(" \t\v\f\r");
+ PSL.add(SanitizedSymbol);
+ }
}
static void handleExtBinaryWriter(sampleprof::SampleProfileWriter &Writer,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117570.400872.patch
Type: text/x-patch
Size: 628 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220118/405e3d68/attachment.bin>
More information about the llvm-commits
mailing list