tianshilei1992 added inline comments.

================
Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:6041
+  llvm::Value *EVal = CGF.EmitScalarExpr(E->IgnoreImpCasts());
+  llvm::Value *DVal = D ? CGF.EmitScalarExpr(D->IgnoreImpCasts()) : nullptr;
+
----------------
Using `D->IgnoreImpCasts()` can make sure to avoid the case that `char` is 
casted to `int` in binary operation. However, say, if user writes the following 
code:
```
int x;
#pragma omp atomic compare
  x = x > 1.01 ? 1.01 : x;
```
`1.01` here will be casted to `1` by clang, and a warning will be emitted. 
Because we ignore the implicit cast, in Sema, it is taken as floating point 
value. However, we already told user that it is casted to `1`, which is a 
little weird to emit an error then.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118632

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

Reply via email to