diff options
author | Adrian Prantl <aprantl@apple.com> | 2016-09-20 18:28:42 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2016-09-20 18:28:42 +0000 |
commit | 12fa3b391100edc02ca49444a8d7cd13805c8815 (patch) | |
tree | 0100c538312c6444d0fc06a2eba186dee9998661 /llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | |
parent | 9800539f19a05d7f2093d8fe40605151a87d0d15 (diff) | |
download | bcm5719-llvm-12fa3b391100edc02ca49444a8d7cd13805c8815.tar.gz bcm5719-llvm-12fa3b391100edc02ca49444a8d7cd13805c8815.zip |
ASAN: Don't drop debug info attachements for global variables.
This is a follow-up to r281284. Global Variables now can have
!dbg attachements, so ASAN should clone these when generating a
sanitized copy of a global variable.
<rdar://problem/24899262>
llvm-svn: 281994
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index b601d391f24..c5bcb39992f 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -1534,6 +1534,13 @@ bool AddressSanitizerModule::InstrumentGlobals(IRBuilder<> &IRB, Module &M) { NewGlobal->copyAttributesFrom(G); NewGlobal->setAlignment(MinRZ); + // Transfer the debug info. The payload starts at offset zero so we can + // copy the debug info over as is. + SmallVector<DIGlobalVariable *, 1> GVs; + G->getDebugInfo(GVs); + for (auto *GV : GVs) + NewGlobal->addDebugInfo(GV); + Value *Indices2[2]; Indices2[0] = IRB.getInt32(0); Indices2[1] = IRB.getInt32(0); |