only correct delayed typos for conditional expressions when needed.

David Tarditi via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 27 17:36:36 PDT 2016


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160728/3e31c0a8/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: c-typo-crash.patch
Type: application/octet-stream
Size: 1548 bytes
Desc: c-typo-crash.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160728/3e31c0a8/attachment-0001.obj>


More information about the cfe-commits mailing list