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
Chris Lattner
807979824e
use -emit-llvm-bc
...
llvm-svn: 45372
2007-12-27 20:35:58 +00:00
Chris Lattner
40ad6cd854
no need to verify this, no errors/warnings are expected.
...
llvm-svn: 45371
2007-12-27 20:31:56 +00:00
Chris Lattner
11221033be
Fix a crash on a top-level objc string, patch by Nico Weber
...
llvm-svn: 45370
2007-12-27 20:29:42 +00:00
Chris Lattner
5e530bcee3
- Use Tok.isObjCAtKeyword instead of Tok.getIdentifierInfo()->getObjCKeywordID().
...
The later fails if the token is not an identifier.
- Replace tabs with spaces.
- Various other cleanups.
Patch by Nico Weber!
llvm-svn: 45368
2007-12-27 19:57:00 +00:00
Seo Sanghyeon
acb00f4a73
Remove broken assert from CodeGen. Better check is done in Sema.
...
llvm-svn: 45358
2007-12-26 05:21:37 +00:00
Seo Sanghyeon
6f1b274976
String literal in aggregate expression
...
llvm-svn: 45330
2007-12-23 03:11:58 +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
Devang Patel
505b4f1fd4
Convert opaque type when struct definition is seen.
...
llvm-svn: 45287
2007-12-21 19:35:28 +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
Chris Lattner
c238331377
Add support for #pragma mark, which shouldn't warn about bogus tokens.
...
llvm-svn: 45212
2007-12-19 19:38:36 +00:00
Fariborz Jahanian
6a128ae962
Minor test twik.
...
llvm-svn: 45208
2007-12-19 19:07:24 +00:00
Chris Lattner
2a70c95387
reenable this code, fix the testcase.
...
llvm-svn: 45205
2007-12-19 18:01:43 +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
37bd2ecb11
local static vars are globals also. This fixes a testcase
...
reported by Seo.
llvm-svn: 45156
2007-12-18 08:16: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
Seo Sanghyeon
d4d8c3c717
Array subscription in aggregate expression
...
llvm-svn: 45023
2007-12-14 02:04:12 +00:00
Seo Sanghyeon
3abb6d8435
Implement dereference operator in aggregate expression
...
llvm-svn: 45020
2007-12-14 01:09:11 +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
Chris Lattner
58c8be81bb
add run line
...
llvm-svn: 44917
2007-12-12 06:20:40 +00:00
Chris Lattner
2fbe8e98c4
add runline, make this test real.
...
llvm-svn: 44916
2007-12-12 06:20:18 +00:00
Chris Lattner
e01fc281c3
verify that tests contain RUN lines.
...
llvm-svn: 44915
2007-12-12 06:19:22 +00:00
Chris Lattner
c6208a72f7
Fix a codegen crash on test/CodeGen/cast.c, reported by Keith.
...
llvm-svn: 44908
2007-12-12 04:13:20 +00:00
Chris Lattner
47fbe949c4
fix expected errors.
...
llvm-svn: 44901
2007-12-12 01:15:04 +00:00
Fariborz Jahanian
27c15cca19
Add -pedantic so test passes.
...
llvm-svn: 44900
2007-12-12 01:06:09 +00:00
Chris Lattner
e002fbea56
Add ObjC parser support for concatenated ObjC strings. Note that
...
this is passed to sema and ignored there, so the second part of the
string will not make it into the AST. Passing to Fariborz to finish
Sema + AST construction.
llvm-svn: 44898
2007-12-12 01:04:12 +00:00
Fariborz Jahanian
c98d956778
Implemented type checking for pointer of objects of protocol-qualified types.
...
Note that incompatible-protocol-qualified-types.m is currently failing. This is
unrelated to this patch and Steve is looking at the general problem of not reporting
incompitible pointer types in return stetement..
llvm-svn: 44897
2007-12-12 01:00:23 +00:00
Fariborz Jahanian
4e56ed5fab
Implemented rewriting of protocol-qualified global variable types.
...
Re-implemented some of rewriting of protocol-qualified function
argument types to support it in its generality.
llvm-svn: 44886
2007-12-11 22:50:14 +00:00
Devang Patel
b37b12d102
Match union field type when member expression is u->x
...
llvm-svn: 44879
2007-12-11 21:33:16 +00:00
Fariborz Jahanian
3b5dca2533
For @optional unimplemented methods do not issue the warning.
...
llvm-svn: 44872
2007-12-11 19:10:26 +00:00
Fariborz Jahanian
251a943ce9
Fixed a parsing bug whereby @optional/@required keyword is not followed by
...
a method declaration.
llvm-svn: 44870
2007-12-11 18:34:51 +00:00
Steve Naroff
3f1223cb06
- Tweak several tests to be compatible with my last commit.
...
- Add a test to message.m for an unusual case for GCC compat (as suggested by Chris).
llvm-svn: 44842
2007-12-11 03:34:41 +00:00
Chris Lattner
11fbda2b5a
Reimplement support for strings that initialize global inits now that
...
the types are right in sema. Thanks Steve.
llvm-svn: 44834
2007-12-11 01:38:45 +00:00
Devang Patel
ab6aadb34a
Add support to share llvm fields for bit-fields.
...
For example, struct { char a; short b:2; };
llvm-svn: 44830
2007-12-11 00:49:18 +00:00
Steve Naroff
f727faf2ed
Explicitly set the string literal type from "char *" to "constant array of char".
...
At this point, I am fairly certain the front-end is correct. Unfortunately, the back-end is still unhappy.
That said, I've commented out the two lines in globalinit.c that are causing problems.
Chris, please have a look...thanks!
llvm-svn: 44823
2007-12-11 00:00:01 +00:00
Steve Naroff
91f78080e3
Add support for initializing char arrays from string literals.
...
Adapted from a patch by Anders Carlsson.
llvm-svn: 44816
2007-12-10 22:44:33 +00:00
Chris Lattner
433fb26707
add support for implicit cast from array to pointer that is not the element
...
type.
llvm-svn: 44809
2007-12-10 19:50:32 +00:00
Chris Lattner
e665077f9a
disable case that makes this fail.
...
llvm-svn: 44807
2007-12-10 19:44:50 +00:00
Devang Patel
bb5c0d8960
Use getABITypeSizeInBits() instead of getTypeSizeInBits() during struct layout.
...
llvm-svn: 44798
2007-12-10 18:25:34 +00:00
Chris Lattner
686628e052
extend or truncate the initializer for a string initializer to match its type.
...
llvm-svn: 44751
2007-12-10 00:00:56 +00:00
Chris Lattner
c25c42f3ca
Implement codegen support for:
...
char text[8] = "string";
Big fixme remains.
llvm-svn: 44750
2007-12-09 23:49:42 +00:00
Chris Lattner
4d62f42eba
Implement correct semantic analysis of subtractions, implementing
...
C99 6.5.6.
llvm-svn: 44746
2007-12-09 21:53:25 +00:00
Chris Lattner
3ed83c1c0f
The flags on tokens indicate whether they are the start of a *physical* line,
...
not the start of a logical line. Be careful about this distinction, which
affects when newlines are printed and when paste-avoidance happens, etc.
This fixes PR1848, thanks to Neil for noticing this!
llvm-svn: 44743
2007-12-09 21:11:08 +00:00
Chris Lattner
283d094b75
implement support for functions that initialize globals.
...
llvm-svn: 44730
2007-12-09 00:36:01 +00:00
Fariborz Jahanian
8ea0779624
Test case for my last patch for implementation of static protocoled type
...
used as reciver type of a message expression.
llvm-svn: 44693
2007-12-08 01:00:55 +00:00
Fariborz Jahanian
33c0e815f3
Patch for rewriting of @protocol.
...
llvm-svn: 44681
2007-12-07 18:47:10 +00:00
Fariborz Jahanian
2bbd03a755
Patch to implement "Protocol" as a built-in type declared as
...
"@class Protocol;"
llvm-svn: 44670
2007-12-07 00:18:54 +00:00
Devang Patel
65a2288eef
More struct bitfields layout work. Now handle,
...
struct STestB1 {char a; char b:2; } stb1;
struct STestB2 {char a; char b:5; char c:4} stb2;
llvm-svn: 44664
2007-12-06 19:16:05 +00:00
Fariborz Jahanian
6b644a6e05
test case for my very last patch.
...
llvm-svn: 44662
2007-12-06 17:43:04 +00:00
Chris Lattner
b36a98e9a3
Fix a bug handling typedefs of functions, patch by Nuno Lopes!
...
llvm-svn: 44661
2007-12-06 17:20:20 +00:00
Fariborz Jahanian
b31a2f2a47
Patch to prevent crash on use of objc2 syntax.
...
llvm-svn: 44617
2007-12-05 18:16:33 +00:00
Fariborz Jahanian
d5db92ba97
Changed type-cast of "struct objc_super"'s 2nd initializer to match definition of
...
"struct objc_super".
llvm-svn: 44616
2007-12-05 17:29:46 +00:00
Steve Naroff
2644aaf537
Recognize CompoundLiteralExpr's as valid lvalue's.
...
Also updated a FIXME in Sema::CheckInitializer()...
llvm-svn: 44602
2007-12-05 04:00:10 +00:00
Fariborz Jahanian
22c278a216
Test case for my last patch.
...
llvm-svn: 44581
2007-12-04 21:48:54 +00:00
Fariborz Jahanian
d0d2bd5089
Fixed a bug exposed by referencing an ivar field using component reference syntax.
...
llvm-svn: 44553
2007-12-03 22:25:42 +00:00
Ted Kremenek
b061554caa
Implemented initial support for "-triple" option to the clang driver. This
...
replaces the functionality previously provided by just "-arch" (which is still
supported but has different semantics).
The new behavior is as follows:
(1) If the user does not specify -triple:
(a) If no -arch options are specified, the target triple used is the host
triple (in llvm/Config/config.h).
(b) If one or more -arch's are specified (and no -triple), then there is
one triple for each -arch, where the specified arch is substituted
for the arch in the host triple. Example:
host triple = i686-apple-darwin9
command: clang -arch ppc -arch ppc64 ...
triples used: ppc-apple-darwin9 ppc64-apple-darwin9
(2) The user does specify a -triple (only one allowed):
(a) If no -arch options are specified, the triple specified by -triple
is used. E.g clang -triple i686-apple-darwin9
(b) If one or more -arch options are specified, then the triple specified
by -triple is used as the primary target, and the arch's specified
by -arch are used to create secondary targets. For example:
clang -triple i686-apple-darwin9 -arch ppc -arch ppc64
has the following targets:
i686-apple-darwin9 (primary target)
ppc-apple-darwin9
ppc64-apple-darwin9
Other changes related to the changes to the driver:
- TargetInfoImpl now includes the triple string.
- TargetInfo::getTargetTriple returns the triple for its primary target.
- test case test/Parser/portability.c has been updated because "-arch linux" is
no longer valid ("linux" is an OS, not an arch); instead we use a bogus
architecture "bogusW16W16" where WCharWidth=16 and WCharAlign=16.
llvm-svn: 44551
2007-12-03 22:06:55 +00:00
Chris Lattner
e5a91b4924
Fix an ast-print/ast-dump bug.
...
llvm-svn: 44550
2007-12-03 21:43:25 +00:00
Bill Wendling
db4e34984b
Fix for testcase that assigns a dereferenced reference to a pointer. The
...
standard says that we should adjust the "reference to T" type to "T"
before analysis.
llvm-svn: 44530
2007-12-03 07:33:35 +00:00
Seo Sanghyeon
3d072bea09
Ignore typedefs in pointer arithmetic codegen.
...
llvm-svn: 44529
2007-12-03 06:23:43 +00:00
Seo Sanghyeon
828429fea9
Fix isStructureType and isUnionType to ignore typedefs, as stated
...
in the header. Patch by Cédric Venet.
llvm-svn: 44519
2007-12-02 16:57:27 +00:00
Christopher Lamb
0cbd8723f3
Treat discarding array initializer elements as an extwarn (so -pedantic-errors flags it). Allow CodeGen to truncate the initializer if needed.
...
llvm-svn: 44518
2007-12-02 08:49:54 +00:00
Chris Lattner
6311b58000
all filevar's have static storage. Previously a global with
...
extern storage class was returning false from hasStaticStorage.
Ted, please review this.
llvm-svn: 44515
2007-12-02 07:47:49 +00:00
Christopher Lamb
39aeb4069b
Commit test for CL 44440.
...
llvm-svn: 44514
2007-12-02 07:47:19 +00:00
Chris Lattner
e4f0feb534
Fix buggy test
...
llvm-svn: 44513
2007-12-02 07:46:00 +00:00
Chris Lattner
d8d18d561e
add codegen support for global inits that require array decay.
...
llvm-svn: 44511
2007-12-02 07:30:13 +00:00
Chris Lattner
5bcdf24a50
Handle global variable definitions which change the type of a definition, such as:
...
extern int x[];
void foo() { x[0] = 1; }
int x[10];
void bar() { x[0] = 1; }
llvm-svn: 44509
2007-12-02 07:09:19 +00:00
Chris Lattner
41af8182d8
implement codegen for functions whose function body type don't match
...
their prototype.
llvm-svn: 44506
2007-12-02 06:27:33 +00:00
Oliver Hunt
aefc8fd415
Support initalisers for more than just int-typed static variables.
...
We now use the CodeGenModule logic for generating the constant
initialiser expression, so happily further initialiser fixes should
automatically work for statics as well.
llvm-svn: 44495
2007-12-02 00:11:25 +00:00
Chris Lattner
9e137aad78
fix a couple switch codegen problems Oliver reported.
...
llvm-svn: 44484
2007-12-01 05:27:33 +00:00
Anders Carlsson
801c5c7467
GCC has an extension where the left hand side of the ? : operator can be omitted. Handle this in a few more places.
...
llvm-svn: 44462
2007-11-30 19:04:31 +00:00
Chris Lattner
1386de8757
fix a bug handling typedefs in member expr codegen. Patch
...
by Seo Sanghyeon
llvm-svn: 44455
2007-11-30 18:02:19 +00:00
Chris Lattner
b6a7b582ee
Fix a codegen crash on void ?: reported by Oliver
...
llvm-svn: 44454
2007-11-30 17:56:23 +00:00
Chris Lattner
aa0b570dfb
Support fully general case expressions, patch by Sanghyeon Seo!
...
llvm-svn: 44453
2007-11-30 17:44:57 +00:00
Christopher Lamb
0112f62bb9
Doh! Check in this long overdue test fix.
...
llvm-svn: 44450
2007-11-30 06:35:48 +00:00
Anders Carlsson
e1af1d20ef
Support lax vector conversions.
...
llvm-svn: 44449
2007-11-30 04:21:22 +00:00
Ted Kremenek
22a0d616f6
Added "complex.c" (a copy of test/Codegen/complex.) to the serialization
...
test suite.
llvm-svn: 44439
2007-11-29 19:05:51 +00:00
Christopher Lamb
42e69f219d
Support floating point literals of the form "1e-16f" which specify an exponent but no decimal point.
...
llvm-svn: 44431
2007-11-29 06:06:27 +00:00
Ted Kremenek
2501c8294f
Fixed test case to not expect a warning when one should not be emitted.
...
Removed redundant test case.
llvm-svn: 44426
2007-11-29 01:03:21 +00:00
Ted Kremenek
0865d8a5d0
Added test cases for -Wfloat-equal to test comparisons against literals that can be
...
represented exactly and inexactly by APFloats. For the former, we do not emit a
warning.
llvm-svn: 44425
2007-11-29 01:00:11 +00:00
Ted Kremenek
5d169cf285
Inlined test case to make it independent of the stmt_exprs test case in test/Sema.
...
llvm-svn: 44416
2007-11-28 21:29:54 +00:00
Ted Kremenek
31540ed8fe
Added the "Serialization" test directory to the set of tests executed.
...
Introduced a few line breaks to make the Makefile easier to read.
llvm-svn: 44413
2007-11-28 19:24:15 +00:00
Ted Kremenek
46cfdb9625
Added initial test case for testing serialization of ASTs. This test
...
case simply performs --test-pickling on the code found in Sema/stmt_exprs.c.
llvm-svn: 44412
2007-11-28 19:23:15 +00:00
Ted Kremenek
44d5166cdb
Changed TestRunner.sh to dump the output and generated script files in
...
subdirectories mirroring where the test case file is located
For example, for the test case "Sema/stmt_exprs.c", instead of the files
"Output/stmt_exprs.c.out" and "Output/stmt_exprs.c.out.script" being created, the
files "Output/Sema/stmt_exprs.c.out" and "Output/Sema/stmt_exprs.c.out.script" are
created. This prevents any collisions from different test directories that have the
same file name for a test case, and also makes it clear where the test case was
drawn from.
llvm-svn: 44410
2007-11-28 19:16:54 +00:00
Ted Kremenek
ab18e6d7fd
Added missing "RUN:" to comment for test case file. This fixed a bug where the test
...
case testing the frontend's support of statement expressions was not being
executed.
llvm-svn: 44409
2007-11-28 19:05:11 +00:00
Chris Lattner
db2a6ef881
Fix a bug checking for 'int foo(void)' that didn't look through typedefs of void.
...
Bug pointed out by Michael Zolda, thanks!
llvm-svn: 44408
2007-11-28 18:51:29 +00:00
Oliver Hunt
93c4ce650c
Fix typo in writable string test
...
llvm-svn: 44398
2007-11-28 06:52:03 +00:00
Oliver Hunt
a951571941
Adding code gen tests for writable and shared string literals.
...
llvm-svn: 44397
2007-11-28 06:27:12 +00:00
Anders Carlsson
299f2fc648
Add more intrinsics. We can now correctly parse both Carbon.h and Cocoa.h without having to do -arch ppc.
...
llvm-svn: 44392
2007-11-28 05:19:59 +00:00
Chris Lattner
da22eeca44
add several cases that Expr::hasStaticStorage missed, pointed out by Oliver Hunt
...
llvm-svn: 44376
2007-11-27 21:35:27 +00:00
Steve Naroff
0ee0b0ab8c
Move the null pointer constant check from Sema::CheckSingleInitializer/ActOnCallExpr/CheckMessageArgumentTypes/ActOnReturnStmt to Sema::CheckSingleAssignmentConstraints. This makes sure all null pointer assignments are considered compatible.
...
Thanks to Seo Sanghyeon for the bug, follow-through, and patch!
llvm-svn: 44366
2007-11-27 17:58:44 +00:00
Anders Carlsson
de71adff60
Report errors for invalid casts from/to vectors.
...
llvm-svn: 44350
2007-11-27 05:51:55 +00:00
Ted Kremenek
6eefb85ef5
Fixed #include of objc/objc.h so that it works on case-sensitive filesystems.
...
llvm-svn: 44337
2007-11-26 22:49:09 +00:00
Fariborz Jahanian
a883d6ed89
Patch to fix a regression caused by recent rewrite changes.
...
A potential API bug in ReplaceText pending (A FIXME is added).
llvm-svn: 44333
2007-11-26 19:52:57 +00:00
Bill Wendling
8da1db4f34
The checking for the delimiters of expected error/warning messages was
...
looking only for { and } instead of {{ and }}. Changed it to check for
this explicitly.
llvm-svn: 44326
2007-11-26 08:26:20 +00:00
Chris Lattner
2ab40a6207
Fix sema support for the gnu ?: expression with a
...
missing middle expression, and fix a codegen bug where
we didn't correctly promote the condition to the right
result type. This fixes PR1824.
llvm-svn: 44322
2007-11-26 01:40:58 +00:00
Chris Lattner
a3ee6fa84f
this works.
...
llvm-svn: 44321
2007-11-26 01:39:17 +00:00
Anders Carlsson
290aa8560b
Check that the clobber registers are valid.
...
llvm-svn: 44311
2007-11-25 00:25:21 +00:00
Ted Kremenek
0d20033c6a
Added more test cases for uninitialized values checker.
...
llvm-svn: 44307
2007-11-24 23:06:58 +00:00
Ted Kremenek
2e04d73d83
Fixed bogus culling of uninitialized-values "taint" propagation during assignments.
...
We accidentally were throttling the propagation of uninitialized state across
assignments (e.g. x = y). Thanks to Anders Carlsson for spotting this problem.
Added test cases to test suite to provide regression testing for the
uninitialized values analysis.
llvm-svn: 44306
2007-11-24 20:07:36 +00:00
Ted Kremenek
33407b3338
Moved dead-stores test cast to a new test suite subdirectory: Analysis.
...
llvm-svn: 44305
2007-11-24 19:49:35 +00:00
Chris Lattner
136449a6d7
improve codegen for global variable initializers, implementing
...
test/CodeGen/global-with-initialiser.c
Patch by Oliver Hunt!
llvm-svn: 44290
2007-11-23 22:07:55 +00:00
Anders Carlsson
80a5ea3552
Check asm input and output expressions.
...
llvm-svn: 44289
2007-11-23 19:43:50 +00:00
Chris Lattner
9fcdc52243
Fix PR1820, an incredibly subtle macro expansion bug that Neil discovered.
...
Neil, please review this fix.
llvm-svn: 44285
2007-11-23 06:50:21 +00:00
Anders Carlsson
091a059c55
GCC fails if there is a trailing colon but no clobbers.
...
llvm-svn: 44265
2007-11-21 23:27:34 +00:00
Chris Lattner
5c3f1541a7
Improve function decl merging, patch by Oliver Hunt!
...
llvm-svn: 44253
2007-11-20 19:04:50 +00:00
Ted Kremenek
9e823c745d
Added another test case for the Dead Stores checker that tests that
...
block-level expressions are evaluated the same as regular expressions. Test
case provided by Nuno Lopes.
llvm-svn: 44247
2007-11-20 03:03:00 +00:00
Ted Kremenek
eb8471bfa1
Added test case for dead stores checker (live variables analysis) that tests
...
for correct propagation/update of liveness information within subexpressions
of Block-Level expressions. Test case provided by Nuno Lopes.
llvm-svn: 44225
2007-11-19 06:38:23 +00:00
Anders Carlsson
9c1011c090
Put back the flags field in the constant CF string type.
...
llvm-svn: 44222
2007-11-19 00:25:30 +00:00
Ted Kremenek
094079c0dc
Added test case for dead-stores checker. Test case provided by Nuno Lopes.
...
llvm-svn: 44221
2007-11-18 20:06:35 +00:00
Chris Lattner
48d52848d7
Tighten up address-of checking, implementing test/Sema/expr-address-of.c.
...
This fixes a bug reported by Seo Sanghyeon.
This was meant to be committed yesterday, but the commit failed. doh.
llvm-svn: 44190
2007-11-16 17:46:48 +00:00
Chris Lattner
609d413363
fix a bug Steve noticed, where a #import of the main file itself would fail.
...
llvm-svn: 44178
2007-11-15 19:07:47 +00:00
Chris Lattner
e6c7a858b0
Fix a bug handling hex floats in c90 mode, pointed out by Neil.
...
llvm-svn: 44120
2007-11-14 16:14:50 +00:00
Chris Lattner
07b201d9c0
implement test/Sema/typedef-prototype.c, allowing code
...
to declare a function with a typedef:
typedef int unary_int_func(int arg);
unary_int_func add_one;
This patch contributed by Seo Sanghyeon!
llvm-svn: 44100
2007-11-14 06:34:38 +00:00
Fariborz Jahanian
bc92fd7542
Type encoding for structs.
...
llvm-svn: 44087
2007-11-13 23:21:38 +00:00
Fariborz Jahanian
989e03989b
Fixed a rewrite of metadata bug when category implementation has no matching interface.
...
llvm-svn: 44072
2007-11-13 22:09:49 +00:00
Chris Lattner
47791a4051
Parse "sizeof(arr)[0]" as a sizeof of an expr if arr
...
is an expression.
llvm-svn: 44065
2007-11-13 20:50:37 +00:00
Ted Kremenek
794d8a6cde
Updated test case to flag about comparisons against constants. We may
...
invert this case (i.e., not flag a warning) in the future.
llvm-svn: 44059
2007-11-13 19:18:22 +00:00
Ted Kremenek
b83f182b59
Modified -Wfloat-equal logic to suppress warnings where floating point values
...
are compared against builtins such as __builtin_inf.
llvm-svn: 44058
2007-11-13 19:17:00 +00:00
Ted Kremenek
2272f72723
Added -Wfloat-equal option to the driver. This makes warnings about
...
floating point comparisons using == or != an opt-in rather than a default
warning.
Updated test case to use -Wfloat-equal.
llvm-svn: 44053
2007-11-13 18:37:02 +00:00
Chris Lattner
2f72c427cf
improve handling of address of global when checking for
...
constants and initializers. Patch by Sanghyeon Seo, thanks!
llvm-svn: 44049
2007-11-13 18:05:45 +00:00
Fariborz Jahanian
21f54eeacf
Patch to do statically typed ivar references.
...
llvm-svn: 44028
2007-11-12 22:29:28 +00:00
Steve Naroff
cac26f4f5f
This is the last 5% of the solution to teaching Sema::ActOnInstanceMessage() about private methods (r43989).
...
While the diff is large, the idea is very simple. When we parse method definitions (in an @implementation), we need to add them incrementally (rather than wait until the @end).
Other details...
- Renamed Sema::ActOnAddMethodsToObjcDecl() to Sema::ActOnAtEnd(). The methods are now optional arguments.
- Removed Parser::AllImplMethods (a nice cleanup).
- Added location info to ObjcImplementationDecl (since we will need it very soon:-)
- Modified message.m test to no longer allow the bogus diagnostic.
llvm-svn: 43995
2007-11-11 17:19:15 +00:00
Steve Naroff
5f9ae64f6e
Make sure Sema::CheckIncrementDecrementOperand() removes typedefs when doing it's analysis.
...
Thanks to Seo Sanghyeon for his excellent (first) bug fix!
llvm-svn: 43994
2007-11-11 14:15:57 +00:00
Steve Naroff
22e078e013
Teach Sema::ActOnInstanceMessage() about private methods. That is, methods declared in an implementation (but not listed in the interface).
...
This commit is only 95% of the bug fix. The last piece to this puzzle is to add the method decls to the implementation incrementally (as we encounter them). At the moment, the methods aren't added until we see an @end (which is too late).
I will complete this later...
llvm-svn: 43989
2007-11-11 00:10:47 +00:00
Fariborz Jahanian
16e3123071
pretty priting for method definitions.
...
llvm-svn: 43986
2007-11-10 20:59:13 +00:00
Steve Naroff
257b4a2467
Fix a basic bug (having to do with typedefs) in Sema::UsualArithmeticConversions().
...
This resuled in the following crash below.
Also modified the usual-float.c test case to capture this case.
[steve-naroffs-imac:clang/test/Sema] snaroff% ../../../../Debug/bin/clang usual-float.c
Assertion failed: (0 && "Sema::UsualArithmeticConversions(): illegal float comparison"), function UsualArithmeticConversions, file SemaExpr.cpp, line 960.
0 clang 0x001ef9b9 _ZN40_GLOBAL__N_Signals.cpp_00000000_4E6DAF8315PrintStackTraceEv + 45
1 clang 0x001efd5f _ZN40_GLOBAL__N_Signals.cpp_00000000_4E6DAF8313SignalHandlerEi + 323
2 libSystem.B.dylib 0x90c6297b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 libSystem.B.dylib 0x90cdb782 raise + 26
5 libSystem.B.dylib 0x90cead3f abort + 73
6 libSystem.B.dylib 0x90cdc923 __assert_rtn + 101
7 clang 0x00077316 _ZN5clang4Sema26UsualArithmeticConversionsERPNS_4ExprES3_b + 1004
8 clang 0x000803cf _ZN5clang4Sema27CheckMultiplyDivideOperandsERPNS_4ExprES3_NS_14SourceLocationEb + 181
9 clang 0x0007a8e8 _ZN5clang4Sema10ActOnBinOpENS_14SourceLocationENS_3tok9TokenKindEPvS4_ + 472
10 clang 0x000cf058 _ZN5clang6Parser26ParseRHSOfBinaryExpressionENS_6Action12ActionResultILj0EEEj + 1286
11 clang 0x000cf2de _ZN5clang6Parser25ParseAssignmentExpressionEv + 86
llvm-svn: 43985
2007-11-10 19:45:54 +00:00
Fariborz Jahanian
b5605179c4
Added class context to method declarations. Provide "interface *" type
...
to 'self' method of instance methods.
llvm-svn: 43957
2007-11-09 19:52:12 +00:00
Fariborz Jahanian
19d4dbd217
Insert invisble arguments to method definition header.
...
llvm-svn: 43948
2007-11-09 17:18:29 +00:00
Chris Lattner
45d561ad99
improve decl merging logic to be more correct with
...
functions. Patch contributed by Nuno Lopes, thanks!
llvm-svn: 43757
2007-11-06 06:07:26 +00:00
Chris Lattner
3209725c68
Add better validation for array types when merging decls. Patch
...
contributed by Oliver Hunt, thanks!
llvm-svn: 43750
2007-11-06 04:28:31 +00:00
Anders Carlsson
bfd60eedd7
Generate code for member exprs.
...
llvm-svn: 43641
2007-11-02 16:59:10 +00:00
Fariborz Jahanian
ac73ff8868
Remaining work to collect objective-c's type qualifiers and use them to encode
...
method types.
llvm-svn: 43617
2007-11-01 17:18:37 +00:00
Chris Lattner
c3ebf29ef6
Implement test/Sema/init.c by treating functions as constants.
...
llvm-svn: 43599
2007-11-01 02:45:17 +00:00
Devang Patel
ad175428c6
start adding pading fields.
...
llvm-svn: 43590
2007-11-01 00:07:12 +00:00
Anders Carlsson
e89b84ab29
Fix a typo that prevented pointer-to-int conversions from working.
...
llvm-svn: 43588
2007-10-31 23:18:02 +00:00
Anders Carlsson
0370eb2034
Handle function calls that return aggregate expressions.
...
llvm-svn: 43581
2007-10-31 22:04:46 +00:00
Devang Patel
cc4c2930ae
New test to verify llvm struct layout.
...
llvm-svn: 43577
2007-10-31 21:02:10 +00:00
Fariborz Jahanian
95b6076c77
Fixed problem with rewriting stand-alone @implementation (with no matching @interface).
...
A new test case added.
llvm-svn: 43568
2007-10-31 18:48:14 +00:00
Chris Lattner
595db86c9d
__real__ and __imag__ can be lvalues. Add support to ast and codegen for them.
...
llvm-svn: 43525
2007-10-30 22:53:42 +00:00
Fariborz Jahanian
4d5b2baa1c
Fixed tests.
...
llvm-svn: 43513
2007-10-30 20:41:57 +00:00
Fariborz Jahanian
18d7b30241
Revisited my last patch to be able to do encoding of ivar types with 'id'.
...
llvm-svn: 43507
2007-10-30 18:27:03 +00:00
Fariborz Jahanian
509d8d6fc6
Added type encoding for 'id' type.
...
llvm-svn: 43504
2007-10-30 17:06:23 +00:00
Ted Kremenek
5d18ce750a
Added to test case for "self-comparison check" uses of relation operators: x < x and x > x
...
should emit warnings.
llvm-svn: 43451
2007-10-29 17:02:56 +00:00
Ted Kremenek
e451eae8d7
For non-floating point types, added check for expressions of the form
...
"x == x" and "x != x". We emit a warning for these since they always evaluate
to a constant value and often indicate a logical error.
Added test case for this check.
llvm-svn: 43450
2007-10-29 16:58:49 +00:00
Ted Kremenek
d4ecc6da67
For checking for floating point comparison using == or !=, we now suppress
...
errors for cases such as "x == x".
Added test case to test this feature.
llvm-svn: 43447
2007-10-29 16:40:01 +00:00
Chris Lattner
5c5808a9a3
improve error recovery handling broken 'then' or 'else' stmts in
...
if statements. This implements Sema/if-empty-body.c:f3, silencing
a bogus secondary warning. It also improve the location info for
the nullstmts created for recovery purposes.
llvm-svn: 43440
2007-10-29 05:08:52 +00:00
Chris Lattner
3bc4d20862
casting to void is ok for structs (C99 6.5.4p2), this fixes
...
one bogus error on PR1750.
llvm-svn: 43436
2007-10-29 04:26:44 +00:00
Devang Patel
ed93c3c3b3
Codegen union member references.
...
llvm-svn: 43390
2007-10-26 19:42:18 +00:00
Devang Patel
7718d7a2eb
Handle non LValue base expressions.
...
llvm-svn: 43387
2007-10-26 18:15:21 +00:00
Devang Patel
ffdb07c939
Code gen static initializer.
...
llvm-svn: 43386
2007-10-26 17:50:58 +00:00
Devang Patel
8717417b3b
Codegen array initializers.
...
llvm-svn: 43385
2007-10-26 17:44:44 +00:00
Devang Patel
19c2b9a66f
Codegen global array initializers.
...
llvm-svn: 43383
2007-10-26 16:31:40 +00:00
Devang Patel
b989c9e65c
Fix "strbuf += stufflen;" crash.
...
llvm-svn: 43365
2007-10-25 22:19:13 +00:00