[llvm] [BOLT] Fix unused variable warning (PR #93253)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 16:29:16 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: Sayhaan Siddiqui (sayhaan)

<details>
<summary>Changes</summary>

This fixes

```
/data/sandcastle/boxes/trunk-grepo-llvm-c2-grepo/llvm-project/bolt/lib/Rewrite/DWARFRewriter.cpp:76:45: warning: variable 'AbbrDecl' set but not used [-Wunused-but-set-variable]

   76 |     if (const DWARFAbbreviationDeclaration *AbbrDecl =
```

---
Full diff: https://github.com/llvm/llvm-project/pull/93253.diff


1 Files Affected:

- (modified) bolt/lib/Rewrite/DWARFRewriter.cpp (+2-2) 


``````````diff
diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp
index d582ce7b33a27..d2a7cbdbb1a2b 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -73,8 +73,8 @@ static void printDie(DWARFUnit &DU, uint64_t DIEOffset) {
   DWARFDataExtractor DebugInfoData = DU.getDebugInfoExtractor();
   DWARFDebugInfoEntry DIEEntry;
   if (DIEEntry.extractFast(DU, &DIEOffset, DebugInfoData, NextCUOffset, 0)) {
-    if (const DWARFAbbreviationDeclaration *AbbrDecl =
-            DIEEntry.getAbbreviationDeclarationPtr()) {
+    const DWARFAbbreviationDeclaration *AbbrDecl;
+    if (AbbrDecl = DIEEntry.getAbbreviationDeclarationPtr()) {
       DWARFDie DDie(&DU, &DIEEntry);
       printDie(DDie);
     } else {

``````````

</details>


https://github.com/llvm/llvm-project/pull/93253


More information about the llvm-commits mailing list