summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DIBuilder.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2017-08-30 18:06:51 +0000
committerAdrian Prantl <aprantl@apple.com>2017-08-30 18:06:51 +0000
commit05782218abd549e0c1bc77032fa9b55526371cfd (patch)
tree1cd1e0e5ace565ad80e6e9053bb7d858a38362b5 /llvm/lib/IR/DIBuilder.cpp
parent1a4cbbe49fcaebe63246c784983556528bcb27d8 (diff)
downloadbcm5719-llvm-05782218abd549e0c1bc77032fa9b55526371cfd.tar.gz
bcm5719-llvm-05782218abd549e0c1bc77032fa9b55526371cfd.zip
Canonicalize the representation of empty an expression in DIGlobalVariableExpression
This change simplifies code that has to deal with DIGlobalVariableExpression and mirrors how we treat DIExpressions in debug info intrinsics. Before this change there were two ways of representing empty expressions on globals, a nullptr and an empty !DIExpression(). If someone needs to upgrade out-of-tree testcases: perl -pi -e 's/(!DIGlobalVariableExpression\(var: ![0-9]*)\)/\1, expr: !DIExpression())/g' <MYTEST.ll> will catch 95%. llvm-svn: 312144
Diffstat (limited to 'llvm/lib/IR/DIBuilder.cpp')
-rw-r--r--llvm/lib/IR/DIBuilder.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 5d4181a2c51..1bd9d557b8f 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -595,6 +595,8 @@ DIGlobalVariableExpression *DIBuilder::createGlobalVariableExpression(
VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
LineNumber, Ty, isLocalToUnit, true, cast_or_null<DIDerivedType>(Decl),
AlignInBits);
+ if (!Expr)
+ Expr = createExpression();
auto *N = DIGlobalVariableExpression::get(VMContext, GV, Expr);
AllGVs.push_back(N);
return N;
OpenPOWER on IntegriCloud