From c5225dfbea3ecd581b9d2b5285334bf45594c1a8 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Sat, 23 Apr 2016 22:29:09 +0000 Subject: DebugInfo: Change DIBuilder to make distinct DIGlobalVariables A long overdue change to make DIGlobalVariable distinct. Much like DISubprogram definitions (changed in r246098), it isn't logical to unique DIGlobalVariable definitions from two different compile units. (Longer-term, we should also find a way to reverse the link between GlobalVariable and DIGlobalVariable, and between DIGlobalVariable and DICompileUnit, so that debug info to do with optimized-out globals disappears. Admittedly it's harder than with Function/DISubprogram, since global variables may be constant-folded and the debug info should still describe that somehow.) llvm-svn: 267301 --- llvm/lib/IR/DIBuilder.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/IR/DIBuilder.cpp') diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index f0baff7..9a61afb 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -560,10 +560,10 @@ DIGlobalVariable *DIBuilder::createGlobalVariable( MDNode *Decl) { checkGlobalVariableScope(Context); - auto *N = - DIGlobalVariable::get(VMContext, cast_or_null(Context), Name, - LinkageName, F, LineNumber, Ty, isLocalToUnit, true, - Val, cast_or_null(Decl)); + auto *N = DIGlobalVariable::getDistinct( + VMContext, cast_or_null(Context), Name, LinkageName, F, + LineNumber, Ty, isLocalToUnit, true, Val, + cast_or_null(Decl)); AllGVs.push_back(N); return N; } -- cgit v1.1