[asan] add the name of the module to the description of a global variable. This impro...
authorKostya Serebryany <kcc@google.com>
Thu, 15 Dec 2011 22:55:55 +0000 (22:55 +0000)
committerKostya Serebryany <kcc@google.com>
Thu, 15 Dec 2011 22:55:55 +0000 (22:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146698 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Instrumentation/AddressSanitizer.cpp

index e4f197853eff07c2aa7512cd7509dada47032936..4cc57276e6f1cb6354b334a8ee1b313f1f7fef66 100644 (file)
@@ -521,7 +521,11 @@ bool AddressSanitizer::insertGlobalRedzones(Module &M) {
         NewTy, G->getInitializer(),
         Constant::getNullValue(RightRedZoneTy), NULL);
 
-    GlobalVariable *Name = createPrivateGlobalForString(M, G->getName());
+    SmallString<2048> DescriptionOfGlobal = G->getName();
+    DescriptionOfGlobal += " (";
+    DescriptionOfGlobal += M.getModuleIdentifier();
+    DescriptionOfGlobal += ")";
+    GlobalVariable *Name = createPrivateGlobalForString(M, DescriptionOfGlobal);
 
     // Create a new global variable with enough space for a redzone.
     GlobalVariable *NewGlobal = new GlobalVariable(