[PATCH] D15876: [llvm-symbolizer] Print out non-address lines verbatim.
Alexey Samsonov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 7 15:50:46 PST 2016
samsonov accepted this revision.
samsonov added a comment.
This revision is now accepted and ready to land.
LGTM, but please address comments.
================
Comment at: tools/llvm-symbolizer/llvm-symbolizer.cpp:92
@@ -91,3 +91,3 @@
-static bool parseCommand(bool &IsData, std::string &ModuleName,
- uint64_t &ModuleOffset) {
+static bool parseCommand(const StringRef &InputString, bool &IsData,
+ std::string &ModuleName, uint64_t &ModuleOffset) {
----------------
Pass StringRef by value.
================
Comment at: tools/llvm-symbolizer/llvm-symbolizer.cpp:100
@@ -104,2 +99,3 @@
+ const char *pos = InputString.data();
if (strncmp(pos, kDataCmd, strlen(kDataCmd)) == 0) {
IsData = true;
----------------
So, once we have `StringRef`, let's use its methods instead of a C string functions.
We have a bunch of them: `startswith`, `drop_front`, `ltrim`, `find_first_not_of` etc.
This can be done in a follow-up commit, but please do so.
================
Comment at: tools/llvm-symbolizer/llvm-symbolizer.cpp:170
@@ +169,3 @@
+ uint64_t ModuleOffset = 0;
+ if (parseCommand(StringRef(InputString), IsData, ModuleName,
+ ModuleOffset)) {
----------------
Reduce the indentation:
if (!parseCommand(...)) {
outs() << InputString;
continue;
}
// existing code
http://reviews.llvm.org/D15876
More information about the llvm-commits
mailing list