Index: llvm/include/llvm/IR/DebugInfoMetadata.h =================================================================== --- llvm/include/llvm/IR/DebugInfoMetadata.h +++ llvm/include/llvm/IR/DebugInfoMetadata.h @@ -61,6 +61,8 @@ namespace llvm { +class DbgVariableIntrinsic; + extern cl::opt EnableFSDiscriminator; class DITypeRefArray { @@ -3722,6 +3724,8 @@ static const FragmentInfo DefaultFragment; public: + DebugVariable(DbgVariableIntrinsic *DII); + DebugVariable(const DILocalVariable *Var, Optional FragmentInfo, const DILocation *InlinedAt) : Variable(Var), Fragment(FragmentInfo), InlinedAt(InlinedAt) {} Index: llvm/lib/IR/DebugInfoMetadata.cpp =================================================================== --- llvm/lib/IR/DebugInfoMetadata.cpp +++ llvm/lib/IR/DebugInfoMetadata.cpp @@ -16,6 +16,7 @@ #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/IR/Function.h" +#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Type.h" #include "llvm/IR/Value.h" @@ -33,6 +34,11 @@ const DIExpression::FragmentInfo DebugVariable::DefaultFragment = { std::numeric_limits::max(), std::numeric_limits::min()}; +DebugVariable::DebugVariable(DbgVariableIntrinsic *DII) + : Variable(DII->getVariable()), + Fragment(DII->getExpression()->getFragmentInfo()), + InlinedAt(DII->getDebugLoc().getInlinedAt()) {} + DILocation::DILocation(LLVMContext &C, StorageType Storage, unsigned Line, unsigned Column, ArrayRef MDs, bool ImplicitCode)