Chris Lattner
1782da2f84
Add a new -rewrite-test option, which is basically a
...
playground to experiment with some new rewriter approaches. For now
it is probably the most complex version of 'cat' ever invented.
llvm-svn: 57406
2008-10-12 05:29:20 +00:00
Chris Lattner
fc7d4a3bd2
Add a new -dump-raw-tokens option, which allows us to see raw tokens.
...
Rename -dumptokens to -dump-tokens.
llvm-svn: 57405
2008-10-12 05:03:36 +00:00
Chris Lattner
b11c3233d8
Change FormTokenWithChars to take the token kind to form, since all clients
...
were setting a kind and then forming it. This is just a minor API cleanup,
no functionality change.
llvm-svn: 57404
2008-10-12 04:51:35 +00:00
Chris Lattner
99e7d23455
When in keep whitespace mode, make sure to return block comments that are
...
unterminated.
llvm-svn: 57403
2008-10-12 04:19:49 +00:00
Chris Lattner
e01e758e11
Change SkipBlockComment and SkipBCPLComment to return true when in
...
keep comment mode, instead of returning false. This matches SkipWhitespace.
llvm-svn: 57402
2008-10-12 04:15:42 +00:00
Chris Lattner
4d96344c19
Add a new mode to the lexer which enables it to return all characters,
...
even whitespace, as tokens from the file. This is enabled with
L->SetKeepWhitespaceMode(true) on a raw lexer. In this mode, you too
can use clang as a really complex version of 'cat' with code like this:
Lexer RawLex(SourceLocation::getFileLoc(SM.getMainFileID(), 0),
PP.getLangOptions(), File.first, File.second);
RawLex.SetKeepWhitespaceMode(true);
Token RawTok;
RawLex.LexFromRawLexer(RawTok);
while (RawTok.isNot(tok::eof)) {
std::cout << PP.getSpelling(RawTok);
RawLex.LexFromRawLexer(RawTok);
}
This will emit exactly the input file, with no canonicalization or other
translation. Realistic clients actually do something with the tokens of
course :)
llvm-svn: 57401
2008-10-12 04:05:48 +00:00
Chris Lattner
924efdf623
Stop the preprocessor from poking the lexer's private parts.
...
llvm-svn: 57399
2008-10-12 03:31:33 +00:00
Chris Lattner
097a8b8777
Fix a couple more places that poke KeepCommentMode unnecesarily.
...
llvm-svn: 57398
2008-10-12 03:27:19 +00:00
Chris Lattner
8637abd333
add a new inKeepCommentMode() accessor to abstract the KeepCommentMode
...
ivar.
llvm-svn: 57397
2008-10-12 03:22:02 +00:00
Chris Lattner
e3f863a388
fix misleading comment.
...
llvm-svn: 57396
2008-10-12 01:34:51 +00:00
Chris Lattner
7c2e9809b1
Simplify raw mode lexing by treating an unterminate /**/ comment the
...
same we we do an unterminated string or character literal. This makes
it so we can guarantee that the lexer never calls into the
preprocessor (which would be suicide for a raw lexer).
llvm-svn: 57395
2008-10-12 01:31:51 +00:00
Chris Lattner
6b0c5ad096
add a comment.
...
llvm-svn: 57394
2008-10-12 01:23:27 +00:00
Chris Lattner
50c9050037
Change how raw lexers are handled: instead of creating them and then
...
using LexRawToken, create one and use LexFromRawLexer. This avoids
twiddling the RawLexer flag around and simplifies some code (even
speeding raw lexing up a tiny bit).
This change also improves the token paster to use a Lexer on the stack
instead of new/deleting it.
llvm-svn: 57393
2008-10-12 01:15:46 +00:00
Chris Lattner
5d3e26a4f6
silence release-assert warnings.
...
llvm-svn: 57392
2008-10-12 00:31:50 +00:00
Chris Lattner
79ef843533
silence some release-assert warnings.
...
llvm-svn: 57391
2008-10-12 00:28:42 +00:00
Chris Lattner
e05f534628
silence a bunch of warnings in a release-assert build.
...
llvm-svn: 57390
2008-10-12 00:26:57 +00:00
Chris Lattner
87e97ea7b8
improve a comment.
...
llvm-svn: 57389
2008-10-12 00:23:07 +00:00
Steve Naroff
b2b5540c40
Add DeclGroup.cpp.
...
llvm-svn: 57354
2008-10-10 16:41:38 +00:00
Steve Naroff
8022c30aaa
Fix/simplify RewriteBlocks::RewriteBlockPointerFunctionArgs().
...
This completes the fix for <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?.
llvm-svn: 57350
2008-10-10 15:33:34 +00:00
Seo Sanghyeon
c9e7c272da
Tests for return statement checks
...
llvm-svn: 57341
2008-10-10 07:20:06 +00:00
Steve Naroff
1d95e5a531
Final phase of converting BlockDecls over to DeclContext. This is unfortunately a largish/complex diff, however it was necessry to pass all the current block tests.
...
llvm-svn: 57337
2008-10-10 01:28:17 +00:00
Daniel Dunbar
eca513d945
Lift EmitTargetBuiltinExpr out of EmitBuiltinExpr.
...
llvm-svn: 57335
2008-10-10 00:24:54 +00:00
Daniel Dunbar
faa4f50b71
Disable blocks support in C++ mode.
...
llvm-svn: 57334
2008-10-10 00:20:52 +00:00
Ted Kremenek
63cfae34fd
Add missing newline.
...
llvm-svn: 57333
2008-10-10 00:17:08 +00:00
Dale Johannesen
c48814bc98
Adjust calls to APFloat conversion for new interface.
...
llvm-svn: 57332
2008-10-09 23:02:32 +00:00
Zhongxing Xu
cc06b463f5
Check some cases for previous patch. Make the code more robust.
...
llvm-svn: 57317
2008-10-09 03:19:06 +00:00
Argyrios Kyrtzidis
1207d31952
Fix a bug that crashed clang when parsing this:
...
class C {
static const int number = 50;
static int arr[number];
};
Here's how it worked:
-GetTypeForDeclarator was called from both Sema::ActOnCXXMemberDeclarator and Sema::ActOnDeclarator.
-VariableArrayTypes are not uniqued so two VariableArrayTypes were created with the same DeclRefExpr.
-On exit they both tried to destroy that one DeclRefExpr.
The fix is not to use GetTypeForDeclarator from the Sema::ActOnCXXMemberDeclarator.
llvm-svn: 57313
2008-10-08 22:20:31 +00:00
Steve Naroff
44078b95ee
Instantiate the BlockDecl in ActOnBlockStart() so we can use it as a DeclContext.
...
This required changes to attach the compound statement later on (like we do for functions).
llvm-svn: 57304
2008-10-08 18:44:00 +00:00
Ted Kremenek
944375abae
Update checker build.
...
llvm-svn: 57303
2008-10-08 18:32:06 +00:00
Steve Naroff
35530480c2
Touchup the rewriter to handle the new BlockExpr->BlockDecl dance.
...
llvm-svn: 57299
2008-10-08 17:31:13 +00:00
Steve Naroff
415d3d570a
- Add BlockDecl AST node.
...
- Modify BlockExpr to reference the BlockDecl.
This is "cleanup" necessary to improve our lookup semantics for blocks (to fix <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?).
Still some follow-up work to finish this (forthcoming).
llvm-svn: 57298
2008-10-08 17:01:13 +00:00
Zhongxing Xu
d9959aee34
This is the first step to implement a field-sensitive store model. Other things are simplified: no heap shape assumption, no parameter alias assumption, etc.
...
llvm-svn: 57285
2008-10-08 02:50:44 +00:00
Ted Kremenek
587a44fe3d
A little more tweaking with StmtIterator and SizeOfAlignofExpr. A recent commit actually introduced a regression, not fixed a bug.
...
llvm-svn: 57282
2008-10-07 23:35:42 +00:00
Ted Kremenek
9bb286ff43
Migrate DeclStmt over to using a DeclGroup instead of a pointer to a ScopedDecl*.
...
This also removes the ugly hack needed in CFG.cpp for subclassing DeclStmt to create a DeclStmt with one Decl*.
llvm-svn: 57275
2008-10-07 23:09:49 +00:00
Ted Kremenek
5ee6292e32
Add #include (introduced by dependence on DeclGroup)
...
llvm-svn: 57274
2008-10-07 23:08:39 +00:00
Ted Kremenek
4faf673d7f
Fixed a masked bug when iterating over the child expressions of SizeOfAlignOfTypeExpr. This bug was unmasked by recent changes to StmtIterator.
...
llvm-svn: 57273
2008-10-07 23:07:10 +00:00
Ted Kremenek
12183e25aa
Add const_iterator to DeclGroup.
...
Serialization for OwningDeclGroupRefs now works.
llvm-svn: 57272
2008-10-07 23:06:01 +00:00
Ted Kremenek
f9638bac59
Add StmtIterator support for DeclGroups.
...
llvm-svn: 57271
2008-10-07 23:04:14 +00:00
Argyrios Kyrtzidis
8ae3684aa9
In ParseParenDeclarator match "D.setGroupingParens(true);" with another setGroupingParens call after the ')' is parsed.
...
Fixes this bug:
int (x)(0); // error, expected function declarator where the '(0)' initializer is
llvm-svn: 57241
2008-10-07 10:21:57 +00:00
Zhongxing Xu
de7509f01a
Added a function call case that generates sink nodes.
...
llvm-svn: 57240
2008-10-07 10:06:03 +00:00
Zhongxing Xu
f5e7c90c46
Migrate MemRegionManager from StateManager to StoreManager.
...
llvm-svn: 57225
2008-10-07 01:31:04 +00:00
Ted Kremenek
6553748599
Added prototype serialization code for DeclGroup.
...
llvm-svn: 57222
2008-10-06 23:49:24 +00:00
Argyrios Kyrtzidis
7b41f721b4
Use getCustomDiagID() instead of specifying the diagnostic in the 'DiagnosticKinds.def' file.
...
llvm-svn: 57220
2008-10-06 23:16:35 +00:00
Argyrios Kyrtzidis
997d00dd13
Simplify handling of direct initializers by letting Sema::AddInitializerToDecl handle conversions, instead of using Sema::ActOnCXXTypeConstructExpr.
...
Additional benefit is that diagnostics are the same for both direct-initialization and copy-initialization.
In the case of "int x( expression );":
-The Init expression of VarDecl 'x' will be the expression inside the parentheses.
-VarDecl::hasCXXDirectInitializer for VarDecl 'x' will return true to let clients distinguish from "int x = expression ;".
llvm-svn: 57219
2008-10-06 23:08:37 +00:00
Ted Kremenek
21cc560188
Remove DeclStmt::getDecl(). Now clients of DeclStmt must explicitly reason about a DeclStmt referring to a collection of Decls.
...
llvm-svn: 57217
2008-10-06 22:51:42 +00:00
Ted Kremenek
db7f2a74db
Explicitly access the first Decl* referenced by a DeclStmt instead of using "getDecl()." Added a FIXME indicating that the call to RewriteObjCQualifiedInterfaceTypes() is meant to modifying the type-specifier; hopefully this will be a little more clean once DeclGroups contain type specifiers.
...
llvm-svn: 57216
2008-10-06 22:45:07 +00:00
Ted Kremenek
5b6f8ee7b9
Use "DeclStmt::getSolitaryDecl()" when accessing the DeclStmt of an @catch .
...
llvm-svn: 57215
2008-10-06 22:39:38 +00:00
Ted Kremenek
6d60a4ec19
Modified DeclGroupRef to always load/store the internal pointer value as Decl*. This hopefully will obviate any concerns with violating strict type-aliasing issues.
...
llvm-svn: 57213
2008-10-06 22:17:16 +00:00
Ted Kremenek
292b3842a0
Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when rewriting Objective-c foreach statements.
...
llvm-svn: 57212
2008-10-06 22:16:13 +00:00
Ted Kremenek
3fef35736e
Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when processing the Decl of an Objective-C foreach statement.
...
llvm-svn: 57209
2008-10-06 20:59:48 +00:00