Commit Graph

5769 Commits

Author SHA1 Message Date
Chris Lattner dfd637f204 add a new helper function to FunctionDecl instead of it being
static in Decl.cpp.

llvm-svn: 70014
2009-04-25 05:56:45 +00:00
Chris Lattner ae4ee5be22 in:
typedef void foo(void);

We get a typedef for a functiontypeproto with no arguments, not
one with one argument and type void.  This means the code being
removed in SemaDecl is dead.

llvm-svn: 70013
2009-04-25 05:51:56 +00:00
Daniel Dunbar 68f1d8ed0c Driver: -mkernel disables default use of unwind tables (although I
don't yet understand where this is happening in llvm-gcc).

llvm-svn: 70012
2009-04-25 05:49:54 +00:00
Chris Lattner 3f863f6827 set NewFD->setInvalidDecl() in one place, sharing code and ensuring that
functions with prototypes get the bit.

llvm-svn: 70011
2009-04-25 05:44:12 +00:00
Daniel Dunbar 11892e951d Driver: -mkernel and -fapple-kext imply -mno-red-zone.
llvm-svn: 70010
2009-04-25 05:33:23 +00:00
Daniel Dunbar ef2ffbc390 Fix pointer addressing and array subscripting of Objective-C interface
types.
 - I broke this in the switch to representing interfaces with opaque
   types.

 - <rdar://problem/6822660> clang crashes on subscript of interface in
   32-bit mode

llvm-svn: 70009
2009-04-25 05:08:32 +00:00
Ted Kremenek e75de95408 Hook up attribute 'objc_ownership_retain' to the analyzer. This attribute allows
users to specify that a method's argument is visibly retained (reference count
incremented).

llvm-svn: 70008
2009-04-25 01:21:50 +00:00
Douglas Gregor f005eac566 Make sure that the consumer sees all interested decls. This fixes Preview
llvm-svn: 70007
2009-04-25 00:41:30 +00:00
Ted Kremenek 2cfd264636 Add new checker-specific attribute 'objc_ownership_retain'. This isn't hooked up
to the checker yet, but essentially it allows a user to specify that an
Objective-C method or C function increments the reference count of a passed
object.

llvm-svn: 70005
2009-04-25 00:17:17 +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
Douglas Gregor c62a133a38 When we de-serialize an Objective-C protocol, hand it to the AST consumer so that we can create metadata
llvm-svn: 70003
2009-04-24 23:42:14 +00:00
Ted Kremenek b97d093e16 Hook up __attribute__((objc_ownership_returns)) to the retain/release checker.
llvm-svn: 70002
2009-04-24 23:32:32 +00:00
Ted Kremenek 44e662cd4f Add new checker-specific attribute 'objc_ownership_returns'. This isn't hooked
up to the checker yet, but essentially it allows a user to specify that an
Objective-C method or C function returns an owned an Objective-C object.

llvm-svn: 70001
2009-04-24 23:09:54 +00:00
Anders Carlsson defc644e06 Add CXXExprWithCleanup
llvm-svn: 70000
2009-04-24 22:47:04 +00:00
Chris Lattner cd2a8c5864 fix the sizeof error recovery issue (sizeof-interface.m:attributeRuns)
by correctly propagating the fact that the type was invalid up to the
attributeRuns decl, then returning an ExprError when attributeRuns is
formed (like we do for normal declrefexprs).

llvm-svn: 69998
2009-04-24 22:30:50 +00:00
Douglas Gregor 9a1899ba42 Fix a pasto in the lookup of instance methods in the global pool
llvm-svn: 69996
2009-04-24 22:23:41 +00:00
Douglas Gregor 6525578397 Once the protocol list has been loaded from the PCH file, add it to
the Objective-C interface.

llvm-svn: 69993
2009-04-24 22:01:00 +00:00
Ted Kremenek 6a966b2486 Fix the same false positive reported in PR 2542 and <rdar://problem/6793409>
involving an NSAnimation object delegating its release to a delegate method.

llvm-svn: 69992
2009-04-24 21:56:17 +00:00
Douglas Gregor 4647cfac32 Fix two small but very nasty bugs in the PCH writer for method pools:
(1) Make sure to pad on-disk hash tables with 4 bytes, not 2, since
  the reader assumes that bucket data is aligned on 4-byte
  boundaries. 
  (2) Don't emit the number of factory methods twice. This was
  throwing off the data counts and therefore causing lookups to
  fail. I've added asserts so that this class of error cannot happen
  again.

llvm-svn: 69991
2009-04-24 21:49:02 +00:00
Douglas Gregor c78d34699f PCH support for the global method pool (= instance and factory method
pools, combined). The methods in the global method pool are lazily
loaded from an on-disk hash table when Sema looks into its version of
the hash tables.

llvm-svn: 69989
2009-04-24 21:10:55 +00:00
Fariborz Jahanian 969bc68195 Minor refactoring. No intended change in behavior.
llvm-svn: 69988
2009-04-24 21:07:43 +00:00
Steve Naroff 3fa455a1aa Add PCH support for #import.
llvm-svn: 69987
2009-04-24 20:03:17 +00:00
Ted Kremenek 53c5b7e0bd Minor refactoring: pass selector to getCommonMethodSummary(). No functionality
change.

llvm-svn: 69985
2009-04-24 18:19:07 +00:00
Ted Kremenek 6e86cafca3 retain/release checker: more hacks to workaround false positives cause by
delegates. When a reference counted object is passed as to a 'void*' argument to
a method stop tracking the reference count.

llvm-svn: 69984
2009-04-24 18:00:17 +00:00
Ted Kremenek 21895e0b89 Sentence case bug name.
llvm-svn: 69983
2009-04-24 17:51:19 +00:00
Ted Kremenek 8a5ad39a46 retain/release checker:
- Fix summary lookup for class methods to now use the (optional)
  ObjCInterfaceDecl associated with a message expression. This removes a
  long-standing FIXME.
- Partial fix for <rdar://problem/6062730> by stop tracking objects that
  are passed to [NSObject performSelector].  These methods are often used
  for delegates, which the analyzer doesn't reason about well yet.

llvm-svn: 69982
2009-04-24 17:50:11 +00:00
Anders Carlsson 95c56ebfb5 Make CXXTemporaryObjectExpr inherit from CXXConstructExpr.
llvm-svn: 69981
2009-04-24 17:34:38 +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
Fariborz Jahanian ce567657fd Minor refactoring. No change in functionality.
llvm-svn: 69979
2009-04-24 17:15:27 +00:00
Steve Naroff b87eeaeadf Use cast_or_null instead of ternary operator (suggested by Doug).
llvm-svn: 69975
2009-04-24 16:59:10 +00:00
Fariborz Jahanian a123b64218 Some code clean up of objc2's bitmap layout.
llvm-svn: 69970
2009-04-24 16:17:09 +00:00
Steve Naroff 54b6db1763 Allow the next catoregory slot to be null.
llvm-svn: 69969
2009-04-24 16:08:42 +00:00
Chris Lattner 40493eb6eb fix rdar://6816766 - Crash with function-like macro test at end of directive.
llvm-svn: 69964
2009-04-24 07:15:46 +00:00
Chris Lattner 469fdc6af3 simplification and speedup
llvm-svn: 69963
2009-04-24 07:15:22 +00:00
Anders Carlsson 643e0a40db Fix assert.
llvm-svn: 69961
2009-04-24 06:06:07 +00:00
Anders Carlsson b17a2c3d8f CXXTempVarDecls aren't looked up. Fixes tests.
llvm-svn: 69960
2009-04-24 06:02:55 +00:00
Anders Carlsson a861067029 Add an ASTContext parameter to CXXTemporaryObjectExpr.
llvm-svn: 69959
2009-04-24 05:44:25 +00:00
Anders Carlsson 56c5bd8d23 Add a VarDecl parameter to the CXXTemporaryObjectExpr constructor. It's unused for now, so no functionality change yet. Also, create CXXTempVarDecls to pass to the CXXTemporaryObjectExpr ctor.
llvm-svn: 69957
2009-04-24 05:23:13 +00:00
Anders Carlsson e500faf8c8 Create a CXXConstructExpr instead of a CXXTemporaryObjectExpr in InitializeVarWithConstructor.
llvm-svn: 69956
2009-04-24 05:16:06 +00:00
Anders Carlsson 32ebd29b99 Make the CXXConstructExpr public and add a StmtClass to it. No functionality change.
llvm-svn: 69954
2009-04-24 05:04:04 +00:00
Daniel Dunbar c1b1b4b2c9 Don't run dsymutil when making a fat executable direct source.
- Otherwise, we will end up with stray .dSYM files which don't get
   lipo'ed or removed.

 - Ideally we would run dsymutil on the result, but we don't have the
   infrastructure for that yet. Note that gcc doesn't handle this case
   either.

 - <rdar://problem/6809621> [driver] clang leaves .dSYM files lying
   around in tmp.

llvm-svn: 69951
2009-04-24 03:03:52 +00:00
Douglas Gregor 38feed810f Eliminate Sema::ObjCAliasDecls. This is based on Steve's fix, but also
updates name lookup so that we see through @compatibility_alias
declarations to their underlying interfaces.

llvm-svn: 69950
2009-04-24 02:57:34 +00:00
Sanjiv Gupta 4742515771 Clang part of r69947. Reverting back 69574 as it is no longer needed.
llvm-svn: 69949
2009-04-24 02:40:57 +00:00
Douglas Gregor ac3531247f Fix Objective-C crashes
llvm-svn: 69945
2009-04-24 02:15:36 +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
Douglas Gregor ac345a3990 Eliminate Sema::ObjCInterfaceDecls
llvm-svn: 69942
2009-04-24 00:16:12 +00:00
Douglas Gregor 79947a24e6 Eliminate Sema::ObjCImplementations, relying instead on name lookup. What's good for uniformity is good for PCH (or is it the other way around?).
As part of this, make ObjCImplDecl inherit from NamedDecl (since
ObjCImplementationDecls now need to have names so that they can be
found). This brings ObjCImplDecl very, very close to
ObjCContainerDecl; we may be able to merge them soon.

llvm-svn: 69941
2009-04-24 00:11:27 +00:00
Douglas Gregor de9f17e943 Eliminate Sema::ObjCProtocols. Instead, we place ObjCProtocolDecls in
their own namespace (IDNS_Protocol) and use the normal name-lookup
routines to find them. Aside from the simplification this provides
(one less DenseMap!), it means that protocols will be lazily
deserialized from PCH files.

Make the code size of the selector table block match the code size of
the type and decl blocks.

llvm-svn: 69939
2009-04-23 23:18:26 +00:00
Daniel Dunbar 838cbe19b7 Call ld, not collect2.
- <rdar://problem/6517382> [driver] call ld directly

llvm-svn: 69938
2009-04-23 23:17:23 +00:00
Ted Kremenek 60746a0a83 Refactor common logic in getMethodSummary() and getClassMethodSummary(). No
functionality change.

llvm-svn: 69936
2009-04-23 23:08:22 +00:00