[PATCH] D37322: [Sema] Correct typos in LHS, RHS before building a binop expression.
Volodymyr Sapsai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 30 18:19:18 PDT 2017
vsapsai created this revision.
Specifically, typo correction should be done before dispatching between
different kinds of binary operations like pseudo-object assignment,
overloaded binary operation, etc.
Without this change we hit an assertion
Assertion failed: (!LHSExpr->hasPlaceholderType(BuiltinType::PseudoObject)), function CheckAssignmentOperands
when in Objective-C we reference a property without `self` and there are
2 equally good typo correction candidates: ivar and a class name. In
this case LHS expression in `BuildBinOp` is
and instead of handling Obj-C property assignment as pseudo-object
assignment, we call `CreateBuiltinBinOp` which corrects typo to
ObjCPropertyRefExpr '<pseudo-object type>'
but cannot handle pseudo-objects and asserts about it (indirectly,
There is no crash in Objective-C++ but I've added a test case because in
the fix we execute different paths for C and C++. I've also considered
removing typo correction from `CreateBuiltinBinOp` and it doesn't cause
any test failures. But I decided to keep it because `CreateBuiltinBinOp`
sometimes is called directly, not through `BuildBinOp`.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4811 bytes
Desc: not available
More information about the cfe-commits