diff options
Diffstat (limited to 'llvm/lib/Analysis/DebugInfo.cpp')
| -rw-r--r-- | llvm/lib/Analysis/DebugInfo.cpp | 17 | 
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp index 337dc3f..2bf87da5 100644 --- a/llvm/lib/Analysis/DebugInfo.cpp +++ b/llvm/lib/Analysis/DebugInfo.cpp @@ -923,7 +923,14 @@ DICompositeType DIFactory::CreateCompositeType(unsigned Tag,      ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang),      ContainingType    }; -  return DICompositeType(MDNode::get(VMContext, &Elts[0], 13)); + +  MDNode *Node = MDNode::get(VMContext, &Elts[0], 13); +  // Create a named metadata so that we do not lose this enum info. +  if (Tag == dwarf::DW_TAG_enumeration_type) { +    NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.enum"); +    NMD->addOperand(Node); +  } +  return DICompositeType(Node);  } @@ -955,7 +962,13 @@ DICompositeType DIFactory::CreateCompositeTypeEx(unsigned Tag,      Elements,      ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang)    }; -  return DICompositeType(MDNode::get(VMContext, &Elts[0], 12)); +  MDNode *Node = MDNode::get(VMContext, &Elts[0], 12); +  // Create a named metadata so that we do not lose this enum info. +  if (Tag == dwarf::DW_TAG_enumeration_type) { +    NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.enum"); +    NMD->addOperand(Node); +  } +  return DICompositeType(Node);  }  | 
