Commit Graph

59240 Commits

Author SHA1 Message Date
Ted Kremenek 0836a19931 Rename attributes 'objc_ownership...' to 'ns_ownership...'.
llvm-svn: 70897
2009-05-04 19:10:19 +00:00
Ted Kremenek a4a81c0ac7 Increase scan-view max timeout to 1 minute.
llvm-svn: 70896
2009-05-04 19:02:41 +00:00
Chris Lattner 23d5a39195 "Fix" a problem with debug info in the presence of always_inline
function calls.  For a program like this:

#include <stdio.h>
static __inline__ __attribute__((always_inline)) 
int bar(int x) { return 4; }
int main() { 
  int X = bar(4);
  printf("%d\n", X);
}

clang was not outputing any debug info for the body of main().  This is
because the backend is getting confused by the region_start/end that clang
is emitting for block scopes.  For now, just disable these (matching llvm-gcc),
this stuff is in progress of rework anyway.

llvm-svn: 70889
2009-05-04 18:27:04 +00:00
Ted Kremenek e396f72ec7 BugReporter (extensive diagnostics): don't mark location contexts that are
control-flow expressions as dead.

llvm-svn: 70887
2009-05-04 18:15:17 +00:00
Bill Wendling 357e03cede Use %llvmgcc instead of llvm-gcc.
llvm-svn: 70886
2009-05-04 18:00:27 +00:00
Ted Kremenek 250d59f33f Fix false positive null dereference by unifying code paths in GRSimpleVals for
'==' and '!=' (some code in the '!=' was not replicated in the '==' code,
causing some constraints to get lost).

llvm-svn: 70885
2009-05-04 17:53:11 +00:00
Ted Kremenek 5dbfa3fadd Rename attributes:
'objc_ownership_cfretain' -> 'cf_ownership_retain'
'objc_ownership_cfrelease' -> 'cf_ownership_release'

Motivation: Core Foundation objects can be used in isolation from Objective-C,
and this forces users to reason about the separate semantics of CF objects. More
Sema support pending.

llvm-svn: 70884
2009-05-04 17:29:57 +00:00
Ted Kremenek 0b0ee3c49d Update test case.
llvm-svn: 70883
2009-05-04 17:27:32 +00:00
Dan Gohman 3f02595048 Use true instead of 1 for a boolean value. And fix a copy+pasto
in a comment.

llvm-svn: 70882
2009-05-04 17:25:21 +00:00
Dan Gohman d05ae1af8a Add an svn:ignore property.
llvm-svn: 70881
2009-05-04 17:12:00 +00:00
Dan Gohman 630f4e1eb3 Trim unnecessary #includes.
llvm-svn: 70880
2009-05-04 17:11:06 +00:00
Dan Gohman cfd6941cf9 Quotes are used for including llvm headers, rather than angles.
llvm-svn: 70879
2009-05-04 17:09:51 +00:00
Ted Kremenek bc76c72f94 Remove support for ObjCMethodDecl attributes that appear between the
return type and the selector.  This is inconsistent with C functions
(where such attributes would be placed on the return type, not the the
FunctionDecl), and is inconsistent with what people are use to seeing.

llvm-svn: 70878
2009-05-04 17:04:30 +00:00
Chris Lattner bef2ee4322 "The attached diff fixes the //FIXME in message send to super. This should now be faster, and works in the presence of class posing. This is now the same approach as used in GCC (the earlier code was a quick hack to get something working)."
Patch by David Chisnall!

llvm-svn: 70877
2009-05-04 16:56:33 +00:00
Duncan Sands 50c70336b0 Teach capture tracking that readonly functions can
only capture their arguments by returning them or
throwing an exception or not based on the argument
value.  Patch essentially by Frits van Bommel.

llvm-svn: 70876
2009-05-04 16:50:29 +00:00
Duncan Sands b88227ef4c Check that pure/const functions are marked nounwind.
llvm-svn: 70875
2009-05-04 16:47:11 +00:00
Ted Kremenek 49a844e1a6 retain checker: Add checker support for FunctionDecl ownership annotations. Need to add Sema support.
llvm-svn: 70873
2009-05-04 16:43:50 +00:00
Chris Lattner fa552d728d fix some problems spotted by Duncan and Nicolas Geoffray
llvm-svn: 70872
2009-05-04 16:29:24 +00:00
Argyrios Kyrtzidis 9ae29b2d8f -Remove the DwarfWriter::RecordSourceLine calls from the instruction selectors.
-Depend on DebugLocs for source line info.

(Comes with Regression-Be-Gone(tm))

llvm-svn: 70871
2009-05-04 16:23:49 +00:00
Ted Kremenek 863f68aa06 retain checker: Pull out logic for parameter annotations into a
separate method.

llvm-svn: 70870
2009-05-04 15:40:58 +00:00
Ted Kremenek df76e6d09d retain checker: Don't treat function's declared in macros differently.
llvm-svn: 70869
2009-05-04 15:34:07 +00:00
Daniel Dunbar 566421c8a3 Patch from David Chisnall:
The attached diff fixes the //FIXME in message send to super.  This
should now be faster, and works in the presence of class posing.  This
is now the same approach as used in GCC (the earlier code was a quick
hack to get something working).

llvm-svn: 70868
2009-05-04 15:31:17 +00:00
Ted Kremenek a68556c4cc Add array index assertion: BasicStore should not expect any fancy
ElementRegions that have non-zero array indices.

llvm-svn: 70867
2009-05-04 15:25:46 +00:00
Daniel Dunbar c1fd2284c1 Update test case... the location given for this error makes it look
rather odd when truncated.

llvm-svn: 70866
2009-05-04 15:18:44 +00:00
Ted Kremenek d795b02be7 Rename 'makeZeroIndex' to 'makeZeroArrayIndex'.
llvm-svn: 70865
2009-05-04 15:17:38 +00:00
Ted Kremenek 629a43ffa1 Zhongxing already implemented this FIXME.
llvm-svn: 70864
2009-05-04 15:14:27 +00:00
Ted Kremenek 238d0b6ecd Rename no-outofbounds.c to xfail-no-outofbounds.c and split off that
test into a separate file to monitor the fact that BasicStoreManager
passes the test.

llvm-svn: 70859
2009-05-04 14:31:19 +00:00
Ted Kremenek 66f8fe18ef Update checker build.
llvm-svn: 70858
2009-05-04 14:24:29 +00:00
Duncan Sands d84881ec53 Testcase for PR3967.
llvm-svn: 70856
2009-05-04 12:54:02 +00:00
Anton Korobeynikov 0a0cc2d7b7 Workaround libstdc++ bug when crosscompiling to mingw.
Patch by Jay Foad!

llvm-svn: 70849
2009-05-04 10:25:30 +00:00
Anton Korobeynikov dad5871f84 It turns out that this version of gcc is broken (cygwin is well-known in shipping
of broken/buggy/snapshot-based compilers)

llvm-svn: 70848
2009-05-04 10:24:46 +00:00
Zhongxing Xu 6ebde279ae array indexes are unsigned integers of the same width as pointer.
no-outofbounds.c still fails. Previously it passed because the array index
is mistakenly a loc::ConcreteInt.

llvm-svn: 70844
2009-05-04 08:52:47 +00:00
Ted Kremenek 2d9fa1b4b7 Test now passes. I'll hold off merging it with the BasicStore test until we know this is a stable change.
llvm-svn: 70837
2009-05-04 07:11:21 +00:00
Ted Kremenek 758fda4274 BasicStore: 'ElementRegion' is the new 'TypedViewRegion'.
StoreManager: Handle casts from one element region to another.
Update test cases.

llvm-svn: 70836
2009-05-04 07:04:36 +00:00
Daniel Dunbar d53e07b396 Remove unnecessary copy of constraint info.
llvm-svn: 70835
2009-05-04 06:56:16 +00:00
Ted Kremenek 95162024e2 This test no longer fails.
llvm-svn: 70834
2009-05-04 06:45:58 +00:00
Douglas Gregor 006fd38dc1 Simplify the interesting-region code by assimmilating blocks of non-whitespace text with each expansion step. It's easier and seems to have better results.
llvm-svn: 70833
2009-05-04 06:45:38 +00:00
Ted Kremenek 35cf12ab2d Handle 'long x = 0; char *y = (char *) x;' by layering an
'ElementRegion' on top of the VarRegion for 'x'.  This causes the test
case xfail_wine_crash.c to now pass for BasicStoreManager.  It doesn't
crash for RegionStoreManager either, but reports a bogus unintialized
value warning.

llvm-svn: 70832
2009-05-04 06:35:49 +00:00
Douglas Gregor 2d69cd247e Tweak the extraction of the "interesting" part of a source range in two ways:
1) First of all, we treat _ as part of an identifier and not as
  punctuation (oops).
  2) Second of all, always make sure that the token that the ^ is
  pointing at is fully within the "interesting" part of the range.

llvm-svn: 70831
2009-05-04 06:27:32 +00:00
Ted Kremenek 02e508960c Per conversations with Zhongxing, add an 'element type' to
ElementRegion.  I also removed 'ElementRegion::getArrayRegion',
although we may need to add this back.

This breaks a few test cases with RegionStore:
- 'array-struct.c' triggers an infinite recursion in RegionStoreManager.  Need to investigate.
- misc-ps.m triggers a failure with RegionStoreManager as we now get the diagnostic:
  'Line 159: Uninitialized or undefined return value returned to caller.'
  
There were a bunch of places that needed to be edit
RegionStoreManager, and we may not be passing all the correct 'element
types' down from GRExprEngine.

Zhongxing: When you get a chance, could you review this?  I could have
easily screwed up something basic in RegionStoreManager.

llvm-svn: 70830
2009-05-04 06:18:28 +00:00
Douglas Gregor 5b07c7ec05 Implement support for comparing pointers with <, >, <=, >=, ==, and !=
in C++, taking into account conversions to the "composite pointer
type" so that we can compare, e.g., a pointer to a derived class to a
pointer to a base class. 

Also, upgrade the "comparing distinct pointer types" from a warning to
an error for C++, since this is clearly an error. Turns out that we
hadn't gone through and audited this code for C++, ever. 

Fixes <rdar://problem/6816420>.

llvm-svn: 70829
2009-05-04 06:07:12 +00:00
Ted Kremenek 1d9a267b2e retain checker:
- Fix retain checker test failures.
- Update retain checker to have annotations override default summary effects, not completely redefine them.

llvm-svn: 70828
2009-05-04 05:31:22 +00:00
Daniel Dunbar e993ba6fca Add -fobjc-tight-layout.
- This implements gcc style Objective-C interface layout (I
   think). Currently it is always off, there is no functionality
   change unless this is passed.
   
   For the curious, the deal is that gcc lays out the fields of a
   subclass as if they were part of the superclass. That is, the
   subclass fields immediately follow the super class fields instead
   of being padded to the alignment of the superclass structure.

 - Currently gcc uses the tight layout in 32-bit and 64-bit modes, and
   llvm-gcc uses it in 32-bit only, for reasons which aren't clear
   yet. We probably want to switch to matching gcc, once this makes it
   through testing... my hope is that we can also fix llvm-gcc in
   order to maintain compatibility between the compilers.

llvm-svn: 70827
2009-05-04 05:16:21 +00:00
Ted Kremenek ff606a1259 retain checker: RetainSummaryManager now has a 'DefaultSummary' object
which is returned instead of a null pointer.  This helps centralize
the logic concerning "default effects".

llvm-svn: 70826
2009-05-04 04:57:00 +00:00
Eli Friedman 2ad7e17096 PR4143: don't crash generating debug info for incomplete enum types.
llvm-svn: 70825
2009-05-04 04:39:55 +00:00
Ted Kremenek 1bff64e309 retain checker: Don't bother using a FoldingSet to unique summaries.
We never compare summaries by their pointers, and we create only a
handful of them when analyzing a given function.

llvm-svn: 70824
2009-05-04 04:30:18 +00:00
Eli Friedman 33955dd28f Remove unnecessary push_back (at least, I think it's unnecessary);
hopefully, this fixes PR4144 without any regressions.

llvm-svn: 70823
2009-05-04 04:12:48 +00:00
Daniel Dunbar 98ba964e5c Don't allow clients to traverse into superclass synthesized properties
via CollectObjCIvars.
 - In places where we need them, we should have the implementation and
   access the properties through it.

This is a fairly substantial functionality change: 
 1. @encode no longer encodes synthesized ivars, ever.

 2. The ivar layout bitmap no longer encodes information for
    synthesized ivars in superclasses. Well, actually I had already
    broken that, but it is intentional now.

We are now differing substantially from llvm-gcc and gcc
here. However, in my opinion this fundamentally *must* work if
non-fragile classes are to work. Without this change, the result of
@encode and the ivar layout depend on the order that the
implementation is seen in a file (if it is in the same file with its
superclass). Since both scenarios should work the same, our behavior
is now consistent with gcc behavior as if an implementation is never
seen following an implementation of its superclass.

Note that #2 is only a functionality change when (A) an
implementation appears in the same translation unit with the
implementation of its superclass, and (B) the superclass has
synthesized ivars. My belief is that this situation does not occur in
practice.

I am not yet sure of the role/semantics of @encode when synthesized
ivars are present... it's use is fairly unsound in a non-fragile world.

llvm-svn: 70822
2009-05-04 04:10:48 +00:00
Evan Cheng 3f77805642 Make sure to color with only allocatable registers for the specific register class.
llvm-svn: 70821
2009-05-04 03:30:11 +00:00
Chris Lattner d579cb1167 * Sink 4 duplicates of edge threading validity checks and DOUT prints into
ThreadEdge directly.  This shares the code, but is just a refactoring.
* Make JumpThreading compute the set of loop headers and avoid threading
  across them.  This prevents jump threading from forming irreducible 
  loops (goodness) but also prevents it from threading in other cases that
  are beneficial (see the comment above FindFunctionBackedges).

llvm-svn: 70820
2009-05-04 02:28:08 +00:00