Commit Graph

935 Commits

Author SHA1 Message Date
Chris Lattner 58418ffa32 Make ProcessDeclAttributes walk the declarator structure pulling
decl attributes out of the various places they can hide.  This makes
us correctly reject things like this:

t.c:2:22: error: mode attribute only supported for integer and floating-point types
  int **__attribute((mode(HI)))* i32;
                     ^

because you can't make a pointer be HImode.

llvm-svn: 52876
2008-06-29 00:16:31 +00:00
Argyrios Kyrtzidis f4ebe9ea4f Handle unnamed bitfields when parsing C++ classes.
llvm-svn: 52855
2008-06-28 08:10:48 +00:00
Eli Friedman 4f89ccb1df Fix for PR2501; this patch makes usual arithmetic conversions for
integers which have the same width and different signedness work 
correctly. (The testcase in PR2501 uses a comparison between long and 
unsigned int).

llvm-svn: 52853
2008-06-28 06:23:08 +00:00
Chris Lattner e6c693d932 Fix a bug where we didn't promote 'const float' (or typedefs) to
double in some places.

llvm-svn: 52846
2008-06-27 22:48:56 +00:00
Ted Kremenek cf1ab19086 Added a simple static analysis check to look for improper uses of CFCreateNumber.
llvm-svn: 52799
2008-06-26 23:59:48 +00:00
Chris Lattner 2239b7d3d2 rename some attr tests for consistency.
llvm-svn: 52770
2008-06-26 06:32:02 +00:00
Chris Lattner 4b413ea3bf fix a bug handling type attributes in the declspec. declspec processing
used to mutate the attribute list for declspecs when the type was 
converted, breaking the case where one declspec was shared by multiple
declarators.

This fixes rdar://6032532.

llvm-svn: 52769
2008-06-26 06:27:57 +00:00
Chris Lattner 64d8d074a8 fix this testcase after Mon Ping's intrinsic rename.
llvm-svn: 52754
2008-06-26 04:06:27 +00:00
Ted Kremenek 3185c9c9cd CF ref checker:
Tracked objects now have their type information tracked with them.

Enhanced summaries for ObjC methods to include the type information of the receiver.

Used the enhanced summaries to support the idiom that NSWindow owns itself (it sends a release message to itself upon close).

Added some comments.

Did some cleanups with the checker logic using operator overloading (reduced redundant code which I was concerned about being the source of bugs).

llvm-svn: 52741
2008-06-25 21:21:56 +00:00
Argyrios Kyrtzidis 7bbb20e338 Add parsing support for C++ classes.
Note that Parser::ParseCXXMemberSpecification is temporarily disabled until the Sema support is in place.
Once ParseCXXMemberSpecification is enabled, the Parser/cxx-class.cpp test will pass.

llvm-svn: 52694
2008-06-24 22:12:16 +00:00
Ted Kremenek ab4a8b5213 The CF retain/release checker now assumes that allocations do not fail. Eventually we will add a flag to the driver to enable allocation failures (documented as a FIXME).
llvm-svn: 52632
2008-06-23 18:02:52 +00:00
Chris Lattner 091f698d29 "this patch adds code generation hooks for Objective-C constant strings. It also modifies Sema so that Objective-C constant strings are treated as untyped objects if the interface for the constant string class can not be found. This is consistent with Apple GCC. I thought it was consistent with GNU GCC, since this was causing failures when trying to compile GNUstep with (GNU) GCC, but it appears that this is not the case when attempting to produce a simple test case to demonstrate it. Possibly there is a way of making the error go away, but I haven't found out what it is yet."
Patch by David Chisnall!

llvm-svn: 52599
2008-06-21 21:44:18 +00:00
Chris Lattner 5a92bab4f0 "This moves built-in Objective-C types up the scope chains to where they can be replaced by versions included from the runtime library's headers."
This makes it ok to use @"foo" without a declaration for NSConstantString.

Patch by David Chisnall!

llvm-svn: 52593
2008-06-21 20:20:39 +00:00
Chris Lattner 535b830449 add parser and sema support for the funny ObjC '@defs' thing.
Patch by David Chisnall!

llvm-svn: 52586
2008-06-21 19:39:06 +00:00
Chris Lattner a9b3cae8fd Switch 'super' from being a weird cast thing to being a predefined expr node.
Patch by David Chisnall with objc rewriter and stmtdumper updates from me.

llvm-svn: 52580
2008-06-21 18:04:54 +00:00
Ted Kremenek 68d2368064 Include stdint.h instead of stdio.h.
llvm-svn: 52578
2008-06-21 17:20:55 +00:00
Ted Kremenek 22cf89d9cd Test the dead-store checker using both -warn-dead-stores and -checker-simple.
llvm-svn: 52568
2008-06-20 23:14:52 +00:00
Ted Kremenek 34a691734e Modified the dead stores checker to...
1) Check if a dead store appears as a subexpression.  For such cases, we emit
   a verbose diagnostic so that users aren't confused.  This addresses:
   
   <rdar://problem/5968508> checker gives misleading report for dead store in loop
   
2) Don't emit a dead store warning when assigning a null value to a pointer.
   This is a common form of defensive programming.  We may wish to make
   this an option to the the checker one day.
   
   This addresses the feature request in the following email:
   
   http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-June/001978.html

llvm-svn: 52555
2008-06-20 21:45:25 +00:00
Ted Kremenek 46c82ab994 Introduce initial transfer function support for __imag__ and __real__. We don't
have complex RValues yet, so this logic is only fully implemented when __imag__
and __real__ are used on non-complex types.

llvm-svn: 52501
2008-06-19 17:55:38 +00:00
Eli Friedman fd4c32164c Make this test actually pass, in addition to the previous patch
which made it work.

llvm-svn: 52382
2008-06-17 05:36:46 +00:00
Ted Kremenek 6bed7d6b1e Remove Analysis-Apple.
llvm-svn: 52366
2008-06-16 21:21:48 +00:00
Ted Kremenek f3c8650502 Move test case "uninit-msg-expr.m" from Analysis-Apple to Analysis (now works on all platforms).
llvm-svn: 52362
2008-06-16 21:15:29 +00:00
Ted Kremenek 2eed4d7a25 Moved test case NoReturn.m from Analysis-Apple to Analysis (now works on all platforms).
llvm-svn: 52359
2008-06-16 21:05:04 +00:00
Ted Kremenek bbe6111cc3 Move NSString.m test case from Analysis-Apple to Analysis. The test case now works on all platforms.
llvm-svn: 52354
2008-06-16 20:37:30 +00:00
Ted Kremenek ccafce3d4c Update test case to use -pedantic (makes the test case more clear).
llvm-svn: 52349
2008-06-16 19:53:46 +00:00
Ted Kremenek 5935a17daf Fix misspelling of "svelte".
llvm-svn: 52348
2008-06-16 19:51:41 +00:00
Ted Kremenek 951bc67096 Move Analysis-Apple/CFString.c to Analysis (the test case now works on all platforms).
llvm-svn: 52346
2008-06-16 19:35:31 +00:00
Ted Kremenek 107f13971f Move CFDateGC.m test case from Analysis-Apple to Analysis (it now runs on all platforms).
llvm-svn: 52344
2008-06-16 18:46:17 +00:00
Ted Kremenek 7056bb1f21 Moved CFDate.m from test/Analysis-Apple to test/Analysis, and added the necessary declarations from Foundation.h to CFDate.m so that the test case can be exercised on all platforms.
llvm-svn: 52343
2008-06-16 18:34:22 +00:00
Ted Kremenek 87c760af36 Add test case for NSString format-string checking.
llvm-svn: 52337
2008-06-16 18:01:05 +00:00
Eli Friedman 327944b343 Basic support for volatile loads and stores. Stores the volatile
qualifier in the lvalue, and changes lvalue loads/stores to honor 
the volatile flag.  Places which need some further attention are marked 
with FIXMEs.

Patch by Cédric Venet.

llvm-svn: 52264
2008-06-13 23:01:12 +00:00
Argyrios Kyrtzidis caec17eab9 Fix broken test.
llvm-svn: 52232
2008-06-12 12:44:52 +00:00
Argyrios Kyrtzidis 351763e156 Multiple tests in a single test file must be linked with '&&'.
Otherwise, failing tests other than the last one will not be reported.

llvm-svn: 52231
2008-06-12 12:40:02 +00:00
Eli Friedman 61b529f466 Don't crash if we can't find FileEntry info for a typedef, since one
isn't guaranteed to exist. This fixes a crash with conflicting typedefs
coming from stdin.

This also fixes the crash in PR2406, but doesn't completely fix the 
issue; it appears there's something strange about the physical location 
for the definition of int64_t in stdlib.h.

llvm-svn: 52209
2008-06-11 06:20:39 +00:00
Argyrios Kyrtzidis 34fe86cd9c Fix the setup of CodeGen/bitfield.c test.
Due to the broken setup it was passing the test while it should have failed.

llvm-svn: 52181
2008-06-10 15:48:26 +00:00
Eli Friedman 940a7c0cf8 Fix the run line for this test.
llvm-svn: 52169
2008-06-10 05:18:06 +00:00
Eli Friedman 4f64def9ee Make this test C instead of C++; making it C++ causes a failure on Linux
because clang can't parse stdio.h in C++ mode yet.

llvm-svn: 52168
2008-06-10 05:14:31 +00:00
Eli Friedman d5b11a3adc Don't include complex.h or tgmath.h for this test; they aren't needed,
and including tgmath.h causes the test to fail for no good reason.

llvm-svn: 52167
2008-06-10 05:09:36 +00:00
Eli Friedman e6e0f23a29 Add code to make test/CodeGen/struct-init.c work correctly without the
pointer cast hack currently in isIntegerConstantExpr 
(in lib/AST/Expr.cpp).  Also removes an odd test that even gcc doesn't accept.

The reason the pointer cast hack is relevant here is that it makes Sema 
end up misinterpreting the relevant expression as a null pointer constant.

The reason for this patch is that I plan to remove the pointer cast hack 
sometime soon because it causes strange issues, especially in its 
current form; see my recent email to cfe-dev
"[PATCH] add constant expression evaluation to the AST and fix PR2413".

llvm-svn: 52120
2008-06-09 05:05:07 +00:00
Eli Friedman 7567573926 For struct initialization, check compatibility with the unqualified
type; this isn't explicitly stated in the standard, but it doesn't 
really make sense for them to have an effect here.  Fixes the included 
testcase, sent to me by Steve Naroff.

llvm-svn: 52113
2008-06-09 03:52:40 +00:00
Nuno Lopes b6f7953818 implement the alias attirbute (in both Sema and Codegen)
llvm-svn: 52092
2008-06-08 15:45:52 +00:00
Eli Friedman c98a7add43 Don't crash emitting an initializer for a static local with union type.
This fix just makes sure to construct the global with the appropriate 
type, and fixes up the one user this affects to compensate.

llvm-svn: 52084
2008-06-08 01:23:18 +00:00
Eli Friedman 69d721e071 Enable the rewriter tests on all platforms; there don't appear to
be any regressions from this on my machine, but please let me know if 
you run into issues.  (The idea here is that it's better to run all 
tests on all platforms if at all possible.)

llvm-svn: 52083
2008-06-07 23:20:33 +00:00
Eli Friedman 7e4f41ef3f Don't include objc.h, so the rewriter tests work on machines without it.
llvm-svn: 52082
2008-06-07 23:15:03 +00:00
Eli Friedman 3ce7b20590 Fix crash with conversion to an address-space-qualified pointer. Bug
reported on cfe-dev by Cédric Venet.

Note that I seriously doubt that this perticular construct is useful, 
though: it's a pointer in an alternate address space pointing into 
unqualified address space.

llvm-svn: 52076
2008-06-07 17:27:51 +00:00
Eli Friedman fd1e32b1f3 Reorganize this loop a bit so it doesn't crash for empty unions. Fixes
PR2419.

llvm-svn: 52060
2008-06-06 20:12:37 +00:00
Nuno Lopes 9b07b7b099 implement constant expr. sub ptr ptr
llvm-svn: 52049
2008-06-06 16:41:08 +00:00
Steve Naroff 946166f4e9 Second half of "fix" for <rdar://problem/5986085> clang on xcode: error: redefinition of 'XCElementToggler' as different kind of symbol
llvm-svn: 52024
2008-06-05 22:57:10 +00:00
Steve Naroff 25449a5221 Fix <rdar://problem/5986833> clang on xcode: incompatible type returning 'void', expected 'int'.
- Changed Sema::ObjCActOnStartOfMethodDef() to more accurately type "self" in factory methods.
- Changed Sema::ActOnInstanceMessage() to use the new type to restrict the lookup.

llvm-svn: 52005
2008-06-05 14:49:39 +00:00
Steve Naroff f9c65246dd Fix <rdar://problem/5987482> clang on xcode: null dereference in Sema::ActOnMemberReferenceExpr.
In addition to fixing the crasher, this commit fixes further improves property lookup (by searching protocols of qualified interfaces..."NSObject <prot>").

llvm-svn: 52001
2008-06-05 13:55:23 +00:00