[llvm] Split DWARFFormValue::getReference into four functions (PR #98905)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 15 06:59:42 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 8fcb822da632ab4330b47641826ace01af0768e0 511e82f9a9369f5991c9663a3efcb1b8a4cc9096 --extensions h,cpp -- llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp llvm/lib/DebugInfo/DWARF/DWARFDie.cpp llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
index fb5712b855..563887d114 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
@@ -260,7 +260,7 @@ toRelativeReference(const std::optional<DWARFFormValue> &V) {
/// \returns the extracted reference value or Default if the V doesn't have a
/// value or the form value's encoding wasn't a relative offset reference form.
inline uint64_t toRelativeReference(const std::optional<DWARFFormValue> &V,
- uint64_t Default) {
+ uint64_t Default) {
return toRelativeReference(V).value_or(Default);
}
@@ -286,7 +286,7 @@ toDebugInfoReference(const std::optional<DWARFFormValue> &V) {
/// value or the form value's encoding wasn't an absolute debug info offset
/// reference form.
inline uint64_t toDebugInfoReference(const std::optional<DWARFFormValue> &V,
- uint64_t Default) {
+ uint64_t Default) {
return toDebugInfoReference(V).value_or(Default);
}
@@ -309,7 +309,7 @@ toSignatureReference(const std::optional<DWARFFormValue> &V) {
/// \returns the extracted reference value or Default if the V doesn't have a
/// value or the form value's encoding wasn't a signature reference form.
inline uint64_t toSignatureReference(const std::optional<DWARFFormValue> &V,
- uint64_t Default) {
+ uint64_t Default) {
return toSignatureReference(V).value_or(Default);
}
@@ -334,7 +334,7 @@ toSupplementaryReference(const std::optional<DWARFFormValue> &V) {
/// \returns the extracted reference value or Default if the V doesn't have a
/// value or the form value's encoding wasn't a supplementary reference form.
inline uint64_t toSupplementaryReference(const std::optional<DWARFFormValue> &V,
- uint64_t Default) {
+ uint64_t Default) {
return toSupplementaryReference(V).value_or(Default);
}
diff --git a/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp b/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp
index 26bce1fd7b..7510326f2e 100644
--- a/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp
@@ -1082,7 +1082,7 @@ unsigned DWARFLinker::DIECloner::cloneDieReferenceAttribute(
CompileUnit &Unit) {
const DWARFUnit &U = Unit.getOrigUnit();
uint64_t Ref;
- if (std::optional<uint64_t> Off = Val.getAsRelativeReference())
+ if (std::optional<uint64_t> Off = Val.getAsRelativeReference())
Ref = Val.getUnit()->getOffset() + *Off;
else if (Off = Val.getAsDebugInfoReference(); Off)
Ref = *Off;
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
index e4d2d0c7e0..bc4badc771 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
@@ -686,7 +686,6 @@ std::optional<uint64_t> DWARFFormValue::getAsDebugInfoReference() const {
return std::nullopt;
}
-
std::optional<uint64_t> DWARFFormValue::getAsSignatureReference() const {
if (Form == DW_FORM_ref_sig8)
return Value.uval;
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
index 32ab022380..373a58d259 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -384,15 +384,18 @@ void TestAllForms() {
//----------------------------------------------------------------------
// Test reference forms
//----------------------------------------------------------------------
- EXPECT_EQ(RefAddr, toDebugInfoReference(DieDG.find(Attr_DW_FORM_ref_addr), 0));
+ EXPECT_EQ(RefAddr,
+ toDebugInfoReference(DieDG.find(Attr_DW_FORM_ref_addr), 0));
EXPECT_EQ(Data1, toRelativeReference(DieDG.find(Attr_DW_FORM_ref1), 0));
EXPECT_EQ(Data2, toRelativeReference(DieDG.find(Attr_DW_FORM_ref2), 0));
EXPECT_EQ(Data4, toRelativeReference(DieDG.find(Attr_DW_FORM_ref4), 0));
EXPECT_EQ(Data8, toRelativeReference(DieDG.find(Attr_DW_FORM_ref8), 0));
if (Version >= 4) {
- EXPECT_EQ(Data8_2, toSignatureReference(DieDG.find(Attr_DW_FORM_ref_sig8), 0));
+ EXPECT_EQ(Data8_2,
+ toSignatureReference(DieDG.find(Attr_DW_FORM_ref_sig8), 0));
}
- EXPECT_EQ(UData[0], toRelativeReference(DieDG.find(Attr_DW_FORM_ref_udata), 0));
+ EXPECT_EQ(UData[0],
+ toRelativeReference(DieDG.find(Attr_DW_FORM_ref_udata), 0));
//----------------------------------------------------------------------
// Test flag forms
``````````
</details>
https://github.com/llvm/llvm-project/pull/98905
More information about the llvm-commits
mailing list