[PATCH] D91980: [OpenMP] Add initial support for `omp [begin/end] assumes`

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 23 10:31:15 PST 2020


ABataev added inline comments.


================
Comment at: clang/include/clang/Sema/Sema.h:10333
+  /// Check if there is an active global `omp begin assumes` directive.
+  bool isInOpenMPAssumeScope() { return !OMPAssumeScoped.empty(); }
+
----------------
ABataev wrote:
> `const` member functions.
It may have side-effects with template instantiations. What if we have something like this:
```
#pragma omp begin assumes ...
template <typename T>
struct S {
...
}
#pragma omp end assumes

void bar() {
#pragma omp assumes ...
  {
    S<int> s;
    s.foo();
  }
}
```
?

`struct S<int>` will be instantiated in the second assume region context though I doubt this is the user intention.


================
Comment at: clang/include/clang/Sema/Sema.h:10333-10336
+  bool isInOpenMPAssumeScope() { return !OMPAssumeScoped.empty(); }
+
+  /// Check if there is an active global `omp assumes` directive.
+  bool hasGlobalOpenMPAssumes() { return !OMPAssumeGlobal.empty(); }
----------------
`const` member functions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91980/new/

https://reviews.llvm.org/D91980



More information about the cfe-commits mailing list