[PATCH] D19135: [sanitizers] Teach the internal demangler about Swift names
Anna Zaks via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 15 10:46:45 PDT 2016
zaks.anna added inline comments.
================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc:77
@@ +76,3 @@
+ swift_demangle_ft swift_demangle_f =
+ (swift_demangle_ft) dlsym(RTLD_DEFAULT, "swift_demangle");
+ if (swift_demangle_f)
----------------
kcc wrote:
> does this mean that we call dlsym every time we are trying to demangle something?
Yes. I'll add a check for the Swift name prefix before calling dlsym.
================
Comment at: lib/sanitizer_common/tests/sanitizer_symbolizer_test.cc:59
@@ +58,3 @@
+TEST(Symbolizer, DemangleCXXAndSwift) {
+ // The Swift name will only be demangled if the Swift runtime is linked in.
+ EXPECT_STREQ("_TtSd", DemangleCXXAndSwift("_TtSd"));
----------------
kcc wrote:
> So, is a swift-specific test possible?
The dlsym will fail since compiler-rt does not depend on Swift runtime that provides the demangler. The test below is a Swift name, but we are only checking that we don't crash or turn it into something else here.
We should be able to add a test to the Swift repo, which is next on my list. (That is blocked on making sure the Swift buildbots checkout compiler-rt.)
http://reviews.llvm.org/D19135
More information about the llvm-commits
mailing list