Commit Graph

215 Commits

Author SHA1 Message Date
Chris Lattner a9d0ffe57e simplify this code to not bother stripping to canonical types, and
indent code properly

llvm-svn: 68866
2009-04-11 18:01:59 +00:00
Fariborz Jahanian 60331be08d Fix another fallout from defining __weak unconditionally.
llvm-svn: 68834
2009-04-10 22:42:54 +00:00
Ted Kremenek a53274e5ba Use getDeclName() instead of getIdentifier() (safe against null pointers)
llvm-svn: 68804
2009-04-10 18:25:37 +00:00
Douglas Gregor bcced4ec31 Propagate the ASTContext to various AST traversal and lookup functions.
No functionality change (really).

llvm-svn: 68726
2009-04-09 21:40:53 +00:00
Fariborz Jahanian 9ecb84bb21 Now that we have __weak defined as attribute in all modes,
we must not issue gc-specific errors in non-gc mode.

llvm-svn: 68551
2009-04-07 21:25:06 +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
Fariborz Jahanian bc3c77b881 Fixed visibility issues related to objc2's synthesized
ivars.

llvm-svn: 68453
2009-04-06 18:30:00 +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
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
Fariborz Jahanian e4fd640147 Fix a bug in declaration of property in continuation
class which was exposed by implementation of 
objc2's nonfragile abi code gen.

llvm-svn: 68259
2009-04-01 23:23:53 +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
Chris Lattner 5bbb3c8ad9 Push DeclGroup much farther throughout the compiler. Now the various
productions (except the already broken ObjC cases like @class X,Y;) in 
the parser that can produce more than one Decl return a DeclGroup instead
of a Decl, etc.

This allows elimination of the Decl::NextDeclarator field, and exposes
various clients that should look at all decls in a group, but which were
only looking at one (such as the dumper, printer, etc).  These have been
fixed.

Still TODO:

1) there are some FIXME's in the code about potentially using
DeclGroup for better location info.
2) ParseObjCAtDirectives should return a DeclGroup due to @class etc.
3) I'm not sure what is going on with StmtIterator.cpp, or if it can
   be radically simplified now.
4) I put a truly horrible hack in ParseTemplate.cpp.

I plan to bring up #3/4 on the mailing list, but don't plan to tackle
#1/2 in the short term.

llvm-svn: 68002
2009-03-29 16:50:03 +00:00
Chris Lattner 114597d69b tighten this up, the decl *must* be a declcontext, no need for the dynamic check.
llvm-svn: 67978
2009-03-29 04:30:19 +00:00
Chris Lattner 83f095cc7e Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for a
pointer.  Its purpose in life is to be a glorified void*, but which does not
implicitly convert to void* or other OpaquePtr's with a different UID.

Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>.  Change the 
entire parser/sema interface to use DeclPtrTy instead of DeclTy*.  This
makes the C++ compiler enforce that these aren't convertible to other opaque
types.

We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc,
but I don't plan to do that in the short term.

The one outstanding known problem with this patch is that we lose the 
bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to
bitmangle the success bit into the low bit of DeclPtrTy.  I will rectify
this with a subsequent patch.

llvm-svn: 67952
2009-03-28 19:18:32 +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 3654e65adf objc: Implemented variables declared in class interface
whose sema decl is at the translation unit.

llvm-svn: 67249
2009-03-18 22:33:24 +00:00
Ted Kremenek 9a46804ca8 Make Selector::getIdentifierInfo() private. I took a first attempt at this last
week in:

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090302/013580.html

That patch caused the output of the diagnostics to change. Since
'DeclarationName' can already reason about Selectors and the Diagnostics logic
reasons about DeclarationName, there is no additional code needed to get the
diagnostics working by making Selector::getIdentifierInfo() private.

llvm-svn: 66992
2009-03-14 00:20:08 +00:00
Steve Naroff 846b1ec40f Remove ActiveScope (revert http://llvm.org/viewvc/llvm-project?view=rev&revision=65694 and http://llvm.org/viewvc/llvm-project?view=rev&revision=66741).
Will replace with something better today...

llvm-svn: 66893
2009-03-13 15:38:40 +00:00
Ted Kremenek 22988cf493 Revert my last couple patches until I can get them to not make the tests fail.
llvm-svn: 66317
2009-03-07 01:47:10 +00:00
Ted Kremenek a44b4f987c Teach Diagnostic about Selector.
llvm-svn: 66314
2009-03-07 01:36:13 +00:00
Ted Kremenek 0666a6ce70 Selector: (changes made after discussing this more with Steve Naroff)
- Make Selector::getAsIdentifierInfo() private.  Using IdentifierInfo* in
  Selector is an implementation detail that clients shouldn't think about.
- Modify diagnostic emission in Sema::ProcessPropertyDecl to not use
  Selector::getAsIdentifierInfo() (which could crash when IdentifierInfo* is
  null) and instead use Selector::getAsString().
- Tidy up Selector::getAsString() implementation.

llvm-svn: 66313
2009-03-07 01:22:02 +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
Chris Lattner 7b26b29351 simplify Sema::AddInstanceMethodToGlobalPool, no functionality change.
llvm-svn: 66016
2009-03-04 05:16:45 +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 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 abf63e7bb3 Fixed a typo.
llvm-svn: 65855
2009-03-02 19:06:08 +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
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
Steve Naroff 70f41d6f07 Minor name change (move the ObjC prefix to a more appropriate place).
llvm-svn: 65695
2009-02-28 16:59:13 +00:00
Steve Naroff d123bd05ca Fix <rdar://problem/6451399> problems with labels and blocks.
- Move the 'LabelMap' from Sema to Scope. To avoid layering problems, the second element is now a 'StmtTy *', which makes the LabelMap a bit more verbose to deal with.
- Add 'ActiveScope' to Sema. Managed by ActOnStartOfFunctionDef(), ObjCActOnStartOfMethodDef(), ActOnBlockStmtExpr().
- Changed ActOnLabelStmt(), ActOnGotoStmt(), ActOnAddrLabel(), and ActOnFinishFunctionBody() to use the new ActiveScope.
- Added FIXME to workaround in ActOnFinishFunctionBody() (for dealing with C++ nested functions).  

llvm-svn: 65694
2009-02-28 16:48:43 +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
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
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 326064168a Fix <rdar://problem/6500554> missing objc error message.
llvm-svn: 65198
2009-02-20 22:59:16 +00:00
Chris Lattner 68d42c77b2 fix indentation
llvm-svn: 65170
2009-02-20 21:38:52 +00:00
Chris Lattner 2229872d2f add plumbing to get ASTContext& down to allocation/deallocation points in ObjCList,
but don't start using it yet.  Renamed some methods to be more consistent.

llvm-svn: 65168
2009-02-20 21:35:13 +00:00
Chris Lattner a499715c83 remove some more methods from objc decls, using the iterator
interfaces more consistently.

llvm-svn: 65138
2009-02-20 18:43:26 +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 a377833888 diagnose uses of deprecated typenames and tags.
We now pass all the deprecation tests in the objc.dg suite.

llvm-svn: 64679
2009-02-16 22:07:16 +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 9018ca8df8 early exit on error. This code is creating an invalid decl on error. This is
dubious, but at least mark it as an invalid decl.

llvm-svn: 64668
2009-02-16 21:26:43 +00:00
Fariborz Jahanian 8827046dd3 Remove an unused variable (which caused a warning).
llvm-svn: 64660
2009-02-16 19:40:26 +00:00
Fariborz Jahanian 7a855e33df Remove FindIvarDeclaration. Use lookupInstanceVariable is is functionally
the same.

llvm-svn: 64657
2009-02-16 19:35:27 +00:00
Chris Lattner 99a83317b7 code cleanup
llvm-svn: 64651
2009-02-16 19:25:52 +00:00
Chris Lattner 41fd42e782 propagate attributes onto property decls.
llvm-svn: 64643
2009-02-16 18:32:47 +00:00
Ben Laurie 7b1c6c09f7 Untabify.
llvm-svn: 64628
2009-02-16 09:18:41 +00:00