Commit Graph

534 Commits

Author SHA1 Message Date
Eric Christopher 52d5ec11cc Fix typo in error message and testcase.
llvm-svn: 112115
2010-08-25 23:45:44 +00:00
Fariborz Jahanian 54d75f6925 No need to default synthesize property if implementation
has its own getter and setter methods declared.
Fixed 8349319 (nonfragile-abi2).

llvm-svn: 112003
2010-08-25 00:31:58 +00:00
Fariborz Jahanian 76b35379f5 Fix a bug in nonfragile-abi2 when attempting to diagnose
previous use of a synthesized 'ivar' with property of same name
declared as @dynamic. In this case, 'ivar' is in the
inherited class and no diagnostics should be issued.

llvm-svn: 111940
2010-08-24 18:48:05 +00:00
Fariborz Jahanian 9d7d3d84ac Diagnose if type of iboutletcollection attribute is a builtin type.
llvm-svn: 111324
2010-08-17 23:19:16 +00:00
Fariborz Jahanian 798f83239c Diagnose use of iboutletcollection on ivar/property
of non-object types. Radar 8308053.

llvm-svn: 111296
2010-08-17 21:39:27 +00:00
Fariborz Jahanian b5d59b66c2 Patch to add type parameter support for attribute iboutletcollection.
Radar 8308053.

llvm-svn: 111275
2010-08-17 20:23:12 +00:00
Fariborz Jahanian 99311ba1a8 Diagnose assiging to an interface object in
non-fragile abi mode as sizes are not statically known.
Fixes radar 8315734.

llvm-svn: 111191
2010-08-16 21:51:12 +00:00
Fariborz Jahanian 18d90a97df When issuing warning for future conflict resolution,
(nonfragile-abi2), do not consider 'ivar' access
in class methods. Also, improve on diagnostics.
Radar 8304561.

llvm-svn: 111023
2010-08-13 18:09:39 +00:00
Fariborz Jahanian 753783a062 Fixes block type matching bug. Radar 8302845.
llvm-svn: 110950
2010-08-12 20:46:12 +00:00
Douglas Gregor 62157e5342 Downgrade error about nonnull attribute bbeing applied to a function without point arguments to a warning
llvm-svn: 110939
2010-08-12 18:48:43 +00:00
Fariborz Jahanian 0bce17e572 Change text of diagnostics on user request.
radar 7948654.

llvm-svn: 110857
2010-08-11 21:22:15 +00:00
Fariborz Jahanian d539d098a4 IRGen support for functions returning objc object
types. Fixes PR7865.

llvm-svn: 110832
2010-08-11 17:37:35 +00:00
Fariborz Jahanian 32e59ba01d Fix a spurious warning when message sent to qualified-id
type receiver (pr7861).

llvm-svn: 110696
2010-08-10 18:10:50 +00:00
Fariborz Jahanian 3337b2e8dd Implements gcc's -Wstrict-selector-match.
(radar 8127244).

llvm-svn: 110622
2010-08-09 23:27:58 +00:00
Fariborz Jahanian ec43022b99 Warn if class object does not implement qualified
id's protocols. Fixes radar 8154220.

llvm-svn: 110583
2010-08-09 18:21:43 +00:00
Douglas Gregor 114e55df5b Fix an Objective-C crasher, PR7839.
llvm-svn: 110515
2010-08-07 12:29:18 +00:00
Fariborz Jahanian 7b70eb4bb1 Tighten the rules when deciding if an ivar must be
auto-synthesized (nonfragile-abi2 specific).
Fixes radar 8251648.

llvm-svn: 109866
2010-07-30 16:59:05 +00:00
Ted Kremenek 28e1c9155e Don't print out ivars twice in Decl::print(). Fixes <rdar://problem/8253668>.
llvm-svn: 109833
2010-07-30 00:47:46 +00:00
Fariborz Jahanian c15dfd8a87 Tigthen the condition for issung ivar shadowing
variables to those in file scope (nonfragile-abi2).
Fixes radar 8248681.

llvm-svn: 109758
2010-07-29 16:53:53 +00:00
Fariborz Jahanian 86151343b4 Warn when property ivar lookup finds a global variable
of same name. In nonfragile-abi2, lookup accesses a synthesized
ivar. This is a transition warning.  Radar 8225011.

llvm-svn: 109197
2010-07-22 23:33:21 +00:00
Ted Kremenek 1ddd6d2b6b Upgrade "'X' is unavailable" from a warning to an error. This matches GCC's behavior. Note that
GCC emits a warning instead of an error when using an unavailable Objective-C protocol, so now
Clang's behavior is more strict in this case, but more consistent.  We will need to see how much
this fires on real code and determine whether this case should be downgraded to a warning.

Fixes <rdar://problem/8213093>.

llvm-svn: 109033
2010-07-21 20:43:11 +00:00
Fariborz Jahanian 3c7ebc3a5e Patch to type match comparing Objective-C Classes which implement
protocols (Radar 8191774).

llvm-svn: 108758
2010-07-19 22:02:22 +00:00
Fariborz Jahanian 2a36089eef Categories cannot synthesize property ivars,
and a minor cleanup.

llvm-svn: 108707
2010-07-19 16:14:33 +00:00
Fariborz Jahanian 6a06144021 Another test case for on demand synthesis of ivars.
llvm-svn: 108600
2010-07-17 01:16:59 +00:00
Fariborz Jahanian 18722981e2 Patch to synthesize property ivars on demand as
part of the new property synthesis by default.
wip.

llvm-svn: 108599
2010-07-17 00:59:30 +00:00
Fariborz Jahanian 56a9d54de8 Don't error when doing default property synthesis
and some are already synthesized by user declaration.

llvm-svn: 108341
2010-07-14 18:11:52 +00:00
Fariborz Jahanian c0b0ced477 Consider obective-c pointer arguments as valid sentinel args
as well. Fixes radar 7975788.

llvm-svn: 108333
2010-07-14 16:37:51 +00:00
Fariborz Jahanian 5848d333b4 Check on property attributes which are declared
in class extensions (radar 8171968).

llvm-svn: 108283
2010-07-13 22:04:56 +00:00
Ted Kremenek 3f1240b614 Add test case for <rdar://problem/4289832>. Clang actuallys gets
the test case right (for the noreturn warning) because the CFG
doesn't support @try yet, but the test case is now present when
we do properly implement CFG support for @try...@catch.

llvm-svn: 107203
2010-06-29 20:25:42 +00:00
Fariborz Jahanian 66f9a6560e This patch fixes a bug whereby, clang skipped
unimplemented property warning for properties 
coming from class's conformin protocol. It also
simplifies the algorithm in the process.
Fixes radar 8035776.

llvm-svn: 107174
2010-06-29 18:12:32 +00:00
Fariborz Jahanian 3bf0ded346 Patch to provide separate ASTs for multiple ObjC class extension
declarations (implements radar 7928731).

llvm-svn: 106597
2010-06-22 23:20:40 +00:00
Ted Kremenek 64c235e4c6 Extend format string type-checking to include '%p'. Fixes remaining cases PR 4468.
llvm-svn: 106151
2010-06-16 21:23:04 +00:00
Fariborz Jahanian 5981b04718 Clang missing warning about conflicting declaration vs. definition
for variable arguments list methods. (radar 8006060).

llvm-svn: 104407
2010-05-21 23:28:58 +00:00
Fariborz Jahanian 9f963c2488 Misc. fixes to bring Objetive-C++'s handling of
gc attributes to be inline with Objective-C
(for radar 7925141).

llvm-svn: 104084
2010-05-18 23:04:17 +00:00
Fariborz Jahanian 87b915a9bc These test now run in objective-c++ mode we well.
llvm-svn: 104041
2010-05-18 18:24:06 +00:00
Douglas Gregor 3f324d569b Diagnose unused exception parameters under a different warning group
(-Wunused-exception-parameter) than normal variables, since it's more
common to name and then ignore an exception parameter. This warning is
neither enabled by default nor by -Wall. Fixes <rdar://problem/7931045>.

llvm-svn: 102931
2010-05-03 18:51:14 +00:00
Douglas Gregor 50ec46d4af Complain when we try to initialize an object of Objective-C class type
(which is ill-formed) with an initializer list. Also, change the
fallback from an assertion to a generic error message, which is far
friendlier. Fixes <rdar://problem/7730948>.

llvm-svn: 102930
2010-05-03 18:24:37 +00:00
Fariborz Jahanian 58f11d6245 Do not issue warning on unimplemented property in the class, if it
conforms to a protocol as one of its super classes does. This is because
conforming super class will implement the property. This implements 
new warning rules for unimplemented properties (radar 7884086).

llvm-svn: 102919
2010-05-03 15:49:20 +00:00
Fariborz Jahanian 9e1a3af030 Properties cannot be synthesized by-dafult in
categories. Issue usual warnings instead of
confusing error message. Radar 7920807

llvm-svn: 102645
2010-04-29 17:52:18 +00:00
Chris Lattner 8f68b777e2 wordsmith an objc warning, rdar://7900756
llvm-svn: 102388
2010-04-26 21:44:01 +00:00
Douglas Gregor f356419bf5 Refactor Objective-C @catch parameter checking by detangling it from
function-parameter checking and splitting it into the normal
ActOn*/Build* pair in Sema. We now use VarDecl to represent the @catch
parameter rather than the ill-fitting ParmVarDecl.

llvm-svn: 102347
2010-04-26 17:32:49 +00:00
Fariborz Jahanian f9b52d5f63 Improve on my previous diagnostics: per Doug's comment.
llvm-svn: 102190
2010-04-23 17:52:02 +00:00
Fariborz Jahanian e459686aac Trying to improve on a diagnostics for properties.
llvm-svn: 102187
2010-04-23 17:22:07 +00:00
Anders Carlsson 58e24a8fd8 Change the 'declared at' diagnostic to say 'declared here'.
llvm-svn: 102163
2010-04-23 02:20:12 +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 0c78ad9665 Rework the Parser-Sema interaction for Objective-C message
sends. Major changes include:

  - Expanded the interface from two actions (ActOnInstanceMessage,
    ActOnClassMessage), where ActOnClassMessage also handled sends to
    "super" by checking whether the identifier was "super", to three
    actions (ActOnInstanceMessage, ActOnClassMessage,
    ActOnSuperMessage). Code completion has the same changes.
  - The parser now resolves the type to which we are sending a class
    message, so ActOnClassMessage now accepts a TypeTy* (rather than
    an IdentifierInfo *). This opens the door to more interesting
    types (for Objective-C++ support).
  - Split ActOnInstanceMessage and ActOnClassMessage into parser
    action functions (with their original names) and semantic
    functions (BuildInstanceMessage and BuildClassMessage,
    respectively). At present, this split is onyl used by
    ActOnSuperMessage, which decides which kind of super message it
    has and forwards to the appropriate Build*Message. In the future,
    Build*Message will be used by template instantiation.
  - Use getObjCMessageKind() within the disambiguation of Objective-C
    message sends vs. array designators.

Two notes about substandard bits in this patch:
  - There is some redundancy in the code in ParseObjCMessageExpr and
  ParseInitializerWithPotentialDesignator; this will be addressed
  shortly by centralizing the mapping from identifiers to type names
  for the message receiver.
  - There is some #if 0'd code that won't likely ever be used---it
  handles the use of 'super' in methods whose class does not have a
  superclass---but could be used to model GCC's behavior more
  closely. This code will die in my next check-in, but I want it in
  Subversion.

llvm-svn: 102021
2010-04-21 19:57:20 +00:00
Fariborz Jahanian 422cb21862 Improve on source location of diagnostic when default
property synthesis is using a super class ivar.

llvm-svn: 102011
2010-04-21 18:57:20 +00:00
Ted Kremenek 15a81e59ca Fix crash on invalid code where a @throw statement is not followed by a ';'
llvm-svn: 101941
2010-04-20 21:21:51 +00:00
Fariborz Jahanian 877aaa9706 Patch to support transparent_union types on
objective-c methods. Fixes radar 7875968.

llvm-svn: 101935
2010-04-20 20:28:15 +00:00
Douglas Gregor 26380d493b More tests for Objective-C-related name lookup weirdness. Yes, it's
weird; yes, it's what GCC does. Almost.

llvm-svn: 101803
2010-04-19 19:10:40 +00:00