diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-06-08 21:14:25 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-06-08 21:14:25 +0000 |
commit | 9f63a451b1b3e36c0c82fcfe78828182bb9a6fa0 (patch) | |
tree | c4a00296a42e178095f01242bb38117060909453 /lib/Sema/SemaCodeComplete.cpp | |
parent | 3772c9abf9651da1f77c83ec937c96e10a353c6a (diff) |
Disallow using ObjC literals in direct comparisons (== and friends).
Objective-C literals conceptually always create new objects, but may be
optimized by the compiler or runtime (constant folding, singletons, etc).
Comparing addresses of these objects is relying on this optimization
behavior, which is really an implementation detail.
In the case of == and !=, offer a fixit to a call to -isEqual:, if the
method is available. This fixit is directly on the error so that it is
automatically applied.
Most of the time, this is really a newbie mistake, hence the fixit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158230 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
0 files changed, 0 insertions, 0 deletions