Steve Naroff
d1c3d1130b
Fix trivial crasher and downgrade an error to warning (to match GCC).
...
llvm-svn: 51976
2008-06-05 04:33:44 +00:00
Steve Naroff
cfdf6166fc
Support "<p>" as a short-hand for "id<p>". Here's a comment from GCC (the only documentation I could find on it).
...
/* Make "<SomeProtocol>" equivalent to "id <SomeProtocol>" - nisse@lysator.liu.se . */
This commit adds the parser magic. The type associated with <p> is still incorrect. Will discuss with Chris.
llvm-svn: 51972
2008-06-05 00:02:44 +00:00
Steve Naroff
d5bf26fa26
Fix crash identified by <rdar://problem/5986085>.
...
llvm-svn: 51969
2008-06-04 23:08:38 +00:00
Devang Patel
dbb7263fd9
Add ObjCInterface layout support.
...
Reuse RecordLayout.
llvm-svn: 51968
2008-06-04 21:54:36 +00:00
Steve Naroff
524fbe8687
Update a test and add a FIXME.
...
llvm-svn: 51967
2008-06-04 21:38:52 +00:00
Ted Kremenek
46267c839d
Added fixmes.
...
llvm-svn: 51964
2008-06-04 20:48:08 +00:00
Steve Naroff
d9c2607014
Parser::ParseObjCSynchronizedStmt() needs to Enter/Exit a decl scope.
...
llvm-svn: 51963
2008-06-04 20:36:13 +00:00
Eli Friedman
2425cd8158
For setting attributes, don't assume there are ParamVarDecls available,
...
because trying to access non-existent ParamVarDecls can crash.
Testcase from the original source for PR2414.
llvm-svn: 51960
2008-06-04 19:41:28 +00:00
Nuno Lopes
7bd6e58ddc
fix crash when codegening 'cond ? lhs : call-to-void-func()'
...
llvm-svn: 51958
2008-06-04 19:15:45 +00:00
Nuno Lopes
28bcfec325
fix type of ?: operator. If one of the operator is void, the type should be void as well.
...
Please confirm this is safe
llvm-svn: 51957
2008-06-04 19:14:12 +00:00
Fariborz Jahanian
6e59392e4b
Fix a gcc compatibility issue which allows more protocol-qualified id on RHS to be
...
assigned to less protocol qualified object on LHS.
llvm-svn: 51956
2008-06-04 19:00:03 +00:00
Eli Friedman
8547e1d129
Don't assume that the type of a FunctionDecl is a FunctionType; that
...
assumption isn't accurate in the presence of typedefs.
llvm-svn: 51951
2008-06-04 17:58:41 +00:00
Steve Naroff
c68e382ba9
ASTContext::typesAreCompatible(): id is compatible with all qualified id types.
...
llvm-svn: 51939
2008-06-04 15:07:33 +00:00
Steve Naroff
f4308aac53
Sema::ActOnClassMessage() needs to look through it's local implementation for private class methods.
...
llvm-svn: 51938
2008-06-04 14:43:54 +00:00
Steve Naroff
5ccccf0326
Make sure we look through categories when searching for a classes property.
...
Fixes <rdar://problem/5984338> clang on xcode: property implementation must have its declaration in interface 'PBXOpenQuicklyModule'
llvm-svn: 51925
2008-06-04 04:46:04 +00:00
Steve Naroff
b115be707d
Put back my temporary hack until Eli addresses this in a more complete fashion.
...
llvm-svn: 51920
2008-06-03 22:06:04 +00:00
Steve Naroff
aaf5108d26
Change Expr::isIntegerConstantExpr() to allow for pointer types (for GCC compatibility). Note FIXME.
...
Fix <rdar://problem/5977870> clang on xcode: error: arrays with static storage duration must have constant integer length
llvm-svn: 51907
2008-06-03 17:15:29 +00:00
Steve Naroff
b788d9bd27
Allow implicit pointer/int conversions on ObjCQualifiedIdTypes in Sema::CheckCompareOperands() and Sema::CheckAssignmentConstraints().
...
Fixes <rdar://problem/5980804> clang on xcode: error: incompatible type sending 'id<XDUMLType>', expected 'NSCellType'.
llvm-svn: 51902
2008-06-03 14:04:54 +00:00
Steve Naroff
0b225dac9b
Finish up r51900.
...
llvm-svn: 51901
2008-06-03 13:21:30 +00:00
Steve Naroff
b877e2c3ca
Fix parser bug/FIXME with @catch .
...
<rdar://problem/5980846> clang on xcode: error: declarator requires an identifier (for @catch )
llvm-svn: 51895
2008-06-03 05:36:54 +00:00
Steve Naroff
ebf4cb4841
Fix <rdar://problem/5979875> clang on xcode: error: use of undeclared identifier 'super'
...
llvm-svn: 51888
2008-06-02 23:03:37 +00:00
Chris Lattner
fd2fe8270e
handle the full assignment-expression grammar when using an
...
objc message send in an initializer expression.
llvm-svn: 51882
2008-06-02 21:31:07 +00:00
Ted Kremenek
0b6b0e7157
Teach the CF retain checker about "_init" methods. Fixes: <rdar://problem/5956379>
...
llvm-svn: 51872
2008-06-02 17:14:13 +00:00
Nuno Lopes
3fe4651e2e
fix decl attributes cleaning
...
this plugs the leak of attributes and also fixes a crash in the test
llvm-svn: 51862
2008-06-01 22:53:53 +00:00
Nuno Lopes
363212b3fa
fix PR2357 (#ifs didnt invalidate the multiple-inclusion optimization state)
...
llvm-svn: 51843
2008-06-01 18:31:24 +00:00
Eli Friedman
10c2417570
Make sure _Bool globals have the correct type.
...
llvm-svn: 51838
2008-06-01 15:31:44 +00:00
Steve Naroff
e643e12313
Tweak Sema::ObjCQualifiedIdTypesAreCompatible() to handle qualified interface types on the RHS.
...
This eliminates a bogus warning identified in the test below.
This fixes <rdar://problem/5968256> clang on xcode: error: incompatible type initializing 'NSObject<XCSelectionSource> *', expected 'id<NSObject,XCSelectionSource>'
llvm-svn: 51832
2008-06-01 02:43:50 +00:00
Steve Naroff
09efde0ae7
Add some more test cases that demonstrate clang is a bit stricter than GCC. These can be fixed lazily if they become a problem.
...
llvm-svn: 51830
2008-05-31 23:10:15 +00:00
Steve Naroff
524011f389
Teach Sema::CheckConditionalOperands() to check for ObjCQualifiedIdType's. This fixes a bogus error.
...
<rdar://problem/5967036> clang on xcode: error: incompatible operand types ('id<DTOutputStreams>' and 'DTFilterOutputStream *')
llvm-svn: 51828
2008-05-31 22:33:45 +00:00
Eli Friedman
252e5f1b29
Calculate alignment for local variables.
...
llvm-svn: 51826
2008-05-31 21:20:41 +00:00
Steve Naroff
a326bae77a
Fix <rdar://problem/5965704> clang: bad receiver type 'id const'
...
llvm-svn: 51809
2008-05-31 02:19:15 +00:00
Steve Naroff
66002283e6
Teach Expr::isLvalue() about ObjC properties. For now, all properties are writable. Added a FIXME for another day.
...
llvm-svn: 51800
2008-05-30 23:23:16 +00:00
Eli Friedman
6859a1b961
PR1893: Fix up the type of tentative definitions of incomplete array
...
types so that they end up the correct size.
llvm-svn: 51787
2008-05-30 20:39:54 +00:00
Eli Friedman
34994cbcbf
Fix and enable generating general union initializers. Essentially, what
...
this does is reconstruct the type for structs and arrays if the type
wouldn't be compatible otherwise.
The assertion about packing in the struct type reconstruction code
sucks, but I don't see any obvious way to fix it. Maybe we need a general
utility method to take a list of types and alignments and try to construct an
unpacked type if possible?
llvm-svn: 51785
2008-05-30 19:58:50 +00:00
Eli Friedman
66572afde4
Allow a pointer implicitly cast to a bool as a constant expression, as
...
required by the standard (the standard doesn't know anything about
implicit casts).
Disallow pointers cast to non-integral arithmetic types as constant
expressions. This was previously allowed by accident.
llvm-svn: 51779
2008-05-30 18:14:48 +00:00
Eli Friedman
3360d898ec
Make sure to allow assigning a pointer to a bool.
...
llvm-svn: 51778
2008-05-30 18:07:22 +00:00
Eli Friedman
f7fe41656c
Fix constant vector init for initializer lists with an incomplete list
...
of elements.
llvm-svn: 51769
2008-05-30 12:02:14 +00:00
Eli Friedman
617ba48fd5
Always check that the definition of a function has the correct type.
...
This fixes a crash on the included testcase (found in NetHack).
llvm-svn: 51767
2008-05-30 11:13:18 +00:00
Eli Friedman
3df5efe83e
Cleanup/refactoring of Sema struct layout. This patch unifies the struct
...
and union codepaths and fixes some minor bugs.
I'm reasonably confident this is accurate, at least for X86. I'll
correct any bugs as I find them; I haven't found any for a while,
though.
llvm-svn: 51762
2008-05-30 09:31:38 +00:00
Eli Friedman
43a6d51494
More complete/correct implementation of the comparison operators for
...
constant expressions.
llvm-svn: 51682
2008-05-29 15:17:49 +00:00
Eli Friedman
3c28524632
Fix an extremely subtle bug with pointer comparisons: they have to be
...
unsigned because it's possible (at least in theory) to have
have both positive and negative pointers pointing to the same object.
llvm-svn: 51681
2008-05-29 15:09:15 +00:00
Eli Friedman
133e8040ca
Rearrange EmitLValueForField a bit to work properly for _Bool bitfields
...
in unions (we don't want to do the union-specific bitcast for
bit-fields).
llvm-svn: 51678
2008-05-29 11:33:25 +00:00
Eli Friedman
045bf4ff82
Add codegen support for a few more kinds of initializer constant
...
expressions.
llvm-svn: 51677
2008-05-29 11:22:45 +00:00
Eli Friedman
174d9c26f1
Add CodeGen support for alignment on globals, both for unusual natural
...
alignment and alignment attributes.
llvm-svn: 51676
2008-05-29 11:10:27 +00:00
Eli Friedman
d72a9624a1
Tentative declarations are supposed to have common linkage, not weak.
...
This change makes clang generate the same thing as llvm-gcc.
llvm-svn: 51674
2008-05-29 11:03:17 +00:00
Eli Friedman
5a6d0ede91
Always use packed structs. This isn't really very nice, but there's
...
nothing fundamentally wrong with it. Emitting unpacked structs where
possible is more work for almost no practical benefit. We'll probably
want to fix it at some point anyway, but it's low priority.
The issue with long double in particular is that LLVM thinks an X86 long
double is 10 bytes, while clang considers it for all purposes to be
either 12 or 16 bytes, depending on the platform, even in a packed
struct.
llvm-svn: 51673
2008-05-29 10:58:49 +00:00
Chris Lattner
a120a521a5
Fix a couple crashes on invalid input.
...
llvm-svn: 51622
2008-05-27 23:32:43 +00:00
Devang Patel
1c56ace4df
Check first member alignment and uses packed struct if required.
...
llvm-svn: 51619
2008-05-27 22:45:40 +00:00
Devang Patel
d608074e09
Fix test case
...
llvm-svn: 51618
2008-05-27 22:44:22 +00:00
Eli Friedman
21911e89d5
A few more cases for aggregate values.
...
llvm-svn: 51596
2008-05-27 15:51:49 +00:00
Eli Friedman
5e2281ede8
Implementation of __builtin_ctlz.
...
llvm-svn: 51595
2008-05-27 15:32:46 +00:00
Eli Friedman
a904087b0d
Get the type right for wide string literals; it's wchar_t, not char.
...
llvm-svn: 51586
2008-05-27 07:57:14 +00:00
Eli Friedman
aee9e54dca
Don't swap function decls, and add them to the scope as they are
...
encountered. Mixing up the decls is unintuitive, and confuses the AST
destruction code. Fixes PR2360.
Note that there is a need to look up the characteristics and
declarations of a function associated with a particular name or decl,
but the original swapping code doesn't solve it properly.
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-May/001644.html is one
suggestion for how to fix that.
llvm-svn: 51584
2008-05-27 05:07:37 +00:00
Eli Friedman
078c963a31
Add a more reliable check for whether a static declaration has already
...
been used. In preparation for the fix to PR2360, but also a minor bug
in its own right.
llvm-svn: 51583
2008-05-27 04:58:01 +00:00
Eli Friedman
bdef5df44e
Generalize the float type generation code, and specifically fix the
...
codegen of X86 long double.
llvm-svn: 51578
2008-05-27 04:20:05 +00:00
Eli Friedman
3e113409cb
Implementation of gcc mode attribute; this is significant because
...
it fixes PR2204. Not too much to say about the implementation; it works
in a similar way to the vector size attribute.
At some point, we need to modify the targets to provide information
about the appropriate types.
llvm-svn: 51577
2008-05-27 03:33:27 +00:00
Eli Friedman
1c2d5f56f8
Change diagnostic per suggestion, to make it a bit clearer what is
...
happening.
llvm-svn: 51574
2008-05-27 02:01:50 +00:00
Eli Friedman
0e56c82e4a
Count the number of initializable members correctly in structs/unions
...
with unnamed members.
llvm-svn: 51557
2008-05-25 14:03:31 +00:00
Eli Friedman
e0f832bd4f
Diagnose implicit init list for empty aggregate, like struct {}. Fixes
...
PR2151 (by not creating the empty implicit init list).
llvm-svn: 51556
2008-05-25 13:49:22 +00:00
Eli Friedman
85f5497c4a
Move the error checking for variable-sized objects so we don't
...
double-report errors; fixes PR2362.
llvm-svn: 51555
2008-05-25 13:22:35 +00:00
Eli Friedman
d042a969c9
Fix this test on non-X86 platforms.
...
llvm-svn: 51552
2008-05-25 04:43:38 +00:00
Chris Lattner
10a7bd6341
fix a nasty off-by-one error.
...
llvm-svn: 51519
2008-05-23 23:29:33 +00:00
Chris Lattner
17c2476d0b
fix an inconsistency computing offsets that caused a crash on rewrite-nest.m
...
llvm-svn: 51514
2008-05-23 23:06:56 +00:00
Ted Kremenek
6849601f69
More test cases for retain/release checker. These cases handle not flagging leaks for static variables.
...
llvm-svn: 51486
2008-05-23 17:25:17 +00:00
Gabor Greif
f61cb42ab5
fix typo
...
llvm-svn: 51479
2008-05-23 11:19:39 +00:00
Ted Kremenek
db622628e8
Additional retain/release checker regression tests.
...
llvm-svn: 51454
2008-05-22 23:46:11 +00:00
Eli Friedman
bb5de96bc8
Patch for PR2350; the issue was tnat we were allowing (with an error)
...
void f(const void) in one place and rejecting it in another.
llvm-svn: 51424
2008-05-22 08:54:03 +00:00
Ted Kremenek
91f035cda7
Improve dead stores diagnostics to include the variable name.
...
llvm-svn: 51395
2008-05-21 22:59:16 +00:00
Ted Kremenek
b120ff1b95
Fixed bug in the transfer function for dereferences: the loaded value from EvalLoad should bind to the UnaryOperator*, not its subexpression.
...
Added test case to exercise this fix when checking for uses of uninitialized values.
Patch by Zhongxing Xu!
llvm-svn: 51377
2008-05-21 15:48:33 +00:00
Eli Friedman
43f6b67135
A small testcase; no patch, since it was a bug in a patch I never
...
committed.
llvm-svn: 51370
2008-05-21 13:21:01 +00:00
Eli Friedman
0ceef458b6
Fix this test so that it's valid; the point is to test for the crash,
...
not the missing diagnostic.
llvm-svn: 51365
2008-05-21 05:37:55 +00:00
Eli Friedman
0883bfb541
PR2347: Fix crash iterating over VLAs; this started triggering because
...
we now iterate over the whole AST when we destroy it.
llvm-svn: 51363
2008-05-21 05:06:46 +00:00
Eli Friedman
86346ede95
Fix a couple of bugs found by Neil Booth in the const-ness checking.
...
llvm-svn: 51361
2008-05-21 03:39:11 +00:00
Eli Friedman
4b44e2ee8c
Test from PR2332; bug already fixed by r51311.
...
llvm-svn: 51316
2008-05-20 12:55:29 +00:00
Eli Friedman
2460b0c941
Fix the scope of K&R-style argument declarations so that they don't
...
extend beyond the end of the function.
I'm not completely sure this is the right way to fix this bug, so
someone familiar with the parser should double-check.
llvm-svn: 51311
2008-05-20 09:10:20 +00:00
Eli Friedman
f77daf5e58
Fix test (it was incorrectly succeeding).
...
llvm-svn: 51310
2008-05-20 09:04:19 +00:00
Eli Friedman
53e38bd6b6
Add codegen support for stack address intrinsics.
...
llvm-svn: 51309
2008-05-20 08:59:34 +00:00
Eli Friedman
503731aa22
Fix typo in test.
...
llvm-svn: 51308
2008-05-20 08:27:04 +00:00
Eli Friedman
f8353034eb
Add __builtin_frame_address and __builtin_return_address gcc builtins to
...
Sema. No codegen yet.
llvm-svn: 51307
2008-05-20 08:23:37 +00:00
Eli Friedman
4b0e2a30e0
Implement codegen for comma operator for structs.
...
llvm-svn: 51304
2008-05-20 07:56:31 +00:00
Eli Friedman
d0e48ea682
Be a bit more defensive in SemaInit.
...
llvm-svn: 51301
2008-05-20 05:25:56 +00:00
Eli Friedman
37a186d765
Add some more checking for compound literals.
...
llvm-svn: 51300
2008-05-20 05:22:08 +00:00
Eli Friedman
a3a4068949
Implement CodeGen for __builtin_memcpy.
...
llvm-svn: 51282
2008-05-19 23:27:48 +00:00
Eli Friedman
ca8da1d89d
Make the unused expression warning a bit less aggressive (found in PHP
...
code).
llvm-svn: 51276
2008-05-19 21:24:43 +00:00
Eli Friedman
a68c3006f4
Switch on SemaInit; this makes some code in SemaDecl dead, but I'll give
...
it a few days to make sure there aren't any significant regressions.
llvm-svn: 51273
2008-05-19 20:29:35 +00:00
Eli Friedman
541268086a
Remove illegal test.
...
llvm-svn: 51267
2008-05-19 20:17:34 +00:00
Eli Friedman
f23b6fa41f
Fix the emission of expressions like char a[10] = "asdf"; previously,
...
they were causing bad code to be emitted. There are two fixes here: one
makes sure we emit a string that is long enough, and one makes sure we
properly handle string initialization in init lists.
llvm-svn: 51259
2008-05-19 17:51:16 +00:00
Eli Friedman
8e12298192
Add proper type-checking for pointer additiion; before, we were accepting
...
addition with a pointer and an integer even when it didn't make sense.
llvm-svn: 51228
2008-05-18 18:08:51 +00:00
Eli Friedman
f2442dcc8d
Fix support for _Bool bitfields. The issue is that the bitfield width
...
used for _Bool is not the same as the primitive width (which for _Bool
is 1 bit). The load and store changes add some casts to make the
types consistent. The EmitLValue changes make sure that the pointer is
of an appropriate type for loading the bitfield.
This isn't perfect, but it's an improvement, and getting everything
right depends on actually laying out structs in an ABI-compliant way.
llvm-svn: 51224
2008-05-17 20:03:47 +00:00
Eli Friedman
cb92a3f03b
Patch for PR2334, and a similar ObjC bug.
...
llvm-svn: 51193
2008-05-16 17:37:11 +00:00
Eli Friedman
a1b4ed8003
Implementation of __builtin_shufflevector, a portable builtin capable of
...
expressing the full flexibility of the LLVM shufflevector instruction.
The expected immediate usage is in *mmintrin.h, so that they don't
depend on the mess of gcc-inherited (and not completely implemented)
shuffle builtins.
llvm-svn: 51113
2008-05-14 19:38:39 +00:00
Eli Friedman
9fd8b68568
Add codegen support for block-level compound literals.
...
llvm-svn: 51081
2008-05-13 23:18:27 +00:00
Eli Friedman
58639e584c
Both operands to && have to be scalars, not just one.
...
llvm-svn: 51065
2008-05-13 20:16:47 +00:00
Steve Naroff
a98fe19c7e
Fix <rdar://problem/5924576> clang -fsyntax-only generates "redefinition" errors when parsing AppKit that gcc does not.
...
Teach Sema::MergeVarDecl() about __private_extern__.
llvm-svn: 51005
2008-05-12 22:36:43 +00:00
Steve Naroff
bf1516c618
Fix <rdar://problem/5928590> clang -fsyntax-only: "incompatible operand types ('int' and 'void')" on input that 'gcc -fsyntax-only' eats
...
llvm-svn: 51002
2008-05-12 21:44:38 +00:00
Chris Lattner
c9c296d235
testcase for PR2263, fixed by Nate's r50903 patch.
...
llvm-svn: 50983
2008-05-12 18:31:17 +00:00
Eli Friedman
6a7087e455
Emit basic block for switch body; fixes PR2307.
...
llvm-svn: 50968
2008-05-12 16:08:04 +00:00
Eli Friedman
6e31321043
Don't try to take the address of a bitfield; fixes PR2310.
...
llvm-svn: 50966
2008-05-12 15:06:05 +00:00
Argyrios Kyrtzidis
fa8e15bfa5
-Implement proper name lookup for namespaces.
...
-identifierResolver exposes an iterator interface to get all decls through the scope chain.
-The semantic staff (checking IdentifierNamespace and Doug's checking for shadowed tags were moved out of IdentifierResolver and back into Sema. IdentifierResolver just gives an iterator for all reachable decls of an identifier.
llvm-svn: 50923
2008-05-09 23:39:43 +00:00
Mon P Wang
b84407d6ec
Added support to generate some atomic operators (add, sub, and, or etc..)
...
llvm-svn: 50919
2008-05-09 22:40:52 +00:00