Commit Graph

308 Commits

Author SHA1 Message Date
Fariborz Jahanian 88fead8c48 Cannot type cast @selector expressions.
llvm-svn: 72284
2009-05-22 21:42:52 +00:00
Fariborz Jahanian 162af638a9 Added -fblocks to the test's options.
llvm-svn: 72274
2009-05-22 20:06:10 +00:00
Fariborz Jahanian db3a4c1388 (Next runtime only) check to see if class implements forwardInvocation method
and objects of this class are derived from 'NSProxy'.
Under such conditions, which means that every method possible is 
implemented in the class, we should not issue "Method definition not found" 
warnings.

llvm-svn: 72267
2009-05-22 17:12:32 +00:00
Fariborz Jahanian 8c46fec43d Fixed a warning bug when receiver is an object via
setting of NSObject attribute.

llvm-svn: 72225
2009-05-21 21:04:28 +00:00
Fariborz Jahanian f1c25029b4 implementation of format_arg for ObjC methods/functions.
Still more to do.

llvm-svn: 72173
2009-05-20 17:41:43 +00:00
Eli Friedman 45966b4671 Remove the -arch option from clang-cc: for all practical purposes, it's
redundant with -triple.

llvm-svn: 72108
2009-05-19 11:12:40 +00:00
Fariborz Jahanian 0c20bddc41 Don't warn if result/argument type of an implemented
method is a qualified id which conforms to the matching type
of its method declaration.

llvm-svn: 71817
2009-05-14 23:52:54 +00:00
Fariborz Jahanian 9e87721d47 Look for and diagnose missing sentinel argument on message
dispatch arguments which have sentinel attribute.

llvm-svn: 71737
2009-05-13 23:20:50 +00:00
Fariborz Jahanian d9d6e6e039 Changed wording of warning when attribute is on
method definition.

llvm-svn: 71615
2009-05-13 00:47:33 +00:00
Fariborz Jahanian 2bd617c46c Method attributes may only be specified on method
declarations.

llvm-svn: 71597
2009-05-12 21:36:23 +00:00
Fariborz Jahanian 5276014db2 We want to diagnose sending message to a forward class
and we also want to tell which message is actually 
being sent.

llvm-svn: 71296
2009-05-08 23:45:49 +00:00
Fariborz Jahanian 1bd844da80 Warn if forward class is used as a receiver.
llvm-svn: 71278
2009-05-08 23:02:36 +00:00
Fariborz Jahanian 3e68a1facc Fixes a bug in my last patch. Order of types reversed.
llvm-svn: 71267
2009-05-08 21:10:00 +00:00
Fariborz Jahanian b2ab73d93c More type checking for properties, accessors and
use of dot-syntax expression. This is to match gcc's.

llvm-svn: 71243
2009-05-08 19:36:34 +00:00
Mike Stump 5580bdcaa2 Add a warning for a missing copy attribute on a property that is a
block pointer.  Radar 6441502

llvm-svn: 71190
2009-05-07 23:06:50 +00:00
Fariborz Jahanian 0d451813f9 a forward class declaration matching a typedef name of a class
refers to the underlying class.
This is radar 6859726. Steve, please read the radar for my rational.

llvm-svn: 71181
2009-05-07 21:49:26 +00:00
Mike Stump 1b821b4fc5 Improve semantic checking for blocks. Radar 6441502
llvm-svn: 71145
2009-05-07 03:14:14 +00:00
Daniel Dunbar 4dbaaa6f43 Improve handling of (X86) target features.
- This is a WIP...

 - This adds -march= handling to the driver, and fixes the defaulting
   of -mcpu on Darwin (which was using the wrong test).

Instead of handling -m{sse, ...} in the driver, pass them to clang-cc as
 -target-feature [+-]name

In clang-cc, communicate with the (clang) target to discover the legal
features of a target, and the features which are enabled based on
-mcpu. This is currently hardcoded just enough to not be a feature
regression, we need to get this information from the backend's
TableGen information somehow.

This is used to construct the full list of features which are being
used, which is in turn used to initialize the predefines.

llvm-svn: 71061
2009-05-06 03:16:41 +00:00
Fariborz Jahanian 3baaffba6b Issue a warning in odd case of instance method used
in a 'Class' receiver which is not a root instance
method.

llvm-svn: 70987
2009-05-05 18:34:37 +00:00
Fariborz Jahanian 60637985de ignore weak_import attribute on objc method decls.
llvm-svn: 70901
2009-05-04 19:35:12 +00:00
Daniel Dunbar bdb23a1f56 Fix invalid error about duplicate declaration of padding bit field in
an interface.

llvm-svn: 70652
2009-05-03 01:08:28 +00:00
Fariborz Jahanian 07b7165b50 Check for method type conflict between declaration in
class/protocol and implementation which could be
an imm. implementation or down in the inheritance
hierarchy.

llvm-svn: 70568
2009-05-01 20:07:12 +00:00
Fariborz Jahanian 68592fc9e1 Use of super class ivar to synthesize property is back to being error.
llvm-svn: 70514
2009-04-30 21:39:24 +00:00
Fariborz Jahanian 334df667a3 Change to warning when property uses an ivar in super class
in an @synthesize diective, as it breaks few projects.

llvm-svn: 70441
2009-04-29 23:31:56 +00:00
Fariborz Jahanian bff0167a0b use of an ivar specified on a property @synthesize
and found in super class triggers a diagnostics.

llvm-svn: 70414
2009-04-29 21:45:02 +00:00
Chris Lattner 11a827471e fix PR4021, array and functions decay in the receiver position of an objc message send.
llvm-svn: 70373
2009-04-29 05:48:32 +00:00
Chris Lattner 669e32f8c0 rdar://6827200 - [sema] reject statically allocated arrays of interface types
Upgrade "array of interface" warning to an error.  In addition to being a
terrible idea, this crashes codegen.

llvm-svn: 70178
2009-04-27 01:55:56 +00:00
Chris Lattner edfa8d4557 Change SemaType's "GetTypeForDeclarator" and "ConvertDeclSpecToType" to
always return a non-null QualType + error bit.  This fixes a bunch of 
cases that didn't check for null result (and could thus crash) and eliminates
some crappy code scattered throughout sema.

This also improves the diagnostics in the recursive struct case to eliminate
a bogus second error.  It also cleans up the case added to function.c by forming
a proper function type even though the declarator is erroneous, allowing the
parameter to be added to the function.  Before:

t.c:2:1: error: unknown type name 'unknown_type'
unknown_type f(void*P)
^
t.c:4:3: error: use of undeclared identifier 'P'
  P+1;
  ^

After:
t.c:2:1: error: unknown type name 'unknown_type'
unknown_type f(void*P)
^

llvm-svn: 70023
2009-04-25 08:47:54 +00:00
Chris Lattner 12bdebbbf7 reject explicit pointer arithmetic on interface pointers in 64-bit objc ABI
llvm-svn: 70004
2009-04-24 23:50:08 +00:00
Fariborz Jahanian 1dcb32260a Avoid issuing spurious errors as side-effect of diagnosing
application of sizeof on an interface.

llvm-svn: 69980
2009-04-24 17:34:33 +00:00
Daniel Dunbar a2666fefd8 We don't accept this test anymore in a non-fragile ABI.
llvm-svn: 69944
2009-04-24 02:11:35 +00:00
Chris Lattner 62975a788e Fix rdar://6821047 - clang crashes on subscript of interface in 64-bit mode
Several changes here:
1. We change Type::isIncompleteType to realize that forward declared 
   interfaces are incomplete.  This eliminate special case code for this
   from the sizeof path, and starts us rejecting P[4] when P is a pointer
   to an incomplete interface.
2. Explicitly reject P[4] when P points to an interface in non-fragile ABI
   mode.
3. Switch the sizeof(interface) diagnostic back to an error instead of a 
   warning in non-fragile abi mode.

llvm-svn: 69943
2009-04-24 00:30:45 +00:00
Fariborz Jahanian 6f0f25b0d8 Diagnose if an implementation implements a forward class
declaration (and avoid issuing bogus error later on).

llvm-svn: 69928
2009-04-23 21:49:04 +00:00
Steve Naroff 3c301dc573 Sema::ActOnStartClassInterface(): Use PushOnScopeChains().
This enables class recognition to work with PCH. I believe this means we can remove Sema::ObjCInterfaceDecls and it's usage within Sema::LookupName(). Will investigate.

llvm-svn: 69891
2009-04-23 15:15:40 +00:00
Chris Lattner d27f8d8c9f rename test
llvm-svn: 69761
2009-04-22 00:59:27 +00:00
Chris Lattner 934074cd5f Fix a problem with objc foreach loop. It turns out that objc mode changes
for scoping to match C99 even when in C89 mode.  This patch fixes this 
(eliminating a "redefinition of thisKey" error), and also prevents non-sensical
diagnostics in -pedantic mode like this:

t.m:7:8: warning: variable declaration in for loop is a C99-specific feature
  for (id thisKey in keys) ;
       ^

llvm-svn: 69760
2009-04-22 00:54:41 +00:00
Mike Stump d79b5a85b0 Tighten up blocks type checking. This was discussed back in the
r56595 timeframe, but left undone.  Radar 6812711

llvm-svn: 69745
2009-04-21 22:51:42 +00:00
Chris Lattner 6750113d54 force a 32-bit triple.
llvm-svn: 69729
2009-04-21 21:42:41 +00:00
Daniel Dunbar d361c345c6 Force triple (test case fails for platforms with the non-fragile ABI).
llvm-svn: 69727
2009-04-21 21:17:29 +00:00
Chris Lattner a8c92540dd temporarily downgrade to a warning.
llvm-svn: 69720
2009-04-21 21:14:41 +00:00
Fariborz Jahanian ece1b2b0e1 Patch to diagnose use of objc's @defs in nonfragile abi.
llvm-svn: 69710
2009-04-21 20:28:41 +00:00
Chris Lattner 37920f5359 reject sizeof(itf) when itf is a forward declared interface, or when
in non-fragile abi mode.  rdar://6811884

llvm-svn: 69701
2009-04-21 19:55:16 +00:00
Daniel Dunbar 108098d56c Fix test typo.
llvm-svn: 69676
2009-04-21 16:03:31 +00:00
Daniel Dunbar 93c1914de3 Use an ASTRecordLayout to compute the sizeof an interface, not
addRecordToClass.
 - Among other things, this fixes a crash when applying sizeof to an
   interface with synthesized ivars, although things still aren't
   "correct" here.

llvm-svn: 69675
2009-04-21 15:48:54 +00:00
Chris Lattner 3501d43a10 implement semantic analysis for @synchronized, fixing a crash on invalid
rdar://6810940 - @synchronized has no sema checks

llvm-svn: 69670
2009-04-21 06:11:25 +00:00
Chris Lattner c70dd56477 add support for goto checking and @synchronized blocks,
rdar://6810106

llvm-svn: 69667
2009-04-21 06:01:00 +00:00
Chris Lattner c5f4ab6372 test that vlas are checked in an objc method context.
llvm-svn: 69508
2009-04-19 05:20:37 +00:00
Chris Lattner 508253d64b the scope checker does work with objc methods, add testcase.
llvm-svn: 69487
2009-04-18 22:37:38 +00:00
Chris Lattner b6e368235a I didn't understand how @catches were chained. Now that I get it, fix
the scope checker to not think @catches are nested in each other, eliminating
some bogus notes.

llvm-svn: 69486
2009-04-18 22:35:34 +00:00
Chris Lattner 5c926f3660 reject invalid jumps among pieces of @try blocks. This seems to work
reasonably well except for the problem that @catches are nested within
each other in the AST, giving the ugly diagnostics in L8.

llvm-svn: 69477
2009-04-18 21:28:52 +00:00