]> granicus.if.org Git - clang/log
clang
17 years agonow that all the infrastructure is in place, enforce C99 6.8.5p3.
Chris Lattner [Tue, 28 Aug 2007 05:03:08 +0000 (05:03 +0000)]
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 :)

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

17 years agoIf the condition of a for statement is promoted, make sure the
Chris Lattner [Tue, 28 Aug 2007 04:55:47 +0000 (04:55 +0000)]
If the condition of a for statement is promoted, make sure the
implicit cast gets linked back into the AST.

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

17 years agoImplement more thoughful error recovery when dealing with bogus declarator types.
Steve Naroff [Tue, 28 Aug 2007 03:03:08 +0000 (03:03 +0000)]
Implement more thoughful error recovery when dealing with bogus declarator types.

For example, the following code was resulting in spurious warnings. This was the result of
Sema::GetTypeForDeclarator() synthesizing a type to hand back to the caller (in this case,
"int []", instead of "struct s[]", which is invalid).

struct s;
struct s* t (struct s z[]) {   // expected-error {{array has incomplete element type}}
  return z;
}

Strategy: Flag the error in Declarator/DeclaratorChunk. This info is later stored in
the ParmVarDecl. If the decl is referenced, Sema::ParseIdentifierExpr() will check if
the type is invalid. If so, it quietly returns "true", without instantiating a DeclRefExpr.

This seems to work nicely. If Chris is happy with the approach, I will generalize this to
all VarDecls.

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

17 years agoAdded support for short-circuit '&&' and '||' operators in source-level CFGs.
Ted Kremenek [Mon, 27 Aug 2007 21:54:41 +0000 (21:54 +0000)]
Added support for short-circuit '&&' and '||' operators in source-level CFGs.

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

17 years agoSome minor aesthetic changes to the control flow.
Steve Naroff [Mon, 27 Aug 2007 21:43:43 +0000 (21:43 +0000)]
Some minor aesthetic changes to the control flow.

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

17 years agoFix remaining bugs with complex/float promotions.
Steve Naroff [Mon, 27 Aug 2007 21:32:55 +0000 (21:32 +0000)]
Fix remaining bugs with complex/float promotions.

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

17 years agoImplemented support for ternary "?" operators in source-level CFGs.
Ted Kremenek [Mon, 27 Aug 2007 21:27:44 +0000 (21:27 +0000)]
Implemented support for ternary "?" operators in source-level CFGs.

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

17 years agoFix a few enum-related fixme's
Chris Lattner [Mon, 27 Aug 2007 21:16:18 +0000 (21:16 +0000)]
Fix a few enum-related fixme's

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

17 years agoFixed bug in child_begin/child_end for CallExpr where we incorrectly calculated a...
Ted Kremenek [Mon, 27 Aug 2007 21:11:44 +0000 (21:11 +0000)]
Fixed bug in child_begin/child_end for CallExpr where we incorrectly calculated a Stmt** pointer
based on an offset within SubExprs.

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

17 years agoFixed bug in child_begin/child_end for ReturnStmt where the iterator
Ted Kremenek [Mon, 27 Aug 2007 20:58:16 +0000 (20:58 +0000)]
Fixed bug in child_begin/child_end for ReturnStmt where the iterator
would be invalid when RetValExp == NULL.

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

17 years agoChanges to CFGBuilder:
Ted Kremenek [Mon, 27 Aug 2007 19:46:09 +0000 (19:46 +0000)]
Changes to CFGBuilder:
+ Added the creation of an empty Entry block at the end of CFG
  construction if the Entry block in the CFG contains multiple
  predecessors (which can happen with labels and do loops).

+ Fixed bug in the creation of an empty Exit block with functions where not
  all paths end in a return statement (but some do).  Basic blocks with
  return statements were jumping to a (sometimes) non-empty block.

+ FinishBlock no longer checks for labels at the beginning of a basic
  block before reversing the statements in the block.  This is because
  the recursion invariants of the builder methods have been cleaned up,
  and blocks are only passed to FinishBlock at most once.

+ Modified handling of "if", "for", "while", "do", and "switch" to allow
  condition expressions that can span multiple basic blocks.  This allows
  such conditions to contain short-circuit expressions (which span multiple
  blocks in the CFG).

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

17 years agoconstify some stuff
Chris Lattner [Mon, 27 Aug 2007 17:56:57 +0000 (17:56 +0000)]
constify some stuff

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

17 years agoteach codegen to lay out enum types.
Chris Lattner [Mon, 27 Aug 2007 17:44:34 +0000 (17:44 +0000)]
teach codegen to lay out enum types.

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

17 years agoimplement sizeof(enum x), patch inspired by Keith Bauer.
Chris Lattner [Mon, 27 Aug 2007 17:38:00 +0000 (17:38 +0000)]
implement sizeof(enum x), patch inspired by Keith Bauer.

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

17 years agobetter error recovery for non-i-c-e enum constants.
Chris Lattner [Mon, 27 Aug 2007 17:37:24 +0000 (17:37 +0000)]
better error recovery for non-i-c-e enum constants.

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

17 years agoC++ allows empty enum list.
Chris Lattner [Mon, 27 Aug 2007 17:24:30 +0000 (17:24 +0000)]
C++ allows empty enum list.

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

17 years agoadd some accessors.
Chris Lattner [Mon, 27 Aug 2007 16:50:56 +0000 (16:50 +0000)]
add some accessors.

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

17 years agoAdd enum type conversion policies, patch by Keith Bauer
Chris Lattner [Mon, 27 Aug 2007 16:48:59 +0000 (16:48 +0000)]
Add enum type conversion policies, patch by Keith Bauer

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

17 years agoUpdated checker for "return of address of stack variable" to look for
Ted Kremenek [Mon, 27 Aug 2007 16:39:17 +0000 (16:39 +0000)]
Updated checker for "return of address of stack variable" to look for
implicit casts from T to T& at the topmost part of the return-value expression.

This checking may be needed within EvalAddr later on.  We'll wait until
test cases show this kind of logic is necessary (as more C++ features are
implemented in clang).

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

17 years agoadd some more testcases now that sema is happier :)
Chris Lattner [Mon, 27 Aug 2007 16:37:44 +0000 (16:37 +0000)]
add some more testcases now that sema is happier :)

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

17 years agoReplaced ASTContext::maxFloatingType() with ASTContext::compareFloatingType().
Steve Naroff [Mon, 27 Aug 2007 15:30:22 +0000 (15:30 +0000)]
Replaced ASTContext::maxFloatingType() with ASTContext::compareFloatingType().

Changed Sema::UsualArithmeticConversions to use the new API.

This fixes the following case...

_Complex double X;
double y;

void foo() {
  X = X + y;
}

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

void foo()
(CompoundStmt 0x2605cc0
  (BinaryOperator 0x2605ca0 '_Complex double' '='
    (DeclRefExpr 0x2605c10 '_Complex double' Decl='X' 0x2605ab0)
    (BinaryOperator 0x2605c80 '_Complex double' '+'
      (DeclRefExpr 0x2605c30 '_Complex double' Decl='X' 0x2605ab0)
      (ImplicitCastExpr 0x2605c70 '_Complex double'
        (DeclRefExpr 0x2605c50 'double' Decl='y' 0x2605ae0)))))

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

17 years agotestcase that doesn't work quite yet
Chris Lattner [Mon, 27 Aug 2007 05:23:45 +0000 (05:23 +0000)]
testcase that doesn't work quite yet

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

17 years agoextwarn about decls intermixed with code in c89 mode.
Chris Lattner [Mon, 27 Aug 2007 04:29:41 +0000 (04:29 +0000)]
extwarn about decls intermixed with code in c89 mode.

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

17 years agoAdd Type::getAsBuiltinType() and Type::builtinTypesAreCompatible().
Steve Naroff [Mon, 27 Aug 2007 04:08:11 +0000 (04:08 +0000)]
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).

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

17 years agoTweak a comment and assert.
Steve Naroff [Mon, 27 Aug 2007 01:41:48 +0000 (01:41 +0000)]
Tweak a comment and assert.

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

17 years agoReplaced ASTContext::maxComplexType() with ASTContext::getFloatingTypeOfSizeWithinDom...
Steve Naroff [Mon, 27 Aug 2007 01:27:54 +0000 (01:27 +0000)]
Replaced ASTContext::maxComplexType() with ASTContext::getFloatingTypeOfSizeWithinDomain().

Changed Sema::UsualArithmeticConversions to correctly implement complex/float conversions,
using maxFloatingType() with getFloatingTypeOfSizeWithinDomain().

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

17 years agoimplement a fixme: __extension__ marker on decls in compound stmts.
Chris Lattner [Mon, 27 Aug 2007 01:01:57 +0000 (01:01 +0000)]
implement a fixme: __extension__ marker on decls in compound stmts.

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

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