Commit Graph

4023 Commits

Author SHA1 Message Date
Fariborz Jahanian 30b3ac5e9e Minor refactoring.
llvm-svn: 65414
2009-02-24 23:38:42 +00:00
Fariborz Jahanian 240f2b7851 patch for two things.
make sure objc2's nonfragile abi is enacted for Leopard too.
add -fobjc-gc-only flag to the image_info symbol.

llvm-svn: 65413
2009-02-24 23:34:44 +00:00
Ted Kremenek 260c49a712 Fix broken logic from my last commit. Branches only occur at basic blocks that end with terminators.
llvm-svn: 65410
2009-02-24 23:34:17 +00:00
Ted Kremenek c324a0e089 Fix diagnostic regression where the leak diagnostic could appear earlier in the path than the branches taken.
llvm-svn: 65407
2009-02-24 23:30:57 +00:00
Devang Patel ab19ecad22 If Loc is invalid (e.g. "self" in Objective-C) then use MainFileID's compile unit.
llvm-svn: 65403
2009-02-24 23:16:03 +00:00
Chris Lattner d8b741c85f handle @encode interactions with array initializers.
llvm-svn: 65401
2009-02-24 23:10:27 +00:00
Chris Lattner 94e6c4be9a rename CheckStringLiteralInit to CheckStringInit and pass in the
string size as an argument.

llvm-svn: 65400
2009-02-24 23:01:39 +00:00
Chris Lattner b0912a59d3 make SemaRef be a reference to sema, not a pointer.
llvm-svn: 65399
2009-02-24 22:50:46 +00:00
Chris Lattner 9ececceea9 move InitListChecker to be private to SemaInit.cpp
llvm-svn: 65398
2009-02-24 22:48:58 +00:00
Chris Lattner 94d2f6819f Make CheckSingleInitializer a static function in SemaInit.cpp
llvm-svn: 65397
2009-02-24 22:46:58 +00:00
Chris Lattner edbf3ba3d2 make CheckStringLiteralInit a static function in SemaInit.cpp
llvm-svn: 65396
2009-02-24 22:41:04 +00:00
Chris Lattner 9c60e859a5 change IsStringLiteralInit into a static function in SemaInit.cpp
llvm-svn: 65395
2009-02-24 22:36:59 +00:00
Chris Lattner 0cb7803341 move some initialization checking code from SemaDecl.cpp
to SemaInit.cpp, no functionality change.

llvm-svn: 65394
2009-02-24 22:27:37 +00:00
Chris Lattner d7e7b8e411 first wave of fixes for @encode sema support. This is part of PR3648.
The big difference here is that (like string literal) @encode has 
array type, not pointer type.

llvm-svn: 65391
2009-02-24 22:18:39 +00:00
Chris Lattner 0be5aa875a some minor cleanups, handle ObjCEncodeExpr in a couple places.
llvm-svn: 65389
2009-02-24 21:54:33 +00:00
Fariborz Jahanian 6fe4306195 Set flag for -fobjc-gc in IMAGE_INFO variable.
llvm-svn: 65387
2009-02-24 21:08:09 +00:00
Douglas Gregor eddf4333fd When we're declaring an object or function with linkage, teach name
lookup to skip over names without linkage. This finishes
<rdar://problem/6127293>.

llvm-svn: 65386
2009-02-24 20:03:32 +00:00
Douglas Gregor 5d68a20949 Extend the implicit declaration and checking against out-of-scope
external declarations to also support external variable
declarations. Unified the code for these two cases into two new
subroutines.

Note that we fail to diagnose cases like the one Neil pointed
out, where a visible non-external declaration hides an external
declaration by the same name. That will require some reshuffling of
name lookup.

llvm-svn: 65385
2009-02-24 19:23:27 +00:00
Ted Kremenek c52f9394ce retain/release checker:
- For autorelease pool tracking, keep information about the stack of pools
  separate from their contents. Also, keep track of the number of times an
  autorelease pool will send the "release" message to an object when the pool is
  destroyed.
- Update CFRefCount::Update to return a new state instead of a reference count
  binding. This will allow us to implement more complicated semantics with
  autorelease pools.

llvm-svn: 65384
2009-02-24 19:15:11 +00:00
Daniel Dunbar d4ecca135a Fix IRgen of constant expressions referring to external/static
variables.
 - PR3657.

llvm-svn: 65381
2009-02-24 18:41:57 +00:00
Daniel Dunbar 0b0dcd987d Some initial Obj-C zero cost EH support.
- Only handles cases with @try with no @catch blocks, and there are a
   number of problems with the implementation. Nevertheless, this is
   good enough to handled @synchronized correctly, and some other
   basic uses.

llvm-svn: 65378
2009-02-24 07:47:38 +00:00
Daniel Dunbar 36ae309434 Add a note about an IRgen optimization opportunity.
llvm-svn: 65376
2009-02-24 06:34:04 +00:00
Chris Lattner 59da739613 Fix PR3635 by handling ## magically
llvm-svn: 65374
2009-02-24 05:29:33 +00:00
Douglas Gregor de681d43eb In C, when we see a function declaration within a local scope, export
that declaration to global scope so that it can be found from other
scopes. This allows us to diagnose redeclaration errors for external
declarations across scopes. We also warn when name lookup finds such
an out-of-scope declaration. This is part of <rdar://problem/6127293>;
we'll also need to do the same thing for variables.

llvm-svn: 65373
2009-02-24 04:26:15 +00:00
Anders Carlsson 729a8202d0 Prevent accidental copying of CodeGenFunction and CodeGenModule.
llvm-svn: 65372
2009-02-24 04:21:31 +00:00
Anders Carlsson b9c9e1d16f Pass the CodeGenModule object to GenerateBlockFunction, instead of *this (which will call the copy constructor).
Also, since we're creating a new CodeGenFunction object for each block function, we don't need to clear the BreakContinueStack.

llvm-svn: 65371
2009-02-24 04:19:41 +00:00
Mike Stump 18e91257e4 Ensure that we can't break or continue out of a block.
llvm-svn: 65370
2009-02-24 02:59:30 +00:00
Ted Kremenek cce27f5502 Fix <rdar://problem/6611677>: Add basic transfer function support in the static
analyzer for array subscript expressions involving bases that are vectors. This
solution is probably a hack: it gets the lvalue of the vector instead of an
rvalue like all other types. This should be reviewed (big FIXME in
GRExprEngine).

llvm-svn: 65366
2009-02-24 02:23:11 +00:00
Daniel Dunbar 94ceb61574 Fix two @synchronized bugs found by inspection: the expression to sychronize on should only be evaluated once, and it is evaluated outside the cleanup scope.
Also, lift SyncEnter and SyncExit up in nervous anticipation of x86-64
zero cost EH.

llvm-svn: 65362
2009-02-24 01:43:46 +00:00
Douglas Gregor e62c0a45dd Improve merging of function declarations. Specifically:
- When we are declaring a function in local scope, we can merge with
    a visible declaration from an outer scope if that declaration
    refers to an entity with linkage. This behavior now works in C++
    and properly ignores entities without linkage.
  - Diagnose the use of "static" on a function declaration in local
    scope.
  - Diagnose the declaration of a static function after a non-static
    declaration of the same function.
  - Propagate the storage specifier to a function declaration from a
    prior declaration (PR3425)
  - Don't name-mangle "main"

llvm-svn: 65360
2009-02-24 01:23:02 +00:00
Ted Kremenek 29b8697393 Move PTHStatCache within the anonymous namespace.
llvm-svn: 65348
2009-02-23 23:27:54 +00:00
Ted Kremenek 2c2ec42322 Tidy up 'ExecutionContinues' to distinguish between jumping to the end of a 'method' or 'funciton'.
llvm-svn: 65346
2009-02-23 23:13:51 +00:00
Ted Kremenek 62b3879c5e Tidy up the path diagnostic generation logic in BugReporter and remove a case where an "Execution continues..." diagnostic could result in an empty message bubble.
llvm-svn: 65342
2009-02-23 22:44:26 +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
Fariborz Jahanian 392124c78e We should not generate __weak write barrier on indirect reference
of a pointer to object; This patch does this odd behavior according to
gcc.

llvm-svn: 65334
2009-02-23 18:59:50 +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
Chris Lattner e7a0a63a16 Add copy assignment operator, caught by doug.
llvm-svn: 65331
2009-02-23 18:17:44 +00:00
Ted Kremenek 50db3d0923 Add more boilerplate logic to more accurately reason about autorelease pools.
This doesn't change the current functionality, but better codifies the
autorelease pool stack itself.

llvm-svn: 65328
2009-02-23 17:45:03 +00:00
Daniel Dunbar 1234749853 Add low level support for generating invoke instead of calls.
- No functionality change.

llvm-svn: 65325
2009-02-23 17:26:39 +00:00
Ted Kremenek 726fd5cbf5 Fix 80 col. violations.
llvm-svn: 65322
2009-02-23 16:54:00 +00:00
Ted Kremenek 82157a17c1 Per Chris L.'s suggestion, use getAsFunctionType() instead of getDesguaredType(). Constify some pointers along the way.
llvm-svn: 65321
2009-02-23 16:51:39 +00:00
Steve Naroff 59bf35e44a Remove isSuperExpr(), which ignores any casts on 'super'.
I don't think casting super makes any sense (since it won't effect method lookup).
Will discuss with other offline and decide what to do.

llvm-svn: 65317
2009-02-23 15:40:48 +00:00
Eli Friedman 3ae5911042 A few small improvements to Evaluate for stuff I noted in FIXMEs.
llvm-svn: 65305
2009-02-23 04:23:56 +00:00
Ted Kremenek e73f282213 retain/release checker: For now don't track the retain count of NSWindow objects (opt for false negatives).
llvm-svn: 65304
2009-02-23 02:51:29 +00:00
Ted Kremenek 5485a2f70b Remove typo.
llvm-svn: 65302
2009-02-23 02:42:56 +00:00
Ted Kremenek 7d4fc5bcdc '[NSAutoreleasePool addObject:]' has an 'autorelease' effect, not a DoNothing effect.
llvm-svn: 65301
2009-02-23 02:31:16 +00:00
Steve Naroff 77170dcb14 Sema::ActOnInstanceMessage(): Tighen up the lookup rules for handling messages to 'Class'. Also improve "super" handling.
llvm-svn: 65300
2009-02-23 02:25:40 +00:00
Steve Naroff d2c44d224c Minor cleanup, replace bool with qual_empty().
llvm-svn: 65293
2009-02-22 19:41:00 +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