Douglas Gregor
b412e174db
Remove the vast majority of the Destroy methods from the AST library,
...
since we aren't going to be calling them ever.
llvm-svn: 109377
2010-07-25 18:17:45 +00:00
Argyrios Kyrtzidis
47cd7a91f4
Support C++ try/catch statements for PCH.
...
llvm-svn: 109112
2010-07-22 16:03:56 +00:00
Tom Care
3ff08a8e76
Added a path-sensitive idempotent operation checker (-analyzer-idempotent-operation). Finds idempotent and/or tautological operations in a path sensitive context, flagging operations that have no effect or a predictable effect.
...
Example:
{
int a = 1;
int b = 5;
int c = b / a; // a is 1 on all paths
}
- New IdempotentOperationChecker class
- Moved recursive Stmt functions in r107675 to IdempotentOperationChecker
- Minor refactoring of SVal to allow checking for any integer
- Added command line option for check
- Added basic test cases
llvm-svn: 107706
2010-07-06 21:43:29 +00:00
Tom Care
4626285dba
Added several helper functions to Stmt to recursively check for different elements (macros, enum constants, etc).
...
llvm-svn: 107675
2010-07-06 17:28:49 +00:00
Douglas Gregor
27b98eae80
Alter the internal representation of the condition variable in
...
if/while/switch/for statements to ensure that walking the children of
these statements actually works. Previously, we stored the condition
variable as a VarDecl. However, StmtIterator isn't able to walk from a
VarDecl to a set of statements, and would (in some circumstances) walk
beyond the end of the list of statements, cause Bad Behavior.
In this change, we've gone back to representing the condition
variables as DeclStmts. While not as memory-efficient as VarDecls, it
greatly simplifies iteration over the children.
Fixes the remainder of <rdar://problem/8104754>.
llvm-svn: 106504
2010-06-21 23:44:13 +00:00
Alexis Hunt
abb2ac8889
Switch over the tablegen to use much prettier range technology
...
Also rename ABSTRACT to ABSTRACT_STMT, in keeping with the other .def
files
llvm-svn: 104017
2010-05-18 06:22:21 +00:00
Alexis Hunt
656bb314d9
Reapplying patch to change StmtNodes.def to StmtNodes.td, this time
...
with no whitespace. This will allow statements to be referred to in
attribute TableGen files.
llvm-svn: 103087
2010-05-05 15:24:00 +00:00
Alexis Hunt
a8136cc408
Revert r103072; I accidentally ended up deleting a bunch of trailing
...
whitespace which makes this patch unreadable. Will recommit without the
whitespace.
llvm-svn: 103086
2010-05-05 15:23:54 +00:00
Alexis Hunt
b9f408a873
Change StmtNodes.def to StmtNodes.td in anticipation of a rewrite of attributes
...
llvm-svn: 103072
2010-05-05 04:13:52 +00:00
Douglas Gregor
96c79498fb
Improve the AST representation of Objective-C @try/@catch/@finally
...
statements. Instead of the @try having a single @catch, where all of
the @catch's were chained (using an O(n^2) algorithm nonetheless),
@try just holds an array of its @catch blocks. The resulting AST is
slightly more compact (not important) and better represents the actual
language semantics (good).
llvm-svn: 102221
2010-04-23 22:50:49 +00:00
Chris Lattner
1a8f394a1f
david conrad points out that {|} in inline assembly on arm are not asm
...
variants. This fixes neon inline asm which my patch for PR6780 broke.
llvm-svn: 102181
2010-04-23 16:29:58 +00:00
Chris Lattner
da081a8e1f
fix PR6780, properly handling the IR {|} escapes in inline asm strings.
...
llvm-svn: 100449
2010-04-05 18:44:00 +00:00
Douglas Gregor
d7d70e4788
Remove the AST statistics tracking I added yesterday; it didn't pan out.
...
llvm-svn: 100027
2010-03-31 18:21:31 +00:00
Douglas Gregor
ad2c6988a2
Introduce new AST statistics that keep track of the number of isa (or
...
dyn_cast) invocations for C++ and Objective-C types, declarations,
expressions, and statements. The statistics will be printed when
-print-stats is provided to Clang -cc1, with results such as:
277073 clang - Number of checks for C++ declaration nodes
13311 clang - Number of checks for C++ expression nodes
18 clang - Number of checks for C++ statement nodes
174182 clang - Number of checks for C++ type nodes
92300 clang - Number of checks for Objective-C declaration nodes
9800 clang - Number of checks for Objective-C expression nodes
7 clang - Number of checks for Objective-C statement nodes
65733 clang - Number of checks for Objective-C type nodes
The statistics are only gathered when NDEBUG is not defined, since
they introduce potentially-expensive operations into very low-level
routines (isa).
llvm-svn: 99912
2010-03-30 18:56:13 +00:00
Sam Weinig
a16b0dd1ae
Implement Doug's suggestion. Eliminate the Stmts pointer from CXXTryStmt and instead allocate the statements after the object.
...
llvm-svn: 95199
2010-02-03 03:56:39 +00:00
Sam Weinig
ebcea988c2
Remove the SmallVector from CXXTryStmt.
...
llvm-svn: 95190
2010-02-03 02:09:59 +00:00
John McCall
2adddcae7e
Remove abstract expression kinds from the StmtClass enum. Update a few users
...
appropriately. Call out a few missing cases in the expression mangler.
llvm-svn: 95176
2010-02-03 00:55:45 +00:00
Benjamin Kramer
43a645cd93
Try to unbreak MSVC build.
...
llvm-svn: 94951
2010-01-31 09:01:55 +00:00
Anders Carlsson
98323d29b6
Remove the SmallVectors from AsmStmt. Fixes PR6105.
...
llvm-svn: 94926
2010-01-30 23:19:41 +00:00
Anders Carlsson
9a020f9a3a
Use IdentifierInfo * instead of std::string for the AsmStmt names.
...
llvm-svn: 94925
2010-01-30 22:25:16 +00:00
Anders Carlsson
0c5d7448d8
Fix thinko.
...
llvm-svn: 94922
2010-01-30 20:48:08 +00:00
Anders Carlsson
66de081f39
Even more AsmStmt cleanup.
...
llvm-svn: 94921
2010-01-30 20:38:10 +00:00
Anders Carlsson
96fe0b5b96
Combine AsmStmt::setOutputsAndInputs and AsmStmt::setClobbers.
...
llvm-svn: 94918
2010-01-30 19:34:25 +00:00
Anders Carlsson
aaeef07280
Implement instantiation of AsmStmts (Crazy, I know)
...
llvm-svn: 94361
2010-01-24 05:50:09 +00:00
Mike Stump
90be58afce
Remember if the AsmStmt came from Microsoft-style inline assembly code.
...
llvm-svn: 92526
2010-01-04 22:37:17 +00:00
Ted Kremenek
17113255a8
Fix bug I just introduced in ForStmt::child_end() where we could iterate off into garbage values.
...
llvm-svn: 92115
2009-12-24 01:59:46 +00:00
Ted Kremenek
1c3ab07968
Coelesce 'DoDestroy()' methods in Stmt.cpp, and modify the child_iterator returned by ForStmt to include the initializer of the condition variable.
...
llvm-svn: 92112
2009-12-24 01:48:39 +00:00
Ted Kremenek
b04c5cb0ba
Modify WhileStmt::child_begin()/child_end() to include the initializer for the condition variable.
...
llvm-svn: 92104
2009-12-24 00:54:19 +00:00
Ted Kremenek
ee7553de62
Modify SwitchStmt::child_begin()/child_end() to include the initializer for the condition variable.
...
llvm-svn: 92100
2009-12-24 00:39:05 +00:00
Ted Kremenek
b27a6d24a6
Add StmtIterator support for iterating over both the condition
...
variable initializer and the other expressions in an IfStmt.
This change required adding a 'DoDestroy()' method for IfStmt that did
not include destroying the initializer (since that is owned by the
VarDecl).
llvm-svn: 92089
2009-12-23 23:38:34 +00:00
Ted Kremenek
00d19ee130
Add 'DeclStmt::DoDestroy()' which doesn't actually recurse over its child expressions (via StmtIterator), as those expressions are owned by the Decls and Types (which are destroyed elsewhere). This fixes a crasher reported in <rdar://problem/7487294>.
...
llvm-svn: 91990
2009-12-23 08:56:00 +00:00
Mike Stump
21d68e2435
Add const to accessors that don't modify the object.
...
llvm-svn: 90153
2009-11-30 20:10:58 +00:00
Kovarththanan Rajaratnam
130f7f9629
Streamline Stmt::CollectingStats() and Decl::CollectingStats(). No functionality change.
...
llvm-svn: 90078
2009-11-29 14:54:35 +00:00
Daniel Dunbar
2c422dc9ca
Move clients to use IdentifierInfo::getNameStart() instead of getName()
...
llvm-svn: 84436
2009-10-18 20:26:12 +00:00
Mike Stump
11289f4280
Remove tabs, and whitespace cleanups.
...
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Torok Edwin
db7149246f
Fix build of clang with gcc-4.4: #include <cstdio> was missing.
...
llvm-svn: 79916
2009-08-24 13:25:12 +00:00
Anders Carlsson
c5c57c3b86
Get rid of Stmt::Clone now that we can reference count statements instead.
...
llvm-svn: 78452
2009-08-08 02:50:17 +00:00
Douglas Gregor
2c742024ff
Introduce reference counting for statements and expressions, using it
...
to allow sharing of nodes. Simplifies some aspects of template
instantiation, and fixes both PR3444 and <rdar://problem/6757457>.
llvm-svn: 78450
2009-08-08 01:41:12 +00:00
Douglas Gregor
e26a285c8f
Separate Stmt::Destroy into the entrypoint for destroying a statement
...
or expression (Destroy) from the virtual function used to actually
destroy a given expression (DoDestroy).
llvm-svn: 78375
2009-08-07 06:08:38 +00:00
Douglas Gregor
a30d046059
Simplify printing of the statistics for types.
...
llvm-svn: 72415
2009-05-26 14:40:08 +00:00
Douglas Gregor
5e16fbe562
Template instantiation for C++ try/catch statements.
...
llvm-svn: 72035
2009-05-18 20:51:54 +00:00
Douglas Gregor
ca60224bbe
Template instantiation for break and continue statements.
...
llvm-svn: 71903
2009-05-15 22:32:39 +00:00
Anders Carlsson
03b0dd5913
Add NullStmt::Clone and use it
...
llvm-svn: 71823
2009-05-15 00:21:21 +00:00
Chris Lattner
f0b64d73a8
split ObjC and C++ Statements out into their own headers.
...
llvm-svn: 70105
2009-04-26 01:32:48 +00:00
Douglas Gregor
f994f062fd
PCH support for inline assembly statements.
...
This completes support for all of C (+ extensions). We can (again)
build a PCH file for Carbon.h.
llvm-svn: 69385
2009-04-17 20:57:14 +00:00
Douglas Gregor
a9af1d13da
PCH support for the first batch of statements, including null,
...
compound, case, default, if, switch, and break statements.
llvm-svn: 69329
2009-04-17 00:04:06 +00:00
Anders Carlsson
16b1461c21
Ignore plus operands when looking up the operand number from a named operand. This matches llvm-gcc and fixes PR3908.
...
llvm-svn: 68371
2009-04-03 05:57:08 +00:00
Chris Lattner
84f3afab97
add some spaces :)
...
llvm-svn: 66738
2009-03-11 23:09:16 +00:00
Chris Lattner
99d892b892
don't use strtoul on a non-null-terminated string.
...
llvm-svn: 66732
2009-03-11 22:52:17 +00:00
Chris Lattner
14311925f2
fix PR3258 by rejecting invalid numeric operands.
...
llvm-svn: 66618
2009-03-11 00:23:13 +00:00