summaryrefslogtreecommitdiffstats
path: root/clang/AST/StmtPrinter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement codegen for __builtin_choose_expr. For example:Chris Lattner2007-08-041-2/+2
| | | | | | | | | | | | | | | | | | | struct X { int A; }; void foo() { struct X s; int i; i = __builtin_choose_expr(0, s, i); } compiles to: %tmp = load i32* %i ; <i32> [#uses=1] store i32 %tmp, i32* %i wow :) llvm-svn: 40801
* Implement __builtin_choose_expr.Steve Naroff2007-08-031-0/+9
| | | | llvm-svn: 40794
* Rename AddrLabel and OCUVectorComponent -> AddrLabelExpr and ↵Chris Lattner2007-08-031-2/+2
| | | | | | OCUVectorElementExpr respectively. This is for consistency with other expr nodes end with *Expr. llvm-svn: 40785
* Add AST/Sema support for __builtin_types_compatible_p (a GNU extension).Steve Naroff2007-08-011-0/+6
| | | | | | Todo...still need to call the action from the parser... llvm-svn: 40693
* Print floating point literal values better.Chris Lattner2007-08-011-2/+2
| | | | llvm-svn: 40659
* Added a new expression, OCUVectorComponent.Steve Naroff2007-07-281-0/+5
| | | | llvm-svn: 40577
* implement ast building and trivial semantic analysis of stmt exprs.Chris Lattner2007-07-241-1/+7
| | | | | | This implements test/Sema/stmt_exprs.c llvm-svn: 40465
* Refactor switch analysis to make it possible to detect duplicate case valuesAnders Carlsson2007-07-221-0/+4
| | | | llvm-svn: 40388
* Implement code generation for __func__, __FUNCTION__ and __PRETTY_FUNCTION__Anders Carlsson2007-07-211-0/+16
| | | | llvm-svn: 40162
* Finish fixing crasher with compound literals.Steve Naroff2007-07-191-0/+4
| | | | | | | We still need to do sematic analysis (and implement initializers), however this should complete the parsing & ast building for compound literals. llvm-svn: 40067
* Remove an extraneous QualType from CastExpr, it's type is alwaysChris Lattner2007-07-151-1/+1
| | | | | | | | | | | | | | | | | | the result type of the expr node. Implement isIntegerConstantExpr for ImplicitCastExpr nodes the same was as for CastExpr nodes. Implement proper sign/zero extension as well as truncation and noop conversion in the i-c-e evaluator. This allows us to correctly handle i-c-e's like these: char array[1024/(sizeof (long))]; int x['\xBb' == (char) 187 ? 1: -1]; this implements test/Sema/i-c-e2.c llvm-svn: 39888
* Improve char literal pretty printing, patch by Keith Bauer!Chris Lattner2007-07-131-6/+43
| | | | llvm-svn: 39846
* More changes related to implementing ImplicitCastExpr.Steve Naroff2007-07-131-1/+2
| | | | | | | | | | | | | | - Fixed a recent regression discovered by Keith Bauer (thanks!). The fix involved adding (back) two arguments to UsualArithmeticConversions. Without the reference arguments, no unary conversions were being passed back to the caller. This had the effect of turning off the UsualUnaryConversions. - Refactored CheckAssignmentConstraints into 3 functions. CheckAssignmentConstraints, CheckSingleAssignmentConstraints, and CheckCompoundAssignmentConstraints. - Changed the argument type of DefaultFunctionArrayConversion from QualType->Expr*&. - Removed a bunch of casts in routines I was working on (cleanup). - Fixed the visitor for ImplicitCastExpr (oops). llvm-svn: 39840
* Add (explicit) AST support for implicit casts. This should simplify the Steve Naroff2007-07-131-0/+3
| | | | | | | | | | | | | | | | | | | code generator. Source translation tools can simply ignore this node. - Added a new Expr node, ImplicitCastExpr. - Changed UsualUnaryConversions/UsualArithmeticConversions to take references to Expr *'s. This will allow these routines to instantiate the new AST node and pass it back. - Changed all clients of UsualUnary/UsualArithmetic (lot's of diff's). - Changed some names in CheckConditionalOperands. Several variables where only distinguished by their case (e.g. Cond, cond). Yuck (what was I thinking). - Removed an old/crufty constructor in CastExpr (cleanup). This check-in does not actually create the new AST node. I wanted to separate the mechanical changes from the semantic changes. In addition, I need to coordinate with Chris, since the semantic change will break the code generator. llvm-svn: 39814
* "Codegen for Character Literals and Conditional OperatorChris Lattner2007-07-131-2/+9
| | | | | | | | | | | Both in one patch, and the test case that Chris didn't commit last time is in there too... I'll split the patch up if somebody wants it split." Patch by Keith Bauer. llvm-svn: 39796
* remember the initializer for a variable in the AST and teach theChris Lattner2007-07-121-1/+7
| | | | | | pretty printer to print it. llvm-svn: 39770
* Finally bite the bullet and make the major change: split the clang namespaceChris Lattner2007-06-151-1/+1
| | | | | | | | | | | | | out of the llvm namespace. This makes the clang namespace be a sibling of llvm instead of being a child. The good thing about this is that it makes many things unambiguous. The bad things is that many things in the llvm namespace (notably data structures like smallvector) now require an llvm:: qualifier. IMO, libsystem and libsupport should be split out of llvm into their own namespace in the future, which will fix this issue. llvm-svn: 39659
* Pretty print if/else/elseif chains nicer, like this:Chris Lattner2007-06-111-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | void printutf8(unsigned int X) { if (X <= 127) printf("%c", (char)X); else if (X <= 2047) printf("%d %d ", 128 + 64 + (X >> 6), 128 + (X & ((1 << 6) - 1))); else if (X <= 65535) printf("%c%c%c", 128 + 64 + 32 + (X >> 12), 128 + ((X >> 6) & 63), 128 + (X & 63)); else printf("UNKNOWN %d\n", X); instead of: if (X <= 127) printf("%c", (char)X); else if (X <= 2047) printf("%d %d ", 128 + 64 + (X >> 6), 128 + (X & ((1 << 6) - 1))); else if (X <= 65535) printf("%c%c%c", 128 + 64 + 32 + (X >> 12), 128 + ((X >> 6) & 63), 128 + (X & 63)); else printf("UNKNOWN %d\n", X); llvm-svn: 39648
* Finally break down and chain together decls that are defined with common ↵Chris Lattner2007-06-091-3/+5
| | | | | | | | | | | declspecs, like: int X, Y, Z; This is required for the code gen to get to all of the declarations in a DeclStmt, and should simplify some other code. llvm-svn: 39623
* Various improvements to the tree printer, including printing decls in for ↵Chris Lattner2007-06-051-25/+39
| | | | | | stmts prettier etc llvm-svn: 39592
* Pretty print storage classes for vardecls.Chris Lattner2007-06-021-1/+14
| | | | llvm-svn: 39556
* Generalize this to support printing any valuedecl, e.g. function definitions.Chris Lattner2007-06-021-6/+8
| | | | | | | | | | | We now print: extern void blah(); as: void (blah)(); Strange, but ok :) llvm-svn: 39549
* more minor improvements to pretty printer.Chris Lattner2007-05-311-24/+5
| | | | llvm-svn: 39538
* add some ;'sChris Lattner2007-05-311-5/+5
| | | | llvm-svn: 39537
* fix a small printer bug, to emit:Chris Lattner2007-05-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | a = b; { int c; c = a + b; int d; d++; } int e; instead of: a = b; { int c; c = a + b; int d; d++; } int e; llvm-svn: 39535
* pretty print exprs in stmt contexts with a trailing semicolon.Chris Lattner2007-05-301-1/+1
| | | | llvm-svn: 39531
* Bug #:Steve Naroff2007-05-301-1/+2
| | | | | | | | | | | | Submitted by: Reviewed by: - ParseForStatement(): Put back a test/assignment. My removal of ParseExprStmt() was a bit over zealous:-(thanks to Chris for pointing it out) - Add assert to VisitDeclStmt(). - Removed an out-of-date FIXME - Added some curlies for a couple multi-line calls to Diag(). llvm-svn: 39528
* Don't print billions of spaces for a label with no indent.Chris Lattner2007-05-291-1/+1
| | | | llvm-svn: 39521
* Bug #:Steve Naroff2007-05-291-0/+12
| | | | | | | | | | | | | | | | | Submitted by: Reviewed by: Implement some FIXME's that stand in the way of fully typechecking "for" statements. This involved: - Adding a DeclStmt AST node (with statement visitor). The DeclStmt printer is preliminary. - Added a ParseDeclStmt action, called from Parser::ParseForStatement() and Parser::ParseStatementOrDeclaration(). DID NOT add to Parser::ParseIdentifierStatement()...probably could have, however didn't really understand the context of this rule (will speak with Chris). - Removed ParseExprStmt (and it's clients)...it was vestigial. llvm-svn: 39518
* implement full sema support for the GCC address-of-label extension.Chris Lattner2007-05-281-22/+32
| | | | llvm-svn: 39510
* Change GotoStmt's to have a pointer to the LabelStmt instead of a pointer toChris Lattner2007-05-281-1/+1
| | | | | | | | | | | | | | | | | the label identifier. Handle fwd references etc. This allows us to detect uses of undefined labels and label redefinitions, such as: t.c:2:12: error: redefinition of label 'abc' abc: ; abc: ^ t.c:2:3: error: previous definition is here abc: ; abc: ^ t.c:12:12: error: use of undeclared label 'hijl' goto hijl; ^ llvm-svn: 39509
* Null pointers in the ast are no longer considered to be the null stmt.Chris Lattner2007-05-281-1/+1
| | | | llvm-svn: 39507
* add a NullStmt ast node.Chris Lattner2007-05-281-0/+4
| | | | llvm-svn: 39505
* implement printer support for C++ bool literalsChris Lattner2007-05-241-1/+1
| | | | llvm-svn: 39489
* Implement a fixmeChris Lattner2007-05-241-3/+3
| | | | llvm-svn: 39488
* Bug #:Bill Wendling2007-05-231-1/+1
| | | | | | | | | | Submitted by: Bill Wendling Reviewed by: Chris Lattner - Changed "std::cerr" to "OS" stream to be consistent with the other outputs in the method. llvm-svn: 39483
* In the yet-another-crazy-idea department, we now print the actual *value* ofChris Lattner2007-05-211-3/+14
| | | | | | integer constants, whoa! :) llvm-svn: 39475
* pretty print switch/if stmts whose bodies are compound stmts.Chris Lattner2007-05-201-11/+45
| | | | llvm-svn: 39469
* Pretty print labels and case stmts better. This leads to output like this:Chris Lattner2007-05-201-14/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | void foo() { abc: def: hij: case 1: case 1: goto abc baz: goto def } instead of: void foo() { abc: def: hij: case 1: case 1: goto abc baz: goto def } llvm-svn: 39468
* Rename type::getAsString to getAsStringInternal. Add a newChris Lattner2007-05-161-11/+3
| | | | | | | QualType::getAsString() that returns a string, which is much easier for clients to use. Convert clients to use it. llvm-svn: 39449
* Bug #:Steve Naroff2007-04-261-0/+5
| | | | | | | | | | | | | | Submitted by: Reviewed by: Misc. changes driven by getting "carbon.h" to compile... - Added ParseCharacterConstant() hook to Action, Sema, etc. - Added CheckAssignmentOperands() & CheckCommaOperands() to Sema. - Added CharacterLiteral AST node. - Fixed CallExpr instantiation - install the correct type. - Install a bunch of temp types and annotate with FIXME's. llvm-svn: 39416
* More changes to complete the dynamic type support for Stmt/Expr.Steve Naroff2007-02-271-1/+6
| | | | | | | | | | | | This set of changes includes: - convert ExprCXX.h and add to the Xcode project file. -- required adding CXXBoolLiteralExpr to StmtNodes.def. -- required adding visitor support (decl/defn). - make the class codes in StmtNodes.def explicit (to enable range checking). -- this required changing all clients of the STMT macro. - declare the instance data const. llvm-svn: 39344
* Batch search/replace snafu (inadvertantly changed ↵Steve Naroff2007-02-211-2/+2
| | | | | | | | | IntegerConstant->StringLiteral). clang still compiled/linked/ran properly...simply a confusing name regression. From now on I'll make sure I run "cvs diff" before committing any changes! llvm-svn: 39342
* rename IntegerConstant->IntegerLiteralSteve Naroff2007-02-211-2/+2
| | | | | | | rename FloatingConstant->FloatingLiteral rename StringExpr->StringLiteral llvm-svn: 39341
* Add support for parsing and pretty printing const_cast, dynamic_cast,Chris Lattner2006-12-041-1/+18
| | | | | | reinterpret_cast, and static_cast. Patch by Bill! llvm-svn: 39247
* remember referenced decls in our AST'sChris Lattner2006-11-201-2/+2
| | | | llvm-svn: 39193
* remember and pretty-print cast typesChris Lattner2006-11-201-3/+3
| | | | llvm-svn: 39191
* correctly handle stuff like:Chris Lattner2006-11-201-1/+1
| | | | | | | | typedef int G; X = sizeof(const G); X = sizeof(restrict G); llvm-svn: 39190
* Parse and remember types enough that we can pretty print:Chris Lattner2006-11-191-3/+5
| | | | | | | | | | | | | | void foo(int X) { X = __alignof(int); X = sizeof(const int** restrict ** volatile*); } as: x = __alignof(int) x = sizeof(int const **restrict **volatile *) llvm-svn: 39181
* pretty print postfix ++/-- nicerChris Lattner2006-11-051-1/+6
| | | | llvm-svn: 39137
OpenPOWER on IntegriCloud