r272587 (http://reviews.llvm.org/D20490) fixed an issue where typo correction 
could cause a crash when compiling C programs.    The problem was that a typo 
expression could be inadvertently processed twice.    r272587 fixed this for 
BinOp expressions.   Conditional expressions can hit the same problem too.  
This change adds the two line fix for them, as well as a small test case 
illustrating the crash.   This is my first time proposing a patch for clang.  I 
don't have commit privileges, so if someone could review/commit this for me, 
I'd appreciate it.   If Phrabicator is the preferred way or there's another 
preferred process for submitting patches, let me know.

I see from the prior review that the consensus was that "typo correction is in 
a messy state, we should fix this".     I agree.  There are other problematic 
places in the code where double-processing might or might not occur for C code. 
 An example is the processing of subscript expressions in 
Parser::ParsePostfixExpressionSuffix.  Without clear invariants, it is hard to 
know what to do.

Testing: clang fails on the test case without this change, passes with it.   
The clang test suite results were otherwise the same before and after this 
change.

Thanks,
David

Attachment: c-typo-crash.patch
Description: c-typo-crash.patch

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

Reply via email to