[llvm] a17b71d - [NFC] Add DebugVariableAggregate class
via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 22 07:19:39 PDT 2023
Author: OCHyams
Date: 2023-03-22T14:18:41Z
New Revision: a17b71d17f853350dcd6c72ab141b196d7caec2a
URL: https://github.com/llvm/llvm-project/commit/a17b71d17f853350dcd6c72ab141b196d7caec2a
DIFF: https://github.com/llvm/llvm-project/commit/a17b71d17f853350dcd6c72ab141b196d7caec2a.diff
LOG: [NFC] Add DebugVariableAggregate class
A DebugVariableAggregate is a DebugVariable that discards FragmentInfo; it
represents a whole variable instance.
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/D146298
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 fb0a194e0c34..258eda717e19 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -3817,6 +3817,18 @@ template <> struct DenseMapInfo<DebugVariable> {
}
};
+/// Identifies a unique instance of a whole variable (discards/ignores fragment
+/// information).
+class DebugVariableAggregate : public DebugVariable {
+public:
+ DebugVariableAggregate(const DbgVariableIntrinsic *DVI);
+ DebugVariableAggregate(const DebugVariable &V)
+ : DebugVariable(V.getVariable(), std::nullopt, V.getInlinedAt()) {}
+};
+
+template <>
+struct DenseMapInfo<DebugVariableAggregate>
+ : public DenseMapInfo<DebugVariable> {};
} // end namespace llvm
#undef DEFINE_MDNODE_GET_UNPACK_IMPL
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index 479a51e1e004..a5da64e59e1d 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -42,6 +42,10 @@ DebugVariable::DebugVariable(const DbgVariableIntrinsic *DII)
Fragment(DII->getExpression()->getFragmentInfo()),
InlinedAt(DII->getDebugLoc().getInlinedAt()) {}
+DebugVariableAggregate::DebugVariableAggregate(const DbgVariableIntrinsic *DVI)
+ : DebugVariable(DVI->getVariable(), std::nullopt,
+ DVI->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