rjmccall added inline comments.

================
Comment at: clang/lib/AST/ExprConstant.cpp:2427
+    FPOptions FPFeatures = Cast->getFPFeaturesInEffect(Info.Ctx.getLangOpts());
+    RM = FPFeatures.getRoundingMode();
+  }
----------------
I think the options really need to be passed in or else correctness is somewhat 
doomed here.

For example, the call to CompoundAssignSubobjectHandler needs to propagate this 
down from the operator expression.


================
Comment at: clang/lib/AST/ExprConstant.cpp:2678
+    // operation. If the result is exact, it does not depend on rounding mode.
+    RM = llvm::RoundingMode::NearestTiesToEven;
+  APFloat::opStatus St;
----------------
Feels like you should have a helper function like `getActiveRoundingMode(Info, 
FPFeatures)`


================
Comment at: clang/lib/AST/ExprConstant.cpp:2712
+  //   initializer,
+  // the evaluation probably need to be rejected.
+
----------------
Is this processing something you can extract meaningfully into a common 
function that works with an opStatus, so that you can just write `if 
(!checkFloatingPointFailure(Info, E, status, fpFeatures)) return false;` in all 
these places?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87822

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

Reply via email to