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
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
Chris Lattner
36f81fb065
Fix a recovery bug Fariborz and I noticed yesterday. We were producing:
...
method.c:4:3: error: use of undeclared identifier 'BADIDENT'
&BADIDENT, 0
^
method.c:5:2: error: expected '}'
};
^
method.c:3:14: error: to match this '{'
struct S A = {
^
now we only produce:
method.c:4:3: error: use of undeclared identifier 'BADIDENT'
&BADIDENT, 0
^
llvm-svn: 43349
2007-10-25 17:27:01 +00:00
Devang Patel
d68df20620
Handle
...
foo()->a = 42;
llvm-svn: 43315
2007-10-24 22:26:28 +00:00
Devang Patel
b67e596d86
Handle non-constant initializers.
...
llvm-svn: 43301
2007-10-24 18:05:48 +00:00
Devang Patel
61eaea88f8
Fix typo.
...
llvm-svn: 43269
2007-10-23 23:29:51 +00:00
Devang Patel
65c4afb940
Handle nested structs.
...
typdef struct A { int i; struct A *next; } A
llvm-svn: 43268
2007-10-23 23:26:46 +00:00
Devang Patel
30efa2eec9
Handle simple struct member expr.
...
llvm-svn: 43258
2007-10-23 20:28:39 +00:00
Chris Lattner
8beb9dee0e
Fix a crash on test/Sema/invalid-decl.c
...
llvm-svn: 43188
2007-10-19 20:10:30 +00:00
Steve Naroff
648e029a3d
Include a simple test case for the previous commit...
...
llvm-svn: 43158
2007-10-19 00:05:15 +00:00
Steve Naroff
a78c464c9e
Fix a bug in Sema::CheckConditionalOperands(). When mixing pointers and null pointer constants, we need to promote the null pointer constant (which is an integer) to the pointer type. Test case is self explanatory.
...
This surfaced yesterday, when compiling test/Sema/cocoa.m on Leopard. Since this has nothing to do with ObjC, it's kind of bizarre this hasn't shown up before. I imagine Cocoa.h on Leopard may have changed recently?
Thanks to Ted for localizing the bug and giving me a useful AST dump...
llvm-svn: 43114
2007-10-18 05:13:08 +00:00
Chris Lattner
fac7ac4130
UsualArithmeticConversions is crashing with an assert
...
when comparing "float" and "const float". This "fixes" the
issue, but may not be the right fix. Steve, please review.
Testcase here: test/Sema/usual-float.c
llvm-svn: 43113
2007-10-18 03:50:33 +00:00
Steve Naroff
8569d77349
Fix the following bug...
...
unsigned char asso_values[] = { 34 };
int legal2() {
return asso_values[0];
}
The code that creates the new constant array type was operating on the original type.
As a result, the constant type being generated was "unsigned char [1][]" (which is wrong).
The fix is to operate on the element type - in this case, the correct type is "unsigned char [1]"
I added this case to array-init.c, which clearly didn't catch this bogosity...
llvm-svn: 43112
2007-10-18 03:27:23 +00:00
Chris Lattner
810c1db3f5
remove typedef.
...
llvm-svn: 43109
2007-10-18 00:38:23 +00:00
Steve Naroff
a3f1336e39
rename test file for builtin "id"...
...
llvm-svn: 43082
2007-10-17 18:39:04 +00:00
Steve Naroff
0f7a2d2dd1
Predefine all the ObjC goodies from <objc/objc.h>. Removed all the ObjC goodies from the respective test files. Moving forward, it will be very nice to assume these builtin!
...
llvm-svn: 43077
2007-10-17 17:53:50 +00:00
Fariborz Jahanian
a32aaefadc
Implementation of AST for @protocol expression.
...
llvm-svn: 43075
2007-10-17 16:58:11 +00:00
Anders Carlsson
f94cd1ffe6
Generate code for static variables that don't have initializers. Also, report an error if a static initializer is not constant.
...
llvm-svn: 43058
2007-10-17 00:52:43 +00:00
Steve Naroff
077c83bddb
Add Sema::CheckMessageArgumentTypes()...
...
llvm-svn: 43050
2007-10-16 23:12:48 +00:00
Fariborz Jahanian
ebac2cb235
Patch to diagnose duplicate method implementations.
...
llvm-svn: 43046
2007-10-16 21:52:23 +00:00
Fariborz Jahanian
4bef462a3e
Patch to implement AST generation for objective-c's @selector expression.
...
llvm-svn: 43038
2007-10-16 20:40:23 +00:00
Steve Naroff
55f52da24c
Emit diagnostics for methods not found.
...
llvm-svn: 43037
2007-10-16 20:39:36 +00:00
Chris Lattner
e6dcd505d0
initialization of references should not do default fn/array promotions.
...
This fixes a bug Anders noticed.
llvm-svn: 43024
2007-10-16 02:55:40 +00:00
Fariborz Jahanian
76a9427783
Patch to parse @selector expressions.
...
llvm-svn: 43022
2007-10-15 23:39:13 +00:00
Fariborz Jahanian
d4b3015dd7
Several name lookup conflict detection fixes involving objective-c names.
...
llvm-svn: 43000
2007-10-15 19:16:57 +00:00
Anders Carlsson
b30f47a869
Fix a warning
...
llvm-svn: 42973
2007-10-15 02:50:04 +00:00
Fariborz Jahanian
fd0312ed79
Patch to check for duplicate method decls in protocols.
...
llvm-svn: 42938
2007-10-12 23:43:31 +00:00
Fariborz Jahanian
ecfe4f1453
Check and diagnose that objective-c objects may not be statically allocated.
...
llvm-svn: 42936
2007-10-12 22:10:42 +00:00
Ted Kremenek
41362cea7b
Added notion of '*' specified format width/specifiers when checking
...
printf format strings. Added type checking to see if the matching
width/precision argument was of type 'int'.
Thanks to Anders Carlsson for reporting this missing feature.
llvm-svn: 42933
2007-10-12 20:51:52 +00:00
Fariborz Jahanian
c7afeebb12
Fixed a @compatible_alias bug. In the process, discovered unnecessary 2ndry lookup
...
ok class names and streamlined this logic to do the lookup once.
llvm-svn: 42926
2007-10-12 19:38:20 +00:00
Steve Naroff
b915146a5d
Replace one FIXME with another. We handle protocols just fine now. The ObjC decl will only be 0 when we have an error on the ObjC decl. I would prefer we pass in a decl that is marked as invalid. I don't think this is critical to fix now, however I'd like us to be consistent. There are currently many places that don't mark the decl as invalid (which need to be fixed)...
...
llvm-svn: 42923
2007-10-12 18:49:25 +00:00
Anders Carlsson
431ef632cb
Add some more diagnostics for va_start, fix tests so they pass with these new diags.
...
llvm-svn: 42917
2007-10-12 17:48:41 +00:00
Fariborz Jahanian
d52cd41630
Fixed a bug whereby, struct tag name matches a typedef/objc-class name
...
and hid them.
llvm-svn: 42915
2007-10-12 16:34:10 +00:00
Steve Naroff
b213da2a70
Temporary fix to test case. This area is currently under construction...test case will be changing again soon.
...
llvm-svn: 42914
2007-10-12 16:15:17 +00:00
Fariborz Jahanian
49c6425ee6
This patch implementa objective-c's @compatibilty-alias declaration.
...
llvm-svn: 42883
2007-10-11 23:42:27 +00:00
Fariborz Jahanian
d797113659
Implemented parsing of objctive-c protocol conforming type used in
...
an identifier statement. Fixed up pretty priting to print this type
correctly.
llvm-svn: 42866
2007-10-11 18:08:47 +00:00
Fariborz Jahanian
70e8f1024a
Patch to create protocol conforming class types.
...
llvm-svn: 42856
2007-10-11 00:55:41 +00:00
Chris Lattner
5e4c75f4ef
rename -parse-ast-print to -ast-print
...
rename -parse-ast-dump to -ast-dump
remove -parse-ast, which is redundant with -fsyntax-only
llvm-svn: 42852
2007-10-11 00:18:28 +00:00
Steve Naroff
783a7a0698
Refinements to Sema::GetObjcIdType()...
...
- Cache the typedef, not the type (avoids importing AST/Type.h).
- Emit an error if "id" cannot be found.
- Comment the routine and add a FIXME to reconsider how we emulate GCC's new fangled behavior. This isn't a priority for now, since almost no code depends on having "id" built-in.
- Add a test.
llvm-svn: 42845
2007-10-10 23:24:43 +00:00
Steve Naroff
7f549f1897
- Make sure default return/argument types (for methods) default to "id".
...
- Cache the "id" type in Sema...initialize ObjcIdType and TUScope (oops).
- Fix ActOnInstanceMessage to allow for "id" type receivers...still work to do (next).
llvm-svn: 42842
2007-10-10 21:53:07 +00:00
Anders Carlsson
db83d77c78
Emit a warning when the body of an if block is a NullStmt.
...
llvm-svn: 42840
2007-10-10 20:50:11 +00:00
Steve Naroff
c62adb6d1a
Make sure methods with no return type default to "id".
...
This fixes a crasher in Sema::MatchTwoMethodDeclarations(), identified by selector-overload.m (just added).
Added Action::ActOnTranslationUnitScope() and renamed Action::PopScope to ActOnPopScope.
Added a Translation Unit Scope instance variable to Sema (will be very useful to ObjC-related actions, since ObjC declarations are always file-scoped).
llvm-svn: 42817
2007-10-09 22:01:59 +00:00
Devang Patel
152f18f671
Recognize while(1) and avoid extra blocks.
...
llvm-svn: 42811
2007-10-09 20:51:27 +00:00
Devang Patel
f8a76755df
new test
...
llvm-svn: 42810
2007-10-09 20:37:41 +00:00
Devang Patel
1166312e8b
Code gen case statement ranges.
...
llvm-svn: 42766
2007-10-08 20:57:48 +00:00
Fariborz Jahanian
ea7a98d8d6
This is the first patch toward supporting protocol conforming
...
objective-c types. It also removes use of Scope* parameter in
getObjCProtocolDecl.
llvm-svn: 42649
2007-10-05 21:01:53 +00:00
Devang Patel
64a9ca7c58
Support case statement ranges.
...
llvm-svn: 42648
2007-10-05 20:54:07 +00:00
Fariborz Jahanian
458f7114db
Patch for 1) Checking for duplicate methods decls in intterface and category.
...
2) Use of the new DenseSet<t> abstractions instead of DenseMap<t,char>.
llvm-svn: 42641
2007-10-05 18:00:57 +00:00
Devang Patel
da5d6bbc40
switch statement code gen.
...
llvm-svn: 42616
2007-10-04 23:45:31 +00:00
Fariborz Jahanian
9081457cbf
this patch accomodates clattner's comments on expression processing in @try-statement.
...
llvm-svn: 42611
2007-10-04 20:19:06 +00:00
Fariborz Jahanian
c9cd8a185d
Fixed all my recent test cases to have the RUN command and
...
fixed consequence of these changes in clang.
llvm-svn: 42600
2007-10-04 00:22:33 +00:00
Fariborz Jahanian
adf84f3f3c
Previously, I warned those methods not implemented in implementation class/category.
...
Now, I also warn those class/categories which are incomplete because of this.
llvm-svn: 42544
2007-10-02 20:06:01 +00:00
Fariborz Jahanian
89b8ef92be
This patch introduces the ObjcCategoryImplDecl class and does the checking related to
...
unimplemented methods in category implementation.
llvm-svn: 42531
2007-10-02 16:38:50 +00:00
Fariborz Jahanian
b75db4cc8c
Patch to warn on umimplemented methods coming from class's
...
protocols.
llvm-svn: 42436
2007-09-28 17:40:07 +00:00
Fariborz Jahanian
f6546b38b2
Patch for method implementation. It populates ObjcImplementationDecl object with method implementation declarations .
...
It checks and warns on those methods declared in class interface and not implemented.
llvm-svn: 42412
2007-09-27 18:57:03 +00:00
Chris Lattner
e6d9ca5443
objc messages have side effects, return true from hasLocalSideEffect,
...
fixing:
VoidMethod.m:14:5: warning: expression result unused
[Greeter hello];
^~~~~~~~~~~~~~~
llvm-svn: 42380
2007-09-26 22:06:30 +00:00
Ted Kremenek
0883fd5817
Removed option "-parse-ast-check" from clang driver. This is now implemented
...
using "-parse-ast -verify".
Updated all test cases (using a sed script) that invoked -parse-ast-check to
now use -parse-ast -verify.
Fixed a bug where using "-verify" instead of "-parse-ast-check" would not
correctly create the DiagClient needed to accumulate diagnostics.
llvm-svn: 42365
2007-09-26 20:14:22 +00:00
Fariborz Jahanian
2a4dd316a0
This patch inserts ivars declared in @implementation in its object and verifies
...
that they conform(in type, name and numbers) to those declared in @interface.
Test case highlights kind of checking we do here.
llvm-svn: 42360
2007-09-26 18:27:25 +00:00
Fariborz Jahanian
e2017c1d1d
Patch to make ObjcImplementationDecl derived from TypeDecl and supprt legacy
...
objective-c code with no @interface declaration.
llvm-svn: 42319
2007-09-25 21:00:20 +00:00
Fariborz Jahanian
bfe13c566c
This patch introduces a new class to keep track of class implementation info. It also adds more
...
semantic checks for class and protocol declarations. Test cases are good indications of kind of
checking being done in this patch.
llvm-svn: 42311
2007-09-25 18:38:09 +00:00
Chris Lattner
d05e44e74e
If we see an invalid #ifdef directive, enter a conditional compilation region
...
so that we don't emit an error on the #endif. Suggestion by Neil.
llvm-svn: 42258
2007-09-24 05:14:57 +00:00
Fariborz Jahanian
7e5d533098
This patch adds to new things to clang:
...
1. Handles saving and checking on protocols used in an @interface declaration
2. Checks and saves class's super class.
3. Adds semantic check to category declarations.
llvm-svn: 42218
2007-09-22 00:01:35 +00:00
Fariborz Jahanian
876e27dafa
This patch instantiates objects for forward protocols and in general handles use of
...
protocols referenced in @protocol declarations.
llvm-svn: 42191
2007-09-21 15:40:54 +00:00
Fariborz Jahanian
397d8de9ed
Handle forward declaration of classes and prevent re-instantiation of
...
ObjcInterfaceClass Objects.
llvm-svn: 42172
2007-09-20 20:26:44 +00:00
Fariborz Jahanian
a8bbc63c1f
Match to do some semantic analysis on objective-c class decl.
...
1. Detect used of undeclared/forward declared super class.
2. Detect duplicate definition of a class.
llvm-svn: 42168
2007-09-20 17:54:07 +00:00
Fariborz Jahanian
62fd2b4730
Patch to parse objective-c's @try-statement and @throw-statement.
...
llvm-svn: 42148
2007-09-19 19:14:32 +00:00
Fariborz Jahanian
39d641f526
Patch to add objective-c's @protocl type declaration.
...
llvm-svn: 42060
2007-09-17 21:07:36 +00:00
Fariborz Jahanian
aefb23092c
Semantic analysis for objective-c ivars.
...
llvm-svn: 41954
2007-09-14 16:27:55 +00:00
Steve Naroff
437b4d8bda
Remove a FIXME. Replace a couple asserts with an appropriate error
...
diagnostic for illegal initializers.
llvm-svn: 41889
2007-09-12 20:13:48 +00:00
Steve Naroff
09bf815f89
The goal of this commit is to get just enough Sema support to recognize Objective-C classes
...
as types. That said, the AST nodes ObjcInterfaceDecl, ObjcInterfaceType, and ObjcClassDecl are *very*
preliminary.
The good news is we no longer need -parse-noop (aka MinimalActions) to parse cocoa.m.
llvm-svn: 41752
2007-09-06 21:24:23 +00:00
Fariborz Jahanian
bd25f7d4a5
Patch for parsing objective-c style method calls.
...
llvm-svn: 41731
2007-09-05 23:08:20 +00:00
Fariborz Jahanian
7db004df78
1. Fix parsing of method prototype involving c-style argument declarations.
...
2. Fixes all allowable key-words used as selectors.
3. Template to do the messaging parse.
4. A test case for all allowable selector names.
llvm-svn: 41723
2007-09-05 19:52:07 +00:00
Chris Lattner
73ab7fa9c6
disable this for now.
...
llvm-svn: 41701
2007-09-04 16:49:09 +00:00
Steve Naroff
ac074b4df4
More fun with initializers!
...
- Fixed many bugs, enhanced test case considerably, added a diagnostic, etc.
- Refactored CheckInitList() into CheckVariableInitList()/CheckConstantInitList().
- Added CheckInitExpr().
- Support for multi-dimensional arrays looking good.
llvm-svn: 41690
2007-09-04 02:20:04 +00:00
Steve Naroff
7d2c5ed92e
Finish getting "array-init.c" to work properly.
...
Array scalar initialization is now is reasonable shape.
Next step, structure and array of structure initializers.
llvm-svn: 41681
2007-09-03 01:24:23 +00:00
Steve Naroff
b03f5940d1
More progress on array initializers.
...
- Added Expr::isConstantExpr().
- Added type checking for InitListExpr elements.
- Added diagnostic for trying to initialize a variable sized object.
llvm-svn: 41674
2007-09-02 20:30:18 +00:00
Steve Naroff
f33527a1aa
More semantic analysis of initializers.
...
Added 2 errors and one warning, updated test case.
llvm-svn: 41672
2007-09-02 15:34:30 +00:00
Steve Naroff
2fea13926f
Start implementing semantic analysis for C initializers.
...
Step 1: Start instantiating InitListExpr's.
Step 2: Call newly added function Sema::CheckInitializer() from Sema::ParseDeclarator().
Step 3: Give InitListExpr's a preliminary type.
Step 4: Start emitting diagnostics for simple assignments.
Note:
As a result of step 1, the CodeGen/mandel.c test asserts "Unimplemented agg expr!", which is expected.
As a result of step 4, the test below now fails. This isn't expected and needs to be investigated (it appears type checking for C++ references is flawed in some way).
******************** TEST 'Sema/cxx-references.cpp' FAILED! ********************
Command:
clang -fsyntax-only Sema/cxx-references.cpp
Output:
Sema/cxx-references.cpp:8:12: warning: incompatible pointer types assigning 'int &*' to 'int *'
int *p = &r;
^~
Sema/cxx-references.cpp:10:20: error: incompatible types assigning 'int (int)' to 'int (&)(int)'
int (&rg)(int) = g;
^
Sema/cxx-references.cpp:13:18: error: incompatible types assigning 'int [3]' to 'int (&)[3]'
int (&ra)[3] = a;
^
Sema/cxx-references.cpp:16:14: error: incompatible types assigning 'int *' to 'int *&'
int *& P = Q;
^
4 diagnostics generated.
******************** TEST 'Sema/cxx-references.cpp' FAILED! ********************
llvm-svn: 41671
2007-09-02 02:04:30 +00:00
Chris Lattner
cac27a5478
Fix a bug/missing-feature Ted noticed: the 'unused' warning should not
...
warn about the last stmt in a stmtexpr, f.e. there should be no warning for:
int maxval_stmt_expr(int x, int y) {
return ({int _a = x, _b = y; _a > _b ? _a : _b; });
}
llvm-svn: 41655
2007-08-31 21:49:55 +00:00
Steve Naroff
096dd942cf
Removed Sema::VerifyConstantArrayType(). With the new Array/ConstantArray/VariableArray nodes, this
...
routine was causing more trouble than it was worth. Anders/Chris noticed that it could return an error code
without emiting a diagnostic (which results in an silent invalid decl, which should *never* happen). In addition,
this routine didn't work well for typedefs and field decls. Lastly, it didn't consider that initializers aren't
in place yet.
Added Type::getAsConstantArrayType(), Type::getAsVariableArrayType(), Type::getAsVariablyModifiedType(),
and Type::isVariablyModifiedType();
Modified Sema::ParseDeclarator() and Sema::ParseField() to use the new predicates. Also added a FIXME for
the initializer omission. Also added a missing test for "static" @ file scope.
llvm-svn: 41647
2007-08-31 17:20:07 +00:00
Steve Naroff
d57fa94148
Final phase of array cleanup (for now), removing a FIXME from yesterday.
...
Moved several array constraints checks from Sema::VerifyConstantArrayType() to
Sema::GetTypeForDeclarator(). VerifyConstantArrayType() is now very simple, and
could be removed eventually.
Now, we get the following (correct) messages for BlockVarDecls:-)
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang x.c -pedantic
x.c:4:20: error: size of array has non-integer type 'float'
int size_not_int[f];
^
x.c:5:21: error: array size is negative
int negative_size[1-2];
^~~
x.c:6:17: warning: zero size arrays are an extension
int zero_size[0];
^
3 diagnostics generated.
llvm-svn: 41624
2007-08-30 22:35:45 +00:00
Chris Lattner
8718fcf35e
a new testcase
...
llvm-svn: 41614
2007-08-30 17:51:09 +00:00
Chris Lattner
fec2519b4b
-C mode doesn't return comments on "#" lines, so the diag checker doesn't pick them up.
...
Test this the hard way.
llvm-svn: 41605
2007-08-30 06:38:49 +00:00
Neil Booth
ac582c5ecb
Ensure we diagnose long long literals in C90 mode.
...
llvm-svn: 41581
2007-08-29 22:00:19 +00:00
Ted Kremenek
5ccf0d832d
Added checking (during parsing) of comparison of floating point values using == or !=.
...
This is the same functionality gcc provides via --Wfloat-equal.
llvm-svn: 41574
2007-08-29 18:06:12 +00:00
Chris Lattner
8a241f9359
Teach Type::is[un]SignedIntegerType about enum decls. This allows the code generator
...
to emit signed comparisons when needed for enum decl references. This implements
test/CodeGen/enum.c. I think enums should be good now.
llvm-svn: 41572
2007-08-29 17:48:46 +00:00
Steve Naroff
cf871f59bf
Move the "invalid decl" idiom up to Decl (where we have some bits to steal:-)
...
Converted ParmVarDecl, FileVarDecl, BlockVarDecl, and Sema::ParseIdentifierExpr() to use the idiom.
Updated array-constraint.c to make sure we no longer get "undeclared identifier" errors:-)
llvm-svn: 41552
2007-08-28 18:45:29 +00:00
Chris Lattner
35da3e29dd
extwarn about VLAs in C89 mode.
...
llvm-svn: 41545
2007-08-28 16:54:00 +00:00
Chris Lattner
f2c338b7d1
warn about long long when in c89 mode.
...
llvm-svn: 41543
2007-08-28 16:40:32 +00:00
Chris Lattner
613cef84b4
new testcase
...
llvm-svn: 41541
2007-08-28 16:20:14 +00:00
Chris Lattner
b8a501ccf1
compute the required destination type for an enum, emitting various warnings.
...
TODO: update the types of the constants and the enum.
llvm-svn: 41532
2007-08-28 06:15:15 +00:00
Chris Lattner
39f920f35b
now that all the infrastructure is in place, enforce C99 6.8.5p3.
...
Note the FIXME: we need some way to mark a decl erroneous :)
llvm-svn: 41524
2007-08-28 05:03:08 +00:00
Chris Lattner
23bf38b8c5
add some more testcases now that sema is happier :)
...
llvm-svn: 41492
2007-08-27 16:37:44 +00:00
Chris Lattner
61f6077814
testcase that doesn't work quite yet
...
llvm-svn: 41478
2007-08-27 05:23:45 +00:00
Chris Lattner
d864daf5c6
extwarn about decls intermixed with code in c89 mode.
...
llvm-svn: 41477
2007-08-27 04:29:41 +00:00
Steve Naroff
808eb8fe88
Add Type::getAsBuiltinType() and Type::builtinTypesAreCompatible().
...
Modified Type::typesAreCompatible() to use the above.
This fixes the following bug submitted by Keith Bauer (thanks!).
int equal(char *a, const char *b)
{
return a == b;
}
Also tweaked Sema::CheckCompareOperands() to ignore the qualifiers when
comparing two pointer types (though it doesn't relate directly to this bug).
llvm-svn: 41476
2007-08-27 04:08:11 +00:00
Chris Lattner
dfaf9f8c2f
implement a fixme: __extension__ marker on decls in compound stmts.
...
llvm-svn: 41473
2007-08-27 01:01:57 +00:00
Chris Lattner
2dd1b72bde
Fix test/Parser/if-scope-*.c. Patch by Neil Booth!
...
llvm-svn: 41471
2007-08-26 23:08:06 +00:00
Chris Lattner
02aac86549
new testcases
...
llvm-svn: 41465
2007-08-26 22:41:57 +00:00
Chris Lattner
9decfbabd3
Fix a bug reported by Keith Bauer
...
llvm-svn: 41452
2007-08-26 17:32:59 +00:00
Steve Naroff
5f90ca9904
Fix bogus warnings (noticed by Chris) with array-constraints.c.
...
Remove bogus type conversions in Sema::GetTypeForDeclarator(). This commit
only deals with the array types (DeclaratorCheck::Array), though the
rest of this routine should be reviewed. Given the complexity of C declarators,
I don't want to change the entire routine now (will discuss with Chris tomorrow).
llvm-svn: 41443
2007-08-26 14:38:38 +00:00
Chris Lattner
e026ebd6fe
steve's recent changes fixed this bogus warning.
...
llvm-svn: 41432
2007-08-26 06:48:28 +00:00
Chris Lattner
1895e58c84
Cases like this:
...
char *C;
C != ((void*)0);
Should not warn about incompatible pointer types. Also, make sure to
insert an implicit conversion even if the operand is null.
llvm-svn: 41408
2007-08-26 01:10:14 +00:00
Chris Lattner
1bc6fac5c6
new testcase
...
llvm-svn: 41406
2007-08-25 21:57:08 +00:00
Steve Naroff
e2562ff99d
Change Expr::isLvalue() to properly deal with ImplicitCastExpr's.
...
This fixes the following bug...
t.c:1:31: error: expression is not assignable
short x; void foo(char c) { x += c; }
This case, among others are now captured in implicit-casts.c.
llvm-svn: 41402
2007-08-25 14:37:06 +00:00
Chris Lattner
6d5922fd66
reenable this.
...
llvm-svn: 41397
2007-08-25 05:31:19 +00:00
Chris Lattner
a206358bb6
test the parser only, not sema.
...
llvm-svn: 41395
2007-08-25 05:26:51 +00:00
Chris Lattner
9f0ad96b3e
implement codegen for real/imag. TODO: imag of non-complex.
...
llvm-svn: 41376
2007-08-24 21:20:17 +00:00
Chris Lattner
3d966d6556
Teach emit-llvm for scalars to properly handle compound assignment
...
operators in all their glory :)
llvm-svn: 41373
2007-08-24 21:00:35 +00:00
Chris Lattner
afd455c0cf
make this harder
...
llvm-svn: 41346
2007-08-23 23:49:47 +00:00
Chris Lattner
67998451c7
finish off switch case overlap checking, adding support for
...
verifying case ranges.
llvm-svn: 41331
2007-08-23 18:29:20 +00:00
Chris Lattner
f81460f99c
detect and diagnose empty case ranges:
...
switch.c:16:8: warning: empty case range specified
case 100 ... 99: ; // expected-warning {{empty case range}}
^~~~~~~~~~
llvm-svn: 41328
2007-08-23 17:48:14 +00:00
Chris Lattner
fcb920d32b
fix a segfault in cases where there are no cases.
...
llvm-svn: 41317
2007-08-23 14:29:07 +00:00
Chris Lattner
10cb5e520f
report duplicate case values. TODO: report duplicate/overlapping ranges.
...
llvm-svn: 41315
2007-08-23 06:23:56 +00:00
Chris Lattner
725c6a4279
this test is passing, though it is generating bogus code at the moment.
...
llvm-svn: 41314
2007-08-23 05:47:53 +00:00
Chris Lattner
fc1c44ac7d
start checking case values of switch stmts more closely. Emit overflow
...
warnings when converting case values to the expression type.
llvm-svn: 41313
2007-08-23 05:46:52 +00:00
Chris Lattner
7d75c0d9b6
run .m files as tests
...
llvm-svn: 41308
2007-08-23 01:09:45 +00:00
Chris Lattner
c4e7a66036
Test that cocoa parses with -parse-noop. In the future
...
(when ready) this test should change to test -fsyntax-only.
llvm-svn: 41307
2007-08-23 01:08:54 +00:00
Chris Lattner
37e54f454a
Fix a nasty C99 scope issue that Neil pointed out (for ifs)
...
This fixes test/Parser/control-scope.c
llvm-svn: 41263
2007-08-22 05:16:28 +00:00
Chris Lattner
85e9b4336a
add a testcase I forgot to check in long ago
...
llvm-svn: 41219
2007-08-21 05:56:30 +00:00
Chris Lattner
91b9a4c8c3
we now correctly emit:
...
unused-expr.c:8:6: warning: comparison of distinct pointer types ('int volatile *' and 'int *')
VP == P;
~~ ^ ~
llvm-svn: 41210
2007-08-21 01:19:46 +00:00
Chris Lattner
76ba849ed3
Fix array->pointer decay. This unbreaks test/CodeGen/array.c
...
llvm-svn: 41202
2007-08-20 22:37:10 +00:00
Ted Kremenek
9fcbb10e86
Added test cases for the return-stack-address checker to test support
...
for the following C++ casts: static_cast, reinterpret_cast, and const_cast.
llvm-svn: 41181
2007-08-20 16:28:05 +00:00
Ted Kremenek
cb173fc7d0
Added extra test case to check proper handling of archaic array indexing: 4[A]
...
llvm-svn: 41147
2007-08-17 22:17:23 +00:00
Anders Carlsson
98f0790fab
Add initial support for constant CFStrings.
...
llvm-svn: 41136
2007-08-17 05:31:46 +00:00
Steve Naroff
cdee44c12a
Fixed Sema::CheckEqualityOperands() and Sema::CheckRelationalOperands() to deal more
...
thoughtfully with incompatible pointers. This includes:
- Emit a diagnostic when two pointers aren't compatible!
- Promote one of the pointers/integers so we maintain the invariant expected by the
code generator (i.e. that the left/right types match).
- Upgrade the pointer/integer comparison diagnostic to include the types.
llvm-svn: 41127
2007-08-16 21:48:38 +00:00
Ted Kremenek
e68f1aad65
Added support for additional format string checking for the printf
...
family of functions. Previous functionality only included checking to
see if the format string was a string literal. Now we check parse the
format string (if it is a literal) and perform the following checks:
(1) Warn if: number conversions (e.g. "%d") != number data arguments.
(2) Warn about missing format strings (e.g., "printf()").
(3) Warn if the format string is not a string literal.
(4) Warn about the use se of '%n' conversion. This conversion is
discouraged for security reasons.
(5) Warn about malformed conversions. For example '%;', '%v'; these
are not valid.
(6) Warn about empty format strings; e.g. printf(""). Although these
can be optimized away by the compiler, they can be indicative of
broken programmer logic. We may need to add additional support to
see when such cases occur within macro expansion to avoid false
positives.
(7) Warn if the string literal is wide; e.g. L"%d".
(8) Warn if we detect a '\0' character WITHIN the format string.
Test cases are included.
llvm-svn: 41076
2007-08-14 17:39:48 +00:00
Chris Lattner
afada9b077
xfail this for now.
...
llvm-svn: 41015
2007-08-11 00:05:07 +00:00
Chris Lattner
cccc311110
add support for a top-level __extension__ marker, implementing a todo.
...
llvm-svn: 41004
2007-08-10 20:57:02 +00:00
Chris Lattner
b87b1b36ee
initial support for checking format strings, patch by Ted Kremenek:
...
"I've coded up some support in clang to flag warnings for non-constant format strings used in calls to printf-like functions (all the functions listed in "man fprintf"). Non-constant format strings are a source of many security exploits in C/C++ programs, and I believe are currently detected by gcc using the flag -Wformat-nonliteral."
llvm-svn: 41003
2007-08-10 20:18:51 +00:00
Chris Lattner
ac9823bc5d
Build ASTs before relexing the file. This avoids having comment finding mutate the
...
preprocessor state, causing bogus diagnostics when the file is parsed for real. This
implements Misc/diag-checker.c. Thanks to Ted for noticing this.
llvm-svn: 41000
2007-08-10 18:27:41 +00:00
Chris Lattner
213ef35a89
fix this test to pass.
...
llvm-svn: 40996
2007-08-10 17:18:58 +00:00
Chris Lattner
e9a91ae4ea
make this harder
...
llvm-svn: 40994
2007-08-10 17:02:59 +00:00
Steve Naroff
12b0447bc6
Finish implementing __builtin_classify_type()...
...
llvm-svn: 40951
2007-08-08 22:15:55 +00:00
Steve Naroff
8a4cf97aa9
Make sure the good old "function/array conversion" is done to function parameters.
...
This resulted in the following error...
[dylan:clang/test/Parser] admin% cat parmvardecl_conversion.c
// RUN: clang -parse-ast-check %s
void f (int p[]) { p++; }
[dylan:clang/test/Parser] admin% clang -parse-ast-check parmvardecl_conversion.c
Errors seen but not expected:
Line 3: cannot modify value of type 'int []'
With this fix, the test case above succeeds.
llvm-svn: 40831
2007-08-05 02:16:31 +00:00
Chris Lattner
374b06a080
the sse intrinsics are missing, leading to errors.
...
llvm-svn: 40800
2007-08-04 00:19:10 +00:00
Chris Lattner
2f48d5e2ed
fix hang in testsuite
...
llvm-svn: 40799
2007-08-04 00:18:28 +00:00
Steve Naroff
0104731e62
Restrict vector component access (using "." and "[]") to variables.
...
Chris suggested this, since it simplifies the code generator.
If this features is needed (and we don't think it is), we can revisit.
The following test case now produces an error.
[dylan:~/llvm/tools/clang] admin% cat t.c
typedef __attribute__(( ocu_vector_type(4) )) float float4;
static void test() {
float4 vec4;
vec4.rg.g;
vec4.rg[1];
}
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang t.c
t.c:8:12: error: vector component access limited to variables
vec4.rg.g;
^~
t.c:9:12: error: vector component access limited to variables
vec4.rg[1];
^~~
2 diagnostics generated.
llvm-svn: 40795
2007-08-03 22:40:33 +00:00
Steve Naroff
9efdabc565
Implement __builtin_choose_expr.
...
llvm-svn: 40794
2007-08-03 21:21:27 +00:00
Steve Naroff
7d451d614c
Add a test case to validate code gen for typeof/builtin_types_compatible.
...
This test case currently generates the following unexpected warnings (when compared with gcc).
[dylan:clang/test/Parser] admin% ../../../../Debug/bin/clang -parse-ast-check builtin_types_compatible.c
Warnings seen but not expected:
Line 28: expression result unused
Line 29: expression result unused
Line 30: expression result unused
Line 31: expression result unused
Line 32: expression result unused
Line 33: expression result unused
llvm-svn: 40789
2007-08-03 18:38:22 +00:00
Chris Lattner
b20b94de3a
testcase for vector element access stuff.
...
llvm-svn: 40783
2007-08-03 16:42:43 +00:00
Chris Lattner
30709dc432
oops, this is the real fix.
...
llvm-svn: 40766
2007-08-02 22:41:43 +00:00
Chris Lattner
7aa350019a
update test
...
llvm-svn: 40765
2007-08-02 22:36:03 +00:00
Chris Lattner
181b01bcfd
make sure we don't lose the ability to parse carbon.h
...
llvm-svn: 40759
2007-08-02 21:40:29 +00:00
Steve Naroff
236becbbc3
Two typeof() related changes...
...
- Changed the name of ASTContext::getTypeOfType(Expr*)->getTypeOfExpr().
- Remove FIXME for TypeOfExpr::getAsStringInternal(). This will work fine for printing the AST. It isn't ideal
for error diagnostics (since it's more natural to display the expressions type).
One "random" (or at least delayed:-) change...
- Changed all "ext_typecheck_*" diagnostics from EXTENSION->WARNING. Reason: Since -pedantic is now
off (by default), these diagnostics were never being emitted (which is bad). With this change, clang will
emit the warning all the time. The only downside (wrt GCC compatibility) is -pedantic-errors will not turn
this diagnostics into errors (a "feature" of making tagging them with EXTENSION). When/if this becomes
an issue, we can revisit.
llvm-svn: 40676
2007-08-01 17:20:42 +00:00
Steve Naroff
872da803b2
Tighten up Parser::ParseTypeofSpecifier().
...
Add some more tests to typeof.c. Also added a couple of missing "expect" attributes that caused the test to fail.
llvm-svn: 40656
2007-07-31 23:56:32 +00:00
Steve Naroff
ad373bdcfe
Add parsing and AST support for GNU "typeof".
...
Many small changes to lot's of files.
Still some FIXME's, however the basic support is in place.
llvm-svn: 40631
2007-07-31 12:34:36 +00:00
Steve Naroff
0d595ca0bb
Finish up semantic analysis for vector components.
...
llvm-svn: 40584
2007-07-30 03:29:09 +00:00
Steve Naroff
f8fd09e22b
Implement syntax/semantic analysis for OCU Vector Components.
...
Next step, AST support...
llvm-svn: 40568
2007-07-27 22:15:19 +00:00
Chris Lattner
626246e93c
don't expect to be able to reparse arbitrary system headers.
...
llvm-svn: 40511
2007-07-26 05:59:05 +00:00
Chris Lattner
02c0439a44
Fix a couple of bugs, add some new cool stuff.
...
1. Fix a todo in Parser::ParseTag, to recover better. On code like
that in test/Sema/decl-invalid.c it causes us to return a single
error instead of multiple.
2. Fix an error in Sema::ParseDeclarator, where it would crash if the
declarator didn't have an identifier. Instead, diagnose the problem.
3. Start adding infrastructure to track the range of locations covered
by a declspec or declarator. This is mostly implemented for declspec,
but could be improved, it is missing for declarator.
Thanks to Neil for pointing out this crash.
llvm-svn: 40482
2007-07-25 00:24:17 +00:00
Steve Naroff
44fd8ff400
Fix Sema::ParseCallExpr()...it wasn't doing the default array/function promotions on it's argument types.
...
This resulted in the following errors when compiling promote_types_in_proto.c test...
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang test/Parser/promote_types_in_proto.c
test/Parser/promote_types_in_proto.c:7:24: error: incompatible types passing 'char *[]' to function expecting 'char *const []'
arrayPromotion(argv);
~~~~~~~~~~~~~~ ^~~~
test/Parser/promote_types_in_proto.c:8:27: error: incompatible types passing 'void (char *const [])' to function expecting 'void (char *const [])'
functionPromotion(arrayPromotion);
~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~
2 diagnostics generated.
When fixing this, noticed that both ParseCallExpr() and ParseReturnStmt() were prematurely comparing types for
equivalence. This is incorrect (since the expr. promotions haven't been done yet). To fix this, I moved the
check "down" to Sema::CheckAssignmentConstraints().
I also converted Type::isArrayType() to the modern API (since I needed it). Still more Type predicates to
convert.
llvm-svn: 40475
2007-07-24 21:46:40 +00:00
Chris Lattner
366727fca1
implement ast building and trivial semantic analysis of stmt exprs.
...
This implements test/Sema/stmt_exprs.c
llvm-svn: 40465
2007-07-24 16:58:17 +00:00
Chris Lattner
54f4d2bd57
correctly verify that default and case are in a switchstmt,
...
this fixes test/Sema/switch.c.
llvm-svn: 40438
2007-07-23 17:05:23 +00:00
Chris Lattner
43eafb4ed5
implement a missing feature in the #include handler, where
...
it did not handle <xyz> headers coming from macro expansions.
This requires special treatment, as the include name is lexed
as multiple tokens, which require reassembly before processing.
llvm-svn: 40418
2007-07-23 04:56:47 +00:00
Anders Carlsson
51873c22d8
Refactor switch analysis to make it possible to detect duplicate case values
...
llvm-svn: 40388
2007-07-22 07:07:56 +00:00
Chris Lattner
e34b2c298a
Catch goto's with a missing identifier, patch by Neil Booth.
...
llvm-svn: 40381
2007-07-22 04:13:33 +00:00
Chris Lattner
c850ad6ee1
Fix a lexer bug where we incorrectly rejected
...
int i = /*/ */ 1;
Thanks to Neil for pointing this out.
llvm-svn: 40379
2007-07-21 23:43:37 +00:00
Chris Lattner
fd5e05f5ce
testcase from neil
...
llvm-svn: 40173
2007-07-21 05:32:22 +00:00
Chris Lattner
a6f5ab5425
Fix off-by-one error when emitting diagnostics. Also, make diagnostic
...
a bit nicer for people who pass lots of extra arguments to calls by
selecting them all instead of just the first one:
arg-duplicate.c:13:13: error: too many arguments to function
f3 (1, 1, 2, 3, 4); // expected-error {{too many arguments to function}}
^~~~~~~
This implements test/Sema/arg-duplicate.c, thanks to Neil for pointing
out this crash.
llvm-svn: 40136
2007-07-21 03:09:58 +00:00
Chris Lattner
3940737edf
Two fixes:
...
1) fix a crash on test/Sema/default.c by making
sure that the switch scope is non-null.
2) if there is an error sema'ing a default or case stmt,
make sure to return the substmt up, so that the error
recovery code has more acurate info to continue with.
llvm-svn: 40134
2007-07-21 03:00:26 +00:00
Chris Lattner
24dbee71ab
Fix a stringizing bug that Neil noticed. We should preprocess this:
...
#define t(x) #x
t(a
c)
to "a c", not "ac".
llvm-svn: 40060
2007-07-19 16:11:58 +00:00
Steve Naroff
fbd098332c
Work towards fixing crasher with compound literals...
...
Before this commit, we crashed in ParseBinOp...
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang -parse-ast-check compound_literal.c
SemaExpr.cpp:1298: failed assertion `(rhs != 0) && "ParseBinOp(): missing right expression"'
With this commit, we still crash in the newly added action ParseCompoundLiteral (which is progress:-)
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang -parse-ast-check compound_literal.c
SemaExpr.cpp:478: failed assertion `(Op != 0) && "ParseCompoundLiteral(): missing expression"'
The crash go away once the actions return AST nodes. I will do this in a separate commit.
llvm-svn: 40032
2007-07-19 01:06:55 +00:00
Chris Lattner
5fbd7e0264
Fix a crasher that Neil reported: Sema::GetTypeForDeclarator should never
...
return a null type. If there is an error parsing the type, pick a new type
for error recovery purposes.
llvm-svn: 40029
2007-07-19 00:42:40 +00:00
Chris Lattner
5c98379b1c
Correctly respect C99 5.1.1.2p4 when searching for the first '(' of
...
a function-like macro invocation. Patch contributed by Neil Booth.
llvm-svn: 40026
2007-07-19 00:07:36 +00:00
Chris Lattner
5b2f6970c1
I forgot to check this in earlier
...
llvm-svn: 39958
2007-07-17 04:58:06 +00:00
Bill Wendling
dfc810717e
Fix references:
...
According to the spec (C++ 5p6[expr]), we need to adjust "T&" to
"T" before further analysis. We do this via the "implicit cast"
thingy.
llvm-svn: 39953
2007-07-17 03:52:31 +00:00
Steve Naroff
1a2cf6b3b3
Implement semantic analysis for the cast operator.
...
llvm-svn: 39943
2007-07-16 23:25:18 +00:00
Chris Lattner
bb1b44f004
Make octal constant lexing use AdvanceToTokenCharacter to give more
...
accurate diagnostics. For test/Lexer/comments.c we now emit:
int x = 000000080; /* expected-error {{invalid digit}} */
^
constants.c:7:4: error: invalid digit '8' in octal constant
00080; /* expected-error {{invalid digit}} */
^
The last line is due to an escaped newline. The full line looks like:
int y = 0000\
00080; /* expected-error {{invalid digit}} */
Previously, we emitted:
constants.c:4:9: error: invalid digit '8' in octal constant
int x = 000000080; /* expected-error {{invalid digit}} */
^
constants.c:6:9: error: invalid digit '8' in octal constant
int y = 0000\
^
which isn't too bad, but the new way is better for the user,
regardless of whether there is an escaped newline or not.
All the other lexer-related diagnostics should switch over
to using AdvanceToTokenCharacter where appropriate. Help
wanted :).
This implements test/Lexer/constants.c.
llvm-svn: 39906
2007-07-16 06:55:01 +00:00
Chris Lattner
f57999dcb1
add required directories to the path automatically, so the user doesn't need to worry about it.
...
llvm-svn: 39901
2007-07-16 04:35:52 +00:00
Chris Lattner
539007a78a
Add support for C++'0x keywords, patch by Doug Gregor
...
llvm-svn: 39897
2007-07-16 04:18:29 +00:00
Chris Lattner
51aff8bd7c
Remove an extraneous QualType from CastExpr, it's type is always
...
the result type of the expr node.
Implement isIntegerConstantExpr for ImplicitCastExpr nodes the same
was as for CastExpr nodes.
Implement proper sign/zero extension as well as truncation and noop
conversion in the i-c-e evaluator. This allows us to correctly
handle i-c-e's like these:
char array[1024/(sizeof (long))];
int x['\xBb' == (char) 187 ? 1: -1];
this implements test/Sema/i-c-e2.c
llvm-svn: 39888
2007-07-15 23:54:50 +00:00
Gabor Greif
e97cd7e65c
add FIXME and un-XFAIL test
...
llvm-svn: 39858
2007-07-14 20:05:18 +00:00
Bill Wendling
657a203adf
Add missing directory
...
llvm-svn: 39853
2007-07-14 09:37:10 +00:00
Chris Lattner
666115c848
Improve char literal pretty printing, patch by Keith Bauer!
...
llvm-svn: 39846
2007-07-13 23:58:20 +00:00
Gabor Greif
03a0073b36
fix type of main, use !=
...
llvm-svn: 39842
2007-07-13 23:40:27 +00:00
Gabor Greif
d4606aa36e
implement _Complex * == and !=
...
llvm-svn: 39841
2007-07-13 23:33:18 +00:00
Gabor Greif
f7b1f667d4
a simple _Complex testcase
...
llvm-svn: 39836
2007-07-13 22:15:44 +00:00
Chris Lattner
35ed92817a
Unspecified type specs default to int. This fixes a crash
...
on test/Sema/implicit-int.c
llvm-svn: 39833
2007-07-13 21:02:29 +00:00
Chris Lattner
91dacfec85
Check in these testcases.
...
llvm-svn: 39829
2007-07-13 20:18:44 +00:00
Chris Lattner
effb7a350f
new testcase that crashes the cfe due to implicit conversion fun
...
llvm-svn: 39826
2007-07-13 20:11:01 +00:00
Chris Lattner
fc7634f2ab
"Someone typed "PtrToInt" where they meant "IntToPtr".
...
I've added a tests/CodeGen directory, and a test for this case that
used to fail and now passes."
Patch by Keith Bauer
llvm-svn: 39794
2007-07-13 03:25:53 +00:00
Chris Lattner
cf9be2d315
update tests
...
llvm-svn: 39786
2007-07-12 16:52:08 +00:00
Chris Lattner
d1c161786f
-pedantic no longer defaults to on.
...
llvm-svn: 39785
2007-07-12 16:49:27 +00:00
Chris Lattner
1e52eee112
update test
...
llvm-svn: 39784
2007-07-12 16:48:52 +00:00
Chris Lattner
113d1410ce
don't pick up random stuff in .svn directories.
...
llvm-svn: 39783
2007-07-12 16:46:07 +00:00
Chris Lattner
63e92754d0
Convert .cvsignore files
...
llvm-svn: 39731
2007-07-11 06:43:45 +00:00
Bill Wendling
772996ab44
Submitted by: Bill Wendling
...
- The && at the end was causing this to fail. Removed.
llvm-svn: 39709
2007-06-29 09:54:25 +00:00
Chris Lattner
bdf3f73eeb
fix this test to work with the checker.
...
llvm-svn: 39708
2007-06-28 05:49:50 +00:00
Bill Wendling
52b4b73442
Submitted by: Bill Wendling
...
Fixed checking to coincide with the correct lines.
llvm-svn: 39696
2007-06-27 18:18:03 +00:00
Bill Wendling
764b90ad4e
Submitted by: Bill Wendling
...
- Revert use of -parse-ast-check.
llvm-svn: 39695
2007-06-27 18:13:04 +00:00
Bill Wendling
87e46687d9
Submitted by: Bill Wendling
...
Reviewed by: Chris Lattner
Split up lines to have only one expected output per line. Restored some
checks.
llvm-svn: 39688
2007-06-27 07:31:17 +00:00
Bill Wendling
fdddfc115e
Submitted by: Bill Wendling
...
Reviewed by: Chris Lattner
- Reverted some checks because they're checking the preprocessor output.
llvm-svn: 39687
2007-06-27 07:26:41 +00:00
Chris Lattner
c4c8e2546b
New testcase for unused expression analysis
...
llvm-svn: 39683
2007-06-27 05:58:33 +00:00
Bill Wendling
eb2def66be
Submitted by: Bill Wendling
...
- Converted to use the -parse-ast-check flag.
llvm-svn: 39681
2007-06-27 04:30:12 +00:00
Bill Wendling
ff1d2c81ba
Submitted by: Bill Wendling
...
- Convert to using the -parse-ast-check method to check warnings and
errors.
llvm-svn: 39680
2007-06-27 04:07:44 +00:00
Chris Lattner
7cf04d1653
we correctly reject array of void now
...
llvm-svn: 39614
2007-06-08 18:15:09 +00:00
Chris Lattner
5a1a0250f8
this testcase has errors, we expect clang to reject it
...
llvm-svn: 39613
2007-06-08 18:14:27 +00:00
Chris Lattner
7a89360402
This testcase bus errors because semantics analysis of these operators isn't implemented.
...
llvm-svn: 39612
2007-06-08 18:13:24 +00:00
Chris Lattner
43312241ea
new testcase
...
llvm-svn: 39609
2007-06-08 17:58:14 +00:00
Chris Lattner
e9a7da1d55
Make make check work again.
...
llvm-svn: 39608
2007-06-08 17:57:13 +00:00
Bill Wendling
cbf4709c03
Add const/volatile badness
...
llvm-svn: 39579
2007-06-03 09:02:28 +00:00
Bill Wendling
6811c0b5f3
Bug #:
...
Submitted by: Bill Wendling
Reviewed by:
C++ references testcase.
llvm-svn: 39497
2007-05-27 10:16:12 +00:00
Chris Lattner
99ca091b9c
Warn when performing 'usual' conversions that require a sign change. This
...
implements test/Preprocessor/expr_usual_conversions.c, which produces this
output:
expr_usual_conversions.c:5:10: warning: left side of operator converted from negative value to unsigned: -42 to 18446744073709551574
#if (-42 + 0U) / -2
^
expr_usual_conversions.c:5:16: warning: right side of operator converted from negative value to unsigned: -2 to 18446744073709551614
#if (-42 + 0U) / -2
^
llvm-svn: 39406
2007-04-11 04:14:45 +00:00
Chris Lattner
9e2fcccc33
Fix run line
...
llvm-svn: 39401
2007-04-10 07:06:36 +00:00
Chris Lattner
a7fa1b247c
'true' in a CPP expression evaluates to 1 when in C++ mode. This implements
...
test/Preprocessor/cxx_true.cpp
llvm-svn: 39399
2007-04-10 06:16:30 +00:00
Chris Lattner
6acf759735
new testcase
...
llvm-svn: 39396
2007-04-10 05:25:39 +00:00
Bill Wendling
82487e1ac3
Testcase for bool types.
...
llvm-svn: 39339
2007-02-13 01:52:09 +00:00
Chris Lattner
a4792c1e64
new testcase that crashed clang
...
llvm-svn: 39315
2007-01-27 06:23:34 +00:00
Chris Lattner
41175f40a3
random testcase
...
llvm-svn: 39301
2007-01-25 07:42:11 +00:00
Chris Lattner
8eaca54d76
new testcase
...
llvm-svn: 39287
2007-01-23 20:16:22 +00:00
Chris Lattner
3e30f7c70f
add a testcase for c++ casting operators, by Bill
...
llvm-svn: 39285
2007-01-23 06:12:15 +00:00
Chris Lattner
23f2e9e687
new testcase
...
llvm-svn: 39271
2007-01-23 01:32:33 +00:00
Chris Lattner
ac71608b17
new testcase
...
llvm-svn: 39251
2007-01-21 06:56:08 +00:00
Chris Lattner
1b65aaef2b
improve this test to also check -fno-operator-keywords.
...
llvm-svn: 39246
2006-12-04 18:00:36 +00:00
Chris Lattner
c81f079d7e
move void argument checking from the parser to the semantic analysis stage.
...
This allows us to handle typedefs of void correctly. This implements
clang/test/Sema/void_arg.c
llvm-svn: 39236
2006-12-03 02:43:54 +00:00
Chris Lattner
784b168c92
new testcase
...
llvm-svn: 39233
2006-12-02 07:59:33 +00:00
Chris Lattner
c5b966f893
check minutia of the standard.
...
llvm-svn: 39215
2006-11-21 17:31:32 +00:00
Chris Lattner
5b9f4891d7
Add support for C++ operator keywords. Patch by Bill Wendling.
...
llvm-svn: 39214
2006-11-21 17:23:33 +00:00
Chris Lattner
058b4b6b41
run .cpp files as tests
...
llvm-svn: 39213
2006-11-21 17:22:28 +00:00
Chris Lattner
017865fb62
adjust test
...
llvm-svn: 39201
2006-11-21 04:06:06 +00:00
Chris Lattner
eda517e456
new testcase
...
llvm-svn: 39195
2006-11-20 07:03:41 +00:00
Chris Lattner
33ad2cacc9
Make Scope keep track of the kind of scope it is. Properly scope loop and
...
switch statements. Make break/continue check that they are inside of an
appropriate control-flow construct. This implements Parser/bad-control.c.
llvm-svn: 39136
2006-11-05 23:47:55 +00:00
Chris Lattner
ce999c490a
new testcase
...
llvm-svn: 39068
2006-10-27 05:43:33 +00:00
Chris Lattner
a32cda40b5
make this harder
...
llvm-svn: 39054
2006-10-25 06:21:19 +00:00
Chris Lattner
1178cbd941
new testcase
...
llvm-svn: 39053
2006-10-25 06:18:35 +00:00
Chris Lattner
19f4440f5b
new testcase
...
llvm-svn: 39040
2006-10-25 03:14:54 +00:00
Chris Lattner
2bda2df3dc
new testcase
...
llvm-svn: 39020
2006-10-20 05:08:12 +00:00
Chris Lattner
43ec2ce473
new testcase
...
llvm-svn: 39000
2006-10-17 03:00:45 +00:00
Chris Lattner
dee9b26fb8
new testcase
...
llvm-svn: 38996
2006-10-17 02:53:13 +00:00
Chris Lattner
02846975da
new testcase
...
llvm-svn: 38982
2006-10-14 19:53:37 +00:00
Chris Lattner
3e8b4d2854
new testcase for #define_target.
...
llvm-svn: 38981
2006-10-14 19:09:13 +00:00
Chris Lattner
aecc057c64
new testcase
...
llvm-svn: 38976
2006-10-14 07:54:12 +00:00
Chris Lattner
8f46a38503
new testcase
...
llvm-svn: 38953
2006-10-06 02:59:40 +00:00
Chris Lattner
3ca67ba67f
new testcase
...
llvm-svn: 38927
2006-08-15 05:11:49 +00:00
Chris Lattner
7bddb3fc61
add bare struct tag decls.
...
llvm-svn: 38899
2006-08-13 19:59:13 +00:00
Chris Lattner
5b6032ab3c
new offsetof testcase
...
llvm-svn: 38892
2006-08-12 19:15:40 +00:00
Chris Lattner
3b51ddf438
new testcase
...
llvm-svn: 38889
2006-08-12 18:40:31 +00:00
Chris Lattner
2c5c421203
add test4
...
llvm-svn: 38886
2006-08-12 18:11:24 +00:00
Chris Lattner
e66218bf49
Split the expression tests out of statements.c into expressions.c
...
llvm-svn: 38882
2006-08-12 17:19:28 +00:00
Chris Lattner
89d53752f5
Fix parsing of assignment expressions and handling of right-associative
...
things.
llvm-svn: 38881
2006-08-12 17:18:19 +00:00
Chris Lattner
eb17652f5f
Check that ?: parses its RHS as 'expression'.
...
llvm-svn: 38878
2006-08-12 17:04:23 +00:00
Chris Lattner
3401781548
Add another testcase
...
llvm-svn: 38870
2006-08-11 02:12:35 +00:00
Chris Lattner
eddbcb2b12
Add sizeof/cast/compound_expr tests.
...
llvm-svn: 38867
2006-08-11 01:38:08 +00:00
Chris Lattner
2f9980ef14
Implement Parser/statements.c:test5: parsing decls that start with identifiers
...
in blocks.
llvm-svn: 38854
2006-08-10 18:39:24 +00:00
Chris Lattner
6dfd97806e
Add support for simple labels.
...
llvm-svn: 38853
2006-08-10 18:31:37 +00:00
Chris Lattner
f8afb62ef9
Add support for parsing declarations in blocks. This implements
...
Parser/statements.c:test4
llvm-svn: 38852
2006-08-10 18:26:31 +00:00
Chris Lattner
97353f2327
add test3
...
llvm-svn: 38850
2006-08-10 05:59:30 +00:00
Chris Lattner
53361ac130
Refactor init-declarator-list parsing code to allow for-statements to have
...
initializers in them.
llvm-svn: 38847
2006-08-10 05:19:57 +00:00
Chris Lattner
905caf37a0
add test2
...
llvm-svn: 38845
2006-08-10 04:59:23 +00:00
Chris Lattner
4dfe4b9da1
new testcase
...
llvm-svn: 38843
2006-08-09 05:47:56 +00:00
Chris Lattner
944bde95ef
new testcase
...
llvm-svn: 38832
2006-08-06 21:55:13 +00:00
Chris Lattner
cc211add25
Make this testcase pass the right arg.
...
llvm-svn: 38829
2006-08-06 18:31:20 +00:00
Chris Lattner
c697e028c6
Run tests in a specific order
...
llvm-svn: 38826
2006-08-06 18:29:35 +00:00
Chris Lattner
df89dd42d7
new testcase
...
llvm-svn: 38825
2006-08-06 18:22:00 +00:00
Chris Lattner
b10969b9b2
new testcase
...
llvm-svn: 38799
2006-07-30 07:33:49 +00:00
Chris Lattner
022b62e941
new testcase
...
llvm-svn: 38798
2006-07-30 07:20:09 +00:00
Chris Lattner
8d31b5d1aa
new testcase
...
llvm-svn: 38794
2006-07-29 07:32:40 +00:00
Chris Lattner
2641bd549c
new testcase
...
llvm-svn: 38792
2006-07-29 07:19:41 +00:00
Chris Lattner
5b123fde96
new testcase
...
llvm-svn: 38790
2006-07-29 07:08:39 +00:00
Chris Lattner
b631d7ce6c
new testcase
...
llvm-svn: 38789
2006-07-29 06:59:47 +00:00
Chris Lattner
232daf6834
testcase from the c99 standard
...
llvm-svn: 38788
2006-07-29 06:48:55 +00:00
Chris Lattner
15d6b28f09
new testcase
...
llvm-svn: 38786
2006-07-29 06:44:19 +00:00
Chris Lattner
f35d327a99
Testcases for comment saving modes, -C and -CC.
...
llvm-svn: 38785
2006-07-29 06:41:10 +00:00
Chris Lattner
d480b9c0ed
new testcase for the GNU comma swallow extension.
...
llvm-svn: 38779
2006-07-29 04:39:12 +00:00
Chris Lattner
63081842a7
new testcase for placemarker handling.
...
llvm-svn: 38777
2006-07-29 04:09:49 +00:00
Chris Lattner
2bc48570b7
new testcase for __VA_ARGS__
...
llvm-svn: 38775
2006-07-29 04:03:59 +00:00
Chris Lattner
f30dcbe07e
new testcase
...
llvm-svn: 38768
2006-07-29 01:24:46 +00:00
Chris Lattner
3961e60991
Tweak expected results do to paste avoidance.
...
llvm-svn: 38766
2006-07-28 06:55:35 +00:00
Chris Lattner
341c9a1615
new testcase for paste avoidance
...
llvm-svn: 38765
2006-07-28 06:54:07 +00:00
Chris Lattner
b1d2594456
Add test for pasting empty formals
...
llvm-svn: 38763
2006-07-28 05:13:36 +00:00
Chris Lattner
fdc0abe619
new testcase
...
llvm-svn: 38759
2006-07-27 06:17:55 +00:00
Chris Lattner
032e6170af
new testcase
...
llvm-svn: 38750
2006-07-20 06:06:55 +00:00
Chris Lattner
0f1f50517b
Simplify identifier lookup in raw mode, implementing Preprocessor/macro_fn_lparen_scan2.c.
...
llvm-svn: 38744
2006-07-20 04:16:23 +00:00
Chris Lattner
9100cff701
new testcase
...
llvm-svn: 38743
2006-07-19 08:13:21 +00:00
Chris Lattner
ae637cd2a9
new testcase from c99 rationale
...
llvm-svn: 38742
2006-07-19 08:04:22 +00:00
Chris Lattner
e11dd370ec
new testcase
...
llvm-svn: 38741
2006-07-19 08:01:28 +00:00
Chris Lattner
85c0e4d780
new testcase
...
llvm-svn: 38739
2006-07-19 06:40:07 +00:00
Chris Lattner
b563379d78
Make this testcase more interesting, actually add a RUN line.
...
llvm-svn: 38738
2006-07-19 06:34:41 +00:00
Chris Lattner
a7e2e74cef
Avoid testing / ## * in the lexer. This will cause an unhelpful error message
...
to be emitted from the lexer. This fixes macro_paste_c_block_comment.c
llvm-svn: 38737
2006-07-19 06:32:35 +00:00
Chris Lattner
30a2fa14ae
Move LexingRawMode handling of file EOF out of the preprocessor into the
...
lexer. This makes more logical sense and also unbreaks the case when the
lexer hasn't been pushed onto the PP include stack. This is the case when
pasting identifiers. This patch implements macro_paste_bcpl_comment.c.
llvm-svn: 38736
2006-07-19 06:31:49 +00:00
Chris Lattner
ab30c0360d
Make this testcase more interesting, actually add run lines :)
...
llvm-svn: 38735
2006-07-19 05:48:15 +00:00
Chris Lattner
e8dcfef324
Fix test/Preprocessor/macro_paste_spacing.c
...
llvm-svn: 38734
2006-07-19 05:45:55 +00:00
Chris Lattner
01ecf835c2
Implement basic token pasting (## operator). This implements
...
test/Preprocessor/macro_paste_simple.c and macro_paste_bad.c. There are
several known bugs still.
llvm-svn: 38733
2006-07-19 05:42:48 +00:00
Chris Lattner
1e17abb2fd
new testcase
...
llvm-svn: 38723
2006-07-16 18:15:05 +00:00
Chris Lattner
1b9f17bc6e
new testcase
...
llvm-svn: 38719
2006-07-15 21:06:48 +00:00
Chris Lattner
6ae37dfba3
new testcase
...
llvm-svn: 38714
2006-07-15 06:53:24 +00:00
Chris Lattner
f69f835398
new testcase
...
llvm-svn: 38704
2006-07-11 05:53:01 +00:00
Chris Lattner
b63d9de243
new tests
...
llvm-svn: 38698
2006-07-11 05:03:43 +00:00
Chris Lattner
53ede2a826
new testcase
...
llvm-svn: 38693
2006-07-11 04:00:23 +00:00
Chris Lattner
08e0035668
ignore cruft
...
llvm-svn: 38656
2006-07-04 19:03:05 +00:00
Chris Lattner
1c9c0d0749
new testcase
...
llvm-svn: 38641
2006-07-03 06:28:30 +00:00
Chris Lattner
45197e935c
new testcase
...
llvm-svn: 38633
2006-07-03 05:25:52 +00:00
Chris Lattner
d94adee36d
new testcase
...
llvm-svn: 38626
2006-07-03 01:26:39 +00:00
Chris Lattner
e55e11ad04
new testcase
...
llvm-svn: 38618
2006-07-02 22:59:48 +00:00
Chris Lattner
20fc36c416
new testcase
...
llvm-svn: 38613
2006-07-02 22:27:09 +00:00
Chris Lattner
a7e7e2b92d
new testcase
...
llvm-svn: 38611
2006-07-02 21:50:31 +00:00
Chris Lattner
d6178a6870
new testcase
...
llvm-svn: 38608
2006-07-02 21:23:03 +00:00
Chris Lattner
0acd4fee90
new testcase
...
llvm-svn: 38605
2006-07-02 20:31:44 +00:00
Chris Lattner
f378f9a08f
Fix the predicate to be more strict
...
llvm-svn: 38593
2006-06-29 16:43:46 +00:00
Chris Lattner
677e3a202c
new testcase
...
llvm-svn: 38592
2006-06-29 16:25:13 +00:00
Chris Lattner
64f7bd0e6e
New testcase
...
llvm-svn: 38576
2006-06-26 01:26:26 +00:00
Chris Lattner
0a401cca91
new testcase
...
llvm-svn: 38575
2006-06-26 01:25:11 +00:00
Chris Lattner
36f0003d16
New testcases
...
llvm-svn: 38572
2006-06-25 05:40:49 +00:00
Chris Lattner
6d45fe842e
utility file
...
llvm-svn: 38546
2006-06-18 07:18:04 +00:00
Chris Lattner
4322e2201b
new testcase
...
llvm-svn: 38545
2006-06-18 07:16:30 +00:00
Chris Lattner
1500881bd9
new testcase
...
llvm-svn: 38544
2006-06-18 07:00:07 +00:00
Chris Lattner
31eef321bf
Initial checkin of testsuite
...
llvm-svn: 38538
2006-06-18 05:42:02 +00:00