ABataev added inline comments.

================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:11663
   X = BO->getLHS();
-  D = BO->getRHS();
+  D = BO->getRHS()->IgnoreImpCasts();
 
----------------
tianshilei1992 wrote:
> tianshilei1992 wrote:
> > ABataev wrote:
> > > Why do we need to use `IgnoreImpCasts()` here and in other places?
> > Clang usually inserts implicit casts. For example, if we have:
> > ```
> > char a, b, c;
> > #pragma omp atomic compare capture
> >   { r = a; if (a > c) { a = b; } }
> > ```
> > Clang inserts an implicit cast from `char` to `int` for all statements 
> > except `r = a`. In this case, what should be the right solution? I'm not 
> > quite sure actually.
> https://godbolt.org/z/a6WWdx581
> This shows how the AST looks like.
I don't see casts to int in `a=b` (BO points to this expression,right?). The 
only cast, that maybe should be removed here, is LValueToRValue


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120290

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to