[flang-commits] [PATCH] D88695: [flang][msvc] Rework a MSVC work-around to avoid clang warning
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Thu Oct 1 12:52:39 PDT 2020
klausler created this revision.
klausler added reviewers: Meinersbur, tskeith.
klausler added a project: Flang.
Herald added a reviewer: jdoerfert.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
klausler requested review of this revision.
A recent MSVC work-around patch is eliciting unused variable
warnings from clang; package the lambda reference arguments
into a struct to avoid the warning.
I don't know whether this new patch still avoids the bugs in MSVC.
(Original work-around patch: https://reviews.llvm.org/D88504)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D88695
Files:
flang/lib/Evaluate/fold-implementation.h
Index: flang/lib/Evaluate/fold-implementation.h
===================================================================
--- flang/lib/Evaluate/fold-implementation.h
+++ flang/lib/Evaluate/fold-implementation.h
@@ -1154,14 +1154,20 @@
if (auto array{ApplyElementwise(context, convert)}) {
return *array;
}
+ struct {
+ FoldingContext &context;
+ Convert<TO, FROMCAT> &convert;
+ } msvcWorkaround{context, convert};
return std::visit(
- [&context, &convert](auto &kindExpr) -> Expr<TO> {
+ [&msvcWorkaround](auto &kindExpr) -> Expr<TO> {
using Operand = ResultType<decltype(kindExpr)>;
// This variable is a workaround for msvc which emits an error when
// using the FROMCAT template parameter below.
TypeCategory constexpr FromCat{FROMCAT};
+ auto &convert{msvcWorkaround.convert};
char buffer[64];
if (auto value{GetScalarConstantValue<Operand>(kindExpr)}) {
+ FoldingContext &context{msvcWorkaround.context};
if constexpr (TO::category == TypeCategory::Integer) {
if constexpr (Operand::category == TypeCategory::Integer) {
auto converted{Scalar<TO>::ConvertSigned(*value)};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88695.295652.patch
Type: text/x-patch
Size: 1213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20201001/cfd09a8c/attachment-0001.bin>
More information about the flang-commits
mailing list