Commit Graph

208 Commits

Author SHA1 Message Date
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
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
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 e34b2c298a Catch goto's with a missing identifier, patch by Neil Booth.
llvm-svn: 40381
2007-07-22 04:13:33 +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
Steve Naroff 1a2cf6b3b3 Implement semantic analysis for the cast operator.
llvm-svn: 39943
2007-07-16 23:25:18 +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
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
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
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 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 eb2def66be Submitted by: Bill Wendling
- Converted to use the -parse-ast-check flag.

llvm-svn: 39681
2007-06-27 04:30:12 +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
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
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 784b168c92 new testcase
llvm-svn: 39233
2006-12-02 07:59:33 +00:00
Chris Lattner 017865fb62 adjust test
llvm-svn: 39201
2006-11-21 04:06:06 +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 19f4440f5b new testcase
llvm-svn: 39040
2006-10-25 03:14:54 +00:00
Chris Lattner 43ec2ce473 new testcase
llvm-svn: 39000
2006-10-17 03:00:45 +00:00
Chris Lattner aecc057c64 new testcase
llvm-svn: 38976
2006-10-14 07:54:12 +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 df89dd42d7 new testcase
llvm-svn: 38825
2006-08-06 18:22:00 +00:00