================
@@ -1578,4 +1578,37 @@ llvm::Expected<lldb::ValueObjectSP>
Interpreter::Visit(const CastNode &node) {
node.GetLocation());
}
+llvm::Expected<lldb::ValueObjectSP>
+Interpreter::Visit(const ConditionalNode &node) {
+ auto cond_or_err = EvaluateAndDereference(node.GetCondition());
+ if (!cond_or_err)
+ return cond_or_err;
+ lldb::ValueObjectSP condition = *cond_or_err;
+
+ CompilerType cond_type = condition->GetCompilerType();
+ if (!cond_type.IsContextuallyConvertibleToBool()) {
+ std::string errMsg = llvm::formatv(
+ "value of type {0} is not contextually convertible to 'bool'",
+ cond_type.TypeDescription());
+ return llvm::make_error<DILDiagnosticError>(m_expr, errMsg,
+ node.GetLocation());
+ }
+ // Note: Unlike C++, DIL evaluates only the operand chosen by the condition,
----------------
hawkinsw wrote:
> > Thank you @kuilpd for the work that you are doing on DIL. I have been
> > attempting to find the time to contribute for several months, but have not
> > been able to get things at `$DAYJOB` under control. I hope that my minor
> > amount of feedback on this PR makes your life a little easier. Thank you,
> > again, for your great work on DIL!
>
> No problem :) We already have plans and WIP implementation of further DIL
> features, so code review on PRs would be welcome.
Thank you for your courteous response! I was worried you might be offended by
my minor suggestion on top of all your excellent work. I hope that future
reviews will be helpful, too! Thank you, again, for all your work! DIL is
looking excellent thanks to your efforts (and others, too, of course!)
https://github.com/llvm/llvm-project/pull/211344
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits