| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
llvm-svn: 41618
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
an empty then or else block (or contained only ';' statements).
For example, we now handle the following:
int empty_else() { if (0) { int a; } else ; }
int empty_then() { if (0) ; else { int a; } }
Thanks to Nico Weber for spotting this problem.
llvm-svn: 41617
|
|
|
|
|
|
|
|
|
| |
couple FIXME's.
Refactored Array/VariableArray, moving SizeModifier/IndexTypeQuals back up to Array. These
attributes are not specific to VLA's. Most of them are specific to array parameter types.
llvm-svn: 41616
|
|
|
|
| |
llvm-svn: 41615
|
|
|
|
| |
llvm-svn: 41613
|
|
|
|
|
|
|
|
|
|
|
| |
including the expressions in the case statement itself (not the body of
the case).
This required moving SubStmt out of SwitchCase into CaseStmt and DefaultStmt
respectively. getSubStmt() now is a virtual call for SwitchCase, but is
a direct (static) call for CaseStmt and DefaultStmt.
llvm-svn: 41609
|
|
|
|
| |
llvm-svn: 41603
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For example, -parse-ast-dump now prints:
static inline int __inline_isinff(float __x)
(CompoundStmt 0x2409a20
(ReturnStmt 0x2409a10
(BinaryOperator 0x24099f0 'int' <///usr/include/architecture/i386/math.h:183:63, col:102> '=='
(CallExpr 0x24098f0 'float' <col:63, col:82>
(ImplicitCastExpr 0x24098e0 'float (*)(float)' <col:63>
(DeclRefExpr 0x2409880 'float (float)' <col:63> Decl='__builtin_fabsf' 0x2409840))
(DeclRefExpr 0x24098a0 'float' <col:79> Decl='__x' 0x2409810))
(CallExpr 0x24099c0 'float' <col:87, col:102>
(ImplicitCastExpr 0x2409870 'float (*)(void)' <col:87>
(DeclRefExpr 0x2409980 'float (void)' <col:87> Decl='__builtin_inff' 0x2409940))))))
where it only prints filename/line# if it changes from the previous value. We
really need loc info on stmts though, like we have on exprs.
llvm-svn: 41602
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[dylan:~/llvm/tools/clang] admin% cat tentative_decls.c
// incorrectly generates redefinition error
extern int array[3];
int array[3];
// incorrectly generates a redefinition error
extern void nup(int a[3]);
void nup(int a[3]) {}
It turns out that this exposed a fairly major flaw in the type system,
array types were never getting uniqued! This is because all array types
contained an expression, which aren't unique.
To solve this, we now have 2 array types, ConstantArrayType and
VariableArrayType. ConstantArrayType's are unique, VAT's aren't.
This is a fairly extensive set of fundamental changes. Fortunately,
all the tests pass. Nevertheless, there may be some collateral damage:-)
If so, let me know!
llvm-svn: 41592
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use Ted's child walking interface to allow the dumper to walk the tree
in one place and only have node-specific callbacks worry about
formatting the nodes (instead of formatting the nodes plus walking the
tree).
This commit eliminates now default cases by letting them fall through with
the normal visitor stuff.
llvm-svn: 41591
|
|
|
|
| |
llvm-svn: 41589
|
|
|
|
| |
llvm-svn: 41588
|
|
|
|
|
|
|
|
|
|
|
|
| |
block begins with a label or case statement, CFGBlock::getLabel() will
return the corresponding LabelStmt/CaseStmt/DefaultStmt.
LabelStmts and SwitchCases no longer appear within the "executable"
statements of a CFGBlock.
More cleanups on visualization/pretty-printing of CFGs (less verbose).
llvm-svn: 41585
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(LLVM-provided) graph algorithms such as DFS and graph visualization
to work effortless on source-level CFGs.
Further cleanup on pretty printing of CFGs. CFGBlock::dump and
CFGBlock::print now take the parent CFG as an argument. This allows
CFGBlocks to print their own appropriate label indicating whether or
not they are the Entry/Exit/IndirectGotoBlock without the CFG::print
routine doing it instead.
Added Graphviz visualization for CFGs: CFG::viewCFG. This employs the
GraphTraits just implemented.
Added "-view-cfg" mode the to clang driver. This is identical to
"-dump-cfg" except that it calls Graphviz to visualize the CFGs
instead of dumping them to the terminal.
llvm-svn: 41580
|
|
|
|
|
|
|
|
|
| |
generator
to emit signed comparisons when needed for enum decl references. This implements
test/CodeGen/enum.c. I think enums should be good now.
llvm-svn: 41572
|
|
|
|
|
|
|
|
|
|
| |
This fixes the following bug submitted by Neil...
const char *f (void) { return 0; }
...which would incorrectly warn with -pedantic enabled.
llvm-svn: 41559
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the following (recent) regression noticed by Keith Bauer (thanks!).
void func(void *a);
main() {
void *p;
p = 0;
func(0);
}
...which now works as you would expect.
llvm-svn: 41557
|
|
|
|
|
|
|
|
|
|
| |
This involves the construction of a specialized "dispatch" block that
all basic blocks containing indirect gotos unconditionally transfer
control-flow to. The successors of the dispatch block has as its successors
all of the blocks containing labels whose address was taken somewhere in
the function.
llvm-svn: 41554
|
|
|
|
| |
llvm-svn: 41549
|
|
|
|
|
|
|
| |
directly in it. Remove TargetInfo::getEnumPolicy, as there is only
one policy that we support right now.
llvm-svn: 41548
|
|
|
|
|
|
| |
arbitrarily complex control-flow in their subexpressions.
llvm-svn: 41547
|
|
|
|
| |
llvm-svn: 41540
|
|
|
|
| |
llvm-svn: 41520
|
|
|
|
| |
llvm-svn: 41514
|
|
|
|
|
|
|
|
| |
calculated a Stmt** pointer
based on an offset within SubExprs.
llvm-svn: 41512
|
|
|
|
|
|
| |
would be invalid when RetValExp == NULL.
llvm-svn: 41511
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
+ 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).
llvm-svn: 41508
|
|
|
|
| |
llvm-svn: 41503
|
|
|
|
| |
llvm-svn: 41500
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)))))
llvm-svn: 41483
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Modified Type::typesAreCompatible() to use the above.
This fixes the following bug submitted by Keith Bauer (thanks!).
int equal(char *a, const char *b)
{
return a == b;
}
Also tweaked Sema::CheckCompareOperands() to ignore the qualifiers when
comparing two pointer types (though it doesn't relate directly to this bug).
llvm-svn: 41476
|
|
|
|
| |
llvm-svn: 41475
|
|
|
|
|
|
|
|
|
| |
ASTContext::getFloatingTypeOfSizeWithinDomain().
Changed Sema::UsualArithmeticConversions to correctly implement complex/float conversions,
using maxFloatingType() with getFloatingTypeOfSizeWithinDomain().
llvm-svn: 41474
|
|
|
|
| |
llvm-svn: 41415
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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))))
llvm-svn: 41413
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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))))))
llvm-svn: 41404
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the following bug...
t.c:1:31: error: expression is not assignable
short x; void foo(char c) { x += c; }
This case, among others are now captured in implicit-casts.c.
llvm-svn: 41402
|
|
|
|
|
|
| |
they show up in dumps etc.
llvm-svn: 41393
|
|
|
|
| |
llvm-svn: 41392
|
|
|
|
| |
llvm-svn: 41390
|
|
|
|
|
|
|
| |
concrete subclasses of Stmt are now required to implement
child_begin/child_end.
llvm-svn: 41374
|
|
|
|
| |
llvm-svn: 41369
|
|
|
|
| |
llvm-svn: 41366
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
llvm-svn: 41363
|
|
|
|
| |
llvm-svn: 41361
|
|
|
|
|
|
|
|
| |
"case sizeof x:"
instead of:
"case sizeofx:"
llvm-svn: 41339
|
|
|
|
|
|
| |
Thanks to Neil for pointing this out.
llvm-svn: 41338
|
|
|
|
|
|
|
| |
from the class declaration. This enables a nice view of what visitor methods
have been implemented.
llvm-svn: 41337
|
|
|
|
| |
llvm-svn: 41334
|
|
|
|
| |
llvm-svn: 41332
|