[SemaObjC] Improve ObjCDictionaryLiteral and ObjCArryLiteral diagnostics
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Tue, 19 Jul 2016 20:21:18 +0000 (20:21 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Tue, 19 Jul 2016 20:21:18 +0000 (20:21 +0000)
commit8a8a9f6a9ffd6691a79a08e62935a23866e72631
treee00aa6705e691ce8a8495ed0e1717cd0cb9276ce
parentbf79c11a52cad291f5a803b2eb71d7e14696cd3c
[SemaObjC] Improve ObjCDictionaryLiteral and ObjCArryLiteral diagnostics

Sema actions on ObjCDictionaryLiteral and ObjCArryLiteral are currently
done as a side-effect of Sema upon parent expressions, which incurs of
delayed typo corrections for such literals to be performed by TypoTransforms
upon the ObjCDictionaryLiteral and ObjCArryLiteral themselves instead of
its elements individually.

This is specially bad because it was not designed to act on several
elements; searching through all possible combinations of corrections for
several elements is very expensive. Additionally, when one of the
elements has no correction candidate, we still explore all options and
at the end emit no typo corrections whatsoever.

Do the proper sema actions by acting on each element alone during appropriate
literal parsing time to get proper diagonistics and decent compile time
behavior.

Differential Revision: http://reviews.llvm.org/D22183

rdar://problem/21046678

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@276020 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Parse/ParseObjc.cpp
test/SemaObjC/objc-array-literal.m
test/SemaObjC/objc-dictionary-literal.m