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
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
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
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
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
4f20351142
When promoting array to pointer for argument, don't lose type qualifiers.
...
llvm-svn: 45510
2008-01-02 22:50:48 +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
Fariborz Jahanian
4f41b272c9
Another test case, testing a variety of objective-c type comparisons.
...
llvm-svn: 45302
2007-12-22 00:17:49 +00:00
Fariborz Jahanian
24e1a0bd35
Another test for objective-c's type comparison.
...
llvm-svn: 45301
2007-12-21 23:48:59 +00:00
Fariborz Jahanian
a7c705ddca
This patch implements some of the more obscure type-checking involving
...
'id' quallified with protocols and static types which have categories and
inheritance which implement these protocols.
llvm-svn: 45294
2007-12-21 22:22:33 +00:00
Fariborz Jahanian
56b5c96ef7
Patch to compare to objective-c static types where one or the other
...
(but not both) may be a protocol qualified static type.
llvm-svn: 45283
2007-12-21 17:34:43 +00:00
Fariborz Jahanian
fd6f3a2460
Test case for my last patch.
...
llvm-svn: 45277
2007-12-21 00:35:35 +00:00
Fariborz Jahanian
76fcf32632
Another test for objective-c type comparison.
...
llvm-svn: 45271
2007-12-20 22:53:29 +00:00
Fariborz Jahanian
4368af07a7
More objective-c type checking. This time comparing objective-c known objects.
...
llvm-svn: 45269
2007-12-20 22:37:58 +00:00
Fariborz Jahanian
63b19f1b6e
Patch to do type-checking for objctive-c's object types.
...
More is yet to come.
llvm-svn: 45263
2007-12-20 19:24:10 +00:00
Chris Lattner
2da14fb84f
implement semantic analysis for __builtin_islessequal and friends.
...
llvm-svn: 45239
2007-12-20 00:26:33 +00:00
Fariborz Jahanian
6a128ae962
Minor test twik.
...
llvm-svn: 45208
2007-12-19 19:07:24 +00:00
Fariborz Jahanian
a1e3420c49
This patch concludes implementation of dynamic objective-c type qualified by
...
protocol list.
llvm-svn: 45203
2007-12-19 17:45:58 +00:00
Chris Lattner
ea72f449fe
Implement C99 6.7.5.3p1
...
llvm-svn: 45188
2007-12-19 05:31:29 +00:00
Fariborz Jahanian
9f0e310861
Refactoring work. ObjcQualifiedIdType is now derived from 'Type'.
...
llvm-svn: 45174
2007-12-18 21:33:44 +00:00
Chris Lattner
20aad334c7
Fix the location we emit the "not a constant" error for this:
...
int foo() {
typedef int x[foo()];
static int y = sizeof(x);
}
previously we'd emit it on the typedef, which made not sense at all.
llvm-svn: 45154
2007-12-18 07:15:40 +00:00
Chris Lattner
dcb7cc59ae
Fix an nice and subtle parser bug reported by Nico Weber.
...
llvm-svn: 45149
2007-12-18 06:06:23 +00:00
Steve Naroff
b74406ba98
Fixe bogus error for variable argument methods. Sema::ObjcGetTypeForMethodDefinition() wasn't preserving the isVariadic boolean. Another fix is to avoid synthsizing the function decl entirely, however this is a separate issue that I don't want to deal with now. Also added a FIXME to Sema::CheckFunctionCall(), which is currently emitting a bogus warning.
...
llvm-svn: 45146
2007-12-18 03:41:15 +00:00
Steve Naroff
1d2538cb4d
Improve how we find private method decls. This involved:
...
- Changed Sema::ObjcActOnStartOfMethodDef() to register the methods with the global pools.
- Changed Sema::ActOnInstanceMessage() to look in global pools (should be much less error prone).
- Added a test case to message.m (for lookup that was broken).
Misc changes while I was investigating this...
- Changed Sema::ActOnAtEnd() to call AddFactoryMethodToGlobalPool (this looked like a cut/paste error).
- Added a comment and tweaked another where I was using the first person.
llvm-svn: 45142
2007-12-18 01:30:32 +00:00
Fariborz Jahanian
24cb52c9b0
Patch to implemented objective-c's dynamic object pointer qualified with
...
the protocol list (id<P,...> types).
llvm-svn: 45121
2007-12-17 21:03:50 +00:00
Ted Kremenek
3fbeaea7ee
Modified format-string checking to not emit a warning when all of the
...
following hold:
(1) A vprintf-like function is called that takes the argument list via a
via_list argument.
(2) The format string is a non-literal that is the parameter value of
the enclosing function, e.g:
void logmessage(const char *fmt,...) {
va_list ap;
va_start(ap,fmt);
fprintf(fmt,ap); // Do not emit a warning.
}
In the future this special case will be enhanced to consult the "format"
attribute attached to a function declaration instead of just allowing a blank
check for all function parameters to be used as format strings to vprintf-like
functions. This will happen when more support for attributes becomes
available.
llvm-svn: 45114
2007-12-17 19:03:13 +00:00
Steve Naroff
eaaae467c7
Sema::ActOnMemberReferenceExpr() needs to perform the default conversions.
...
Bug and test case provided by Carl Lewis.
llvm-svn: 45078
2007-12-16 21:42:28 +00:00
Chris Lattner
3c1334013d
Don't do integer promotions of LHS for compound shift assignment. The LHS has to be a modifiable lvalue.
...
llvm-svn: 44993
2007-12-13 07:28:16 +00:00
Fariborz Jahanian
56637d127f
Fixed test to match the new diagnostic text.
...
llvm-svn: 44966
2007-12-13 00:16:34 +00:00
Fariborz Jahanian
4d1288a67e
Concatenation of objc strings.
...
llvm-svn: 44964
2007-12-12 23:55:49 +00:00
Chris Lattner
6d513f37c9
Unbreak -stats on cocoa.h
...
llvm-svn: 44919
2007-12-12 06:43:05 +00:00
Chris Lattner
b011825453
add run lines.
...
llvm-svn: 44918
2007-12-12 06:22:14 +00:00