]> granicus.if.org Git - clang/log
clang
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

17 years agoSupport '~' for complex conjugation. This is a GCC extension.
Steve Naroff [Thu, 23 Aug 2007 22:06:40 +0000 (22:06 +0000)]
Support '~' for complex conjugation. This is a GCC extension.

This following now compiles without error...

_Complex unsigned X, Y;
_Complex double x, y;
void test2(int c) {
  X = ~Y;
  x = ~y;
}

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

17 years agofix a bug where we would type 0ULL as unsigned instead of unsigned long long
Chris Lattner [Thu, 23 Aug 2007 21:58:08 +0000 (21:58 +0000)]
fix a bug where we would type 0ULL as unsigned instead of unsigned long long

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

17 years agoPretty print as:
Chris Lattner [Thu, 23 Aug 2007 21:46:40 +0000 (21:46 +0000)]
Pretty print as:
  "case sizeof x:"
instead of:
  "case sizeofx:"

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

17 years agosizeof(x) doesn't require x to be an i-c-e for sizeof to be an i-c-e. Thanks to...
Chris Lattner [Thu, 23 Aug 2007 21:42:50 +0000 (21:42 +0000)]
sizeof(x) doesn't require x to be an i-c-e for sizeof to be an i-c-e.  Thanks to Neil for pointing this out.

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

17 years agoNo functionality change. Moved visitor methods for CFGBuilder out-of-line
Ted Kremenek [Thu, 23 Aug 2007 21:42:29 +0000 (21:42 +0000)]
No functionality change.  Moved visitor methods for CFGBuilder out-of-line
from the class declaration.  This enables a nice view of what visitor methods
have been implemented.

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

17 years agoadd support for codegen of calls returning complex.
Chris Lattner [Thu, 23 Aug 2007 21:38:16 +0000 (21:38 +0000)]
add support for codegen of calls returning complex.

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

17 years agoRemove a FIXME, allowing ++/-- on Complex types (a GCC extension).
Steve Naroff [Thu, 23 Aug 2007 21:37:33 +0000 (21:37 +0000)]
Remove a FIXME, allowing ++/-- on Complex types (a GCC extension).

Now, the following test case succeeds...

_Complex double x, y;
void test2(int c) {
  ++x;
}

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

17 years agomoved CFGBuilder into an anonymous namespace
Ted Kremenek [Thu, 23 Aug 2007 21:26:19 +0000 (21:26 +0000)]
moved CFGBuilder into an anonymous namespace

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

17 years ago- Cleanup "hack" comment and fix typos.
Steve Naroff [Thu, 23 Aug 2007 19:56:30 +0000 (19:56 +0000)]
- Cleanup "hack" comment and fix typos.
- Use getLang().ObjC2 when appropriate.

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

17 years agoAdded support for switch, default, and case statements in source-level CFGs.
Ted Kremenek [Thu, 23 Aug 2007 18:43:24 +0000 (18:43 +0000)]
Added support for switch, default, and case statements in source-level CFGs.

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

17 years agofinish off switch case overlap checking, adding support for
Chris Lattner [Thu, 23 Aug 2007 18:29:20 +0000 (18:29 +0000)]
finish off switch case overlap checking, adding support for
verifying case ranges.

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

17 years agoAdd helper functions Token::isObjCAtKeyword() and Token::getObjCKeywordID().
Steve Naroff [Thu, 23 Aug 2007 18:16:40 +0000 (18:16 +0000)]
Add helper functions Token::isObjCAtKeyword() and Token::getObjCKeywordID().

Convert all clients to the new cleaner, more robust API.

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

17 years agoRefactored "getSubStmt" and "SubStmt" from the CaseStmt and DefaultStmt
Ted Kremenek [Thu, 23 Aug 2007 18:04:38 +0000 (18:04 +0000)]
Refactored "getSubStmt" and "SubStmt" from the CaseStmt and DefaultStmt
class to their common parent class SwitchCase.

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

17 years agodetect and diagnose empty case ranges:
Chris Lattner [Thu, 23 Aug 2007 17:48:14 +0000 (17:48 +0000)]
detect and diagnose empty case ranges:

switch.c:16:8: warning: empty case range specified
  case 100 ... 99: ;  // expected-warning {{empty case range}}
       ^~~~~~~~~~

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

17 years agoFor gotos, breaks, and continues where we cannot find a target successor
Ted Kremenek [Thu, 23 Aug 2007 17:29:58 +0000 (17:29 +0000)]
For gotos, breaks, and continues where we cannot find a target successor
block (because we are creating a CFG from an incomplete AST) we now
(gracefully) have a block ending with such statements not have any successors
instead of firing an assertion.

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

17 years agoAdded support for do..while loops in CFG construction.
Ted Kremenek [Thu, 23 Aug 2007 17:15:32 +0000 (17:15 +0000)]
Added support for do..while loops in CFG construction.

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

17 years agoModified CFG to have explicit "Exit" pointer for exit block. This should
Ted Kremenek [Thu, 23 Aug 2007 16:51:52 +0000 (16:51 +0000)]
Modified CFG to have explicit "Exit" pointer for exit block.  This should
have been committed with my previous patch.

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

17 years agoRenamed "CFG::BuildCFG" to "CFG::buildCFG" to have more consistent capitalization.
Ted Kremenek [Thu, 23 Aug 2007 16:51:22 +0000 (16:51 +0000)]
Renamed "CFG::BuildCFG" to "CFG::buildCFG" to have more consistent capitalization.

Added explicit "Exit" CFGBlock pointer to the source-level CFG.

Changed the construction of blocks with "return" statements to have the
return statement appear both as a statement in the list of statements for
a CFGBlock as well as appear as a control-flow terminator.  Also removed
the implicit linearization of "return" so that the return value and the
return statement did not appear as separate statements in the block.

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

17 years agoAs suggested by Chris, use MatchRHSPunctuation instead of manually looking for a...
Anders Carlsson [Thu, 23 Aug 2007 15:31:37 +0000 (15:31 +0000)]
As suggested by Chris, use MatchRHSPunctuation instead of manually looking for a right parenthesis when parsing @encode() and @protocol().

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

17 years agoParse ObjC @protocol expressions.
Anders Carlsson [Thu, 23 Aug 2007 15:25:28 +0000 (15:25 +0000)]
Parse ObjC @protocol expressions.

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

17 years agofix a segfault in cases where there are no cases.
Chris Lattner [Thu, 23 Aug 2007 14:29:07 +0000 (14:29 +0000)]
fix a segfault in cases where there are no cases.

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

17 years agoreport duplicate case values. TODO: report duplicate/overlapping ranges.
Chris Lattner [Thu, 23 Aug 2007 06:23:56 +0000 (06:23 +0000)]
report duplicate case values.  TODO: report duplicate/overlapping ranges.

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

17 years agothis test is passing, though it is generating bogus code at the moment.
Chris Lattner [Thu, 23 Aug 2007 05:47:53 +0000 (05:47 +0000)]
this test is passing, though it is generating bogus code at the moment.

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

17 years agostart checking case values of switch stmts more closely. Emit overflow
Chris Lattner [Thu, 23 Aug 2007 05:46:52 +0000 (05:46 +0000)]
start checking case values of switch stmts more closely.  Emit overflow
warnings when converting case values to the expression type.

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

17 years agoUpdate to match the API from LLVM mainline.
Chris Lattner [Thu, 23 Aug 2007 05:22:10 +0000 (05:22 +0000)]
Update to match the API from LLVM mainline.

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

17 years agorun .m files as tests
Chris Lattner [Thu, 23 Aug 2007 01:09:45 +0000 (01:09 +0000)]
run .m files as tests

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

17 years agoTest that cocoa parses with -parse-noop. In the future
Chris Lattner [Thu, 23 Aug 2007 01:08:54 +0000 (01:08 +0000)]
Test that cocoa parses with -parse-noop.  In the future
(when ready) this test should change to test -fsyntax-only.

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

17 years agoWith this commit, we now successfully parse "Cocoa.h"!
Steve Naroff [Wed, 22 Aug 2007 23:18:22 +0000 (23:18 +0000)]
With this commit, we now successfully parse "Cocoa.h"!

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

17 years agoFixed bugs in source-level CFG construction for "for" and "while" loops
Ted Kremenek [Wed, 22 Aug 2007 22:35:28 +0000 (22:35 +0000)]
Fixed bugs in source-level CFG construction for "for" and "while" loops
where break targets weren't being set and restored properly.  Also
cleaned up CFGBuilder code for "for" and "while" to use less reliance
on globals and to have clearer semantics.

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

17 years agoFix a misleading comment...
Steve Naroff [Wed, 22 Aug 2007 22:19:13 +0000 (22:19 +0000)]
Fix a misleading comment...

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

17 years agoAdd support for parsing protocols.
Steve Naroff [Wed, 22 Aug 2007 22:17:26 +0000 (22:17 +0000)]
Add support for parsing protocols.

Now we can parse quite a bit of "Foundation.h" (a couple bugs remain).

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

17 years agoAdded support for "break" statements in source-level ASTs.
Ted Kremenek [Wed, 22 Aug 2007 21:51:58 +0000 (21:51 +0000)]
Added support for "break" statements in source-level ASTs.
Some comment cleanups.

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

17 years agoAdded support for "continue" statements in source-level CFGs
Ted Kremenek [Wed, 22 Aug 2007 21:36:54 +0000 (21:36 +0000)]
Added support for "continue" statements in source-level CFGs

Cleaned up some code for "for" and "while" loops by making their
implementations more symmetrical (and added a few comments).

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

17 years agoAdded preliminary support for while loops within source-level CFGs.
Ted Kremenek [Wed, 22 Aug 2007 21:05:42 +0000 (21:05 +0000)]
Added preliminary support for while loops within source-level CFGs.

Adjusted printing of source-level CFGs to account that the entry block
may not be the first block in the list of blocks a CFG object maintains.

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

17 years agoAdded explicit pointer within class CFG to the Entry block.
Ted Kremenek [Wed, 22 Aug 2007 21:03:50 +0000 (21:03 +0000)]
Added explicit pointer within class CFG to the Entry block.
Before we assumed that the first block in the list of blocks was the entry
block, but this has posed hurdles during CFG construction.

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

17 years agoFinish up method prototype parsing.
Steve Naroff [Wed, 22 Aug 2007 18:35:33 +0000 (18:35 +0000)]
Finish up method prototype parsing.

Next step...starting installing class names into the type namespace (so we can start parsing Cocoa headers).

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

17 years agoAdded CFG support for: for loops
Ted Kremenek [Wed, 22 Aug 2007 18:22:34 +0000 (18:22 +0000)]
Added CFG support for: for loops

In CFG dumper, refactored the code to print block terminators into a
StmtVisitor.

Added the method "FinishBlock" to CFGBuilder to do the reversal of statements
in a block instead of calling "reverseStmts" for a block directly.  This
was necessary to fix a bug in how blocks with labels were being processed
(some cases would cause the statements to be reversed twice).  FinishBlock
detects blocks that start with labels and doesn't do a second reversal.

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

17 years agoAdd support for parsing method prototypes (and other stuff required by @interface).
Steve Naroff [Wed, 22 Aug 2007 16:35:03 +0000 (16:35 +0000)]
Add support for parsing method prototypes (and other stuff required by @interface).

Still need to finish Parser::ParseObjCMethodDecl(). Before I do, I need to do a minor
refactoring of ParseDeclarationOrFunctionDefinition(), to disallow function definitions.
At the moment, @inteface allows function defs (which is incorrect).

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

17 years agoChanged data structure recording the CFG blocks that need to be backpatched
Ted Kremenek [Wed, 22 Aug 2007 15:40:58 +0000 (15:40 +0000)]
Changed data structure recording the CFG blocks that need to be backpatched
to labeled blocks from a list to a vector.

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

17 years agoParse @encode expressions.
Anders Carlsson [Wed, 22 Aug 2007 15:14:15 +0000 (15:14 +0000)]
Parse @encode expressions.

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

17 years agoupdate todo markers
Chris Lattner [Wed, 22 Aug 2007 06:06:56 +0000 (06:06 +0000)]
update todo markers

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

17 years agooptimize scope push/pop to avoid work in the common case.
Chris Lattner [Wed, 22 Aug 2007 05:33:11 +0000 (05:33 +0000)]
optimize scope push/pop to avoid work in the common case.

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

17 years agoFix the scoping issue Neil pointed out for the rest of
Chris Lattner [Wed, 22 Aug 2007 05:28:50 +0000 (05:28 +0000)]
Fix the scoping issue Neil pointed out for the rest of
the selection statements and iteration statements.  Add
spec citations.

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

17 years agoFix a nasty C99 scope issue that Neil pointed out (for ifs)
Chris Lattner [Wed, 22 Aug 2007 05:16:28 +0000 (05:16 +0000)]
Fix a nasty C99 scope issue that Neil pointed out (for ifs)
This fixes test/Parser/control-scope.c

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

17 years agoAdded CFG support for gotos and labels.
Ted Kremenek [Tue, 21 Aug 2007 23:26:17 +0000 (23:26 +0000)]
Added CFG support for gotos and labels.

Modified CFG so that getEntry(), getExit(), front() and back() return
CFGBlock& instead of CFGBlock*.

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

17 years agoadd some fixme's, implement complex struct members.
Chris Lattner [Tue, 21 Aug 2007 22:33:41 +0000 (22:33 +0000)]
add some fixme's, implement complex struct members.

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

17 years agoimplement codegen for --/++
Chris Lattner [Tue, 21 Aug 2007 22:25:29 +0000 (22:25 +0000)]
implement codegen for --/++

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

17 years agoConverted CFGBuilder to use StmtVisitor instead of doing a switch
Ted Kremenek [Tue, 21 Aug 2007 22:06:14 +0000 (22:06 +0000)]
Converted CFGBuilder to use StmtVisitor instead of doing a switch
dispatch to walk the AST.

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

17 years agoadd cfg.h/cfg.cpp to the xcode project at Ted's request.
Chris Lattner [Tue, 21 Aug 2007 21:44:59 +0000 (21:44 +0000)]
add cfg.h/cfg.cpp to the xcode project at Ted's request.

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

17 years agoAdded CFG infrastructure (CFG.cpp and CFG.h) for clang ASTs.
Ted Kremenek [Tue, 21 Aug 2007 21:42:03 +0000 (21:42 +0000)]
Added CFG infrastructure (CFG.cpp and CFG.h) for clang ASTs.

Added builder code to translate ASTs to CFGs.  This currently supports
if, return, and non-control flow statements.

Added pretty-printer to debug CFGs.

Added a "-dump-cfg" option to the clang driver to dump CFGs for code
sent through the frontend.

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

17 years agoImplement parsing for objc instance variables.
Steve Naroff [Tue, 21 Aug 2007 21:17:12 +0000 (21:17 +0000)]
Implement parsing for objc instance variables.

Next step, method...

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

17 years agoimplement __extension__ and unary~ for complex.
Chris Lattner [Tue, 21 Aug 2007 20:41:44 +0000 (20:41 +0000)]
implement __extension__ and unary~ for complex.

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

17 years agoAdded reverse iterators for the body of CompountStmt. These are useful for
Ted Kremenek [Tue, 21 Aug 2007 20:29:50 +0000 (20:29 +0000)]
Added reverse iterators for the body of CompountStmt.  These are useful for
CFG construction (among other potential uses).

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

17 years agoimplement codegen for complex unary +/-
Chris Lattner [Tue, 21 Aug 2007 20:08:23 +0000 (20:08 +0000)]
implement codegen for complex unary +/-

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

17 years agoDon't remove the grammar construct, just the TODO.
Anders Carlsson [Tue, 21 Aug 2007 19:18:49 +0000 (19:18 +0000)]
Don't remove the grammar construct, just the TODO.

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

17 years agominor nicities.
Chris Lattner [Tue, 21 Aug 2007 18:51:13 +0000 (18:51 +0000)]
minor nicities.

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

17 years agoTweak error recovery for missing semicolon after decl. For this:
Chris Lattner [Tue, 21 Aug 2007 18:36:18 +0000 (18:36 +0000)]
Tweak error recovery for missing semicolon after decl.  For this:

void foo() {
  int x
  if (x) {
  }
}

We now emit:

a.c:5:3: error: parse error
  if (x) {
  ^
1 diagnostic generated.

instead of:

a.c:5:3: error: parse error
  if (x) {
  ^
a.c:9:1: error: expected '}'

^
2 diagnostics generated.

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

17 years agoadd unary operator support to the stmtvisitor
Chris Lattner [Tue, 21 Aug 2007 18:18:25 +0000 (18:18 +0000)]
add unary operator support to the stmtvisitor

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

17 years agoRemove objc-string-literal since it's been implemented now.
Anders Carlsson [Tue, 21 Aug 2007 18:14:25 +0000 (18:14 +0000)]
Remove objc-string-literal since it's been implemented now.

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

17 years agoimplement support for complex subscripts.
Chris Lattner [Tue, 21 Aug 2007 18:03:58 +0000 (18:03 +0000)]
implement support for complex subscripts.

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

17 years agoallow support for volatile lvalues even though it's still not right.
Chris Lattner [Tue, 21 Aug 2007 18:02:02 +0000 (18:02 +0000)]
allow support for volatile lvalues even though it's still not right.

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

17 years agoImplement parsing and code generation of Objective-C string literals.
Anders Carlsson [Tue, 21 Aug 2007 17:43:55 +0000 (17:43 +0000)]
Implement parsing and code generation of Objective-C string literals.

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

17 years agoadd a new builder ivar.
Chris Lattner [Tue, 21 Aug 2007 17:39:38 +0000 (17:39 +0000)]
add a new builder ivar.

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

17 years agomove EmitLoadOfComplex/EmitStoreOfComplex into ComplexExprEmitter.
Chris Lattner [Tue, 21 Aug 2007 17:28:34 +0000 (17:28 +0000)]
move EmitLoadOfComplex/EmitStoreOfComplex into ComplexExprEmitter.

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

17 years agoimplement comma for complex.
Chris Lattner [Tue, 21 Aug 2007 17:15:50 +0000 (17:15 +0000)]
implement comma for complex.

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

17 years agoand/or/xor are invalid for complex, even integer complex apparently.
Chris Lattner [Tue, 21 Aug 2007 17:12:50 +0000 (17:12 +0000)]
and/or/xor are invalid for complex, even integer complex apparently.

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

17 years agosimplify code slightly
Chris Lattner [Tue, 21 Aug 2007 17:03:38 +0000 (17:03 +0000)]
simplify code slightly

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

17 years agoadd sema support for complex integer types
Chris Lattner [Tue, 21 Aug 2007 17:02:28 +0000 (17:02 +0000)]
add sema support for complex integer types

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

17 years agoreimplement support for complex comparisons, add support for integer complex compares.
Chris Lattner [Tue, 21 Aug 2007 16:57:55 +0000 (16:57 +0000)]
reimplement support for complex comparisons, add support for integer complex compares.

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

17 years agoadd getAsComplexType() for consistency
Chris Lattner [Tue, 21 Aug 2007 16:54:08 +0000 (16:54 +0000)]
add getAsComplexType() for consistency

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

17 years agoAdd the comparisons and logical binops to the visitor.
Chris Lattner [Tue, 21 Aug 2007 16:38:51 +0000 (16:38 +0000)]
Add the comparisons and logical binops to the visitor.

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

17 years agoreimplement complex mul
Chris Lattner [Tue, 21 Aug 2007 16:34:16 +0000 (16:34 +0000)]
reimplement complex mul

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

17 years agoadd a testcase I forgot to check in long ago
Chris Lattner [Tue, 21 Aug 2007 05:56:30 +0000 (05:56 +0000)]
add a testcase I forgot to check in long ago

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

17 years agoupdate some comments.
Chris Lattner [Tue, 21 Aug 2007 05:54:53 +0000 (05:54 +0000)]
update some comments.

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

17 years agoSplit complex arithmetic codegen out from aggregate codegen.
Chris Lattner [Tue, 21 Aug 2007 05:54:00 +0000 (05:54 +0000)]
Split complex arithmetic codegen out from aggregate codegen.
This means that we get rid of tons of intermediate allocas.  For
example:

void foo(double _Complex a, double _Complex b) {
   a = b+a+a;
}

this used to have 4 temporary allocas, now it has zero of them.
This also simplifies the individual visitor methods because they
now can all operate on real/imag pairs instead of having to
load/store all over the place.

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

17 years agosimplify this a bit to remove indirection
Chris Lattner [Tue, 21 Aug 2007 05:02:10 +0000 (05:02 +0000)]
simplify this a bit to remove indirection

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

17 years agoreimplement addition of complex numbers.
Chris Lattner [Tue, 21 Aug 2007 04:59:27 +0000 (04:59 +0000)]
reimplement addition of complex numbers.

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

17 years agoAdd the ability to visit binary operators without having to
Chris Lattner [Tue, 21 Aug 2007 04:43:17 +0000 (04:43 +0000)]
Add the ability to visit binary operators without having to
match on binop then explicitly switching again.

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

17 years agoswitch aggregate expr codegen to use a visitor to localize most of the nasty
Chris Lattner [Tue, 21 Aug 2007 04:25:47 +0000 (04:25 +0000)]
switch aggregate expr codegen to use a visitor to localize most of the nasty
details in its own file.

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

17 years agoNow that the visitor is defined in one place, it is nice and easy to allow clients
Chris Lattner [Tue, 21 Aug 2007 04:06:29 +0000 (04:06 +0000)]
Now that the visitor is defined in one place, it is nice and easy to allow clients
to have visitors that return non-void.

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