aaron.ballman added a comment.

This looks reasonable to me, but you should wait for @rsmith to sign off before 
committing.



================
Comment at: lib/Sema/SemaStmt.cpp:669
   if (Cond.isInvalid())
-    return StmtError();
+    Cond = ConditionResult(
+        *this, nullptr,
----------------
ogoffart wrote:
> aaron.ballman wrote:
> > This makes the condition result valid when it isn't. Users of this 
> > condition result may expect a valid condition result to return nonnull 
> > values when calling `get()`, which makes me uncomfortable.
> Get return a non-null value.
> That's why i'm constructing an OpaqueValueExpr placeholder expression.
> 
> The ConditionVar (nullptr in the line bellow) can be null. It is null in 
> valid code most of the time actually, when one does not declare a new 
> variable in in condition.
> 
> But the result is that users of this condition will get a OpaqueValueExpr 
> when calling get and should not be disturbed by that as they will just take 
> that as an expression.
> 
Ah, sorry, I misread the code in my haste.


https://reviews.llvm.org/D26350



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

Reply via email to