git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104274
91177308-0d34-0410-b5e6-
96231b3b80d8
DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
StringRef Name,
DIFile F, unsigned LineNo,
- DIType Ty, bool OptimizedBuild = false);
+ DIType Ty, bool AlwaysPreserve = false);
/// CreateComplexVariable - Create a new descriptor for the specified
/// variable which has a complex address expression for its address.
StringRef Name,
DIFile F,
unsigned LineNo,
- DIType Ty, bool OptimizedBuild) {
+ DIType Ty, bool AlwaysPreserve) {
Value *Elts[] = {
GetTagConstant(Tag),
Context,
Ty,
};
MDNode *Node = MDNode::get(VMContext, &Elts[0], 6);
- if (OptimizedBuild) {
+ if (AlwaysPreserve) {
+ // The optimizer may remove local variable. If there is an interest
+ // to preserve variable info in such situation then stash it in a
+ // named mdnode.
NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.lv");
NMD->addOperand(Node);
}