[PATCH] D59214: [clang][OpeMP] Model OpenMP structured-block in AST (PR40563)
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 16 06:41:42 PDT 2019
lebedev.ri added inline comments.
================
Comment at: lib/AST/StmtOpenMP.cpp:40
+ if (auto *LD = dyn_cast<OMPLoopDirective>(this))
+ return LD->getBody();
+ return getInnermostCapturedStmt()->getCapturedStmt();
----------------
@riccibruno
`getBody()` exists in `const`-only variant
`getInnermostCapturedStmt()` does exist in both the `const` and non-`const` variants,
but the `const` variant does `const_cast` and defers to non-`const` variant.
`getCapturedStmt()` is good though.
So at best i can add
```
Stmt *getStructuredBlock() {
return const_cast<Stmt *>(const_cast<OMPExecutableDirective *>(this)->getStructuredBlock());
}
```
I'm not sure it's worth it?
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59214/new/
https://reviews.llvm.org/D59214
More information about the cfe-commits
mailing list