rsmith added a comment.

Maybe take this very slightly further so it becomes testable: change the 
expression evaluator (lib/AST/ExprConstant.cpp) so it treats floating-point 
operations as non-constant if they're potentially-overflowing.

You also need to update lib/Serialization/AST{Reader,Writer}Stmt.cpp to 
round-trip this information through AST files.

How do you intend for this to work in template instantiation? Do we record the 
pragmas in the AST (and likewise for the state on entry to each function) so 
that we can rebuild the `FPOptions` during instantiation, or should we be 
inheriting the `FPOptions` from the expression in the template onto the 
expression in the instantiation? In the latter case, it would make more sense 
to me to track `FPOptions` on the `Scope` rather than as a `Sema` member, so 
that the state is more-obviously unavailable during template instantiation.



================
Comment at: include/clang/AST/Expr.h:1794-1796
+  // This is only meaningful for operations on floating point types and 0
+  // otherwise.
+  unsigned FPFeatures : 3;
----------------
Move this adjacent to the other bitfields so we don't spend 32 / 64 bits on it.


Repository:
  rC Clang

https://reviews.llvm.org/D52839



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

Reply via email to