================
@@ -91,16 +92,30 @@ class CheckResult {
ProgramStateRef InBoundsState = nullptr;
};
-// Evaluate the comparison Value < Threshold with the help of the custom
+enum class Comparison { LT, LE, EQ };
+
+inline BinaryOperator::Opcode asOpcode(Comparison C) {
+ switch (C) {
+ case Comparison::LT:
+ return BO_LT;
+ case Comparison::LE:
+ return BO_LE;
+ case Comparison::EQ:
+ return BO_EQ;
+ }
+ llvm_unreachable("unhandled Comparison kind");
+}
----------------
NagyDonat wrote:
I really dislike the pattern where an `enum` is wrapped in boilerplate struct,
and also I prefer to avoid implicit conversions unless they are very natural
and significantly simplify lots of code. (I'd say that an implicit conversion
needs at least a dozen uses to be useful.)
https://github.com/llvm/llvm-project/pull/218712
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits