[ASan] Collect unmangled names of global variables in Clang to print them in error...
authorAlexey Samsonov <vonosmas@gmail.com>
Sat, 12 Jul 2014 00:42:52 +0000 (00:42 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Sat, 12 Jul 2014 00:42:52 +0000 (00:42 +0000)
commita9b243cdf1b4b0adfb6a74e8c96638138634e979
treee50749ebe8d304ba9135f2b0375a0e547a3a8d35
parent689cbf5bffa2b8b4761641766627d83dcaeccdcc
[ASan] Collect unmangled names of global variables in Clang to print them in error reports.

Currently ASan instrumentation pass creates a string with global name
for each instrumented global (to include global names in the error report). Global
name is already mangled at this point, and we may not be able to demangle it
at runtime (e.g. there is no __cxa_demangle on Android).

Instead, create a string with fully qualified global name in Clang, and pass it
to ASan instrumentation pass in llvm.asan.globals metadata. If there is no metadata
for some global, ASan will use the original algorithm.

This fixes https://code.google.com/p/address-sanitizer/issues/detail?id=264.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212872 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGDecl.cpp
lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/CodeGenModule.h
test/CodeGen/asan-globals.cpp