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
Steve Naroff
039ad3cf90
Fix Sema::CheckConditionalOperands(). The null pointer constant checks need to precede the check for two pointer operands.
...
llvm-svn: 45732
2008-01-08 01:11:38 +00:00
Chris Lattner
a30be59fa2
Fix a nasty corner case that Neil noticed in PR1900, where we would
...
incorrectly apply the multiple include optimization to files with
guards like:
#if !defined(x) MACRO
where MACRO could expand to different things in different contexts.
Thanks Neil!
llvm-svn: 45716
2008-01-07 19:50:27 +00:00
Fariborz Jahanian
d5450b7f07
Limit type of foreach's element and collection to be a pointer to
...
objc object type.
llvm-svn: 45709
2008-01-07 18:14:04 +00:00
Fariborz Jahanian
fef287cb67
Issue diagnostics if more than one declaration in objectove-c's foreach-stmt header.
...
llvm-svn: 45708
2008-01-07 17:52:35 +00:00
Chris Lattner
940cfebf90
add comments for the various AssignConvertType's, and split int->pointer from pointer->int.
...
llvm-svn: 45591
2008-01-04 18:22:42 +00:00
Chris Lattner
9bad62c72a
Merge all the 'assignment' diagnostic code into one routine, decloning
...
it from several places. This merges the diagnostics, making them more
uniform and fewer in number. This also simplifies and cleans up the code.
Some highlights:
1. This removes a bunch of very-similar diagnostics.
2. This renames AssignmentCheckResult -> AssignConvertType
3. This merges PointerFromInt + IntFromPointer which were always treated the same.
4. This updates a bunch of test cases that have minor changes to the produced diagnostics.
llvm-svn: 45589
2008-01-04 18:04:52 +00:00
Fariborz Jahanian
775d5d02af
Patch to add semantics check for ObjC2's foreacn statement.
...
llvm-svn: 45561
2008-01-04 00:27:46 +00:00
Chris Lattner
816dea2fc5
generalize some of the conversion warnings.
...
llvm-svn: 45560
2008-01-03 23:38:43 +00:00
Chris Lattner
166ae81be1
update for changes in diagnostic strings.
...
llvm-svn: 45559
2008-01-03 23:36:08 +00:00
Chris Lattner
0a788433eb
give better diagnostics for converting between function pointer and void*.
...
llvm-svn: 45556
2008-01-03 22:56:36 +00:00
Fariborz Jahanian
5cc21a7e02
Fixed a bug reported by Chris, involving assiging 0 to a qualified object type.
...
llvm-svn: 45542
2008-01-03 18:46:52 +00:00
Chris Lattner
20455f204f
Fix a crash reported by Seo Sanghyeon.
...
llvm-svn: 45530
2008-01-03 06:36:51 +00:00
Chris Lattner
4f20351142
When promoting array to pointer for argument, don't lose type qualifiers.
...
llvm-svn: 45510
2008-01-02 22:50:48 +00:00
Chris Lattner
7977cca8e8
Fix PR1895: a crash on an ugly gcc extension.
...
llvm-svn: 45505
2008-01-02 21:54:09 +00:00
Fariborz Jahanian
056e3a4e90
Issue diagnostic when objective-c's @interface is preceeded by a type specifier.
...
llvm-svn: 45491
2008-01-02 19:17:38 +00:00
Fariborz Jahanian
5e57e1890d
Prevent crash on incorrect objc messaging expression.
...
llvm-svn: 45489
2008-01-02 18:09:46 +00:00
Nate Begeman
330aaa79e0
Allow implicit casts during arithmetic for OCUVector operations
...
Add codegen support and test for said casts.
llvm-svn: 45443
2007-12-30 02:59:45 +00:00
Nate Begeman
16a3a9d5f9
Rename stats to print-stats to avoid conflicting with llvm's
...
stats statistic when clang is built as a dylib.
llvm-svn: 45441
2007-12-30 01:38:50 +00:00
Christopher Lamb
d91c3d4926
Enable CodeGen for member expressions based on call expressions returning aggregate types. This enables expressions like 'foo().member.submember'.
...
llvm-svn: 45395
2007-12-29 05:02:41 +00:00
Chris Lattner
20bc6e06cd
add a file I forgot to svn add.
...
llvm-svn: 45374
2007-12-27 21:46:27 +00:00