[PATCH] D116637: [Clang][Sema][OpenMP] Sema support for `atomic compare`

Shilei Tian via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 4 08:10:41 PST 2022


tianshilei1992 marked an inline comment as done.
tianshilei1992 added inline comments.


================
Comment at: clang/test/OpenMP/atomic_ast_print.cpp:40
+#ifdef OMP51
+// omp51-error at +1 2 {{atomic compare is not supported for now}}
+#pragma omp atomic compare
----------------
ABataev wrote:
> tianshilei1992 wrote:
> > ABataev wrote:
> > > Try to add `-fsyntax-only` in RUN to avoid error message in the test
> > Adding `-fsyntax-only` will not print the AST, just the error message.
> > ```
> > ➜  clang -cc1 -x c++ -fopenmp -fopenmp-version=51 -ast-print atomic.cpp
> > atomic.cpp:12:20: error: atomic compare is not supported for now
> > #pragma omp atomic compare
> >                    ^
> > class C {
> >     int x;
> > public:
> >     int &val() {
> >         return this->x;
> >     }
> > };
> > void compare() {
> >     C x;
> >     C e;
> >     C d;
> >     #pragma omp atomic compare
> >         if (x.val() == e.val())
> >             x.val() = d.val();
> > }
> > 1 error generated.
> > ➜  clang -cc1 -x c++ -fopenmp -fopenmp-version=51 -ast-print -fsyntax-only atomic.cpp
> > atomic.cpp:12:20: error: atomic compare is not supported for now
> > #pragma omp atomic compare
> >                    ^
> > 1 error generated.
> > ```
> Ah, yes. Can you move the error message to codegen from Sema to avoid all these problems?
Do we support error message in code gen? I didn't see similar code in `clang/lib/CodeGen/CGStmtOpenMP.cpp`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116637



More information about the cfe-commits mailing list