Commit Graph

415 Commits

Author SHA1 Message Date
Steve Naroff d338d08f49 Fix typo in newly added test case.
llvm-svn: 68515
2009-04-07 14:22:40 +00:00
Steve Naroff 54e5945297 Change the type of ObjC @ string constants (from NSConstantString->NSString).
This fixes <rdar://problem/6757102> clang type for @"xxx" is "NSConstantString *" (GCC type is "NSString *").

llvm-svn: 68514
2009-04-07 14:18:33 +00:00
Fariborz Jahanian 54d569c51d Warn instead of error on duplicate protocol definitions.
Be kind to so many projects which are doing this (and be
like gcc).

llvm-svn: 68474
2009-04-06 23:43:32 +00:00
Steve Naroff 837dc03222 Make casting 'super' a deprecated warning (instead of a hard error).
This will simplify clang adoption, and is probably better "etiquette" (since gcc has always accepted this idiom without warning). Once we are over the adoption hurdle, we can turn this into an error.

llvm-svn: 68468
2009-04-06 22:07:54 +00:00
Fariborz Jahanian 15e3a5c4b8 writable property in a category of class's superclass
makes the property writable in the current class.
 

llvm-svn: 68446
2009-04-06 16:59:10 +00:00
Fariborz Jahanian 2705859981 Real corener case of a method declared in a protocol
used in a class which declares a property of the same
name. This should not result in an unimplemented
method warning.

llvm-svn: 68409
2009-04-03 21:51:32 +00:00
Chris Lattner 01b8ef2ac4 improve the string literal comparison warning to not call @encode's "string literals".
llvm-svn: 68407
2009-04-03 21:11:28 +00:00
Steve Naroff 3e90e33356 Tweak test (now that http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090330/015001.html is fixed).
llvm-svn: 68364
2009-04-03 01:25:18 +00:00
Fariborz Jahanian 38a5c9650e Fix up lookup rules for properties declared in
objc's continuation class.

llvm-svn: 68339
2009-04-02 18:44:20 +00:00
Steve Naroff d5ca2d0165 Fix http://llvm.org/bugs/show_bug.cgi?id=3907.
llvm-svn: 68338
2009-04-02 18:37:59 +00:00
Steve Naroff 0f55fd9f33 Update test case and comment.
llvm-svn: 68247
2009-04-01 21:27:56 +00:00
Steve Naroff 8d816d6cb5 CodeGenModule::GetAddrOfConstantCFString():
- Finish up support for converting UTF8->UTF16 to support ObjC @"string" constants.

Remove warning from CheckObjCString.

As the FIXME in the test case indicates, I still have a bug to work out (apparently with \u handling).

llvm-svn: 68245
2009-04-01 21:16:31 +00:00
Daniel Dunbar 9ff631039c Forgot to remove trailing &&
llvm-svn: 68220
2009-04-01 18:11:41 +00:00
Daniel Dunbar f46945b274 Ted & I crossed paths here, these tests are in cocoa-pth.m now.
llvm-svn: 68215
2009-04-01 16:59:39 +00:00
Daniel Dunbar f524eff37d Add cocoa-pth.c test case, this got lost in shuffling PTH test cases.
llvm-svn: 68205
2009-04-01 15:36:37 +00:00
Ted Kremenek 455de13de1 Re-enable PTH testing for cocoa.h and carbon.h. This tests that PTH works on
real-world header files and these tests have caught serious bugs in the past.

llvm-svn: 68204
2009-04-01 15:28:20 +00:00
Daniel Dunbar 386ef885bb Pull clang-cc code for generating PTH files based on the input type.
- <rdar://problem/6741594> [pth] don't abuse -x to drive pth
   generation

 - Simpler, and fixes PR3915.

Cleanup test cases for PTH:
 - Update to use -emit-pth

 - Removed PTH test of carbon.c and cocoa.mm; these didn't actually
   verify anything, and since PTH is token based the extra coverage
   (over cocoa.m) isn't particularly helpful.

 - Split PTH tests in cocoa.m to cocoa-pth.m, solely to increase
   available parallelism when running tests.

Ted, could you update the PTH test cases (include-pth.c and
cocoa-pth.m) to have some sort of positive check that the PTH is
getting used? "# of PTH cache hits" or "tokens read from PTH cache"
statistics would work great. :)

llvm-svn: 68189
2009-04-01 05:09:09 +00:00
Mike Stump cafa0a9746 Fix block comparisons. Radar 6732116.
llvm-svn: 68171
2009-04-01 01:17:39 +00:00
Fariborz Jahanian b35b4a9b42 fe support for objc2's nonfragile-abi synthesized ivars.
llvm-svn: 68077
2009-03-31 00:06:29 +00:00
Steve Naroff 389925dc87 Fix <rdar://problem/6697053> instance variable is protected.
Treat @package the same as @public. The documentation for @package says it is analogous to private_extern for variables/functions. Fully implementing this requires some kind of linker support (so access is denied to code outside the classes executable image). I don't believe GCC fully implements this semantic. Will discuss with Fariborz offline.

llvm-svn: 67755
2009-03-26 16:01:08 +00:00
Daniel Dunbar a45cf5b6b0 Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602
2009-03-24 02:24:46 +00:00
Fariborz Jahanian 629aed9327 Issue error if variables are defined inside an objc class,
category or protocol.

llvm-svn: 67450
2009-03-21 18:06:45 +00:00
Fariborz Jahanian d302bbd0c1 When looking for property name (or getter method) in a
dot-syntax expression after earching the list of protocols
in the qualified-id, must keep searching the protocol list
of each of the protocols in the list.

llvm-svn: 67314
2009-03-19 18:15:34 +00:00
Mike Stump 38cae30095 Ignore weak import on properties.
llvm-svn: 67205
2009-03-18 15:05:17 +00:00
Daniel Dunbar 94d48e0bd0 Force triple for a couple test cases.
llvm-svn: 66974
2009-03-13 22:48:51 +00:00
Steve Naroff 28a531e003 Implement FIXME related to <rdar://problem/6496506> Implement class setter/getter for properties.
llvm-svn: 66689
2009-03-11 20:12:18 +00:00
Steve Naroff aa82be2b5b Fix <rdar://problem/6655054> clang issues bogus error on property usage in a dot-syntax.
llvm-svn: 66659
2009-03-11 15:15:01 +00:00
Steve Naroff 1d984fe2bd Fix <rdar://problem/6578665> user declared setter method should be used when using property syntx.
llvm-svn: 66658
2009-03-11 13:48:17 +00:00
Chris Lattner 6e76e592a3 Improve the "bad receiver" warning for ObjC message sends to be less confusing.
llvm-svn: 66635
2009-03-11 03:47:47 +00:00
Chris Lattner 1897de1c38 Fix PR3766, a really nasty silent miscompilation case where we emitted
a warning and then threw away the AST.  While I'm in there, tighten up the
code to actually reject completely bogus cases (sending a message to a 
struct).  We still allow sending a message to an int, which doesn't make
sense but GCC allows it and is easy to support.

llvm-svn: 66468
2009-03-09 21:19:16 +00:00
Steve Naroff 9527bbfc08 Implement property '.' notation on Factory/Class objects. Parser changes aren't very pretty:-(
This fixes <rdar://problem/6496506> Implement class setter/getter for properties.

llvm-svn: 66465
2009-03-09 21:12:44 +00:00
Steve Naroff ed03170d28 Improvements to private method lookup.
Patch by Jean-Daniel Dupas. Thanks!

llvm-svn: 66383
2009-03-08 18:56:13 +00:00
Steve Naroff e29c4dd022 Partial fix <rdar://problem/6301205> [irgen] dot-syntax on super isn't supported.
Tweak Sema::ActOnMemberReferenceExpr() and Sema::ActOnDeclarationNameExpr() to handle "super." notation for Class methods.

llvm-svn: 66185
2009-03-05 20:12:00 +00:00
Steve Naroff 8f4528bc7c Tweak diag for <rdar://problem/5982579> [clang on xcode] (using arch=x86_64): synthesized property 'sdkPath' must either be named the same as a compatible ivar or must explicitly name an ivar.
llvm-svn: 66162
2009-03-05 15:45:01 +00:00
Steve Naroff 41d09add4f Fix <rdar://problem/6144382> [sema] gcc inconsistency w.r.t. forward protocol declarations.
llvm-svn: 66161
2009-03-05 15:22:01 +00:00
Fariborz Jahanian b8d091c4eb Implemented access check for ivars accessed inside
c-style functions declared inside objc @implementations.

llvm-svn: 66087
2009-03-04 22:30:12 +00:00
Steve Naroff d1b64be776 Partial fix for <rdar://problem/6645157> [clang on Xcode; regression]: error: instance variable 'someField' is private.
A recent regression caused by http://llvm.org/viewvc/llvm-project?rev=65912&view=rev.

This commit isn't fully baked. Nevertheless, it should cause Xcode to compile again. Will speak with Fariborz offline.

llvm-svn: 66045
2009-03-04 18:34:24 +00:00
Fariborz Jahanian c2371eadd6 Fix a corner case of message lookup looking for class methods.
If all else failed, find the message in class's root's
list of instacne methods!

llvm-svn: 66040
2009-03-04 17:50:39 +00:00
Steve Naroff 3f49feeed5 Finish up some fixes related to <rdar://problem/6497631> Message lookup is sometimes different than gcc's.
- Disallow casting 'super'. GCC allows this, however it doesn't make sense (super isn't an expression and the cast won't alter lookup/dispatch).
- Tighten up lookup when messaging 'self'.

llvm-svn: 66033
2009-03-04 15:11:40 +00:00
Eli Friedman f22fa28522 Make this test a bit more specific about the target so that it passes on
Linux.

llvm-svn: 66019
2009-03-04 06:00:10 +00:00
Steve Naroff 013813dd5d Change a warning to an error...
llvm-svn: 65978
2009-03-03 23:13:51 +00:00
Fariborz Jahanian 9a8e759b4f Implement an important missing warning when a selector
is searched for in the global pool. It already uncovered 
a clang bug in message selection.

llvm-svn: 65974
2009-03-03 22:19:15 +00:00
Steve Naroff c03f6b91b1 Fix <rdar://problem/5982579> [clang on xcode] (using arch=x86_64): synthesized property 'sdkPath' must either be named the same as a compatible ivar or must explicitly name an ivar.
llvm-svn: 65973
2009-03-03 22:09:41 +00:00
Steve Naroff 27ed6f6766 Fix <rdar://problem/6252237> [sema] qualified id should be disallowed in @catch statements.
llvm-svn: 65969
2009-03-03 21:16:54 +00:00
Steve Naroff 39d6fba0d6 Fix <rdar://problem/6632061> [sema] non object types should not be allowed in @catch statements.
llvm-svn: 65968
2009-03-03 20:59:06 +00:00
Steve Naroff b0e25c1ceb Remove old/incorrect warnings.
llvm-svn: 65950
2009-03-03 15:49:23 +00:00
Steve Naroff 3e1181e2e9 Fix <rdar://problem/6497242> Inherited overridden protocol declared objects don't work.
Change Sema::DiagnosePropertyMismatch() to check for type compatibility (rather than type equivalence, which is too strict).

llvm-svn: 65949
2009-03-03 15:43:24 +00:00
Steve Naroff 157599fe1c Fix <rdar://problem/6497608> clang does not catch ivar type mismatches in @implementation.
llvm-svn: 65948
2009-03-03 14:49:36 +00:00
Fariborz Jahanian a458c4ff65 Check of ivar access access control.
llvm-svn: 65912
2009-03-03 01:21:12 +00:00
Steve Naroff f3833d70be Fix <rdar://problem/6635908> crash on invalid
llvm-svn: 65909
2009-03-03 00:45:38 +00:00
Fariborz Jahanian bf8e842b67 Diagnose a variety of access of ivars when they conflict with
local or global variables in instance/class methods.

llvm-svn: 65879
2009-03-02 21:55:29 +00:00
Fariborz Jahanian 33afd771b4 Check for duplicate declaration of method of a class
in its extension.

llvm-svn: 65854
2009-03-02 19:05:07 +00:00
Steve Naroff 8676e08730 Fix <rdar://problem/6248764> parser rejects: bad receiver type 'CFStringRef'.
Downgrade an error to a warning (for GCC compatibility).

llvm-svn: 65779
2009-03-01 17:14:31 +00:00
Steve Naroff 114aecb26b Fix <rdar://problem/6619539> incompatible pointer types sending 'XCElementSpacer *', expected 'XCElement *' (not handling protocol signatures correctly?).
- Reworked ASTContext::canAssignObjCInterfaces().
- Added ObjCProtocolDecl::lookupProtocolNamed().

llvm-svn: 65773
2009-03-01 16:12:44 +00:00
Chris Lattner 9ef10f4638 "This patch uses the new ObjCImplDecl class to merge Sema::ImplMethodsVsClassMethods and Sema::ImplCategoryMethodsVsIntfMethods methods.
And now, when clang check a class implementation to find unimplemented methods, it also checks all methods from the class extensions (unnamed categories).

There is also a test case to check this warning.

This patch contains also a minor update for ObjCImplDecl . getNameAsCString and getNameAsString now returns an empty string instead of crashing for unnamed categories."

Patch by Jean-Daniel Dupas!

llvm-svn: 65744
2009-03-01 00:56:52 +00:00
Fariborz Jahanian f5c1c923e8 Diagnose gc attribute mismatch of property and its ivar.
llvm-svn: 65656
2009-02-27 22:38:11 +00:00
Fariborz Jahanian 7285cf57a3 Do not issue bogus error on __weak/__strong ivar access.
llvm-svn: 65583
2009-02-26 23:05:51 +00:00
Steve Naroff de68001e76 Fix <rdar://problem/6574319> clang issues error on 'readonly' property with a defaul setter attribute.
Needed to make isPropertyReadonly() non-const (for this fix to compile). I imagine there's a way to retain the const-ness, however I have more important fish to fry.

llvm-svn: 65562
2009-02-26 19:11:32 +00:00
Steve Naroff 42ab0dd1ee Fix <rdar://problem/6614945> method not found.
This was a fairly recent regression.

llvm-svn: 65547
2009-02-26 18:16:19 +00:00
Steve Naroff b162f170da Fix http://llvm.org/bugs/show_bug.cgi?id=3544.
The code for looking up local/private method in Sema::ActOnInstanceMessage() was not handling categories properly. Sema::ActOnClassMessage() didn't have this bug.
Created a helper with the correct logic and changed both methods to use it.

llvm-svn: 65532
2009-02-26 15:55:06 +00:00
Steve Naroff 8ec2784f58 Fix ObjCInterfaceDecl::lookupInstanceMethod()/lookupClassMethod() to search in inherited protocols.
Also changed ObjCInterfaceDecl::lookupClassMethod() to look through a categories protocols.

Test/patch submitted by Jean-Daniel Dupas (thanks!).

llvm-svn: 65526
2009-02-26 11:32:02 +00:00
Anders Carlsson f2f2e7f6a1 Use CheckAssignmentConstraints for checking the cleanup attr function. Fixes PR3656.
llvm-svn: 65461
2009-02-25 17:19:08 +00:00
Chris Lattner d13b8b55ca fix rdar://6611778, a redefinition of an interface was causing an
assertion when the ivars and method list was reset into the existing
interface.  To fix this, mark decls as invalid when they are redefined,
and don't insert ivars/methods into invalid decls.

llvm-svn: 65340
2009-02-23 22:00:08 +00:00
Steve Naroff a94e52c687 - Generate error for protocol qualifiers on 'Class'.
- Generate error for protocol qualifiers on non-ObjC types.

llvm-svn: 65333
2009-02-23 18:53:24 +00:00
Steve Naroff 91362dd011 Revert http://llvm.org/viewvc/llvm-project?view=rev&revision=65244.
Remove support for "Class<P>". Will be making this an error.

llvm-svn: 65332
2009-02-23 18:36:16 +00:00
Steve Naroff c4173fa704 Contains the following (related to problems found while investigting <rdar://problem/6497631> Message lookup is sometimes different than gcc's).
- Implement instance/class overloading in ObjCContainerDecl (removing a FIXME). This involved hacking NamedDecl::declarationReplaces(), which took awhile to figure out (didn't realize replace was the default).
- Changed Sema::ActOnInstanceMessage() to remove redundant warnings when dealing with protocols. For now, I've omitted the "protocol" term in the diagnostic. It simplifies the code flow and wan't always 100% accurate (e.g. "Foo<Prot>" looks in the class interface, not just the protocol).
- Changed several test cases to jive with the above changes.

llvm-svn: 65292
2009-02-22 19:35:57 +00:00
Steve Naroff 670e72ddc7 Add support for GCC ObjC extension "Class<protocol>". Sigh.
Found while researching <rdar://problem/6497631> Message lookup is sometimes different than gcc's.

Will never be seen in user code. Needed to pass dejagnu testsuite.

llvm-svn: 65244
2009-02-21 20:17:11 +00:00
Steve Naroff cd8d572283 Warn about bogus protocol qualifiers.
llvm-svn: 65241
2009-02-21 19:50:43 +00:00
Fariborz Jahanian 0c9404e0a7 Warn on use of __weak attribute on local
variable (objc2 gc specific).

llvm-svn: 65240
2009-02-21 19:44:02 +00:00
Steve Naroff da88fb9c73 Add test case to record a couple inconsistencies with GCC (found in <rdar://problem/6561076> [clang on Xcode] warning: cannot find protocol definition for 'OzzyP').
Removing the "cannot find protocol" warning is trivial if necessary (but I don't think it's the right thing to do).

llvm-svn: 65232
2009-02-21 17:03:43 +00:00
Steve Naroff 7a7814c32b This fixes <rdar://problem/6497650> More type mismatches issues with clang.
Move two key ObjC typechecks from Sema::CheckPointerTypesForAssignment() to ASTContext::mergeTypes().

This allows us to take advantage of the recursion in ASTContext::mergeTypes(), removing some bogus warnings.

This test case I've added includes an example where we still warn (and GCC doesn't). Need to talk with folks and decide what to do. At this point, the major bogosities should be fixed.

llvm-svn: 65231
2009-02-21 16:18:07 +00:00
Steve Naroff 326064168a Fix <rdar://problem/6500554> missing objc error message.
llvm-svn: 65198
2009-02-20 22:59:16 +00:00
Steve Naroff 17b2f5d728 Fix <rdar://problem/6586239> bitfield constraints not enforced (for ObjC)
llvm-svn: 65128
2009-02-20 17:57:11 +00:00
Eli Friedman 7157825d44 Use -verify for consistency.
llvm-svn: 65106
2009-02-20 02:03:47 +00:00
Douglas Gregor 171c45ab0c Downgrade complaints about calling unavailable functions to a warning
(as GCC does), except when we've performed overload resolution and
found an unavailable function: in this case, we actually error.

Merge the checking of unavailable functions with the checking for
deprecated functions. This unifies a bit of code, and makes sure that
we're checking for unavailable functions in the right places. Also,
this check can cause an error. We may, eventually, want an option to
make "unavailable" warnings into errors.

Implement much of the logic needed for C++0x deleted functions, which
are effectively the same as "unavailable" functions (but always cause
an error when referenced). However, we don't have the syntax to
specify deleted functions yet :)

llvm-svn: 64955
2009-02-18 21:56:37 +00:00
Chris Lattner a26fb347a0 Start improving diagnostics that relate to subcharacters of string literals.
First step, handle diagnostics in StringLiteral's that are due to token pasting.

For example, we now handle:
  id str2 = @"foo" 
            "bar"
           @"baz"
           " b\0larg";  // expected-warning {{literal contains NUL character}}

Correctly:

test/SemaObjC/exprs.m:17:15: warning: CFString literal contains NUL character
           " b\0larg";  // expected-warning {{literal contains NUL character}}
           ~~~^~~~~~~

There are several other related issues still to be done.

llvm-svn: 64924
2009-02-18 17:49:48 +00:00
Chris Lattner c96e0c4399 pass -verify in exprs.m, merge const-id.m into message.m
llvm-svn: 64886
2009-02-18 04:41:38 +00:00
Chris Lattner 2c4866057d fix rdar://6597252: two exactly identical pointer types are always
compatible, even if they are weird implicit objc pointer types like
Class.

llvm-svn: 64885
2009-02-18 04:38:20 +00:00
Chris Lattner e404d0ba05 warn about interfaces that inherit from deprecated classes.
llvm-svn: 64671
2009-02-16 21:33:09 +00:00
Chris Lattner ced903b793 warn about categories that implement deprecated interfaces.
llvm-svn: 64670
2009-02-16 21:30:01 +00:00
Chris Lattner 46d6b13448 do not warn about uses of deprecated decls when in an out-of-line objc method
whose declaration was declared as deprecated.

llvm-svn: 64658
2009-02-16 19:35:30 +00:00
Chris Lattner 43df556ab5 Add support for deprecating ObjC properties. Unlike GCC, we warn that the
property is deprecated, not the getter/setter if the attribute is on
the property.

llvm-svn: 64644
2009-02-16 18:35:08 +00:00
Douglas Gregor 75a45ba2a4 Adopt a more principled approach to invalid declarations:
- If a declaration is an invalid redeclaration of an existing name,
    complain about the invalid redeclaration then avoid adding it to
    the AST (we can still parse the definition or initializer, if any).
  - If the declaration is invalid but there is no prior declaration
    with that name, introduce the invalid declaration into the AST
    (for later error recovery).
  - If the declaration is an invalid redeclaration of a builtin that
    starts with __builtin_, we produce an error and drop the
    redeclaration. If it is an invalid redeclaration of a library
    builtin (e.g., malloc, printf), warn (don't error!) and drop the
    redeclaration.

If a user attempts to define a builtin, produce an error and (if it's
a library builtin like malloc) suggest -ffreestanding.

This addresses <rdar://problem/6097585> and PR2892. However, PR3588 is
still going to cause some problems when builtins are redeclared
without a prototype.

llvm-svn: 64639
2009-02-16 17:45:42 +00:00
Chris Lattner 50afe31b43 add support for deprecated objc ivars.
llvm-svn: 64637
2009-02-16 17:19:12 +00:00
Chris Lattner 96895e8dcd specify a triple to use, otherwise we get errors on this test for
hosts with a different size_t type.

llvm-svn: 64636
2009-02-16 17:11:14 +00:00
Chris Lattner f06a702e46 update expected-warning line.
llvm-svn: 64635
2009-02-16 17:08:46 +00:00
Anders Carlsson b6ba4682b5 Add support for deprecated Obj-C methods. The semantics mostly match what gcc has.
llvm-svn: 64562
2009-02-14 19:08:58 +00:00
Chris Lattner 677a35804f add parser and type checking support for attribute((objc_exception)).
We don't have "zero cost" exceptions for ObjC yet, so there is no codegen
support required.

llvm-svn: 64546
2009-02-14 08:09:34 +00:00
Chris Lattner 9844408ad6 rename test
llvm-svn: 64545
2009-02-14 08:08:05 +00:00
Steve Naroff 344e74a986 Fix <rdar://problem/6499801> clang does not detect objc type mismatch in conditional expr
llvm-svn: 64393
2009-02-12 19:05:07 +00:00
Steve Naroff 0fa412cc6d Turn warning into error. Minor incompatibility with GCC (for scalar types, GCC only produces a warning).
llvm-svn: 64375
2009-02-12 15:54:59 +00:00
Steve Naroff 22cc840947 Remove some non-ascii characters. Thanks Gabor.
llvm-svn: 64330
2009-02-11 22:01:48 +00:00
Steve Naroff 7a54c0d7d4 Fix <rdar://problem/6505139> [clang on growl]: need to allow unnamed selectors as the first argument
llvm-svn: 64320
2009-02-11 20:43:13 +00:00
Steve Naroff 5ee2c02ac6 Fix <rdar://problem/6243503> [sema] @throw; accepted outside catch block.
llvm-svn: 64318
2009-02-11 20:05:44 +00:00
Steve Naroff d5581d2af1 Fix <rdar://problem/6206858> [sema] type check @throw statements.
Added a FIXME to handle 'rethrow' check.

llvm-svn: 64308
2009-02-11 17:45:08 +00:00
Douglas Gregor 9817f4a717 Make Sema::getTypeName return the opaque pointer of a QualType rather
than a Decl, which gives us some more flexibility to express the
results with the type system. There are no clients using this
flexibility yet, but it's meant to be able to describe qualified names
as written in the source (e.g., "foo::type") or template-ids that name
a class template specialization (e.g., "std::vector<INT>").

DeclSpec's TST_typedef has become TST_typename, to reflect its use to
describe types found by name (that may or may not be typedefs). The
type representation of a DeclSpec with TST_typename is an opaque
QualType pointer. All users of TST_typedef, both direct and indirect,
have been updated for these changes.

llvm-svn: 64141
2009-02-09 15:09:02 +00:00
Sebastian Redl 2175b6a767 Make one expected-diag directive match exactly one actual diagnostic.
This uncovers some bugs, so several test cases now fail.

llvm-svn: 64025
2009-02-07 19:52:04 +00:00
Ted Kremenek 80954b7dc3 Add sub-testcase where we process Cocoa.h using --disable-free (i.e., test the usage of the BumpPtrAllocator in ASTContext).
llvm-svn: 63957
2009-02-06 19:36:35 +00:00
Steve Naroff 189d41f625 Fix <rdar://problem/6552648> error: redefinition of 'XCElementAnchorDelegate' as different kind of symbol.
At first glance, this looked like a recent regression (possibly created by http://llvm.org/viewvc/llvm-project?view=rev&revision=63354, which was the only recent change to this section of Sema::ActOnStartClassInterface()). After more investigation, it looks like an edge case bug that we didn't cover in our tests.

llvm-svn: 63738
2009-02-04 17:14:05 +00:00
Ted Kremenek ae54f2f590 Fix <rdar://problem/6512717> by correctly reading the right offset in the token data in PTHLexer::getSourceLocation().
llvm-svn: 62725
2009-01-21 22:41:38 +00:00
Fariborz Jahanian 54fa418d03 Type of property and its ivar is more restrictive
that rules for assignment.

llvm-svn: 62524
2009-01-19 20:13:47 +00:00
Douglas Gregor dd430f7ec9 Centralize error reporting of improper uses of incomplete types in the
new DiagnoseIncompleteType. It provides additional information about
struct/class/union/enum types when possible, either by pointing to the
forward declaration of that type or by pointing to the definition (if
we're in the process of defining that type). 
Fixes <rdar://problem/6500531>.

llvm-svn: 62521
2009-01-19 19:26:10 +00:00
Fariborz Jahanian dab04840f0 Patch to allow @dynamic synthesis of property in a category,
with @synthesize being illegal.

llvm-svn: 62515
2009-01-19 18:16:19 +00:00
Fariborz Jahanian 091ae97786 Diagnose when method parameter is an object.
llvm-svn: 62431
2009-01-17 21:57:49 +00:00
Fariborz Jahanian 10401ce2e0 Don't ICE (issue diagnostics) when receiver is a non-objc
type.

llvm-svn: 62355
2009-01-16 20:35:09 +00:00
Fariborz Jahanian 1778f4bf6d Don't ICE on user redeclaration of objc's built-in types.
Issue diagnostics instead if types do not match.

llvm-svn: 62349
2009-01-16 19:58:32 +00:00
Fariborz Jahanian 255c0958dd Implemenent objective-c's NSObject attribute as a way of ddeclaraing c-type
objects as an objective-c object.

llvm-svn: 62197
2009-01-13 23:34:40 +00:00
Douglas Gregor c6f58fe266 Implement support for anonymous structs and unions in C. Both C and
C++ handle anonymous structs/unions in the same way. Addresses several
bugs:

  <rdar://problem/6259534>
  <rdar://problem/6481130>
  <rdar://problem/6483159>

The test case in PR clang/1750 now passes with -fsyntax-only, but
CodeGen for inline assembler still fails.

llvm-svn: 62112
2009-01-12 22:49:06 +00:00
Fariborz Jahanian 8e1555c7c3 Patch to supprt case of readonly property being
assigned to when it has user declared setter method
defined in the class implementation (but no declaration in
the class itself).

llvm-svn: 62098
2009-01-12 19:55:42 +00:00
Douglas Gregor 45a33ecce1 Properly set the scope of non-fields declared within a struct, union,
or enum to be outside that struct, union, or enum. Fixes several
regressions: 

  <rdar://problem/6487662>
  <rdar://problem/6487669>
  <rdar://problem/6487684>
  <rdar://problem/6487702>
  PR clang/3305
  PR clang/3312

There is still some work to do in Objective-C++, but this requires
that each of the Objective-C entities (interfaces, implementations,
etc.) to be introduced into the context stack with
PushDeclContext/PopDeclContext. This will be a separate fix, later.

llvm-svn: 62091
2009-01-12 18:45:55 +00:00
Fariborz Jahanian 8630b2d992 Explicit declaration of property setters over-ride
prohibition of 'readonly' properties in an assignment.

llvm-svn: 62028
2009-01-10 18:43:55 +00:00
Fariborz Jahanian 519976c4e9 This patch removes mergeProperties and does the property lookup
in designated protocols lazily.

llvm-svn: 62007
2009-01-09 21:04:52 +00:00
Daniel Dunbar f4c6616d9d Fix crash on null deference when searching for readwrite properties in
categories.
 - Also, simplify nesting via early return.

llvm-svn: 61968
2009-01-09 01:04:21 +00:00
Ted Kremenek 339153d3be Re-enable PTH testing for Cocoa.h and Carbon.h (and include testing for Objective-C++).
llvm-svn: 61965
2009-01-09 00:41:48 +00:00
Ted Kremenek cb5a95f3a4 Temporarily revert r61956 and r61957 (PTH tests failing).
llvm-svn: 61960
2009-01-09 00:27:29 +00:00
Ted Kremenek 8598addcd7 Enhance -fsyntax-only test of Cocoa.h to also include testing for PTH.
llvm-svn: 61957
2009-01-08 23:41:35 +00:00
Fariborz Jahanian d11dc0b1d9 Place warning about 'readonly' property attributes which
are related to setter syntax under -Wreadonly-setter-attrs
to prevent warnings in projects built with gcc.

llvm-svn: 61953
2009-01-08 23:23:10 +00:00
Douglas Gregor 82ac25e4a7 Unify the code for defining tags in C and C++, so that we always
introduce a Scope for the body of a tag. This reduces the number of
semantic differences between C and C++ structs and unions, and will
help with other features (e.g., anonymous unions) in C. Some important
points:

  - Fields are now in the "member" namespace (IDNS_Member), to keep
    them separate from tags and ordinary names in C. See the new test
    in Sema/member-reference.c for an example of why this matters. In
    C++, ordinary and member name lookup will find members in both the
    ordinary and member namespace, so the difference between
    IDNS_Member and IDNS_Ordinary is erased by Sema::LookupDecl (but
    only in C++!). 
  - We always introduce a Scope and push a DeclContext when we're
    defining a tag, in both C and C++. Previously, we had different
    actions and different Scope/CurContext behavior for enums, C
    structs/unions, and C++ structs/unions/classes. Now, it's one pair
    of actions. (Yay!)

There's still some fuzziness in the handling of struct/union/enum
definitions within other struct/union/enum definitions in C. We'll
need to do some more cleanup to eliminate some reliance on CurContext
before we can solve this issue for real. What we want is for something
like this:

  struct X {
    struct T { int x; } t;
  };

to introduce T into translation unit scope (placing it at the
appropriate point in the IdentifierResolver chain, too), but it should
still have struct X as its lexical declaration
context. PushOnScopeChains isn't smart enough to do that yet, though,
so there's a FIXME test in nested-redef.c

llvm-svn: 61940
2009-01-08 20:45:30 +00:00
Fariborz Jahanian dd2d75bb52 Don't ICE when messaging on 'super' receiver when class
of category implementation is undeclared. Issue error instead.

llvm-svn: 61882
2009-01-07 21:01:41 +00:00
Nuno Lopes 037bc858a0 add RUN line
llvm-svn: 61452
2008-12-27 23:47:34 +00:00
Douglas Gregor 033f56d533 Add some block-pointer conversions in C++
llvm-svn: 61359
2008-12-23 00:53:59 +00:00
Fariborz Jahanian ed4c443193 Patch to remove bogus warning in case of @dynamic
property in a category and to issue diagnostics
for mismatch method in some other cases.

llvm-svn: 61336
2008-12-22 19:05:31 +00:00
Anders Carlsson 324de7ba46 Fix for PR3234
llvm-svn: 61245
2008-12-19 17:27:57 +00:00
Steve Naroff d96f7cca5f Fix http://llvm.org/bugs/show_bug.cgi?id=3189.
llvm-svn: 61202
2008-12-18 15:50:41 +00:00
Fariborz Jahanian fff8cba8da Consolidated property check into property-typecheck-1.m file.
Improved on property diagnostics.
Added a FIXME per Steve's comments.

llvm-svn: 61141
2008-12-17 17:55:55 +00:00
Steve Naroff 596e137c84 Fix <rdar://problem/6450964> clang on xcode: Assertion failed: (RecordForDecl && "lookupFieldDeclForIvar no storage for class").
This was a recent regression caused by r61043 (related to code gen. for ivar references).

Fariborz, please review. I have some other concerns related to code generation for ivars that we can discuss later.

llvm-svn: 61134
2008-12-17 14:13:49 +00:00
Fariborz Jahanian 1470e9322e Semantics of @protocol attributes.
llvm-svn: 61114
2008-12-17 01:07:27 +00:00
Fariborz Jahanian 3a1bb22178 Patch to check for ObjC's property type.
llvm-svn: 61090
2008-12-16 17:51:01 +00:00
Fariborz Jahanian a599c1352b Diagnose that ivars in current and super class may not
be duplicates and a test case.

llvm-svn: 61068
2008-12-16 01:08:35 +00:00
Steve Naroff c68cfcfd03 The "real" fix for <rdar://problem/6424347> clang on xcode: Assertion failed: (0 && "unexpected type"), function mergeTypes,
Commit r60845 was premature.

llvm-svn: 60852
2008-12-10 22:14:21 +00:00
Steve Naroff 13ac125edf Fix <rdar://problem/6424347> clang on xcode: Assertion failed: (0 && "unexpected type"), function mergeTypes,
llvm-svn: 60845
2008-12-10 20:07:25 +00:00
Steve Naroff 68e167df8e Fix <rdar://problem/6418623> Bogus block type compatibility warning.
llvm-svn: 60842
2008-12-10 17:49:55 +00:00
Fariborz Jahanian ea831ee11c Prevent bogus warning on unimplemented setter/getter when user
has added declaration of these methods in its @interface.

llvm-svn: 60803
2008-12-09 22:43:22 +00:00
Steve Naroff 70cb0071c9 Add testcase for commit r60781.
llvm-svn: 60793
2008-12-09 20:59:16 +00:00
Steve Naroff 5fd31b17df ObjCInterfaceDecl::lookupInstanceMethod() needs to look through a categories protocols.
Fixes <rdar://problem/6418640> clang on prokit: error: incompatible type returning 'id', expected 'NSSize'

llvm-svn: 60716
2008-12-08 20:57:28 +00:00
Fariborz Jahanian 3edadfc730 Changed 'readonly' 'retain/copy' diagnostics into
warning as it is allowed in gcc and will break projects.

llvm-svn: 60710
2008-12-08 19:28:10 +00:00
Fariborz Jahanian 3685995d2c Since we do not allow a readonly property to be 'copy'retain', we
must allow the continuation class to extend it to a 'readwrite'
and 'copy/retain'.

llvm-svn: 60709
2008-12-08 18:47:29 +00:00
Fariborz Jahanian d2c2ad515e Use of properties declared in protocols in the category
via the category's protocol list1s, with appropriate
diagnsostics and a test case.

llvm-svn: 60634
2008-12-06 23:03:39 +00:00
Fariborz Jahanian ff83998e31 Improve error reporting of property and setter/getter
type mimatches.

llvm-svn: 60630
2008-12-06 21:48:16 +00:00
Fariborz Jahanian 5a3422f602 Patch to diagnose a variety of misuse of property
attributes. Example would be, readonly, assign or
assign, copy, etc.

llvm-svn: 60620
2008-12-06 01:12:43 +00:00
Fariborz Jahanian fbbaf6afae This test checks for duplicate implementation of the same
property. It also checks for duplicate use of the same ivar
in two different iproperty implementations. It also caught
an error for a test case used in CodeGen :).

llvm-svn: 60610
2008-12-05 22:32:48 +00:00
Fariborz Jahanian 88909849bb Fixed a test case. Added a test case showing property setter's
type mismatch (related to my last patch).

llvm-svn: 60599
2008-12-05 18:38:31 +00:00
Fariborz Jahanian 7988d7dc3e (instance/class) Method type checking between class and its implementation.
(instance/class) Method type checking between category and its implementation.
And a test case for all.

llvm-svn: 60598
2008-12-05 18:18:52 +00:00
Fariborz Jahanian 521b3a363e Patch for diagnosing type mismatch between
methods in class and its implementation.
This is work in progress.

llvm-svn: 60573
2008-12-05 01:35:25 +00:00
Chris Lattner 2ca529ce61 instead of forcing blocks on by default, make them default to off, but let
specific targets default them to on.  Default blocks to on on 10.6 and later.
Add a -fblocks option that allows the user to override the target's default.
Use -fblocks in the various testcases that use blocks.

llvm-svn: 60563
2008-12-04 23:20:07 +00:00
Fariborz Jahanian 5271058c75 Output better diagnostics for continuation class
property attribute mis-specification.

llvm-svn: 60562
2008-12-04 22:56:16 +00:00
Fariborz Jahanian e7167c28f6 Removed a FIXME. Added a test case for anonymous category.
llvm-svn: 60115
2008-11-26 20:33:54 +00:00
Fariborz Jahanian f8ef9f3dc9 Set default property attributes on each property.
Implemented anonymous category (also know as continuation class)
used to override main class's property attribute. This is work in 
propgress.

llvm-svn: 60114
2008-11-26 20:01:34 +00:00
Douglas Gregor 08d96d5182 Fix a minor typo in the handling of the conditional operator for Objective-C interface pointers
llvm-svn: 60096
2008-11-26 06:43:45 +00:00
Fariborz Jahanian 9a207ee4dc Patch to allow over-riding of readonly property to
a writable property in one of its category.

llvm-svn: 60035
2008-11-25 17:56:43 +00:00
Fariborz Jahanian 8fc3741b76 Patch to remove bogus waring when a property declaration
is imported from a protocol into the implementation.

llvm-svn: 59988
2008-11-24 22:16:00 +00:00
Chris Lattner 1e5665e6be Change a whole lot of diagnostics to take QualType's directly
instead of converting them to strings first.  This also fixes a
bunch of minor inconsistencies in the diagnostics emitted by clang
and adds a bunch of FIXME's to DiagnosticKinds.def.

llvm-svn: 59948
2008-11-24 06:25:27 +00:00
Chris Lattner f3d3faeca6 Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of
uses of getName() with uses of getDeclName().  This upgrades a bunch of
diags to take DeclNames instead of std::strings.

This also tweaks a couple of diagnostics to be cleaner and changes
CheckInitializerTypes/PerformInitializationByConstructor to pass
around DeclarationNames instead of std::strings.

llvm-svn: 59947
2008-11-24 05:29:24 +00:00
Chris Lattner 86d7d91366 Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make it
assert if the name is not an identifier.  Update callers to do the right
thing and avoid this method in unsafe cases.  This also fixes an objc
warning that was missing a space, and migrates a couple more to taking
IdentifierInfo and QualTypes instead of std::strings.

llvm-svn: 59936
2008-11-24 03:54:41 +00:00
Chris Lattner 4fc69799f5 Rewrite FindDiagnostics to be more strict about the formatting of the
expected-foo strings.  Now the only allowed characters between 
expected-error and {{  is whitespace.

llvm-svn: 59925
2008-11-24 01:28:17 +00:00
Chris Lattner 12f7c5a36a convert some more warnings to NOTEs.
llvm-svn: 59923
2008-11-23 23:26:13 +00:00
Chris Lattner d068503565 remove warn_previous_declaration
llvm-svn: 59922
2008-11-23 23:20:13 +00:00
Chris Lattner 03c4041cb5 make the 'to match this' diagnostic a note.
llvm-svn: 59921
2008-11-23 23:17:07 +00:00
Chris Lattner 0369c57ac6 Make all the 'redefinition' diagnostics more consistent, and make the
"previously defined here" diagnostics all notes.

llvm-svn: 59920
2008-11-23 23:12:31 +00:00
Chris Lattner e6447ef989 make some objc redefinition warnings more consistent: call definitions
"definitions", not declarations.  Point out the location of the 
original definition.

llvm-svn: 59919
2008-11-23 22:46:27 +00:00
Chris Lattner 88dcd2a1ab Tweak duplicate category diagnostic to work like the duplicate protocol diagnostic.
Also, point out where the previous decl was.  This unxfails two tests.

llvm-svn: 59918
2008-11-23 22:38:38 +00:00
Chris Lattner e3d20d9545 Convert IdentifierInfo's to be printed the same as DeclarationNames
with implicit quotes around them.  This has a bunch of follow-on 
effects and requires tweaking to a whole lot of code.  This causes
a regression in two tests (xfailed) by causing it to emit things like:

  Line 10: duplicate interface declaration for category 'MyClass1' ('Category1')

instead of:

  Line 10: duplicate interface declaration for category 'MyClass1(Category1)'

I will fix this in a follow-up commit.

As part of this, I had to start switching stuff to use ->getDeclName() instead
of Decl::getName() for consistency.  This is good, but I was planning to do this
as an independent patch.  There will be several follow-on patches
to clean up some of the mess, but this patch is already too big.

llvm-svn: 59917
2008-11-23 21:45:46 +00:00
Fariborz Jahanian 5118c418e6 Support for implicit property assignment. Error assigning to
'implicit' property with no 'setter'.

llvm-svn: 59878
2008-11-22 20:25:50 +00:00
Fariborz Jahanian bf65ce5372 And a test case for my last patch.
llvm-svn: 59875
2008-11-22 18:40:47 +00:00
Chris Lattner cedef8d111 merge some simple call diagnostics.
llvm-svn: 59831
2008-11-21 18:44:24 +00:00
Fariborz Jahanian c1877cbc21 __weak ivar need not warn.
llvm-svn: 59743
2008-11-20 19:35:51 +00:00
Fariborz Jahanian d4081c697a Added a test case for __weak field decls. Change SetVarDeclObjCAttribute
to static function. Added comments.

llvm-svn: 59738
2008-11-20 18:10:58 +00:00
Steve Naroff 9e4ac111f0 Fix <rdar://problem/6150376> [sema] crash on invalid message send.
The core fix in Sema::ActOnClassMessage(). All the other changes have to do with passing down the SourceLocation for the receiver (to properly position the cursor when producing an error diagnostic).

llvm-svn: 59639
2008-11-19 15:54:23 +00:00
Steve Naroff 119f60e12a Fix <rdar://problem/6329769> [sema] crash on duplication definition of interface with protocols.
As soon as we detect duplicate interfaces, discontinue further semantic checks (returning the original interface).

This is now consistent with how we handle protocols (and less error prone in general).

llvm-svn: 59541
2008-11-18 19:15:30 +00:00
Steve Naroff 773cdc7c0d Fix <rdar://problem/6333904> [sema] message lookup on super is incorrect
Missing special lookup rule in Sema::ActOnInstanceMessage().

llvm-svn: 59467
2008-11-17 22:29:32 +00:00
Steve Naroff 753567f2c1 Fix <rdar://problem/6316324> [sema] spurious warning on comparison of qualified id.
llvm-svn: 59459
2008-11-17 19:49:16 +00:00
Steve Naroff ecf2bb8724 Fix <rdar://problem/6320086> parser rejects block capturing ivar.
llvm-svn: 59444
2008-11-17 16:28:52 +00:00
Steve Naroff 1d4a9a31b6 Fix <rdar://problem/6315646> clang on xcode: error: invalid operands to binary expression ('id<NSTableViewDelegate>' and 'XCExtendedArrayController *').
There is still a bug here (as the FIXME in the test case indicates). Prior to this patch, the bug would generate an error. Now, we simply do nothing (which is less harmful until we can get it right). The complete bug fix will require changing ASTContext::mergeTypes(), which I'd like to defer for now.

llvm-svn: 58241
2008-10-27 10:33:19 +00:00
Steve Naroff b0c653a649 Fix <rdar://problem/6311947> clang on xcode (regression): error: use of undeclared identifier 'expandedValue'.
Mea culpa: I introduced this regresson in the following 2 commits: r57529 (10/14), r57841 (10/20).

llvm-svn: 58007
2008-10-22 22:40:28 +00:00
Steve Naroff 1df62692f2 Fix <rdar://problem/6257675> error: member reference base type ('NSUserDefaults *') is not a structure or union.
Teach Sema::ActOnMemberReferenceExpr() to look through local category implementations associated with the class.

llvm-svn: 57995
2008-10-22 19:16:27 +00:00
Steve Naroff e94444faf3 Fix <rdar://problem/6257645> clang static analyzer crashes when encountering blocks as objects
ASTContext::isObjCObjectPointerType() needs to consider blocks as objects.

llvm-svn: 57913
2008-10-21 18:21:45 +00:00
Steve Naroff 90255b4f54 Fix a crasher during error recovery in Parser::ParseObjCTypeName().
Found this while fixing another unrelated radar.

llvm-svn: 57904
2008-10-21 14:15:04 +00:00
Steve Naroff a0ed165a84 Fix <rdar://problem/6261178> clang-on-xcode: [sema] multiple method warning is over enthusiastic.
Fix <rdar://problem/6265257> warnings for ambiguous message send swamp other warnings.

Reworked Sema::MatchTwoMethodDeclarations() to optionally match based on method size and alignment (the default in GCC). Changed Sema::LookupInstanceMethodInGlobalPool() to use this feature.

Added -Wno-struct-selector-match to driver, however didn't hook it up yet. Added a FIXME that says this.

llvm-svn: 57898
2008-10-21 10:37:50 +00:00
Steve Naroff bca9fd755d Fix <rdar://problem/6268365> Parser rejects property (dot notation) access on id<protocol>.
llvm-svn: 57850
2008-10-20 22:53:06 +00:00
Steve Naroff ea54d9ef72 Sema::CheckCompareOperands() and ASTContext::mergeTypes(): Change handling of ObjC qualified id types to be consistent with gcc. This changes a handful of test case errors into warnings (diff will tell you which cases have changed).
llvm-svn: 57841
2008-10-20 18:19:10 +00:00
Chris Lattner 64b1f2f030 More property attribute recovery improvements. Instead of this:
crash.m:8:12: error: type name requires a specifier or qualifier
@property (readonlyx, getter=isAwesome) int _awesome;
           ^
crash.m:8:29: error: expected ';' at end of declaration list
@property (readonlyx, getter=isAwesome) int _awesome;
                            ^
crash.m:8:39: error: expected identifier or '('
@property (readonlyx, getter=isAwesome) int _awesome;
                                      ^

we now get:

crash.m:8:12: error: unknown property attribute 'readonlyx'
@property (readonlyx, getter=isAwesome) int _awesome;
           ^

Also, we can eliminate isObjCPropertyAttribute now.

llvm-svn: 57811
2008-10-20 07:15:22 +00:00
Chris Lattner 55c53a3dd8 add testcase for the recovery improvements in my last patch.
llvm-svn: 57810
2008-10-20 07:03:51 +00:00
Chris Lattner 93429b047b fix a crash on unnamed properties like:
@property (readonly) int : 4;

llvm-svn: 57805
2008-10-20 06:33:53 +00:00
Chris Lattner da9fb15b90 refactor a bunch of code:
Check for @end in ParseObjCInterfaceDeclList instead of in each caller
Handle @required and @optional with the same code

Add some fixmes about some apparently objc2 code that is being accepted
in objc1.

llvm-svn: 57803
2008-10-20 06:10:06 +00:00
Daniel Dunbar 70e3ebafdb Improve attribute parsing & tests.
- Support noreturn on function-typed variables.

 - Extend isFunctionOrMethod to return true for K&R functions and
   provide hasFunctionProto to check if a decl has information about
   its arguments. This code needs some serious cleaning, but works.

 - Add/improve test cases for noreturn and unused.

llvm-svn: 57778
2008-10-19 02:04:16 +00:00
Steve Naroff 9546eee50a Fix <rdar://problem/6239726> Parser rejects: type of property 'list' does not match type of ivar
and
http://llvm.org/bugs/show_bug.cgi?id=2893

llvm-svn: 57640
2008-10-16 14:59:30 +00:00
Steve Naroff 8afa98916a Downgrade incompatibilities with objc qualified types (e.g. id <P>) to warnings.
Note: One day, we should consider moving the actual diags to ObjCQualifiedIdTypesAreCompatible(), since it has more information on the actual problem. GCC currently emits slightly more instructive errors for some cases involving protocols. I added a FIXME to the code.

llvm-svn: 57529
2008-10-14 22:18:38 +00:00
Steve Naroff 4a82d815de Fix <rdar://problem/6191148> [sema] Objective-C method lookup (at global scope) fails to handle overloaded selectors properly.
Long standing bug in Sema::ActOnInstanceMessage(). We now warn when messaging an "id" with multiple method signatures in scope. The diags are a little verbose, however they can be streamlined if necessary. 

llvm-svn: 56843
2008-09-30 14:38:43 +00:00
Steve Naroff c2036d5da4 Fix <rdar://problem/6253149> property declaration doesn't declare getter and setter.
llvm-svn: 56785
2008-09-29 14:20:56 +00:00
Steve Naroff 8edb573a79 Fix <rdar://problem/6252129> implementation of method in category doesn't effectively declare it for methods below.
llvm-svn: 56771
2008-09-28 14:55:53 +00:00
Daniel Dunbar c136e0ca43 Sema support for format and noreturn attributes on Objective-C methods.
llvm-svn: 56640
2008-09-26 04:12:28 +00:00
Daniel Dunbar 980c66946b Add support for CFString in format attribute.
llvm-svn: 56639
2008-09-26 03:32:58 +00:00
Daniel Dunbar e8a06e619a Implement type checking of Objective-C property attributes.
- readonly and readwrite are mutually exclusive.
 - assign, copy, and retain are mutually exclusive.
 - copy and retain are invalid on non-object types.
 - Warn about using default 'assign' property on object types
   (attempting to follow gcc behavior).

llvm-svn: 56507
2008-09-23 21:53:23 +00:00
Steve Naroff cd5e782bce Fix http://llvm.org/bugs/show_bug.cgi?id=2816.
llvm-svn: 56433
2008-09-22 10:28:57 +00:00
Daniel Dunbar 484603be40 Iterate on sema for :? in Objective-C:
- Follow C99 behavior of using other operand type when one of
   operands is a null pointer constant.
 - Fix overenthusiastic devolving of any Objective-C types to id:
   o If either operand has an Objective-C object type then:
     - If both operands are interfaces and either operand can be
       assigned to the other, use that type as the composite type.
     - Otherwise, if either type is id, use id as the composite type.
     - Otherwise, warn about incompatible types and use id as the
       composite type.
 - Return handling of qualified idea to separate test following
   general pointer type checking.
   o Upgraded from old code to allow devolving to id (without warning,
     which matches GCC).
 - <rdar://problem/6212771>

Add test case for issues fixed above, XFAIL though because it exposed
a new issue in property handling.

llvm-svn: 56135
2008-09-11 23:12:46 +00:00
Daniel Dunbar ce05c8eb49 Fix two bugs exposed by array passing assert:
(1) Additional arguments to variadic methods should have default
promotions applied.

(2) Additional arguments to non-variadic methods were allowed.

llvm-svn: 56084
2008-09-11 00:50:25 +00:00
Daniel Dunbar b034bc71d4 Add XFAIL test case for:
<rdar://problem/6211479> [sema] array type invalid for Obj-C property

llvm-svn: 56075
2008-09-10 23:11:23 +00:00
Daniel Dunbar 98982ef954 Fix unintended use of doxygen comment strings.
llvm-svn: 55805
2008-09-04 21:54:53 +00:00
Daniel Dunbar c7dfbfd544 Prevent invalid warnings about incomplete implementations for methods
which are inherited from base clases or protocols.

llvm-svn: 55790
2008-09-04 20:01:15 +00:00
Daniel Dunbar de1ec9cdcd Improve type-checking of ?: for Objective-C types.
- Allow any Objective-C object types to devolve to type id in a ?:
   expression. This matches gcc behavior more closely.

llvm-svn: 55705
2008-09-03 17:53:25 +00:00
Daniel Dunbar ef89086c12 Restore Objective-C dot-syntax access of methods.
- Now also searches for correct setter method.
 - There are still some issues regarding validation of the setter
   method and access of read-only properties.

llvm-svn: 55686
2008-09-03 01:05:41 +00:00
Daniel Dunbar e0a09432cc Temporarily disable some tests which due to dot-syntax
access of methods.

llvm-svn: 55569
2008-08-30 16:22:34 +00:00
Daniel Dunbar e0a673e60f Update test case (we were missing a warning here)
llvm-svn: 55408
2008-08-27 05:41:04 +00:00
Daniel Dunbar 5e558bcf26 Add ObjCPropertyDecl::isReadOnly.
Respect isReadOnly when generating synthesized method decls.

llvm-svn: 55364
2008-08-26 07:16:44 +00:00
Daniel Dunbar 40bf7fe20e In incompatible pointer-typed ?: expressions, add implicit conversion
of RHSs to id type instead of void* if either has Objective-C object
type.
 - This ensures the result can still be used in normal places an
   object can be used, like a message send.

Add implicit conversions for ?: applied to qualified id types to
ensure that the RHSs are compatible. 
 - This prevents a codegen crash (creating invalid PHI nodes).
 - Again, this relates to the fact that qualified id types have no
   canonical types.
 - Note that the implicit type casted to is incorrect, however this
   doesn't currently cause problems because of the flexibility of the
   id type.

Test cases for above.

llvm-svn: 55346
2008-08-26 00:41:39 +00:00
Anders Carlsson 1ec2ccd8ee Objective-C foreach selector elements must be lvalues.
llvm-svn: 55316
2008-08-25 18:16:36 +00:00
Anders Carlsson c7c20702b1 Fix silly bug in objc_gc attribute parsing and add test case
llvm-svn: 55286
2008-08-24 16:33:25 +00:00
Chris Lattner 2ebb178f8b Fix a FIXME by not creating an invalid AST on erroneous input. Also
make diagnostic output in some other malformed cases significantly
more useful.  This fixes PR2708

llvm-svn: 55215
2008-08-23 01:48:03 +00:00
Chris Lattner 3f4c68b78e proper grammar n stuph
llvm-svn: 54954
2008-08-18 22:51:28 +00:00
Chris Lattner e5d812af59 warn when someone tries to make an array of ObjC interfaces instead of array
of pointers to them.  rdar://4304469

llvm-svn: 54953
2008-08-18 22:49:54 +00:00
Chris Lattner 197a301669 Fix rdar://6124613 a crash on invalid code.
llvm-svn: 54340
2008-08-05 06:19:09 +00:00
Chris Lattner 9c1842b612 simplify some code.
llvm-svn: 54091
2008-07-26 03:47:43 +00:00
Chris Lattner 908d39e45e remove duplicate error message.
llvm-svn: 54090
2008-07-26 03:40:25 +00:00
Chris Lattner 31236f8744 remove objc prefixes from these tests.
llvm-svn: 54085
2008-07-26 01:04:40 +00:00
Chris Lattner 89026888ef move all objc sema tests into a new SemaObjC directory. Next step is to
remove the objc- prefix from the tests that use it.

llvm-svn: 54084
2008-07-26 00:57:24 +00:00