Commit Graph

35677 Commits

Author SHA1 Message Date
Ted Kremenek 9aae513318 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.

llvm-svn: 41337
2007-08-23 21:42:29 +00:00
Chris Lattner 1aaab49a3e add support for codegen of calls returning complex.
llvm-svn: 41336
2007-08-23 21:38:16 +00:00
Steve Naroff 9e1e551c01 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;
}

llvm-svn: 41335
2007-08-23 21:37:33 +00:00
Ted Kremenek 04cca64f8c moved CFGBuilder into an anonymous namespace
llvm-svn: 41334
2007-08-23 21:26:19 +00:00
Steve Naroff 4e1f80d255 - Cleanup "hack" comment and fix typos.
- Use getLang().ObjC2 when appropriate.

llvm-svn: 41333
2007-08-23 19:56:30 +00:00
Ted Kremenek 879d8e1f77 Added support for switch, default, and case statements in source-level CFGs.
llvm-svn: 41332
2007-08-23 18:43:24 +00:00
Chris Lattner 67998451c7 finish off switch case overlap checking, adding support for
verifying case ranges.

llvm-svn: 41331
2007-08-23 18:29:20 +00:00
Steve Naroff 7c34817902 Add helper functions Token::isObjCAtKeyword() and Token::getObjCKeywordID().
Convert all clients to the new cleaner, more robust API.

llvm-svn: 41330
2007-08-23 18:16:40 +00:00
Ted Kremenek 13fdfe99cd Refactored "getSubStmt" and "SubStmt" from the CaseStmt and DefaultStmt
class to their common parent class SwitchCase.

llvm-svn: 41329
2007-08-23 18:04:38 +00:00
Chris Lattner f81460f99c detect and diagnose empty case ranges:
switch.c:16:8: warning: empty case range specified
  case 100 ... 99: ;  // expected-warning {{empty case range}}
       ^~~~~~~~~~

llvm-svn: 41328
2007-08-23 17:48:14 +00:00
Ted Kremenek 9ee3bcf81c 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.

llvm-svn: 41327
2007-08-23 17:29:58 +00:00
Duncan Sands a0f12c5493 Fix this testcase: there are two matches for
llvm.cttz.i64 because of the declaration of
the intrinsic.  Also, emit-llvm is automatic
and doesn't need to be specified.

llvm-svn: 41326
2007-08-23 17:22:50 +00:00
Ted Kremenek 9443f5b1e0 Added support for do..while loops in CFG construction.
llvm-svn: 41325
2007-08-23 17:15:32 +00:00
Ted Kremenek 07b5b52cd0 Modified CFG to have explicit "Exit" pointer for exit block. This should
have been committed with my previous patch.

llvm-svn: 41324
2007-08-23 16:51:52 +00:00
Ted Kremenek 889073f785 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.

llvm-svn: 41323
2007-08-23 16:51:22 +00:00
Anders Carlsson cb8f832c26 As suggested by Chris, use MatchRHSPunctuation instead of manually looking for a right parenthesis when parsing @encode() and @protocol().
llvm-svn: 41321
2007-08-23 15:31:37 +00:00
Anders Carlsson e01493d47b Parse ObjC @protocol expressions.
llvm-svn: 41320
2007-08-23 15:25:28 +00:00
Chris Lattner 33800d1428 add some notes on really poor codegen.
llvm-svn: 41319
2007-08-23 15:22:07 +00:00
Chris Lattner 92c6a65d4e new example
llvm-svn: 41318
2007-08-23 15:16:03 +00:00
Chris Lattner fcb920d32b fix a segfault in cases where there are no cases.
llvm-svn: 41317
2007-08-23 14:29:07 +00:00
Anton Korobeynikov 97cdac8d19 Perform correct codegen for eh_dwarf_cfa intrinsic.
llvm-svn: 41316
2007-08-23 07:21:06 +00:00
Chris Lattner 10cb5e520f report duplicate case values. TODO: report duplicate/overlapping ranges.
llvm-svn: 41315
2007-08-23 06:23:56 +00:00
Chris Lattner 725c6a4279 this test is passing, though it is generating bogus code at the moment.
llvm-svn: 41314
2007-08-23 05:47:53 +00:00
Chris Lattner fc1c44ac7d start checking case values of switch stmts more closely. Emit overflow
warnings when converting case values to the expression type.

llvm-svn: 41313
2007-08-23 05:46:52 +00:00
Chris Lattner 53e5a38684 Update to match the API from LLVM mainline.
llvm-svn: 41312
2007-08-23 05:22:10 +00:00
Chris Lattner 06eca7a4ca default this to radix 10 like the toString(Un)Signed methods.
llvm-svn: 41311
2007-08-23 05:21:48 +00:00
Chris Lattner d2d32bae97 Avoid hiding issues.
llvm-svn: 41310
2007-08-23 05:20:48 +00:00
Chris Lattner b0f158cfdf rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()
Add an APSInt::toString() method.

llvm-svn: 41309
2007-08-23 05:15:32 +00:00
Chris Lattner 7d75c0d9b6 run .m files as tests
llvm-svn: 41308
2007-08-23 01:09:45 +00:00
Chris Lattner c4e7a66036 Test that cocoa parses with -parse-noop. In the future
(when ready) this test should change to test -fsyntax-only.

llvm-svn: 41307
2007-08-23 01:08:54 +00:00
Duncan Sands f2bcd37083 Implement review feedback on trampoline documentation.
llvm-svn: 41304
2007-08-22 23:39:54 +00:00
Steve Naroff 7e901fdf86 With this commit, we now successfully parse "Cocoa.h"!
llvm-svn: 41303
2007-08-22 23:18:22 +00:00
Ted Kremenek 0a6ec03884 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.

llvm-svn: 41302
2007-08-22 22:35:28 +00:00
Steve Naroff c6e96bfef3 Fix a misleading comment...
llvm-svn: 41301
2007-08-22 22:19:13 +00:00
Steve Naroff 0b6a01a449 Add support for parsing protocols.
Now we can parse quite a bit of "Foundation.h" (a couple bugs remain).

llvm-svn: 41300
2007-08-22 22:17:26 +00:00
Ted Kremenek e1810dee74 Added support for "break" statements in source-level ASTs.
Some comment cleanups.

llvm-svn: 41299
2007-08-22 21:51:58 +00:00
Ted Kremenek 1aebee0a4d 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).

llvm-svn: 41298
2007-08-22 21:36:54 +00:00
Devang Patel 887db2d832 Remove dead code.
llvm-svn: 41295
2007-08-22 21:07:41 +00:00
Ted Kremenek 1c65be13cc 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.

llvm-svn: 41294
2007-08-22 21:05:42 +00:00
Ted Kremenek 88dea224c1 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.

llvm-svn: 41293
2007-08-22 21:03:50 +00:00
Devang Patel 6f4f23320d Fix typo.
llvm-svn: 41292
2007-08-22 20:55:18 +00:00
Andrew Lenharth 544fdd27fb update test to check that codegen works with llvm.used in llvm.metadata section
llvm-svn: 41289
2007-08-22 19:36:31 +00:00
Devang Patel 31206b56d5 Cosmetic change
"True Loop" and "False Loop" naming terminology to refer two loops
after loop cloning is confusing. Instead just use A_Loop and B_Loop.

llvm-svn: 41287
2007-08-22 19:33:29 +00:00
Andrew Lenharth beb80a9832 move this check. ppc outputs .no_dead_strip properly
llvm-svn: 41286
2007-08-22 19:33:11 +00:00
Bill Wendling 862afea91e Add the PCSymbol for Darwin x86 platforms.
llvm-svn: 41284
2007-08-22 18:44:05 +00:00
Steve Naroff f1bc45b1d1 Finish up method prototype parsing.
Next step...starting installing class names into the type namespace (so we can start parsing Cocoa headers).

llvm-svn: 41283
2007-08-22 18:35:33 +00:00
Devang Patel 90da534987 Refactor loop condition check in a separate function.
llvm-svn: 41282
2007-08-22 18:27:01 +00:00
Ted Kremenek 7e776b1d9c 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.

llvm-svn: 41281
2007-08-22 18:22:34 +00:00
Devang Patel cd8beb7645 Fix thinko.
Starting value of second loop's induction variable can not be lower 
then starting value of original loop's induction variable.

llvm-svn: 41280
2007-08-22 18:07:47 +00:00
Steve Naroff 99264b4b04 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).

llvm-svn: 41275
2007-08-22 16:35:03 +00:00