[PATCH] D88965: [Flang][OpenMP] Rework parser changes for OpenMP atomic construct.
sameeran joshi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 9 06:14:42 PDT 2020
sameeranjoshi marked an inline comment as done.
sameeranjoshi added inline comments.
================
Comment at: flang/lib/Parser/unparse.cpp:2267
Word("!$OMP ATOMIC");
- Walk(std::get<OmpAtomicMemoryOrderClauseList>(x.t));
+ Walk(std::get<0>(x.t));
Word(" UPDATE");
----------------
SouraVX wrote:
> NIT: Can't we use the type name here ? `get<0>` does the job but makes the code less readable.
If you take a look at how `parse-tree.h` represents `AtomicUpdate`
```
// ATOMIC UPDATE
struct OmpAtomicUpdate {
TUPLE_CLASS_BOILERPLATE(OmpAtomicUpdate);
std::tuple<OmpClauseList, Verbatim,
OmpClauseList, Statement<AssignmentStmt>,
std::optional<OmpEndAtomic>>
t;
};
```
When `std::tuple` contains more than 1 repeated types, there is ambiguity for compiler to choose the type.
This makes us use indices to make it explicit.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88965/new/
https://reviews.llvm.org/D88965
More information about the llvm-commits
mailing list