[PATCH] Keep the IfStmt node even if the condition is invalid

Olivier Goffart via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 29 15:17:09 PDT 2015


Hi, 

Please review the attached patch. It does not discard the full 'if' statement 
if the condition is invalid.

This is quite useful for IDE's or other tools which would like to recover as 
much as possible even if there are a few errors in the code, and discarding 
the full 'if' bodies is unfortunate.

Thanks.
-- 
Olivier


P.S: For the same reason, i'm also trying to fix the fact that if there is any 
typo in an expression statement, the full statement is discarded. The reason 
is i believe that Sema::CorrectDelayedTyposInExpr just return null if any typo 
could not be corrected. That's unrelated to this patch, but i still would 
welcome hint on how to fix it.  Should CorrectDelayedTyposInExpr somehow 
replace the TypoExpr instead of removing them? Or should it create a new node 
(some kind of error ErrorExpr)? Or should the caller of 
CorrectDelayedTyposInExpr be changed to keep the original?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Keep-the-IfStmt-node-even-if-the-condition-is-invali.patch
Type: text/x-patch
Size: 3323 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150930/0f64b446/attachment.bin>


More information about the cfe-commits mailing list