The code that gets binary file name is moved to a separate function.
It makes the code of parseCommand cleaner and allows to reuse the
parsing code.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
60,050 ms | x64 debian > MLIR.Examples/standalone::test.toy |
Event Timeline
llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp | ||
---|---|---|
138 | The function returns a part of its input, so there is no need to allocate new memory for that, StringRef is enough. It should be the responsibility of the caller to copy the result if necessary. Also, the function can update Source if it is passed as a reference, which would simplify the code even more. | |
164 | It looks like kDelimiters can be removed. |
llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp | ||
---|---|---|
138 | Indeed, StringRef can be used here.
Passing by reference can bring new issues. In this case it prevents from using constructs like getSpaceDelimitedWord(Source.ltrim()). | |
164 | It is true. Removed. |
llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp | ||
---|---|---|
138 | Are there any reasons not to do the trimming within this function? |
One nit from me, otherwise LGTM too.
llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp | ||
---|---|---|
145 | Nit: https://llvm.org/docs/CodingStandards.html#prefer-preincrement (I know this was there before, but since you're moving the code, you might as well fix it at the same time) |
The function returns a part of its input, so there is no need to allocate new memory for that, StringRef is enough. It should be the responsibility of the caller to copy the result if necessary.
Also, the function can update Source if it is passed as a reference, which would simplify the code even more.