]> granicus.if.org Git - clang/log
clang
17 years agomove EmitAggregateCopy into AggExprEmitter
Chris Lattner [Sun, 26 Aug 2007 23:13:56 +0000 (23:13 +0000)]
move EmitAggregateCopy into AggExprEmitter

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41472 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix test/Parser/if-scope-*.c. Patch by Neil Booth!
Chris Lattner [Sun, 26 Aug 2007 23:08:06 +0000 (23:08 +0000)]
Fix test/Parser/if-scope-*.c.  Patch by Neil Booth!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41471 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove dead code
Chris Lattner [Sun, 26 Aug 2007 23:02:57 +0000 (23:02 +0000)]
remove dead code

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41470 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove dead protos
Chris Lattner [Sun, 26 Aug 2007 23:01:23 +0000 (23:01 +0000)]
remove dead protos

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41469 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoeliminate EmitAnyExpr, inlining it and simplifying it into its only caller.
Chris Lattner [Sun, 26 Aug 2007 22:58:05 +0000 (22:58 +0000)]
eliminate EmitAnyExpr, inlining it and simplifying it into its only caller.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41468 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoeliminate use of EmitAnyExpr.
Chris Lattner [Sun, 26 Aug 2007 22:55:13 +0000 (22:55 +0000)]
eliminate use of EmitAnyExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41467 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement a fixme
Chris Lattner [Sun, 26 Aug 2007 22:47:40 +0000 (22:47 +0000)]
implement a fixme

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41466 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agonew testcases
Chris Lattner [Sun, 26 Aug 2007 22:41:57 +0000 (22:41 +0000)]
new testcases

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41465 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplement compound assignment operators whose LHS is scalar but RHS is complex.
Chris Lattner [Sun, 26 Aug 2007 22:37:40 +0000 (22:37 +0000)]
Implement compound assignment operators whose LHS is scalar but RHS is complex.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41464 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement codegen of compound assignment operators for complex.
Chris Lattner [Sun, 26 Aug 2007 22:09:01 +0000 (22:09 +0000)]
implement codegen of compound assignment operators for complex.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41463 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoIf a visitor doesn't define VisitBinMulAssign, fallback to VisitCompoundAssignOperator
Chris Lattner [Sun, 26 Aug 2007 22:08:29 +0000 (22:08 +0000)]
If a visitor doesn't define VisitBinMulAssign, fallback to VisitCompoundAssignOperator
instead of VisitBinaryOperator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41462 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agocompound assignment operators are of type CompoundAssignOperator
Chris Lattner [Sun, 26 Aug 2007 21:41:21 +0000 (21:41 +0000)]
compound assignment operators are of type CompoundAssignOperator

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41460 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agodispatch to functions like VisitBinRemAssign with knowledge that
Chris Lattner [Sun, 26 Aug 2007 21:40:28 +0000 (21:40 +0000)]
dispatch to functions like VisitBinRemAssign  with knowledge that
the operand is of type CompoundAssignOperator, not just BinaryOperator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41459 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoupdate fixme's
Chris Lattner [Sun, 26 Aug 2007 21:27:07 +0000 (21:27 +0000)]
update fixme's

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41458 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement complex division
Chris Lattner [Sun, 26 Aug 2007 21:24:19 +0000 (21:24 +0000)]
implement complex division

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41457 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd isysroot support, patch by Keith Bauer
Chris Lattner [Sun, 26 Aug 2007 17:47:35 +0000 (17:47 +0000)]
Add isysroot support, patch by Keith Bauer

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41455 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix %p format checking, patch by Keith Bauer.
Chris Lattner [Sun, 26 Aug 2007 17:39:38 +0000 (17:39 +0000)]
Fix %p format checking, patch by Keith Bauer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41454 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFor warnings like this:
Chris Lattner [Sun, 26 Aug 2007 17:38:22 +0000 (17:38 +0000)]
For warnings like this:

t.c:3:9: warning: invalid conversion '%B'
printf("%B\a\n", p);
~~~~~~  ^

Don't beep the console or print the newline.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41453 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a bug reported by Keith Bauer
Chris Lattner [Sun, 26 Aug 2007 17:32:59 +0000 (17:32 +0000)]
Fix a bug reported by Keith Bauer

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41452 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agofix a typo noticed by Gordon Henriksen
Chris Lattner [Sun, 26 Aug 2007 17:25:57 +0000 (17:25 +0000)]
fix a typo noticed by Gordon Henriksen

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41451 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agollvmgcc is right :)
Chris Lattner [Sun, 26 Aug 2007 16:54:05 +0000 (16:54 +0000)]
llvmgcc is right :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41450 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agocompound assignmetns work for scalars.
Chris Lattner [Sun, 26 Aug 2007 16:52:57 +0000 (16:52 +0000)]
compound assignmetns work for scalars.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41449 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement conversions of complex to bool.
Chris Lattner [Sun, 26 Aug 2007 16:52:28 +0000 (16:52 +0000)]
implement conversions of complex to bool.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41448 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove ConvertScalarValueToBool.
Chris Lattner [Sun, 26 Aug 2007 16:46:58 +0000 (16:46 +0000)]
remove ConvertScalarValueToBool.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41447 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoreimplement ConvertScalarValueToBool in CGExprScalar.cpp
Chris Lattner [Sun, 26 Aug 2007 16:42:57 +0000 (16:42 +0000)]
reimplement ConvertScalarValueToBool in CGExprScalar.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41446 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agorefactor some code to expose compex->scalar conversion to CGF
Chris Lattner [Sun, 26 Aug 2007 16:34:22 +0000 (16:34 +0000)]
refactor some code to expose compex->scalar conversion to CGF

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41445 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agobe slightly more volatile correct
Chris Lattner [Sun, 26 Aug 2007 16:22:13 +0000 (16:22 +0000)]
be slightly more volatile correct

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41444 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix bogus warnings (noticed by Chris) with array-constraints.c.
Steve Naroff [Sun, 26 Aug 2007 14:38:38 +0000 (14:38 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41443 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agothese fixme's are easy :)
Chris Lattner [Sun, 26 Aug 2007 07:30:49 +0000 (07:30 +0000)]
these fixme's are easy :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41442 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement a fixme, add a couple more :)
Chris Lattner [Sun, 26 Aug 2007 07:29:23 +0000 (07:29 +0000)]
implement a fixme, add a couple more :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41441 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agothere are no conversions from aggregates to scalars.
Chris Lattner [Sun, 26 Aug 2007 07:26:12 +0000 (07:26 +0000)]
there are no conversions from aggregates to scalars.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41440 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement conversions from complex to scalar types.
Chris Lattner [Sun, 26 Aug 2007 07:21:11 +0000 (07:21 +0000)]
implement conversions from complex to scalar types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41439 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoOmit EmitConversion
Chris Lattner [Sun, 26 Aug 2007 07:16:41 +0000 (07:16 +0000)]
Omit EmitConversion

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41438 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix return of aggregate and return of complex.
Chris Lattner [Sun, 26 Aug 2007 07:14:44 +0000 (07:14 +0000)]
Fix return of aggregate and return of complex.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41437 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agothese implicit conversions are now explicit :)
Chris Lattner [Sun, 26 Aug 2007 07:09:42 +0000 (07:09 +0000)]
these implicit conversions are now explicit :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41436 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove uses of EmitConversion
Chris Lattner [Sun, 26 Aug 2007 07:08:39 +0000 (07:08 +0000)]
remove uses of EmitConversion

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41435 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplicit casts take care of this code, remove it now.
Chris Lattner [Sun, 26 Aug 2007 07:06:24 +0000 (07:06 +0000)]
implicit casts take care of this code, remove it now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41434 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agorefactor scalar conversions out into CGExprScalar.cpp
Chris Lattner [Sun, 26 Aug 2007 06:48:56 +0000 (06:48 +0000)]
refactor scalar conversions out into CGExprScalar.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41433 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agosteve's recent changes fixed this bogus warning.
Chris Lattner [Sun, 26 Aug 2007 06:48:28 +0000 (06:48 +0000)]
steve's recent changes fixed this bogus warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41432 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoBreak the assumption that any sort of scope (e.g. a loop scope) can
Chris Lattner [Sun, 26 Aug 2007 06:24:45 +0000 (06:24 +0000)]
Break the assumption that any sort of scope (e.g. a loop scope) can
hold declarations.  Instead, introduce a new "DeclScope" scope type that
holds them explicitly.  For now, all scopes have this bit, but in the
future we can use them to fix some issues Neil noticed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41431 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove some dead enum values.
Chris Lattner [Sun, 26 Aug 2007 06:03:04 +0000 (06:03 +0000)]
remove some dead enum values.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41430 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplement casts from scalar -> complex and complex->complex.
Chris Lattner [Sun, 26 Aug 2007 05:57:57 +0000 (05:57 +0000)]
Implement casts from scalar -> complex and complex->complex.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41429 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agorequire that operands to __real/__imag are complex or arithmetic. This
Chris Lattner [Sun, 26 Aug 2007 05:39:26 +0000 (05:39 +0000)]
require that operands to __real/__imag are complex or arithmetic.  This
fixes GCC PR33193

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41428 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement codegen of __imag of a scalar. Our impl doesn't suffer from
Chris Lattner [Sun, 26 Aug 2007 05:29:21 +0000 (05:29 +0000)]
implement codegen of __imag of a scalar.  Our impl doesn't suffer from
GCC bug PR33192.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41427 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake initialization of complex vars work.
Chris Lattner [Sun, 26 Aug 2007 05:13:54 +0000 (05:13 +0000)]
Make initialization of complex vars work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41426 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agofix codegen of pre/post inc/dec of a pointer.
Chris Lattner [Sun, 26 Aug 2007 05:10:16 +0000 (05:10 +0000)]
fix codegen of pre/post inc/dec of a pointer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41425 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agotolerate unimplemented codegen better
Chris Lattner [Sun, 26 Aug 2007 05:06:40 +0000 (05:06 +0000)]
tolerate unimplemented codegen better

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41424 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoint X[] isn't a VLA. This improves support for stdio.h on darwin.
Chris Lattner [Sun, 26 Aug 2007 05:02:07 +0000 (05:02 +0000)]
int X[] isn't a VLA.  This improves support for stdio.h on darwin.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41423 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake some diags EXTENSION so they are errors with pedantic errors
Neil Booth [Sun, 26 Aug 2007 05:01:15 +0000 (05:01 +0000)]
Make some diags EXTENSION so they are errors with pedantic errors

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41422 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement rudimentary union layout support.
Chris Lattner [Sun, 26 Aug 2007 04:50:19 +0000 (04:50 +0000)]
implement rudimentary union layout support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41421 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoWhy didn't gcc catch this? :(
Chris Lattner [Sun, 26 Aug 2007 04:42:42 +0000 (04:42 +0000)]
Why didn't gcc catch this? :(

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41420 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoDon't make unknown builtins fatal errors yet.
Chris Lattner [Sun, 26 Aug 2007 04:17:05 +0000 (04:17 +0000)]
Don't make unknown builtins fatal errors yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41419 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove a bunch of dead code
Chris Lattner [Sun, 26 Aug 2007 04:13:58 +0000 (04:13 +0000)]
remove a bunch of dead code

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41418 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agofix a bug introduced by the recent childification of ForStmt.
Chris Lattner [Sun, 26 Aug 2007 04:11:23 +0000 (04:11 +0000)]
fix a bug introduced by the recent childification of ForStmt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41417 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake parse-ast-print print the storage class and inline
Chris Lattner [Sun, 26 Aug 2007 04:02:13 +0000 (04:02 +0000)]
Make parse-ast-print print the storage class and inline
specifier of functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41416 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agonull pointers don't get an extra newline.
Chris Lattner [Sun, 26 Aug 2007 03:53:29 +0000 (03:53 +0000)]
null pointers don't get an extra newline.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41415 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement codegen for complex literals.
Chris Lattner [Sun, 26 Aug 2007 03:51:12 +0000 (03:51 +0000)]
implement codegen for complex literals.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41414 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd a new ImaginaryLiteral AST node that is used to
Chris Lattner [Sun, 26 Aug 2007 03:42:43 +0000 (03:42 +0000)]
add a new ImaginaryLiteral AST node that is used to
represent imaginary literals:

float _Complex A;
void foo() {
  A = 1.0iF;
}

generates:

  (BinaryOperator 0x2305ec0 '_Complex float' '='
    (DeclRefExpr 0x2305e60 '_Complex float' Decl='A' 0x2305cf0)
    (ImaginaryLiteral 0x2305f40 '_Complex float'
      (FloatingLiteral 0x2305ea0 'float' 1.000000))))

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41413 91177308-0d34-0410-b5e6-96231b3b80d8

17 years ago1.0 is double, 1.0F is a float.
Chris Lattner [Sun, 26 Aug 2007 03:29:23 +0000 (03:29 +0000)]
1.0 is double, 1.0F is a float.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41412 91177308-0d34-0410-b5e6-96231b3b80d8

17 years ago1) refactor some code.
Chris Lattner [Sun, 26 Aug 2007 01:58:14 +0000 (01:58 +0000)]
1) refactor some code.
2) Add support for lexing imaginary constants (a GCC extension):

t.c:5:10: warning: imaginary constants are an extension
  A = 1.0iF;
         ^

3) Make the 'invalid suffix' diagnostic pointer more accurate:

t.c:6:10: error: invalid suffix 'qF' on floating constant
  A = 1.0qF;
         ^

instead of:

t.c:6:10: error: invalid suffix 'qF' on floating constant
  A = 1.0qF;
      ^

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41411 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agomerge checkrelational and checkequality into CheckCompareOperands,
Chris Lattner [Sun, 26 Aug 2007 01:18:55 +0000 (01:18 +0000)]
merge checkrelational and checkequality into CheckCompareOperands,
to merge duplicate code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41410 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoCases like this:
Chris Lattner [Sun, 26 Aug 2007 01:10:14 +0000 (01:10 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41408 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agonew testcase
Chris Lattner [Sat, 25 Aug 2007 21:57:08 +0000 (21:57 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41406 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoThe new correct compound assignment operators exposed a bug in codegen.
Chris Lattner [Sat, 25 Aug 2007 21:56:20 +0000 (21:56 +0000)]
The new correct compound assignment operators exposed a bug in codegen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41405 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoSurpress the UsualUnaryConversions for compound assignment operators. This change
Steve Naroff [Sat, 25 Aug 2007 19:54:59 +0000 (19:54 +0000)]
Surpress the UsualUnaryConversions for compound assignment operators. This change
eliminates the possibility that the left hand expression is an ImplicitCastExpr.
As a result, I removed the check for ImplicitCastExpr in Expr::isLvalue().

This results in the following AST's...

[dylan:~/llvm/tools/clang] admin% cat fix.c

short x; void test4(char c) {
  x += c;
  x = x + c;
}
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang fix.c -parse-ast-dump
Read top-level variable decl: 'x'

void test4(char c)
(CompoundStmt 0x2605d30
  (CompoundAssignOperator 0x2605c40 'short' '+='
    (DeclRefExpr 0x2605c00 'short' Decl='x' 0x2605a80)
    (DeclRefExpr 0x2605c20 'char' Decl='c' 0x2605bc0))
  (BinaryOperator 0x2605d10 'short' '='
    (DeclRefExpr 0x2605c60 'short' Decl='x' 0x2605a80)
    (ImplicitCastExpr 0x2605d00 'short'
      (BinaryOperator 0x2605ce0 'int' '+'
        (ImplicitCastExpr 0x2605cc0 'int'
          (DeclRefExpr 0x2605c80 'short' Decl='x' 0x2605a80))
        (ImplicitCastExpr 0x2605cd0 'int'
          (DeclRefExpr 0x2605ca0 'char' Decl='c' 0x2605bc0))))))

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41404 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoread and ignore the body of a namespace.
Chris Lattner [Sat, 25 Aug 2007 18:15:16 +0000 (18:15 +0000)]
read and ignore the body of a namespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41403 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoChange Expr::isLvalue() to properly deal with ImplicitCastExpr's.
Steve Naroff [Sat, 25 Aug 2007 14:37:06 +0000 (14:37 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41402 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoGive CXXBoolLiteralExpr a type (all expressions need a valid type).
Steve Naroff [Sat, 25 Aug 2007 14:02:58 +0000 (14:02 +0000)]
Give CXXBoolLiteralExpr a type (all expressions need a valid type).

This fixes the following:

******************** TEST 'Parser/cxx-bool.cpp' FAILED! ********************
Command:
clang -fsyntax-only Parser/cxx-bool.cpp
Output:
SemaExpr.cpp:731: failed assertion `!t.isNull() && "DefaultFunctionArrayConversion - missing type"'
Output/cxx-bool.cpp.out.script: line 1: 22697 Abort trap              clang -fsyntax-only Parser/cxx-bool.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41401 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agorefactor enough of the top-level parsing logic to parse and
Chris Lattner [Sat, 25 Aug 2007 06:57:03 +0000 (06:57 +0000)]
refactor enough of the top-level parsing logic to parse and
ignore 'namespace foo {}'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41400 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoC++ explicitly allows an empty source file.
Chris Lattner [Sat, 25 Aug 2007 05:47:03 +0000 (05:47 +0000)]
C++ explicitly allows an empty source file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41399 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix the test/Sema/format-strings.c regression. This code should be refactored.
Chris Lattner [Sat, 25 Aug 2007 05:36:18 +0000 (05:36 +0000)]
Fix the test/Sema/format-strings.c regression.  This code should be refactored.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41398 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoreenable this.
Chris Lattner [Sat, 25 Aug 2007 05:31:19 +0000 (05:31 +0000)]
reenable this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41397 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix the regression on test/Sema/cfstring.c
Chris Lattner [Sat, 25 Aug 2007 05:30:33 +0000 (05:30 +0000)]
Fix the regression on test/Sema/cfstring.c

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41396 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agotest the parser only, not sema.
Chris Lattner [Sat, 25 Aug 2007 05:26:51 +0000 (05:26 +0000)]
test the parser only, not sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41395 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoSplit the ASTNode out for compound assignments out from binary operators. Now
Chris Lattner [Sat, 25 Aug 2007 02:00:02 +0000 (02:00 +0000)]
Split the ASTNode out for compound assignments out from binary operators.  Now
they show up in dumps etc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41393 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agofix off-by-one error
Chris Lattner [Sat, 25 Aug 2007 01:55:00 +0000 (01:55 +0000)]
fix off-by-one error

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41392 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix clang -parse-ast-dump carbon.c
Chris Lattner [Sat, 25 Aug 2007 01:49:16 +0000 (01:49 +0000)]
Fix clang -parse-ast-dump carbon.c

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41391 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agorename sNames -> StmtClassInfo. Make lookups constant time.
Chris Lattner [Sat, 25 Aug 2007 01:42:24 +0000 (01:42 +0000)]
rename sNames -> StmtClassInfo.  Make lookups constant time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41390 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoThis modest change insures ImplicitCastExpr's get generated for all "assignments",
Steve Naroff [Fri, 24 Aug 2007 22:33:52 +0000 (22:33 +0000)]
This modest change insures ImplicitCastExpr's get generated for all "assignments",
while includes init decls, assignment exprs, call exprs, and return statements.

Here are a few examples with the correct AST's...

[dylan:~/llvm/tools/clang] admin% cat impcomp.c

_Complex double X;
void test2(int c) {
  X = 5;
}
void foo() {
  int i;
  double d = i;
  double _Complex a = 5;

  test2(a);
  a = 5;
  d = i;
}

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang impcomp.c -parse-ast-dump
Read top-level variable decl: 'X'

void test2(int c)
(CompoundStmt 0x2605ce0
  (BinaryOperator 0x2605cc0 '_Complex double' '='
    (DeclRefExpr 0x2605c70 '_Complex double' Decl='X' 0x2605af0)
    (ImplicitCastExpr 0x2605cb0 '_Complex double'
      (IntegerLiteral 0x2605c90 'int' 5))))

void foo()
(CompoundStmt 0x2606030
  (DeclStmt 0x2605bd0
    0x2605d90 "int i")
  (DeclStmt 0x2605e20
    0x2605de0 "double d =
      (ImplicitCastExpr 0x2605e10 'double'
        (DeclRefExpr 0x2605dc0 'int' Decl='i' 0x2605d90))")
  (DeclStmt 0x2605e90
    0x2605e50 "_Complex double a =
      (ImplicitCastExpr 0x2605e80 '_Complex double'
        (IntegerLiteral 0x2605e30 'int' 5))")
  (CallExpr 0x2605f20 'void'
    (ImplicitCastExpr 0x2605f00 'void (*)(int)'
      (DeclRefExpr 0x2605ea0 'void (int)' Decl='test2' 0x2605c00))
    (ImplicitCastExpr 0x2605f10 'int'
      (DeclRefExpr 0x2605ec0 '_Complex double' Decl='a' 0x2605e50)))
  (BinaryOperator 0x2605fa0 '_Complex double' '='
    (DeclRefExpr 0x2605f50 '_Complex double' Decl='a' 0x2605e50)
    (ImplicitCastExpr 0x2605f90 '_Complex double'
      (IntegerLiteral 0x2605f70 'int' 5)))
  (BinaryOperator 0x2606010 'double' '='
    (DeclRefExpr 0x2605fc0 'double' Decl='d' 0x2605de0)
    (ImplicitCastExpr 0x2606000 'double'
      (DeclRefExpr 0x2605fe0 'int' Decl='i' 0x2605d90))))

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41379 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove a dead argument
Chris Lattner [Fri, 24 Aug 2007 21:41:10 +0000 (21:41 +0000)]
remove a dead argument

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41377 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement codegen for real/imag. TODO: imag of non-complex.
Chris Lattner [Fri, 24 Aug 2007 21:20:17 +0000 (21:20 +0000)]
implement codegen for real/imag.  TODO: imag of non-complex.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41376 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplement sema support for __real/__imag nodes.
Chris Lattner [Fri, 24 Aug 2007 21:16:53 +0000 (21:16 +0000)]
Implement sema support for __real/__imag nodes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41375 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdded child_begin/child_end to all subclasses of Stmt in Stmt.h. All
Ted Kremenek [Fri, 24 Aug 2007 21:09:09 +0000 (21:09 +0000)]
Added child_begin/child_end to all subclasses of Stmt in Stmt.h.  All
concrete subclasses of Stmt are now required to implement
child_begin/child_end.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41374 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoTeach emit-llvm for scalars to properly handle compound assignment
Chris Lattner [Fri, 24 Aug 2007 21:00:35 +0000 (21:00 +0000)]
Teach emit-llvm for scalars to properly handle compound assignment
operators in all their glory :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41373 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdded ExprCXX.cpp
Ted Kremenek [Fri, 24 Aug 2007 20:24:16 +0000 (20:24 +0000)]
Added ExprCXX.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41370 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplementation of child_begin/child_end for C++ expressions.
Ted Kremenek [Fri, 24 Aug 2007 20:21:10 +0000 (20:21 +0000)]
Implementation of child_begin/child_end for C++ expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41369 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplemented child_begin/child_end for our current set of C++ expressions.
Ted Kremenek [Fri, 24 Aug 2007 20:20:38 +0000 (20:20 +0000)]
Implemented child_begin/child_end for our current set of C++ expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41368 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFinished adding child_begin/child_end to all subclasses of Stmt in Expr.h.
Ted Kremenek [Fri, 24 Aug 2007 20:06:47 +0000 (20:06 +0000)]
Finished adding child_begin/child_end to all subclasses of Stmt in Expr.h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41366 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoSurpress ImplicitCastExprs for compound assignment expressions. For compound assignments,
Steve Naroff [Fri, 24 Aug 2007 19:07:16 +0000 (19:07 +0000)]
Surpress ImplicitCastExprs for compound assignment expressions. For compound assignments,
it is o.k. for the LHS and RHS to have different types. Converting the type can cause
errors like the one Chris noticed (below).

This change required a fair number of diffs (since there is a lot of shared code
between single and compound assignments). This makes the API's look a bit uglier,
however I couldn't think of a better way to do it (without duplicating code).

Fix the following (incorrect) error:

int A;
long long B;

void foo() {
  A /= B;
}

$ clang ~/scalar.c -emit-llvm
/Users/sabre/scalar.c:6:5: error: expression is not assignable
  A /= B;
  ~ ^

Now it works properly...

[dylan:~/llvm/tools/clang] admin% cat compound.c
int A;
long long B;

void foo() {
  A /= B;
}
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang compound.c -parse-ast-dump
Read top-level variable decl: 'A'
Read top-level variable decl: 'B'

void foo()
(CompoundStmt 0x2605c40
  (BinaryOperator 0x2605c20 'int' '/=' ComputeTy='long long'
    (DeclRefExpr 0x2605be0 'int' Decl='A' 0x2605a80)
    (DeclRefExpr 0x2605c00 'long long' Decl='B' 0x2605ab0)))

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41364 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoBegan implementing "child iterator" interface for Stmts and Exprs. Each
Ted Kremenek [Fri, 24 Aug 2007 18:13:47 +0000 (18:13 +0000)]
Began implementing "child iterator" interface for Stmts and Exprs.  Each
subclass of Stmt will implement child_begin() and child_end(), which will
be used to iterate over all the children (subexpressions/substatements) of
a Stmt object.  This will provide for easy traversal over the AST, which
is useful for a variety of purposes.

None of the interfaces to subclasses of Stmt will be changed (other than
adding the child_begin and child_end methods).

The only caveat is that the implementation of subclasses of Stmt will require
colocating all substatements (subexpressions) in an array.  This is because
we define child_iterator as Stmt**.  All accessor methods to subexpressions
will need to be altered to reflect this new implementation.

This patch includes the typedefs for child_iterator, as well the implementation
for child_begin/child_end for the primary expressions and some postfix
expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41363 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake sure we get extension diagnostics for GCC's complex extensions.
Steve Naroff [Fri, 24 Aug 2007 17:20:07 +0000 (17:20 +0000)]
Make sure we get extension diagnostics for GCC's complex extensions.

Now we emit the following when -pedantic-errors is enabled...

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang complex.c -pedantic-errors
complex.c:4:3: error: ISO C does not support '++'/'--' on complex integer types
  ++x;
  ^ ~
complex.c:9:7: error: ISO C does not support '~' for complex conjugation
  X = ~Y;
      ^
complex.c:10:7: error: ISO C does not support '~' for complex conjugation
  x = ~y;
      ^

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41362 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoprint the computation type for compound assignment operators in dumps.
Chris Lattner [Fri, 24 Aug 2007 16:24:49 +0000 (16:24 +0000)]
print the computation type for compound assignment operators in dumps.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41361 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agocompletely refactor codegen of scalar expressions out into its own CGExprScalar.cpp...
Chris Lattner [Fri, 24 Aug 2007 05:35:26 +0000 (05:35 +0000)]
completely refactor codegen of scalar expressions out into its own CGExprScalar.cpp file.

This patch temporarily breaks compound assignment operators, but greatly simplifies many
things.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41355 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agorename two files.
Chris Lattner [Fri, 24 Aug 2007 02:22:53 +0000 (02:22 +0000)]
rename two files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41350 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement codegen of builtin_choose_expr for complex.
Chris Lattner [Fri, 24 Aug 2007 02:18:47 +0000 (02:18 +0000)]
implement codegen of builtin_choose_expr for complex.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41349 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agostub out complex -> bool conversion.
Chris Lattner [Fri, 24 Aug 2007 00:01:20 +0000 (00:01 +0000)]
stub out complex -> bool conversion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41347 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agomake this harder
Chris Lattner [Thu, 23 Aug 2007 23:49:47 +0000 (23:49 +0000)]
make this harder

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41346 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement complex subtraction
Chris Lattner [Thu, 23 Aug 2007 23:46:33 +0000 (23:46 +0000)]
implement complex subtraction

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41345 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement passing of complex and aggregates through call args.
Chris Lattner [Thu, 23 Aug 2007 23:43:33 +0000 (23:43 +0000)]
implement passing of complex and aggregates through call args.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41344 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoin the truncation case, make sure to propagate the sign correctly, this
Chris Lattner [Thu, 23 Aug 2007 22:08:35 +0000 (22:08 +0000)]
in the truncation case, make sure to propagate the sign correctly, this
fixes an assertion on:
void f (int z) { switch (z) { case ~0ULL: case -1: return; } }

testcase from Neil.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41343 91177308-0d34-0410-b5e6-96231b3b80d8