[PATCH] D53308: [Fixed Point Arithmetic] Fixed Point to Boolean Cast

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 18 11:48:53 PDT 2018


rjmccall added inline comments.


================
Comment at: clang/lib/AST/ExprConstant.cpp:9599
+      return false;
+    return Success(Val.getInt().getBoolValue(), E);
+  }
----------------
I know you haven't really done constant-evaluation yet, but I think you should at least be setting up operations like this correctly:

1. There should be an `EvaluateFixedPoint` function that evaluates an expression as a fixed-point value, just like `EvaluateFloat` and the others, which can be structured to use `FixedPointExprEvaluator`.
2. There should be a `getBoolValue` method on `APFixedPoint`.


================
Comment at: clang/lib/CodeGen/CGExprScalar.cpp:2026
+    return EmitScalarConversion(Visit(E), E->getType(), DestTy,
+                                CE->getExprLoc());
 
----------------
Why are you pushing these casts through `EmitScalarConversion` when the cast kind already tells you which operation you're doing?


Repository:
  rC Clang

https://reviews.llvm.org/D53308





More information about the cfe-commits mailing list