aaron.ballman added a reviewer: clang-language-wg.
aaron.ballman added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:11422
   llvm::APSInt Left = LHSResult.Val.getInt();
 
   // If LHS does not have a signed type and non-negative value
----------------
... to early here instead, and it should also check `isSignedOverflowDefined()` 
(note: we should probably fix `SignedOverflowBehavior` in LangOptions.def to be 
set based on the C++ language mode instead of needing to check for C++20 
specifically)


================
Comment at: clang/lib/Sema/SemaExpr.cpp:11425-11426
   // then, the behavior is undefined before C++2a. Warn about it.
   if (Left.isNegative() && !S.getLangOpts().isSignedOverflowDefined() &&
       !S.getLangOpts().CPlusPlus20) {
     S.DiagRuntimeBehavior(Loc, LHS.get(),
----------------
and then we can remove the check for signed overflow defined or C++20 here 
because we've already bailed out.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:11456-11457
 
+  if (S.getLangOpts().CPlusPlus20)
+    return;
+
----------------
I think this should move up...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127518

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

Reply via email to