summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Stmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [ms-inline asm] Pass Tokens to Sema and store them in the AST. No functionalChad Rosier2012-08-061-3/+7
| | | | | | change intended. No test case as there's no real way to test at this time. llvm-svn: 161342
* Inline storage of attributes in AttributedStmt.Alexander Kornienko2012-07-091-0/+17
| | | | llvm-svn: 159925
* Split out the "empty" case for compound statement into a separate ctor.Benjamin Kramer2012-07-041-0/+16
| | | | | | Move the ASTContext-dependent version out of line. llvm-svn: 159717
* Etch out the code path for MS-style inline assembly.Chad Rosier2012-06-111-0/+6
| | | | llvm-svn: 158325
* Add an AttributedStmt type to represent a statement with C++11 attributesRichard Smith2012-04-141-2/+4
| | | | | | | | | attached. Since we do not support any attributes which appertain to a statement (yet), testing of this is necessarily quite minimal. Patch by Alexander Kornienko! llvm-svn: 154723
* [AST/Sema/libclang] Replace getSourceRange().getBegin() with getLocStart().Daniel Dunbar2012-03-091-13/+13
| | | | | | | | | - getSourceRange().getBegin() is about as awesome a pattern as .copy().size(). I already killed the hot paths so this doesn't seem to impact performance on my tests-of-the-day, but it is a much more sensible (and shorter) pattern. llvm-svn: 152419
* [AST] Reimplement Stmt::getLoc{Start,End} to dispatch to subclass overloads.Daniel Dunbar2012-03-091-0/+66
| | | | | | | | - getSourceRange() can be very expensive, we should try to avoid it if at all possible. In conjunction with the previous commit I measured a ~2% speedup on 403.gcc/combine.c and a 3% speedup on OmniGroupFrameworks/NSBezierPath-OAExtensions.m. llvm-svn: 152411
* AST/stats: Don't effectively use an out-of-line function to return a staticDaniel Dunbar2012-03-051-5/+3
| | | | | | bool. Ugh. llvm-svn: 152062
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-2/+0
| | | | llvm-svn: 148577
* Extend the Stmt AST to make it easier to look through label, default,Chandler Carruth2011-09-101-0/+16
| | | | | | | | | | | and case statements. Use this to make the logic in the CFG builder more robust at finding the actual statements within a compound statement, even when there are many layers of labels obscuring it. Also extend the test cases for a large chunk of PR10063. Still more work to do here though. llvm-svn: 139437
* Extend the ASTContext constructor to delay the initialization ofDouglas Gregor2011-09-021-1/+1
| | | | | | | | builtin types (When requested). This is another step toward making ASTUnit build the ASTContext as needed when loading an AST file, rather than doing so after the fact. No actual functionality change (yet). llvm-svn: 138985
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-6/+6
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* In ARC, reclaim all return values of retainable type, not just thoseJohn McCall2011-07-071-0/+12
| | | | | | | | | | | | where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 llvm-svn: 134605
* Don't overread the buffer when an %x escape in inline asm ends prematurely.Benjamin Kramer2011-07-051-0/+4
| | | | | | Tested by valgrind & Sema/asm.c. llvm-svn: 134404
* Switch the Decl and Stmt stats printing to use llvm::errs() instead ofChandler Carruth2011-07-041-8/+9
| | | | | | | fprintf, and to be more consistent in formatting with the other stats printing routines. llvm-svn: 134374
* Parsing/AST support for Structured Exception HandlingJohn Wiegley2011-04-281-0/+58
| | | | | | | | Patch authored by Sohail Somani. Provide parsing and AST support for Windows structured exception handling. llvm-svn: 130366
* Add support for C++0x's range-based for loops, as specified by the C++11 ↵Richard Smith2011-04-141-0/+34
| | | | | | draft standard (N3291). llvm-svn: 129541
* tidy upChris Lattner2011-02-281-3/+3
| | | | llvm-svn: 126595
* add one more case of mismatched input/output constraints. Chris Lattner2011-02-211-0/+4
| | | | | | | | | | | | | | | | | | | When the mismatch is due to a larger input operand that is a constant, truncate it down to the size of the output. This allows us to accept some cases in the linux kernel and elsewhere. Pedantically speaking, we generate different code than GCC, though I can't imagine how it would matter: Clang: movb $-1, %al frob %al GCC: movl $255, %eax frob %al llvm-svn: 126148
* Step #1/N of implementing support for __label__: split labels intoChris Lattner2011-02-171-2/+2
| | | | | | | | | | | | | | | | | | | LabelDecl and LabelStmt. There is a 1-1 correspondence between the two, but this simplifies a bunch of code by itself. This is because labels are the only place where we previously had references to random other statements, causing grief for AST serialization and other stuff. This does cause one regression (attr(unused) doesn't silence unused label warnings) which I'll address next. This does fix some minor bugs: 1. "The only valid attribute " diagnostic was capitalized. 2. Various diagnostics printed as ''labelname'' instead of 'labelname' 3. This reduces duplication of label checking between functions and blocks. Review appreciated, particularly for the cindex and template bits. llvm-svn: 125733
* Non-void functions need to return some value.Nick Lewycky2011-02-091-5/+13
| | | | llvm-svn: 125185
* Give these little helper functions definitions so that newer gccs stopJohn McCall2011-02-091-5/+9
| | | | | | complaining. llvm-svn: 125184
* Remove vtables from the Stmt hierarchy; this was pretty easy asJohn McCall2011-02-091-160/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | there were only three virtual methods of any significance. The primary way to grab child iterators now is with Stmt::child_range children(); Stmt::const_child_range children() const; where a child_range is just a std::pair of iterators suitable for being llvm::tie'd to some locals. I've left the old child_begin() and child_end() accessors in place, but it's probably a substantial penalty to grab the iterators individually now, since the switch-based dispatch is kindof inherently slower than vtable dispatch. Grabbing them together is probably a slight win over the status quo, although of course we could've achieved that with vtables, too. I also reclassified SwitchCase (correctly) as an abstract Stmt class, which (as the first such class that wasn't an Expr subclass) required some fiddling in a few places. There are somewhat gross metaprogramming hooks in place to ensure that new statements/expressions continue to implement getSourceRange() and children(). I had to work around a recent clang bug; dgregor actually fixed it already, but I didn't want to introduce a selfhosting dependency on ToT. llvm-svn: 125183
* Revert r119838 "Don't warn for empty 'if' body if there is a macro that ↵Argyrios Kyrtzidis2010-11-201-4/+2
| | | | | | | | | | expands to nothing" and use a better and more general approach, where NullStmt has a flag to indicate whether it was preceded by an empty macro. Thanks to Abramo Bagnara for the hint! llvm-svn: 119887
* Don't warn for empty 'if' body if there is a macro that expands to nothing, e.g:Argyrios Kyrtzidis2010-11-191-2/+4
| | | | | | | | | if (condition) CALL(0); // empty macro but don't warn for empty body. Fixes rdar://8436021. llvm-svn: 119838
* Rename alignof -> alignOf to avoid irritating C++'0x compilers,Chris Lattner2010-10-301-4/+4
| | | | | | PR8423 llvm-svn: 117775
* Implement an indirect-goto optimization for goto *&&lbl and respect thisJohn McCall2010-10-281-2/+6
| | | | | | | | | | | | | | in the scope checker. With that done, turn an indirect goto into a protected scope into a hard error; otherwise IR generation has to start worrying about declarations not dominating their scopes, as exemplified in PR8473. If this really affects anyone, I can probably adjust this to only hard-error on possible indirect gotos into VLA scopes rather than arbitrary scopes. But we'll see how people cope with the aggressive change on the marginal feature. llvm-svn: 117539
* Optimize field space usage in CompoundStmt, LabelStmt, Expr, and CastExpr.John McCall2010-10-261-4/+6
| | | | | | | | | There's probably still significant padding waste on x86-64 UNIXen, but the difference in 32-bit compiles should be significant. There are a lot of Expr nodes left that could lose a word this way. llvm-svn: 117359
* Initialize 'AllEnumCasesCovered' in SwitchStmt's constructor.Ted Kremenek2010-09-091-1/+1
| | | | llvm-svn: 113448
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-1/+1
| | | | | | to the new constants. llvm-svn: 112047
* Convert all uses of StringLiteral::getStrData() to StringLiteral::getString()Benjamin Kramer2010-08-171-2/+3
| | | | | | and remove getStrData(). Patch by Peter Davies (with some tweaks). llvm-svn: 111229
* Remove the vast majority of the Destroy methods from the AST library,Douglas Gregor2010-07-251-78/+0
| | | | | | since we aren't going to be calling them ever. llvm-svn: 109377
* Support C++ try/catch statements for PCH.Argyrios Kyrtzidis2010-07-221-0/+9
| | | | llvm-svn: 109112
* Added a path-sensitive idempotent operation checker ↵Tom Care2010-07-061-66/+0
| | | | | | | | | | | | | | | | | | | (-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
* Added several helper functions to Stmt to recursively check for different ↵Tom Care2010-07-061-0/+66
| | | | | | elements (macros, enum constants, etc). llvm-svn: 107675
* Alter the internal representation of the condition variable inDouglas Gregor2010-06-211-8/+124
| | | | | | | | | | | | | | | | 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
* Switch over the tablegen to use much prettier range technologyAlexis Hunt2010-05-181-1/+1
| | | | | | | Also rename ABSTRACT to ABSTRACT_STMT, in keeping with the other .def files llvm-svn: 104017
* Reapplying patch to change StmtNodes.def to StmtNodes.td, this timeAlexis Hunt2010-05-051-5/+5
| | | | | | | with no whitespace. This will allow statements to be referred to in attribute TableGen files. llvm-svn: 103087
* Revert r103072; I accidentally ended up deleting a bunch of trailingAlexis Hunt2010-05-051-29/+29
| | | | | | | whitespace which makes this patch unreadable. Will recommit without the whitespace. llvm-svn: 103086
* Change StmtNodes.def to StmtNodes.td in anticipation of a rewrite of attributesAlexis Hunt2010-05-051-29/+29
| | | | llvm-svn: 103072
* Improve the AST representation of Objective-C @try/@catch/@finallyDouglas Gregor2010-04-231-27/+53
| | | | | | | | | | 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
* david conrad points out that {|} in inline assembly on arm are not asmChris Lattner2010-04-231-3/+6
| | | | | | variants. This fixes neon inline asm which my patch for PR6780 broke. llvm-svn: 102181
* fix PR6780, properly handling the IR {|} escapes in inline asm strings.Chris Lattner2010-04-051-5/+9
| | | | llvm-svn: 100449
* Remove the AST statistics tracking I added yesterday; it didn't pan out.Douglas Gregor2010-03-311-7/+0
| | | | llvm-svn: 100027
* Introduce new AST statistics that keep track of the number of isa (orDouglas Gregor2010-03-301-0/+7
| | | | | | | | | | | | | | | | | | | | | 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
* Implement Doug's suggestion. Eliminate the Stmts pointer from CXXTryStmt and ↵Sam Weinig2010-02-031-12/+19
| | | | | | instead allocate the statements after the object. llvm-svn: 95199
* Remove the SmallVector from CXXTryStmt.Sam Weinig2010-02-031-14/+23
| | | | llvm-svn: 95190
* Remove abstract expression kinds from the StmtClass enum. Update a few usersJohn McCall2010-02-031-0/+1
| | | | | | appropriately. Call out a few missing cases in the expression mangler. llvm-svn: 95176
* Try to unbreak MSVC build.Benjamin Kramer2010-01-311-1/+1
| | | | llvm-svn: 94951
* Remove the SmallVectors from AsmStmt. Fixes PR6105.Anders Carlsson2010-01-301-21/+49
| | | | llvm-svn: 94926
OpenPOWER on IntegriCloud