]> granicus.if.org Git - clang/log
clang
16 years agoShore up transfer function for ObjCForCollectionStmt.
Ted Kremenek [Wed, 12 Nov 2008 21:12:46 +0000 (21:12 +0000)]
Shore up transfer function for ObjCForCollectionStmt.

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

16 years agoUse Stmt* instead of Expr* for block-level expression.
Ted Kremenek [Wed, 12 Nov 2008 21:12:18 +0000 (21:12 +0000)]
Use Stmt* instead of Expr* for block-level expression.

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

16 years agoObjCForCollectionStmts are block-level expressions.
Ted Kremenek [Wed, 12 Nov 2008 21:11:49 +0000 (21:11 +0000)]
ObjCForCollectionStmts are block-level expressions.

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

16 years agoRestructure code to encourage fallthrough, no functionality change.
Chris Lattner [Wed, 12 Nov 2008 19:48:13 +0000 (19:48 +0000)]
Restructure code to encourage fallthrough, no functionality change.

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

16 years agofix PR3048. I'm going to do some more work before closing it off and
Chris Lattner [Wed, 12 Nov 2008 19:45:49 +0000 (19:45 +0000)]
fix PR3048.  I'm going to do some more work before closing it off and
adding a testcase.

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

16 years agoAdd (preliminary) transfer function support for ObjCForCollectionStmt. Still need...
Ted Kremenek [Wed, 12 Nov 2008 19:24:17 +0000 (19:24 +0000)]
Add (preliminary) transfer function support for ObjCForCollectionStmt.  Still need to flesh out some logic.

When processing DeclStmt, use the new interface to StateManager::BindDecl.  Conjuring of symbols is now done in VisitDeclStmt.

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

16 years agoConjured symbols now bind to Stmt* instead of Expr*.
Ted Kremenek [Wed, 12 Nov 2008 19:22:47 +0000 (19:22 +0000)]
Conjured symbols now bind to Stmt* instead of Expr*.

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

16 years agoUpdate method names involving GRStateRef. No functionality change.
Ted Kremenek [Wed, 12 Nov 2008 19:22:09 +0000 (19:22 +0000)]
Update method names involving GRStateRef.  No functionality change.

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

16 years agoGRStateRef:
Ted Kremenek [Wed, 12 Nov 2008 19:21:30 +0000 (19:21 +0000)]
GRStateRef:
- Rename SetSVal to BindLoc
- Add BindDecl
- Add BindExpr

GRState:
- Environment now binds to Stmt* instead of Expr*.  This is needed for processing ObjCForCollectionStmt (essentially the declaration of the the 'element' variable can have an SVal attached to it).
- BindDecl no longer accepts Expr* for the initialization value; use SVal* instead.

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

16 years agoStoreManager::BindDecl now takes an SVal* for the initialization value instead of...
Ted Kremenek [Wed, 12 Nov 2008 19:18:35 +0000 (19:18 +0000)]
StoreManager::BindDecl now takes an SVal* for the initialization value instead of an Expr* (which can be null).  Lazy symbolication of conjured symbols is now the sole responsibility of GRExprEngine.

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

16 years agoImplement support for operator overloading using candidate operator
Douglas Gregor [Wed, 12 Nov 2008 17:17:38 +0000 (17:17 +0000)]
Implement support for operator overloading using candidate operator
functions for built-in operators, e.g., the builtin

  bool operator==(int const*, int const*)

can be used for the expression "x1 == x2" given:

  struct X {
    operator int const*();
  } x1, x2;

The scheme for handling these built-in operators is relatively simple:
for each candidate required by the standard, create a special kind of
candidate function for the built-in. If overload resolution picks the
built-in operator, we perform the appropriate conversions on the
arguments and then let the normal built-in operator take care of it.

There may be some optimization opportunity left: if we can reduce the
number of built-in operator overloads we generate, overload resolution
for these cases will go faster. However, one must be careful when
doing this: GCC generates too few operator overloads in our little
test program, and fails to compile it because none of the overloads it
generates match.

Note that we only support operator overload for non-member binary
operators at the moment. The other operators will follow.

As part of this change, ImplicitCastExpr can now be an lvalue.

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

16 years agoStart a README.txt of possible optimizations to do in IRgen.
Daniel Dunbar [Wed, 12 Nov 2008 12:31:28 +0000 (12:31 +0000)]
Start a README.txt of possible optimizations to do in IRgen.

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

16 years agoHandle ?: in EmitBranchOnBoolExpr.
Daniel Dunbar [Wed, 12 Nov 2008 10:30:32 +0000 (10:30 +0000)]
Handle ?: in EmitBranchOnBoolExpr.

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

16 years agoRename ?: operator blocks to cond.true and cond.false (I don't know
Daniel Dunbar [Wed, 12 Nov 2008 10:13:37 +0000 (10:13 +0000)]
Rename ?: operator blocks to cond.true and cond.false (I don't know
what "cond.?" means, and this avoids quoting).

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

16 years agoComment/indentation fix.
Daniel Dunbar [Wed, 12 Nov 2008 10:12:14 +0000 (10:12 +0000)]
Comment/indentation fix.

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

16 years agoSome additions to tryEvaluate I've had sitting around for a while.
Eli Friedman [Wed, 12 Nov 2008 09:44:48 +0000 (09:44 +0000)]
Some additions to tryEvaluate I've had sitting around for a while.
This pushes it a lot closer to being able to deal with most of the stuff
CodeGen's constant expression evaluator knows how to deal with.  This
also fixes PR3003.

The test could possibly use some improvement, but this'll work for now.
Test 6 is inspired by PR3003; the other tests are mostly just designed
to exercise the new code.  The reason for the funny structure of the
tests is that type fixing for arrays inside of structs is the only place
in Sema that calls tryEvaluate, at least for the moment.

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

16 years agoLower ?: into select when the selected values are cheap and side-effect-free.
Chris Lattner [Wed, 12 Nov 2008 08:55:54 +0000 (08:55 +0000)]
Lower ?: into select when the selected values are cheap and side-effect-free.
This cuts another 200 lines off expr.ll, forming 23 selects.

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

16 years agoemit better codegen for ||/&&, shrinking expr.ll by another 240 lines.
Chris Lattner [Wed, 12 Nov 2008 08:38:24 +0000 (08:38 +0000)]
emit better codegen for ||/&&, shrinking expr.ll by another 240 lines.
This happens for stuff like this:

x = cond1 || cond2 || cond3 || cond4;

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

16 years agouse ConstantFoldsToSimpleInteger instead of code emission to do
Chris Lattner [Wed, 12 Nov 2008 08:26:50 +0000 (08:26 +0000)]
use ConstantFoldsToSimpleInteger instead of code emission to do
constant folding.

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

16 years agoIRgen improvements on unreachable code:
Daniel Dunbar [Wed, 12 Nov 2008 08:21:33 +0000 (08:21 +0000)]
IRgen improvements on unreachable code:
 - Split out "simple" statements which can easily handle IR generation
   when there is no insert point. These are generally statements which
   start by emitting a new block or are only containers for other
   statements.

 - This fixes a regression in emitting dummy blocks, notably for case
   statements.

 - This also fixes spurious emission of a number of debug stoppoint
   intrinsic instructions.

Remove unneeded sw.body block, just clear the insertion point.

Lift out CodeGenFunction::EmitStopPoint which calls into the
CGDebugInfo class when generating debug info.

Normalize definitions of Emit{Break,Continue}Stmt and usage of
ErrorUnsupported.

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

16 years agoHandle Unary ! in EmitBranchOnBoolExpr, so that we can efficiently
Chris Lattner [Wed, 12 Nov 2008 08:13:36 +0000 (08:13 +0000)]
Handle Unary ! in EmitBranchOnBoolExpr, so that we can efficiently
codegen stuff like "if (!(X && Y))"

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

16 years agoUse EmitBranchOnBoolExpr in VisitConditionalOperator. This
Chris Lattner [Wed, 12 Nov 2008 08:08:13 +0000 (08:08 +0000)]
Use EmitBranchOnBoolExpr in VisitConditionalOperator.  This
shrinks code yet again by a bit.

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

16 years agoMove EmitBranchOnBoolExpr and ConstantFoldsToSimpleInteger to
Chris Lattner [Wed, 12 Nov 2008 08:04:58 +0000 (08:04 +0000)]
Move EmitBranchOnBoolExpr and ConstantFoldsToSimpleInteger to
CodeGenFunction.cpp.  Change VisitConditionalOperator to use
constant fold instead of codegen'ing a constant conditional.

Change ForStmt to use EmitBranchOnBoolExpr, this shrinks
expr.c very slightly to 40239 lines.

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

16 years agosort files by name.
Chris Lattner [Wed, 12 Nov 2008 07:46:52 +0000 (07:46 +0000)]
sort files by name.

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

16 years agoMake emission of 'if' conditions much more sophisticated when we
Chris Lattner [Wed, 12 Nov 2008 07:46:33 +0000 (07:46 +0000)]
Make emission of 'if' conditions much more sophisticated when we
have a condition that is an &&/||.  Before we used to compile things like this:

int test() {
  if (x && y) foo(); else bar();
}

into:

%0 = load i32* @x ; <i32> [#uses=1]
%1 = icmp ne i32 %0, 0 ; <i1> [#uses=1]
br i1 %1, label %land_rhs, label %land_cont

land_rhs: ; preds = %entry
%2 = load i32* @y ; <i32> [#uses=1]
%3 = icmp ne i32 %2, 0 ; <i1> [#uses=1]
br label %land_cont

land_cont: ; preds = %land_rhs, %entry
%4 = phi i1 [ false, %entry ], [ %3, %land_rhs ] ; <i1> [#uses=1]
br i1 %4, label %ifthen, label %ifelse

ifthen: ; preds = %land_cont
%call = call i32 (...)* @foo() ; <i32> [#uses=0]
br label %ifend

ifelse: ; preds = %land_cont
%call1 = call i32 (...)* @bar() ; <i32> [#uses=0]
br label %ifend

ifend: ; preds = %ifelse, %ifthen

Now we turn it into the much more svelte code:

        %0 = load i32* @x               ; <i32> [#uses=1]
        %1 = icmp ne i32 %0, 0          ; <i1> [#uses=1]
        br i1 %1, label %land_lhs_true, label %ifelse

land_lhs_true:          ; preds = %entry
        %2 = load i32* @y               ; <i32> [#uses=1]
        %3 = icmp ne i32 %2, 0          ; <i1> [#uses=1]
        br i1 %3, label %ifthen, label %ifelse

ifthen:         ; preds = %land_lhs_true
        %call = call i32 (...)* @foo()          ; <i32> [#uses=0]
        br label %ifend

ifelse:         ; preds = %land_lhs_true, %entry
        %call1 = call i32 (...)* @bar()         ; <i32> [#uses=0]
        br label %ifend

ifend:          ; preds = %ifelse, %ifthen

Note the lack of a phi node.

This shrinks the -O0 .ll file for 176.gcc/expr.c from 43176 to 40267 lines.

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

16 years agofix a crash analyzing constants in 176.gcc/expr.c with my next patch. It was
Chris Lattner [Wed, 12 Nov 2008 07:43:42 +0000 (07:43 +0000)]
fix a crash analyzing constants in 176.gcc/expr.c with my next patch. It was
crashing because we errors are ignored in subexpressions that are not evaluated,
but we still evaluate the result of parents.  This would cause an assertion
because the erroneous subexpr didn't have its result value set to the right type.

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

16 years agoTeach the aggressive constant folder to fold X && 0 -> 0 and X || 1 -> 1
Chris Lattner [Wed, 12 Nov 2008 07:04:29 +0000 (07:04 +0000)]
Teach the aggressive constant folder to fold X && 0 -> 0 and X || 1 -> 1

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

16 years agoClean up some code to use isZero instead of calling getZExtValue.
Chris Lattner [Wed, 12 Nov 2008 04:54:14 +0000 (04:54 +0000)]
Clean up some code to use isZero instead of calling getZExtValue.

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

16 years agoFix testcase for 64-bit systems.
Sebastian Redl [Wed, 12 Nov 2008 00:18:32 +0000 (00:18 +0000)]
Fix testcase for 64-bit systems.

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

16 years agoUse createBasicBlock here too.
Daniel Dunbar [Wed, 12 Nov 2008 00:02:07 +0000 (00:02 +0000)]
Use createBasicBlock here too.

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

16 years agoDisable generation of basic block names in NDEBUG mode.
Daniel Dunbar [Wed, 12 Nov 2008 00:01:12 +0000 (00:01 +0000)]
Disable generation of basic block names in NDEBUG mode.

Revert to enabling generation of instruction names when not in NDEBUG
mode.

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

16 years agoRework IRgen invariant w.r.t. current insert point.
Daniel Dunbar [Tue, 11 Nov 2008 23:11:34 +0000 (23:11 +0000)]
Rework IRgen invariant w.r.t. current insert point.
 - EmitStmt is no longer required to finish with a current insertion
   point defined (i.e. it does not need to make dummy
   blocks). Instead, it can clear the insertion point in the builder
   which indicates that the current insertion point is unreachable.
 - CodeGenFunction provides HaveInsertPoint and EnsureInsertPoint
   which respectively test if there is an insert point and ensure an
   insertion point exists (by making a dummy block).
 - Clearly mark functions in CodeGenFunction which can be called with
   no insertion point defined. Currently this is a limited set, and
   EmitStmt simply EnsureInsertPoint()s before emitting subsequent IR.

Remove EmitDummyBlock, which is no longer needed. Clients who haven't
already cleared the insertion point (typically via EmitBranch) can do
so by hand.

Remove isDummyBlock, which has effectively been renamed to
HaveInsertPoint.

The main thrust of this change is that we no longer have create dummy
blocks just to destroy them a short time later in EmitBlock in the
common case that there is no unreachable code following something like
a goto.

Additionally, this means that we are not using the hokey condition in
isDummyBlock that a block without a name is a dummy block. Guess how
well that works when we never emit block names!

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

16 years agoChange EmitBranch to always clear the insert point to clarify irgen
Daniel Dunbar [Tue, 11 Nov 2008 22:06:59 +0000 (22:06 +0000)]
Change EmitBranch to always clear the insert point to clarify irgen
invariants.

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

16 years agoEmit debug region end in unified return block.
Daniel Dunbar [Tue, 11 Nov 2008 20:59:54 +0000 (20:59 +0000)]
Emit debug region end in unified return block.

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

16 years agoCodegen support for fastcall & stdcall CC.
Anton Korobeynikov [Tue, 11 Nov 2008 20:21:14 +0000 (20:21 +0000)]
Codegen support for fastcall & stdcall CC.
Patch by Ilya Okonsky!

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

16 years agoFlow-sensitive uninitialized values analysis:
Ted Kremenek [Tue, 11 Nov 2008 19:41:42 +0000 (19:41 +0000)]
Flow-sensitive uninitialized values analysis:
- Added support for ObjCForCollectionStmt
- Fixed bug where expression values would be always set to uninitialized when loops were involved

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

16 years agoAccesses to a collection within a fast enumeration 'for' statement constitute a ...
Ted Kremenek [Tue, 11 Nov 2008 19:40:47 +0000 (19:40 +0000)]
Accesses to a collection within a fast enumeration 'for' statement constitute a 'use'.

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

16 years agoAdd fine-grain methods for control which bits are set/reset in ExprDeclBitVector.
Ted Kremenek [Tue, 11 Nov 2008 19:39:47 +0000 (19:39 +0000)]
Add fine-grain methods for control which bits are set/reset in ExprDeclBitVector.

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

16 years agoTry to not emit the dead side of ?: if the condition is a constant.
Chris Lattner [Tue, 11 Nov 2008 18:56:45 +0000 (18:56 +0000)]
Try to not emit the dead side of ?: if the condition is a constant.

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

16 years ago"a patch telling cmake to install clang headers in the target
Chris Lattner [Tue, 11 Nov 2008 18:39:10 +0000 (18:39 +0000)]
"a patch telling cmake to install clang headers in the target
install directory"

Patch by Lukasz Janyst!

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

16 years agoIntroduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof expressions...
Sebastian Redl [Tue, 11 Nov 2008 17:56:53 +0000 (17:56 +0000)]
Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof expressions, both of values and types.

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

16 years agoAdd transfer function support for ObjCForCollectionStmt to LiveVariables.
Ted Kremenek [Tue, 11 Nov 2008 17:42:10 +0000 (17:42 +0000)]
Add transfer function support for ObjCForCollectionStmt to LiveVariables.

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

16 years agoAdd CFG support for Objective-C 2.0 fast enumeration 'for' statement:
Ted Kremenek [Tue, 11 Nov 2008 17:10:00 +0000 (17:10 +0000)]
Add CFG support for Objective-C 2.0 fast enumeration 'for' statement:

http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_7_section_2.html#//apple_ref/doc/uid/TP30001163-CH18-SW3

Need to modify GRExprEngine, LiveVariables, and UninitializedValues to understand this construct.

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

16 years agoImplement C++ 'typeid' parsing and sema.
Sebastian Redl [Tue, 11 Nov 2008 11:37:55 +0000 (11:37 +0000)]
Implement C++ 'typeid' parsing and sema.

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

16 years agoAdd CodeGenFunction::EmitBranch.
Daniel Dunbar [Tue, 11 Nov 2008 09:41:28 +0000 (09:41 +0000)]
Add CodeGenFunction::EmitBranch.
 - Emits an unconditional branch, with extra logic to avoid generating
   spurious branches out of dummy blocks.

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

16 years agoFix cmake build, patch from Jjgod Jiang.
Daniel Dunbar [Tue, 11 Nov 2008 08:29:24 +0000 (08:29 +0000)]
Fix cmake build, patch from Jjgod Jiang.

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

16 years agoshort circuit && and || when possible. This substantially reduces
Chris Lattner [Tue, 11 Nov 2008 07:41:27 +0000 (07:41 +0000)]
short circuit && and || when possible.  This substantially reduces
the size of the -O0 output on some cases.  For example, on expr.c from
176.gcc, it shrinks the .ll file from 43164 to 42835 lines, and removed
references to two external symbols.

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

16 years agoMake codegen smart enough to not emit the dead side of an if whose
Chris Lattner [Tue, 11 Nov 2008 07:24:28 +0000 (07:24 +0000)]
Make codegen smart enough to not emit the dead side of an if whose
condition is a constant.  This shrinks -O0 codegen by quite a bit
on some cases.

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

16 years agoimplement debug info for typeof()
Chris Lattner [Tue, 11 Nov 2008 07:01:36 +0000 (07:01 +0000)]
implement debug info for typeof()

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

16 years agomerge some testcases together.
Chris Lattner [Tue, 11 Nov 2008 06:42:53 +0000 (06:42 +0000)]
merge some testcases together.

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

16 years agoMove backend output out of destructor.
Daniel Dunbar [Tue, 11 Nov 2008 06:35:39 +0000 (06:35 +0000)]
Move backend output out of destructor.

Don't free AST consumer when --disable-free is set.

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

16 years agoremove the wrong PR # from the file name.
Chris Lattner [Tue, 11 Nov 2008 06:28:10 +0000 (06:28 +0000)]
remove the wrong PR # from the file name.

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

16 years agoadd PR#
Chris Lattner [Tue, 11 Nov 2008 06:27:34 +0000 (06:27 +0000)]
add PR#

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

16 years agoFix PR3031 by silencing follow-on errors in invalid declarations.
Chris Lattner [Tue, 11 Nov 2008 06:13:16 +0000 (06:13 +0000)]
Fix PR3031 by silencing follow-on errors in invalid declarations.

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

16 years agoRemove unused function declaration.
Daniel Dunbar [Tue, 11 Nov 2008 04:48:20 +0000 (04:48 +0000)]
Remove unused function declaration.

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

16 years agoAdd CodeGenFunction::EmitDummyBlock for marking places where we make
Daniel Dunbar [Tue, 11 Nov 2008 04:34:23 +0000 (04:34 +0000)]
Add CodeGenFunction::EmitDummyBlock for marking places where we make
"dummy" blocks (blocks just used to make sure we have a place to dump
code to).

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

16 years agoRemove CodeGenFunction::StartBlock.
Daniel Dunbar [Tue, 11 Nov 2008 04:12:31 +0000 (04:12 +0000)]
Remove CodeGenFunction::StartBlock.
 - Was confusing and only used in one small part of the code.

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

16 years agoThese tests have no needed to redirect stderr to stdout.
Daniel Dunbar [Tue, 11 Nov 2008 04:09:47 +0000 (04:09 +0000)]
These tests have no needed to redirect stderr to stdout.

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

16 years agoCentralize basic block creation in CodeGenFunction::createBasicBlock.
Daniel Dunbar [Tue, 11 Nov 2008 02:29:29 +0000 (02:29 +0000)]
Centralize basic block creation in CodeGenFunction::createBasicBlock.
 - No functionality change.

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

16 years agoFix StringLiteral print bug.
Zhongxing Xu [Tue, 11 Nov 2008 01:36:32 +0000 (01:36 +0000)]
Fix StringLiteral print bug.

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

16 years agoAdd && to test command.
Zhongxing Xu [Tue, 11 Nov 2008 01:25:18 +0000 (01:25 +0000)]
Add && to test command.

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

16 years agoFix Release-Asserts warning.
Daniel Dunbar [Tue, 11 Nov 2008 01:16:00 +0000 (01:16 +0000)]
Fix Release-Asserts warning.

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

16 years agoBasic support for taking the address of an overloaded function
Douglas Gregor [Mon, 10 Nov 2008 20:40:00 +0000 (20:40 +0000)]
Basic support for taking the address of an overloaded function

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

16 years agoUpdate VC++ project file.
Steve Naroff [Mon, 10 Nov 2008 20:02:45 +0000 (20:02 +0000)]
Update VC++ project file.

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

16 years agoRemove an out-of-date FIXME
Douglas Gregor [Mon, 10 Nov 2008 17:01:38 +0000 (17:01 +0000)]
Remove an out-of-date FIXME

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

16 years agoImprove parser error recovery after a constructor initializer
Douglas Gregor [Mon, 10 Nov 2008 16:59:40 +0000 (16:59 +0000)]
Improve parser error recovery after a constructor initializer

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

16 years agoAllow user-defined conversions during reference binding
Douglas Gregor [Mon, 10 Nov 2008 16:14:15 +0000 (16:14 +0000)]
Allow user-defined conversions during reference binding

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

16 years agoDon't create a typedef for the injected-class-name
Douglas Gregor [Mon, 10 Nov 2008 14:41:22 +0000 (14:41 +0000)]
Don't create a typedef for the injected-class-name

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

16 years agoSome cleanups to the declaration/checking of overloaded operators in C++. Thanks...
Douglas Gregor [Mon, 10 Nov 2008 13:38:07 +0000 (13:38 +0000)]
Some cleanups to the declaration/checking of overloaded operators in C++. Thanks to Sebastian for the review

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

16 years agoAdd pretty printing to StringRegion.
Zhongxing Xu [Mon, 10 Nov 2008 13:05:26 +0000 (13:05 +0000)]
Add pretty printing to StringRegion.

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

16 years agoAdd region store model to path-sensitive testing.
Zhongxing Xu [Mon, 10 Nov 2008 09:43:12 +0000 (09:43 +0000)]
Add region store model to path-sensitive testing.

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

16 years agoImplement RegionStoreManager::RemoveDeadBindings(). This prunes several false warning...
Zhongxing Xu [Mon, 10 Nov 2008 09:39:04 +0000 (09:39 +0000)]
Implement RegionStoreManager::RemoveDeadBindings(). This prunes several false warning caused by removal of symbolic constraints. Currently we just mark all symbols live. Further optimization for dead binding removal needed.

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

16 years agodon't preserve names on IR instructions. This matches llvm-gcc's behavior and
Chris Lattner [Mon, 10 Nov 2008 06:31:46 +0000 (06:31 +0000)]
don't preserve names on IR instructions.  This matches llvm-gcc's behavior and
speeds up the compiler by ~8% at -emit-llvm -O0.

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

16 years agosort files add a missed header to the project.
Chris Lattner [Mon, 10 Nov 2008 06:31:19 +0000 (06:31 +0000)]
sort files add a missed header to the project.

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

16 years agoFix even more bugs in debug info support:
Chris Lattner [Mon, 10 Nov 2008 06:10:01 +0000 (06:10 +0000)]
Fix even more bugs in debug info support:
1. emit proper debug info for forward decls of structs.
2. emit DW_TAG_member nodes around members of a field like llvm-gcc does.

This slows down debug info generation, but is required for correctness.

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

16 years agoreimplement debug info generation in terms of DebugInfo.h instead of
Chris Lattner [Mon, 10 Nov 2008 06:08:34 +0000 (06:08 +0000)]
reimplement debug info generation in terms of DebugInfo.h instead of
using MachineModuleInfo.  This runs at about the same speed as the old
code, but fixes a bunch of bugs and is simpler and shorter.

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

16 years agoPrint integer value instead of raw pointer. This is a hack to be fixed by migrating...
Zhongxing Xu [Mon, 10 Nov 2008 05:00:06 +0000 (05:00 +0000)]
Print integer value instead of raw pointer. This is a hack to be fixed by migrating the output in analyzer to llvm::raw_ostream.

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

16 years agosilence a warning from gcc.
Chris Lattner [Mon, 10 Nov 2008 03:00:37 +0000 (03:00 +0000)]
silence a warning from gcc.

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

16 years agoIntroduce ScopedDecl::getLexicalDeclContext() which is different from ScopedDecl...
Argyrios Kyrtzidis [Sun, 9 Nov 2008 23:41:00 +0000 (23:41 +0000)]
Introduce ScopedDecl::getLexicalDeclContext() which is different from ScopedDecl::getDeclContext() when there are nested-names.
e.g.:
  namespace A {
    void f(); // SemanticDC (getDeclContext) == LexicalDC (getLexicalDeclContext) == 'namespace A'
  }
  void A::f(); // SemanticDC == namespace 'A'
               // LexicalDC == global namespace

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

16 years agoWhen a tag has nested-name ('struct foo::bar'), use not 'CurContext' but the context...
Argyrios Kyrtzidis [Sun, 9 Nov 2008 22:53:32 +0000 (22:53 +0000)]
When a tag has nested-name ('struct foo::bar'), use not 'CurContext' but the context of the nested-name ('foo::').

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

16 years agoSimplify handling of nested-names in tags ('struct foo::bar').
Argyrios Kyrtzidis [Sun, 9 Nov 2008 22:09:58 +0000 (22:09 +0000)]
Simplify handling of nested-names in tags ('struct foo::bar').
-Use more of the non nested-name code path.
-Also use the ActOnTagStruct code path.

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

16 years agoSupport named operands in inline asm statements.
Anders Carlsson [Sun, 9 Nov 2008 18:54:14 +0000 (18:54 +0000)]
Support named operands in inline asm statements.

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

16 years agoUpdate C++ status: class support improved due to nested name parsing.
Sebastian Redl [Sun, 9 Nov 2008 11:32:32 +0000 (11:32 +0000)]
Update C++ status: class support improved due to nested name parsing.

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

16 years agoImplement Sema support for C++ nested-name-specifiers.
Argyrios Kyrtzidis [Sat, 8 Nov 2008 17:17:31 +0000 (17:17 +0000)]
Implement Sema support for C++ nested-name-specifiers.

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

16 years agoSilence a GCC member initialization order warning.
Argyrios Kyrtzidis [Sat, 8 Nov 2008 16:47:38 +0000 (16:47 +0000)]
Silence a GCC member initialization order warning.

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

16 years agoImplement support for C++ nested-name-specifiers ('foo::bar::x') in the Parser side.
Argyrios Kyrtzidis [Sat, 8 Nov 2008 16:45:02 +0000 (16:45 +0000)]
Implement support for C++ nested-name-specifiers ('foo::bar::x') in the Parser side.
No Sema functionality change, just the signatures of the Action/Sema methods.

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

16 years agoIntroduce annotation tokens, a special kind of token, created and used only by the...
Argyrios Kyrtzidis [Sat, 8 Nov 2008 16:17:04 +0000 (16:17 +0000)]
Introduce annotation tokens, a special kind of token, created and used only by the parser to replace a group of tokens with a single token encoding semantic information.
Will be fully utilized later for C++ nested-name-specifiers.

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

16 years agoUpdate C++ status to reflect parser capabilities for chapter 9 (classes). Slightly...
Sebastian Redl [Sat, 8 Nov 2008 15:40:37 +0000 (15:40 +0000)]
Update C++ status to reflect parser capabilities for chapter 9 (classes). Slightly extend the class parser test.

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

16 years agoUpdate C++ status: dynamic_cast is sema-complete.
Sebastian Redl [Sat, 8 Nov 2008 14:43:13 +0000 (14:43 +0000)]
Update C++ status: dynamic_cast is sema-complete.

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

16 years agoMove named cast helpers out of Sema, as Chris requested. This requirse making a few...
Sebastian Redl [Sat, 8 Nov 2008 13:00:26 +0000 (13:00 +0000)]
Move named cast helpers out of Sema, as Chris requested. This requirse making a few functions public that weren't before.

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

16 years agoRevert r58880, it breaks test/SemaCXX/constructor.cpp
Argyrios Kyrtzidis [Sat, 8 Nov 2008 12:02:25 +0000 (12:02 +0000)]
Revert r58880, it breaks test/SemaCXX/constructor.cpp

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

16 years agoUse only one constructor for CXXMethodDecl. Keep initialization stuff into one place.
Argyrios Kyrtzidis [Sat, 8 Nov 2008 11:24:06 +0000 (11:24 +0000)]
Use only one constructor for CXXMethodDecl. Keep initialization stuff into one place.

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

16 years agoAvoid redundant cast<>s / simplify type dispatch.
Daniel Dunbar [Sat, 8 Nov 2008 06:12:46 +0000 (06:12 +0000)]
Avoid redundant cast<>s / simplify type dispatch.

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

16 years agoSupport getTypeInfo, getTypeAlign, getTypeSize on const Type*s.
Daniel Dunbar [Sat, 8 Nov 2008 05:48:37 +0000 (05:48 +0000)]
Support getTypeInfo, getTypeAlign, getTypeSize on const Type*s.
 - Size/align are not effected by CVR qualifiers.

Support getCanonicalType: const Type* -> const Type*.

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

16 years ago"Fix" PR3021, don't crash on generating record types when we can't
Daniel Dunbar [Sat, 8 Nov 2008 04:42:29 +0000 (04:42 +0000)]
"Fix" PR3021, don't crash on generating record types when we can't
generate the type of a member.

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

16 years agoSilence a gcc warning.
Daniel Dunbar [Sat, 8 Nov 2008 04:28:37 +0000 (04:28 +0000)]
Silence a gcc warning.

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

16 years agoAdd a boilerplate for out-of-bound array checking. This has no real function currently.
Zhongxing Xu [Sat, 8 Nov 2008 03:45:42 +0000 (03:45 +0000)]
Add a boilerplate for out-of-bound array checking. This has no real function currently.

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

16 years agoIn a declarator, consider an identifier a constructor only if it is followed by '('.
Argyrios Kyrtzidis [Sat, 8 Nov 2008 01:09:16 +0000 (01:09 +0000)]
In a declarator, consider an identifier a constructor only if it is followed by '('.

Previously:

class C {
  int C;  // Declarator::SetConstructor was called here.
};

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

16 years agoupdate post-build step
Ted Kremenek [Sat, 8 Nov 2008 01:02:26 +0000 (01:02 +0000)]
update post-build step

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

16 years agoGreatly improve static_cast diagnostics
Sebastian Redl [Fri, 7 Nov 2008 23:29:29 +0000 (23:29 +0000)]
Greatly improve static_cast diagnostics

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