]> granicus.if.org Git - clang/commit
[ASan] Use metadata to pass source-level information from Clang to ASan.
authorAlexey Samsonov <vonosmas@gmail.com>
Sat, 2 Aug 2014 00:35:50 +0000 (00:35 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Sat, 2 Aug 2014 00:35:50 +0000 (00:35 +0000)
commit04ec81cb8bf9fe920c8e3f3d81d800619bc2c816
tree4bd3aa73eb4bc49cd381f46a804fcfbcf58b1e52
parenta95ae2c1b9a9c1a81ead106b2d757a250e0d4ce9
[ASan] Use metadata to pass source-level information from Clang to ASan.

Instead of creating global variables for source locations and global names,
just create metadata nodes and strings. They will be transformed into actual
globals in the instrumentation pass (if necessary). This approach is more
flexible:
1) we don't have to ensure that our custom globals survive all the optimizations
2) if globals are discarded for some reason, we will simply ignore metadata for them
   and won't have to erase corresponding globals
3) metadata for source locations can be reused for other purposes: e.g. we may
   attach source location metadata to alloca instructions and provide better descriptions
   for stack variables in ASan error reports.

No functionality change.

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