[all-commits] [llvm/llvm-project] 61e1c3: [Demangle] convert itaniumDemangle and nonMicrosof...
Nick Desaulniers via All-commits
all-commits at lists.llvm.org
Fri Jun 2 15:03:10 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 61e1c3d80db6e94e8b5b83b3819afefeec4d357b
https://github.com/llvm/llvm-project/commit/61e1c3d80db6e94e8b5b83b3819afefeec4d357b
Author: Nick Desaulniers <ndesaulniers at google.com>
Date: 2023-06-02 (Fri, 02 Jun 2023)
Changed paths:
M llvm/include/llvm/Demangle/Demangle.h
M llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
M llvm/lib/Demangle/Demangle.cpp
M llvm/lib/Demangle/ItaniumDemangle.cpp
M llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
M llvm/tools/llvm-nm/llvm-nm.cpp
M llvm/tools/llvm-opt-report/OptReport.cpp
Log Message:
-----------
[Demangle] convert itaniumDemangle and nonMicrosoftDemangle to use std::string_view
D149104 converted llvm::demangle to use std::string_view. Enabling
"expensive checks" (via -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON) causes
lld/test/wasm/why-extract.s to fail. The reason for this is obscure:
Reason #10007 why std::string_view is dangerous:
Consider the following pattern:
std::string_view s = ...;
const char *c = s.data();
std::strlen(c);
Is c a NUL-terminated C style string? It depends; but if it's not then
it's not safe to call std::strlen on the std::string_view::data().
std::string_view::length() should be used instead.
Fixing this fixes the one lone test that caught this.
microsoftDemangle, rustDemangle, and dlangDemangle should get this same
treatment, too. I will do that next.
Reviewed By: MaskRay, efriedma
Differential Revision: https://reviews.llvm.org/D149675
More information about the All-commits
mailing list