[PATCH] D133286: [NFC] Add `DebugVariable` constructor that takes `DbgVariableIntrinsic *`
Orlando Cazalet-Hyams via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 5 02:46:06 PDT 2022
Orlando created this revision.
Orlando added reviewers: jryans, djtodoro, StephenTozer.
Orlando added a project: debug-info.
Herald added a subscriber: hiraditya.
Herald added a project: All.
Orlando requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Note: The constructor definition cannot be inline without some refactoring
as it introduces a circular dependency between the headers
`llvm/include/llvm/IR/DebugInfoMetadata.h` (this file) and
`llvm/IR/IntrinsicInst.h` (where `DbgVariableIntrinsic` is defined).
---
This is used by the assignment tracking patch stack (starts at D132220 <https://reviews.llvm.org/D132220>). I'm happy to wait for those patches to land before landing this, to avoid having unused code hanging around.
https://reviews.llvm.org/D133286
Files:
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/lib/IR/DebugInfoMetadata.cpp
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<uint64_t>::max(), std::numeric_limits<uint64_t>::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<Metadata *> MDs,
bool ImplicitCode)
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<bool> EnableFSDiscriminator;
class DITypeRefArray {
@@ -3722,6 +3724,8 @@
static const FragmentInfo DefaultFragment;
public:
+ DebugVariable(DbgVariableIntrinsic *DII);
+
DebugVariable(const DILocalVariable *Var, Optional<FragmentInfo> FragmentInfo,
const DILocation *InlinedAt)
: Variable(Var), Fragment(FragmentInfo), InlinedAt(InlinedAt) {}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133286.457912.patch
Type: text/x-patch
Size: 1636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220905/b4d5c197/attachment.bin>
More information about the llvm-commits
mailing list