[flang-commits] [flang] [flang][OpenMP] Silence unused-but-set-variable message (NFC) (PR #130979)
via flang-commits
flang-commits at lists.llvm.org
Wed Mar 12 08:32:59 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
Author: Kelvin Li (kkwli)
<details>
<summary>Changes</summary>
This patch is to get around the unused-but-set message.
```
llvm-project/flang/lib/Lower/OpenMP/Clauses.cpp:162:22: error: variable 'symRef' set but not used [-Werror,-Wunused-but-set-variable]
162 | } else if (auto *symRef = base.UnwrapSymbolRef()) {
| ^
1 error generated.
```
---
Full diff: https://github.com/llvm/llvm-project/pull/130979.diff
1 Files Affected:
- (modified) flang/lib/Lower/OpenMP/Clauses.cpp (+1)
``````````diff
diff --git a/flang/lib/Lower/OpenMP/Clauses.cpp b/flang/lib/Lower/OpenMP/Clauses.cpp
index 9fa9abd9e8ceb..86d78e0358677 100644
--- a/flang/lib/Lower/OpenMP/Clauses.cpp
+++ b/flang/lib/Lower/OpenMP/Clauses.cpp
@@ -165,6 +165,7 @@ std::optional<Object> getBaseObject(const Object &object,
// e.g. A(i) is represented as {Symbol(A), Designator(ArrayRef(A, i))}.
// Here we have the Symbol(A), which is what we started with.
assert(&**symRef == object.sym());
+ [[maybe_unused]] auto *unused = symRef;
return std::nullopt;
}
} else {
``````````
</details>
https://github.com/llvm/llvm-project/pull/130979
More information about the flang-commits
mailing list