[PATCH] D117570: Handle whitespace in symbol list

Chris Bieneman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 18 09:59:58 PST 2022


beanz updated this revision to Diff 400895.
beanz added a comment.
Herald added a subscriber: wenlei.

Upating based on feedback from @MaskRay!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117570/new/

https://reviews.llvm.org/D117570

Files:
  llvm/test/Transforms/SampleProfile/Inputs/profile-symbol-list.text
  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();
+    PSL.add(SanitizedSymbol);
+  }
 }
 
 static void handleExtBinaryWriter(sampleprof::SampleProfileWriter &Writer,
Index: llvm/test/Transforms/SampleProfile/Inputs/profile-symbol-list.text
===================================================================
--- llvm/test/Transforms/SampleProfile/Inputs/profile-symbol-list.text
+++ llvm/test/Transforms/SampleProfile/Inputs/profile-symbol-list.text
@@ -7,4 +7,4 @@
 _fini
 _init
 _start
-main
+main 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117570.400895.patch
Type: text/x-patch
Size: 952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220118/a905959c/attachment.bin>


More information about the llvm-commits mailing list