Commit Graph

11 Commits

Author SHA1 Message Date
Fariborz Jahanian 413e064b45 Fix an objc++ diagnostic initializing objc pointers.
// rdar:// 9139947

llvm-svn: 128013
2011-03-21 19:08:42 +00:00
Douglas Gregor 6dd3a6a181 When we're performing an explicit cast of some sort, don't complain
about deprecated Objective-C pointer conversions. Plus, make sure to
actually set an appropriate AssignmentAction when performing an
implicit conversion from an InitializationSequence. Fixes regressions
in the GCC DejaGNU testsuite.

llvm-svn: 120744
2010-12-02 21:47:04 +00:00
Douglas Gregor 8d6d06761f Improve our handling of cv-qualifiers in Objective-C pointer
conversions. Previously, we would end up collapsing qualification
conversions into the Objective-C pointer conversion step, including
(possibly) stripping qualifiers that shouldn't be removed.

This generalizes BuildSimilarlyQualifiedPointerType() to also work on
Objective-C object pointers, then eliminates the (redundant, not
totally correct) BuildSimilarlyQualifiedObjCObjectPointerType()
function.

Fixes <rdar://problem/8714395>.

llvm-svn: 120607
2010-12-01 21:43:58 +00:00
Chris Lattner 938cebc076 "const id<NSFoo> *" instead of "id<NSFoo> const *".
I think this wraps up all the legal cases.

llvm-svn: 113096
2010-09-05 00:43:21 +00:00
Douglas Gregor fb0c0d37b7 Extend the "cannot convert from base class pointer to derived class
pointer" diagnostic to handle references, too.

llvm-svn: 107372
2010-07-01 02:14:45 +00:00
Douglas Gregor 56f2e34a6a Improve diagnostic when we fail to pick an overload because it would
require a base-to-derived pointer conversion.

llvm-svn: 107349
2010-06-30 23:01:39 +00:00
Douglas Gregor 4f4946aaaa Whenever we complain about a failed initialization of a function or
method parameter, provide a note pointing at the parameter itself so
the user does not have to manually look for the function/method being
called and match up parameters to arguments. For example, we now get:

t.c:4:5: warning: incompatible pointer types passing 'long *' to
parameter of
      type 'int *' [-pedantic]
  f(long_ptr);
    ^~~~~~~~
t.c:1:13: note: passing argument to parameter 'x' here
void f(int *x);
            ^

llvm-svn: 102038
2010-04-22 00:20:18 +00:00
Douglas Gregor 6b7f12c039 Switch the initialization of Objective-C message parameters (as occurs
during message sends) over to the new initialization code and away
from the C-only CheckSingleAssignmentConstraints. The enables the use
of C++ types in method parameters and message arguments, as well as
unifying more initialiation code overall.

llvm-svn: 102035
2010-04-21 23:24:10 +00:00
Douglas Gregor c68e140657 Improve diagnostics when we fail to convert from a source type to a
destination type for initialization, assignment, parameter-passing,
etc. The main issue fixed here is that we used rather confusing
wording for diagnostics such as

t.c:2:9: warning: initializing 'char const [2]' discards qualifiers,
      expected 'char *' [-pedantic]
  char *name = __func__;
        ^      ~~~~~~~~

We're not initializing a 'char const [2]', we're initializing a 'char
*' with an expression of type 'char const [2]'. Similar problems
existed for other diagnostics in this area, so I've normalized them all
with more precise descriptive text to say what we're
initializing/converting/assigning/etc. from and to. The warning for
the code above is now:

t.c:2:9: warning: initializing 'char *' from an expression of type
      'char const [2]' discards qualifiers [-pedantic]
  char *name = __func__;
        ^      ~~~~~~~~

Fixes <rdar://problem/7447179>.

llvm-svn: 100832
2010-04-09 00:35:39 +00:00
Fariborz Jahanian b397e43dea objective-c++ must take into account qualifiers when
considering valid objc pointer converions.

llvm-svn: 98557
2010-03-15 18:36:00 +00:00
Fariborz Jahanian 01cbe441b3 Allow pointer convesion of an objective-c pointer to
'void *' to mimic gcc's behavior. (fixes radar 7477351).

llvm-svn: 91570
2009-12-16 23:13:33 +00:00