Fariborz Jahanian
60a901621f
Fixed a nasty bug which took a while to come up with a test case,
...
diagnose, and took even longer to fix. It has to do with rewriting of a message
receiver which is an 'ivar' reference. Fix, however, is to remove a code which
was not doing the right thing and no longer needed.
llvm-svn: 46279
2008-01-23 20:34:40 +00:00
Chris Lattner
7238225c28
add support for -Wundef.
...
llvm-svn: 46274
2008-01-23 17:19:46 +00:00
Fariborz Jahanian
0a71ad2e07
Problem with ObjC's type-encoding of nested structs causing infinit recursion.
...
llvm-svn: 46260
2008-01-22 22:44:46 +00:00
Lauro Ramos Venancio
09af71c2a6
Implement bitfield write.
...
llvm-svn: 46258
2008-01-22 22:36:45 +00:00
Lauro Ramos Venancio
2ddcb25a3b
Implement bitfield read.
...
llvm-svn: 46257
2008-01-22 20:17:04 +00:00
Chris Lattner
97ff7763dc
Fix PR1936, a crash on malformed #if. Thanks to Neil for
...
noticing this!
llvm-svn: 46256
2008-01-22 19:34:51 +00:00
Steve Naroff
f9eb598de3
Sema::CheckInitializerTypes(). Start simpliying and cleaning up...
...
llvm-svn: 46234
2008-01-21 23:53:58 +00:00
Fariborz Jahanian
7718e36e25
Elimate bogus warning when va_start is correctly used in
...
a method.
llvm-svn: 46232
2008-01-21 22:59:53 +00:00
Lauro Ramos Venancio
37bae3e8aa
Simplify the bitfield codegen.
...
llvm-svn: 46230
2008-01-21 22:54:57 +00:00
Fariborz Jahanian
eab81cd03f
Synthesize methods with va-arg list correctly.
...
llvm-svn: 46212
2008-01-21 20:14:23 +00:00
Steve Naroff
c7d2df23f8
Fix two bugs with an @throw that doesn't have a statement.
...
- ObjCAtThrowStmt::getSourceRange() needs to check if it has a statement (and not go "boom":-)
- RewriteTest::RewriteObjCThrowStmt() needs to generate refer to the current exception.
llvm-svn: 46184
2008-01-19 00:42:38 +00:00
Steve Naroff
acb6fa6bea
Sema::FinalizeDeclaratorGroup(): Tighten up the tentative definition rule when dealing with arrays.
...
Bug submitted by Eli.
llvm-svn: 46179
2008-01-18 20:40:52 +00:00
Anders Carlsson
60bfc161a0
Assert that the type of the cast is equal to the _unqualified_ type of the subexpression. Fixes a problem spotted by Nuno Lopes.
...
llvm-svn: 46158
2008-01-18 02:25:57 +00:00
Steve Naroff
b716fbab44
Sema::FinalizeDeclaratorGroup()...make sure we emit an diagnostic for tentative definitions with incomplete types. Touch up all test cases that are effected.
...
llvm-svn: 46152
2008-01-18 00:39:39 +00:00
Fariborz Jahanian
9a5124a67e
Don't ICE on missing interface declaration when declaring one of its protocols.
...
llvm-svn: 46141
2008-01-17 20:33:24 +00:00
Steve Naroff
1aa1941889
Declarator::clear(): Null out variable after it's been deleted.
...
This avoids a double free (which is good:-)
Bug submitted by Eli.
llvm-svn: 46105
2008-01-17 00:36:28 +00:00
Steve Naroff
8a0abea999
Type::isArithmeticType(): disallow incomplete enum decls.
...
Bug submitted by Eli.
llvm-svn: 46102
2008-01-16 23:54:22 +00:00
Chris Lattner
a65e1f3b31
Move promoteExprToType from being a static method in SemaExpr.cpp to being
...
a method named ImpCastExprToType in Sema.
Use this method to insert implicit casts for case statements from their
operand type to the condition type of the switch. This fixes a crash on
test/CodeGen/statements.c, reported by Eli Friedman.
llvm-svn: 46083
2008-01-16 19:17:22 +00:00
Steve Naroff
17832a48f8
Sema::MergeFunctionDecl()...make sure diagnostic is accurate (wrt function declarations/definitions). Patch by Carl Lewis!
...
llvm-svn: 46070
2008-01-16 15:01:34 +00:00
Fariborz Jahanian
b860cbf052
Added support for rewriting of continue/break statements inside ObjC2's foreach-stmt.
...
llvm-svn: 46037
2008-01-15 23:58:23 +00:00
Steve Naroff
abefc391dd
Finish up handling all permutations of "complex int" (in Sema::UsualArithmeticConversions()).
...
A FIXME remains to verify the conversion rules are consistent with GCC.
Thanks to Eli for the new/improved test case...
llvm-svn: 46022
2008-01-15 22:21:49 +00:00
Steve Naroff
6fcfd0581d
- Change Type::isComplexType() to exlude GCC's complex integer extension. In general, we will keep the lowest level Type predicates "pure" (i.e. true to the C99 spec).
...
- Modify Sema::UsualArithmeticConversions() to work with the new definition of Type::isComplexType().
This is a nice cleanup and also fixes a bug submitted by Eli (which I've added to the test suite).
llvm-svn: 46005
2008-01-15 19:36:10 +00:00
Chris Lattner
15346fae70
avoid pasting L + "foo" into L"foo".
...
llvm-svn: 46000
2008-01-15 05:22:14 +00:00
Steve Naroff
7f988889ef
Rework commit r45976, which was incorrect.
...
- Add Type::isComplexIntegerType(), Type::getAsComplexIntegerType().
- Don't inlude complex types with Type::isIntegerType(), which is too general.
- Use the new predicates in Sema::UsualArithmeticConversions() to recognize/convert the types.
llvm-svn: 45992
2008-01-15 01:41:59 +00:00
Steve Naroff
d8c7d484af
Make sure Sema::GetTypeForDeclarator() deals with abstract declarators when diagnosing incorrect code.
...
Bug submitted by Eli.
llvm-svn: 45989
2008-01-14 23:33:18 +00:00
Steve Naroff
c28f46c6b4
Teach Type::isIntegerType() about GCC's __complex__ integer extensions...
...
Bug submitted by Eli.
llvm-svn: 45976
2008-01-14 21:38:57 +00:00
Steve Naroff
012484d6c8
Fix crasher when redefining functions. Not 100% pleased with this solution, but it is clearly an improvement. Will discuss with Chris later.
...
llvm-svn: 45975
2008-01-14 20:51:29 +00:00
Steve Naroff
d32419de0d
Record if a compound literal expression is @ file scope. This allows us to implement C99 6.5.2.5p6. This could have been done without modifying the AST (by checking the decl type and passing the info down to isContextExpr), however we concluded this is more desirable.
...
Bug/patch by Eli Friedman!
llvm-svn: 45966
2008-01-14 18:19:28 +00:00
Steve Naroff
4871fe0b8f
Revert r45951, Chris says it violates the C99 spec.
...
llvm-svn: 45961
2008-01-14 16:10:57 +00:00
Anders Carlsson
1ba25ca171
Add codegen upport for implicit casts to aggregate exprs.
...
llvm-svn: 45954
2008-01-14 06:28:57 +00:00
Chris Lattner
fd65291aa3
Fix ASTContext::typesAreCompatible when analyzing a function type with
...
proto and function type without proto. It would never call
'functionTypesAreCompatible' because they have different type classes.
llvm-svn: 45952
2008-01-14 05:45:46 +00:00
Steve Naroff
090353191c
Rewrite Expr::isNullPointerConstant() to deal with multiple levels of explicit casts.
...
Now, isNullPointerConstant() will return true for the following: "(void*)(double*)0"
llvm-svn: 45951
2008-01-14 02:53:34 +00:00
Steve Naroff
826e91ae04
Change Sema::CheckAddressOfOperation() to respect C99-only addressof rules.
...
Remove diagnostics from Sema::CheckIndirectionOperand(). C89/C99 allow dereferencing an incomplete type. clang appears to be emulating some incorrect gcc behavior (see below).
void
foo (void)
{
struct b;
struct b* x = 0;
struct b* y = &*x; // gcc produces an error ("dereferencing pointer to incomplete type")
}
With this patch, the above is now allowed.
Bug/Patch by Eli Friedman!
llvm-svn: 45933
2008-01-13 17:10:08 +00:00
Chris Lattner
317e6ba07f
Tighten up handling of __func__ and friends: it should be an array
...
of const char, and it should error if it occurs outside a function.
Is it valid in an objc method? If so we should handle that too.
llvm-svn: 45910
2008-01-12 18:39:25 +00:00
Chris Lattner
a81a0279cc
Fix the type of predefined identifiers like __func__. Patch by
...
Eli Friedman!
llvm-svn: 45906
2008-01-12 08:14:25 +00:00
Fariborz Jahanian
939776756f
Recover from user typo not having proper @interface decl and a bad foreach decl.
...
llvm-svn: 45839
2008-01-10 20:33:58 +00:00
Fariborz Jahanian
2de9a0be09
Remove non-ascii chaaracter from diagnostic
...
llvm-svn: 45836
2008-01-10 18:10:31 +00:00
Fariborz Jahanian
c644ee4992
Warn (as gcc does) when @end does not close anything.
...
llvm-svn: 45834
2008-01-10 17:58:07 +00:00
Fariborz Jahanian
db701b47d2
Pass rewritten output to 'clang' for verification.
...
llvm-svn: 45794
2008-01-10 00:30:24 +00:00
Fariborz Jahanian
82ae0152a7
Allow messaging expression as foreach's collection expression.
...
llvm-svn: 45793
2008-01-10 00:24:29 +00:00
Steve Naroff
e6b0ec8b5e
Fix Sema::ActOnDeclarator() to call MergeFunctionDecl for function decls that aren't in scope. Since C functions are in a flat namespace, we need to give them special treatment (when compared with variables and typedefs).
...
llvm-svn: 45789
2008-01-09 23:34:55 +00:00
Steve Naroff
c6edcbdb5d
Fix ASTContext::typesAreCompatible to allow for int/enum compatibility (C99 6.7.2.2p4).
...
Fix Sema::MergeFunctionDecl to allow for function type compatibility (by using the predicate on ASTContext). Function types don't have to be identical to be compatible...
llvm-svn: 45784
2008-01-09 22:43:08 +00:00
Steve Naroff
08ddb8c55c
Teach Sema::ActOnCompoundLiteral about constraint C99 6.5.2.5p3.
...
llvm-svn: 45782
2008-01-09 20:58:06 +00:00
Chris Lattner
41a1ef0dfe
implement proper support for _Bool in memory, which is usually i8, not i1.
...
This fixes a crash reported by Seo Sanghyeon
llvm-svn: 45778
2008-01-09 18:47:25 +00:00
Fariborz Jahanian
6fa7516bc9
Type-cast RHS of assignment to prevent warning compiling rewritten foreach code.
...
llvm-svn: 45777
2008-01-09 18:15:42 +00:00
Fariborz Jahanian
22f2347791
Fixed a bug whereby a parethesized collection expression was not being rewritten correctly.
...
llvm-svn: 45776
2008-01-09 17:50:00 +00:00
Fariborz Jahanian
05d2876ec3
Another test case for testing rewriteing of nested foreach-statement.
...
llvm-svn: 45769
2008-01-09 00:47:02 +00:00
Fariborz Jahanian
a305a5609e
Remove dependency on objc.h
...
llvm-svn: 45767
2008-01-09 00:33:05 +00:00
Steve Naroff
66a26044f8
Teach Expr::isConstantExpr() about CompoundLiterals.
...
llvm-svn: 45764
2008-01-09 00:05:37 +00:00
Fariborz Jahanian
965a8961c7
Patch to rewrite ObjC2's foreach-stmt.
...
llvm-svn: 45760
2008-01-08 22:06:28 +00:00