[all-commits] [llvm/llvm-project] 7a86cc: [lldb][NFC] Remove unnecessary std::string tempora...
Felipe de Azevedo Piovezan via All-commits
all-commits at lists.llvm.org
Mon Dec 4 10:25:07 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7a86cc6c4ca11e37d5985d4fc902658ab6ad0e22
https://github.com/llvm/llvm-project/commit/7a86cc6c4ca11e37d5985d4fc902658ab6ad0e22
Author: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
Date: 2023-12-04 (Mon, 04 Dec 2023)
Changed paths:
M lldb/source/Interpreter/OptionArgParser.cpp
Log Message:
-----------
[lldb][NFC] Remove unnecessary std::string temporaries
The existing code was taking three substrings from a regex match and converting
to std::strings prior to using them. This may have been done to address
null-termination concerns, but this is not the case:
1. `name` was being used to call `c_str()` and then implicitly converted back to
a `StringRef` on the call to `ToAddress`. While the path `const char *` ->
`StringRef` requires null-termination, we can simply use the original StringRef.
2. `str_offset` was being converted back to a StringRef in order to call a
member method. Member methods can't handle non-null termination.
3. `sign` simply had it's 0-th element accessed.
Commit: 3e98a285138a517fd918ec0ac8397dc56330d8e7
https://github.com/llvm/llvm-project/commit/3e98a285138a517fd918ec0ac8397dc56330d8e7
Author: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
Date: 2023-12-04 (Mon, 04 Dec 2023)
Changed paths:
M lldb/source/Interpreter/OptionArgParser.cpp
Log Message:
-----------
[lldb][NFC] Remove else after return in OptionArgParse
This will enable us to prove that there is unreachable code in this function in
a subsequent commit.
Commit: d24d7edaef9517edd9eb2ab26b02969e201bbcad
https://github.com/llvm/llvm-project/commit/d24d7edaef9517edd9eb2ab26b02969e201bbcad
Author: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
Date: 2023-12-04 (Mon, 04 Dec 2023)
Changed paths:
M lldb/source/Interpreter/OptionArgParser.cpp
Log Message:
-----------
[lldb][NFC] Delete unreachable code and dead variable in OptionArgParser
With the combination of an early return and removing an else-after-return, it
becomes evident that there is unreachable code in the function being changed.
Compare: https://github.com/llvm/llvm-project/compare/503dbe75a042...d24d7edaef95
More information about the All-commits
mailing list