[flang-commits] [flang] [flang][OpenMP] Silence unused-but-set-variable message (NFC) (PR #130979)
Kelvin Li via flang-commits
flang-commits at lists.llvm.org
Wed Mar 12 08:32:26 PDT 2025
https://github.com/kkwli created https://github.com/llvm/llvm-project/pull/130979
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.
```
>From 9a83874a8da48d09e73c35672a8643fa29a99bba Mon Sep 17 00:00:00 2001
From: Kelvin Li <kli at ca.ibm.com>
Date: Wed, 12 Mar 2025 11:26:02 -0400
Subject: [PATCH] [flang][OpenMP] Silence unused-but-set-variable message (NFC)
---
flang/lib/Lower/OpenMP/Clauses.cpp | 1 +
1 file changed, 1 insertion(+)
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 {
More information about the flang-commits
mailing list