Commit Graph

14816 Commits

Author SHA1 Message Date
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