[llvm] 50d9bb6 - [NFC] Add DebugVariable constructor that takes DbgVariableIntrinsic pointer

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 20 07:29:22 PDT 2022


Author: OCHyams
Date: 2022-10-20T15:28:00+01:00
New Revision: 50d9bb6b39c56f394eba63f4b8473a7e5a021e85

URL: https://github.com/llvm/llvm-project/commit/50d9bb6b39c56f394eba63f4b8473a7e5a021e85
DIFF: https://github.com/llvm/llvm-project/commit/50d9bb6b39c56f394eba63f4b8473a7e5a021e85.diff

LOG: [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

Added: 
    

Modified: 
    llvm/include/llvm/IR/DebugInfoMetadata.h
    llvm/lib/IR/DebugInfoMetadata.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index db1d031a062d8..8fc3f54bf2813 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -64,6 +64,8 @@ namespace dwarf {
 enum Tag : uint16_t;
 }
 
+class DbgVariableIntrinsic;
+
 extern cl::opt<bool> EnableFSDiscriminator;
 
 class DITypeRefArray {
@@ -3629,6 +3631,8 @@ class DebugVariable {
   static const FragmentInfo DefaultFragment;
 
 public:
+  DebugVariable(const DbgVariableIntrinsic *DII);
+
   DebugVariable(const DILocalVariable *Var, Optional<FragmentInfo> FragmentInfo,
                 const DILocation *InlinedAt)
       : Variable(Var), Fragment(FragmentInfo), InlinedAt(InlinedAt) {}

diff  --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index e8d8eafeb2d58..b29daeb653f0b 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -17,6 +17,7 @@
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/BinaryFormat/Dwarf.h"
 #include "llvm/IR/Function.h"
+#include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Type.h"
 #include "llvm/IR/Value.h"
 
@@ -34,6 +35,11 @@ cl::opt<bool> EnableFSDiscriminator(
 const DIExpression::FragmentInfo DebugVariable::DefaultFragment = {
     std::numeric_limits<uint64_t>::max(), std::numeric_limits<uint64_t>::min()};
 
+DebugVariable::DebugVariable(const 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)


        


More information about the llvm-commits mailing list