Skip to content

Commit 50d9bb6

Browse files
committed
[NFC] Add DebugVariable constructor that takes DbgVariableIntrinsic pointer
Note: The constructor definition cannot be inline without some refactoring as it introduces a circular dependency between the headers llvm/IR/DebugInfoMetadata.h (this file) and llvm/IR/IntrinsicInst.h (where DbgVariableIntrinsic is defined). Reviewed By: jryans Differential Revision: https://reviews.llvm.org/D133286
1 parent f825214 commit 50d9bb6

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

llvm/include/llvm/IR/DebugInfoMetadata.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ namespace dwarf {
6464
enum Tag : uint16_t;
6565
}
6666

67+
class DbgVariableIntrinsic;
68+
6769
extern cl::opt<bool> EnableFSDiscriminator;
6870

6971
class DITypeRefArray {
@@ -3629,6 +3631,8 @@ class DebugVariable {
36293631
static const FragmentInfo DefaultFragment;
36303632

36313633
public:
3634+
DebugVariable(const DbgVariableIntrinsic *DII);
3635+
36323636
DebugVariable(const DILocalVariable *Var, Optional<FragmentInfo> FragmentInfo,
36333637
const DILocation *InlinedAt)
36343638
: Variable(Var), Fragment(FragmentInfo), InlinedAt(InlinedAt) {}

llvm/lib/IR/DebugInfoMetadata.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "llvm/ADT/StringSwitch.h"
1818
#include "llvm/BinaryFormat/Dwarf.h"
1919
#include "llvm/IR/Function.h"
20+
#include "llvm/IR/IntrinsicInst.h"
2021
#include "llvm/IR/Type.h"
2122
#include "llvm/IR/Value.h"
2223

@@ -34,6 +35,11 @@ cl::opt<bool> EnableFSDiscriminator(
3435
const DIExpression::FragmentInfo DebugVariable::DefaultFragment = {
3536
std::numeric_limits<uint64_t>::max(), std::numeric_limits<uint64_t>::min()};
3637

38+
DebugVariable::DebugVariable(const DbgVariableIntrinsic *DII)
39+
: Variable(DII->getVariable()),
40+
Fragment(DII->getExpression()->getFragmentInfo()),
41+
InlinedAt(DII->getDebugLoc().getInlinedAt()) {}
42+
3743
DILocation::DILocation(LLVMContext &C, StorageType Storage, unsigned Line,
3844
unsigned Column, ArrayRef<Metadata *> MDs,
3945
bool ImplicitCode)

0 commit comments

Comments
 (0)