[PATCH] D128009: [flang] Add semantics test for image_status and add a check
Peter Klausler via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 6 12:14:43 PDT 2022
klausler added inline comments.
================
Comment at: flang/lib/Evaluate/intrinsics.cpp:2353
+ std::visit(common::visitors{
+ [&](const Constant<Type<TypeCategory::Integer, 1>>
+ &array) {
----------------
klausler wrote:
> Please don't copy-and-paste code for each currently supported kind of integer. Use an abstraction that covers all of them.
```
common::visit([&](const auto &kindExpr) {
using IntType = std::decay_t<decltype(kindExpr)>::Result;
if (const auto *constArray{UnwrapConstantValue<IntType>(kindExpr)}) {
ok = CheckArrayForNonPositive(constArray, context, arg, procName, argName);
}
}, intExpr->u);
```
UnwrapConstantValue() will also work through parentheses.
(just a suggestion; not tested)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128009/new/
https://reviews.llvm.org/D128009
More information about the llvm-commits
mailing list