summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/StmtPrinter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Selector::getIdentifierInfoForSlot() can return NULL values, a factDouglas Gregor2011-02-181-1/+1
| | | | | | | | | | | | that was ignored in a few places (most notably, code completion). Introduce Selector::getNameForSlot() for the common case where we only care about the name. Audit all uses of getIdentifierInfoForSlot(), switching many over to getNameForSlot(), fixing a few crashers. Fixed <rdar://problem/8939352>, a code-completion crasher. llvm-svn: 125977
* Change the representation of GNU ?: expressions to use a different expressionJohn McCall2011-02-171-10/+9
| | | | | | | | | | | | | | | | | | | | | | class and to bind the shared value using OpaqueValueExpr. This fixes an unnoticed problem with deserialization of these expressions where the deserialized form would lose the vital pointer-equality trait; or rather, it fixes it because this patch also does the right thing for deserializing OVEs. Change OVEs to not be a "temporary object" in the sense that copy elision is permitted. This new representation is not totally unawkward to work with, but I think that's really part and parcel with the semantics we're modelling here. In particular, it's much easier to fix things like the copy elision bug and to make the CFG look right. I've tried to update the analyzer to deal with this in at least some obvious cases, and I think we get a much better CFG out, but the printing of OpaqueValueExprs probably needs some work. llvm-svn: 125744
* AST, Sema, Serialization: add CUDAKernelCallExpr and related semantic actionsPeter Collingbourne2011-02-091-0/+9
| | | | llvm-svn: 125217
* Remove vtables from the Stmt hierarchy; this was pretty easy asJohn McCall2011-02-091-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* StmtPrinter: factor out arg printing code to PrintCallArgsPeter Collingbourne2011-02-081-3/+8
| | | | llvm-svn: 125114
* Implement the Microsoft __is_convertible_to type trait, modeling theDouglas Gregor2011-01-271-1/+1
| | | | | | | | | | semantics after the C++0x is_convertible type trait. This implementation is not 100% complete, because it allows access errors to be hard errors (rather than just evaluating false). Original patch by Steven Watanabe! llvm-svn: 124425
* Improve the printing of C++ construction expressions, from Yuri Gribov!Douglas Gregor2011-01-241-7/+8
| | | | llvm-svn: 124123
* Check whether DependentScopeDeclRefExpr's NestedNameSpecifier exists before ↵Axel Naumann2011-01-241-1/+2
| | | | | | accessing it, both for consistency (see StmtPrinter::VisitDeclRefExpr()) and for other use cases of dependent types. llvm-svn: 124119
* Introduce a new expression kind, SubstNonTypeTemplateParmPackExpr,Douglas Gregor2011-01-151-0/+6
| | | | | | | | | that captures the substitution of a non-type template argument pack for a non-type template parameter pack within a pack expansion that cannot be fully expanded. This follows the approach taken by SubstTemplateTypeParmPackType. llvm-svn: 123506
* Implement the sizeof...(pack) expression to compute the length of aDouglas Gregor2011-01-041-1/+5
| | | | | | | | | parameter pack. Note that we're missing proper libclang support for the new SizeOfPackExpr expression node. llvm-svn: 122813
* Implement support for pack expansions whose pattern is a non-typeDouglas Gregor2011-01-031-0/+5
| | | | | | | | | | | | | | | | | template argument (described by an expression, of course). For example: template<int...> struct int_tuple { }; template<int ...Values> struct square { typedef int_tuple<(Values*Values)...> type; }; It also lays the foundation for pack expansions in an initializer-list. llvm-svn: 122751
* Remove the TypesCompatibleExprClass AST node. Merge its functionality into ↵Francois Pichet2010-12-081-7/+2
| | | | | | BinaryTypeTraitExpr. llvm-svn: 121298
* Fix enumerator not handled in switch warnings.Francois Pichet2010-12-071-2/+2
| | | | llvm-svn: 121084
* Type traits intrinsic implementation: __is_base_of(T, U)Francois Pichet2010-12-071-1/+16
| | | | | | New AST node introduced: BinaryTypeTraitExpr; to be reused for more intrinsics. llvm-svn: 121074
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-061-1/+1
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ↵John McCall2010-12-021-14/+4
| | | | | | | | ObjCPropertyRefExpr into the latter. llvm-svn: 120643
* Add a new expression kind, OpaqueValueExpr, which is useful forJohn McCall2010-11-151-0/+3
| | | | | | | certain internal type-checking procedures as well as for representing certain implicitly-generated operations. Uses to follow. llvm-svn: 119289
* Update to use 'LLVM_*' macro names for attributes.Chandler Carruth2010-10-231-2/+2
| | | | llvm-svn: 117201
* Eliminate usage of ObjCSuperExpr used forFariborz Jahanian2010-10-141-5/+7
| | | | | | | 'super' as receiver of property or a setter/getter methods. //rdar: //8525788 llvm-svn: 116483
* Define and implement CXXNoexceptExpr. Create it in Sema.Sebastian Redl2010-09-101-0/+6
| | | | llvm-svn: 113623
* Microsoft's __uuidof operator implementation part 1.Francois Pichet2010-09-081-0/+10
| | | | llvm-svn: 113356
* Provide proper type-source location information forDouglas Gregor2010-09-081-1/+5
| | | | | | | | CXXTemporaryObjectExpr, CXXScalarValueInitExpr, and CXXUnresolvedConstructExpr, getting rid of a bunch of FIXMEs in the process. llvm-svn: 113319
* Eliminate CXXBindReferenceExpr, which was used in a ton ofDouglas Gregor2010-09-021-4/+0
| | | | | | well-intentioned but completely unused code. llvm-svn: 112868
* Revert my user-defined literal commits - r1124{58,60,67} pendingAlexis Hunt2010-08-301-5/+0
| | | | | | some issues being sorted out. llvm-svn: 112493
* Implement C++0x user-defined string literals.Alexis Hunt2010-08-291-0/+5
| | | | | | | | | | The extra data stored on user-defined literal Tokens is stored in extra allocated memory, which is managed by the PreprocessorLexer because there isn't a better place to put it that makes sure it gets deallocated, but only after it's used up. My testing has shown no significant slowdown as a result, but independent testing would be appreciated. llvm-svn: 112458
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-5/+5
| | | | | | to the new constants. llvm-svn: 112047
* Regularize the API for accessing explicit template arguments.John McCall2010-08-191-2/+2
| | | | llvm-svn: 111584
* StringRef'ication of lots stuff, patch by Peter Davies!Daniel Dunbar2010-08-171-1/+1
| | | | llvm-svn: 111314
* Convert all uses of StringLiteral::getStrData() to StringLiteral::getString()Benjamin Kramer2010-08-171-2/+4
| | | | | | and remove getStrData(). Patch by Peter Davies (with some tweaks). llvm-svn: 111229
* Some refactoring on StmtPrinter to avoid unused function warnings.Argyrios Kyrtzidis2010-08-151-15/+9
| | | | llvm-svn: 111088
* Zap unused UnaryOperator::OffsetOf.Eli Friedman2010-08-131-28/+0
| | | | llvm-svn: 110996
* Added locations and type source info for DeclarationName.Abramo Bagnara2010-08-111-6/+6
| | | | llvm-svn: 110860
* Revert the dump functions to send output to llvm::errs(), matching the LLVM ↵Argyrios Kyrtzidis2010-08-091-2/+2
| | | | | | | | convention; suggestion by Daniel. '-ast-print' / '-ast-dump' command line options still send output to llvm::outs(). llvm-svn: 110569
* Send AST dumping/printing to stdout instead of stderr.Argyrios Kyrtzidis2010-08-031-1/+1
| | | | llvm-svn: 110123
* Reinstate the fix for PR7556. A silly use of isTrivial() wasDouglas Gregor2010-07-081-1/+1
| | | | | | suppressing copies of objects with trivial copy constructors. llvm-svn: 107857
* Revert r107828 and r107827, the fix for PR7556, which seems to beDouglas Gregor2010-07-071-1/+1
| | | | | | breaking bootstrap on Linux. llvm-svn: 107837
* Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect itsDouglas Gregor2010-07-071-1/+1
| | | | | | newly-narrowed scope. No functionality change. llvm-svn: 107828
* AST: Propogate printing policy to types in a bunch more places.Daniel Dunbar2010-06-301-15/+15
| | | | llvm-svn: 107311
* Nasty rewriter bug which turns out to have an easy fix inFariborz Jahanian2010-06-301-1/+1
| | | | | | | rewriting a c-style cast expression in statement printer. Fixes radar 8143056. llvm-svn: 107289
* Reapplying patch to change StmtNodes.def to StmtNodes.td, this timeAlexis Hunt2010-05-051-1/+1
| | | | | | | 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-4/+4
| | | | | | | 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-4/+4
| | | | llvm-svn: 103072
* Teach __builtin_offsetof to compute the offsets of members of baseDouglas Gregor2010-04-291-1/+5
| | | | | | | | classes, since we only warn (not error) on offsetof() for non-POD types. We store the base path within the OffsetOfExpr itself, then evaluate the offsets within the constant evaluator. llvm-svn: 102571
* Completely reimplement __builtin_offsetof, based on a patch by RobertoDouglas Gregor2010-04-281-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amadini. This change introduces a new expression node type, OffsetOfExpr, that describes __builtin_offsetof. Previously, __builtin_offsetof was implemented using a unary operator whose subexpression involved various synthesized array-subscript and member-reference expressions, which was ugly and made it very hard to instantiate as a template. OffsetOfExpr represents the AST more faithfully, with proper type source information and a more compact representation. OffsetOfExpr also has support for dependent __builtin_offsetof expressions; it can be value-dependent, but will never be type-dependent (like sizeof or alignof). This commit introduces template instantiation for __builtin_offsetof as well. There are two major caveats to this patch: 1) CodeGen cannot handle the case where __builtin_offsetof is not a constant expression, so it produces an error. So, to avoid regressing in C, we retain the old UnaryOperator-based __builtin_offsetof implementation in C while using the shiny new OffsetOfExpr implementation in C++. The old implementation can go away once we have proper CodeGen support for this case, which we expect won't cause much trouble in C++. 2) __builtin_offsetof doesn't work well with non-POD class types, particularly when the designated field is found within a base class. I will address this in a subsequent patch. Fixes PR5880 and a bunch of assertions when building Boost.Python tests. llvm-svn: 102542
* Improve the AST representation of Objective-C @try/@catch/@finallyDouglas Gregor2010-04-231-5/+2
| | | | | | | | | | 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
* Overhaul the AST representation of Objective-C message sendDouglas Gregor2010-04-211-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expressions, to improve source-location information, clarify the actual receiver of the message, and pave the way for proper C++ support. The ObjCMessageExpr node represents four different kinds of message sends in a single AST node: 1) Send to a object instance described by an expression (e.g., [x method:5]) 2) Send to a class described by the class name (e.g., [NSString method:5]) 3) Send to a superclass class (e.g, [super method:5] in class method) 4) Send to a superclass instance (e.g., [super method:5] in instance method) Previously these four cases where tangled together. Now, they have more distinct representations. Specific changes: 1) Unchanged; the object instance is represented by an Expr*. 2) Previously stored the ObjCInterfaceDecl* referring to the class receiving the message. Now stores a TypeSourceInfo* so that we know how the class was spelled. This both maintains typedef information and opens the door for more complicated C++ types (e.g., dependent types). There was an alternative, unused representation of these sends by naming the class via an IdentifierInfo *. In practice, we either had an ObjCInterfaceDecl *, from which we would get the IdentifierInfo *, or we fell into the case below... 3) Previously represented by a class message whose IdentifierInfo * referred to "super". Sema and CodeGen would use isStr("super") to determine if they had a send to super. Now represented as a "class super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). 4) Previously represented by an instance message whose receiver is a an ObjCSuperExpr, which Sema and CodeGen would check for via isa<ObjCSuperExpr>(). Now represented as an "instance super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). Note that ObjCSuperExpr only has one remaining use in the AST, which is for "super.prop" references. The new representation of ObjCMessageExpr is 2 pointers smaller than the old one, since it combines more storage. It also eliminates a leak when we loaded message-send expressions from a precompiled header. The representation also feels much cleaner to me; comments welcome! This patch attempts to maintain the same semantics we previously had with Objective-C message sends. In several places, there are massive changes that boil down to simply replacing a nested-if structure such as: if (message has a receiver expression) { // instance message if (isa<ObjCSuperExpr>(...)) { // send to super } else { // send to an object } } else { // class message if (name->isStr("super")) { // class send to super } else { // send to class } } with a switch switch (E->getReceiverKind()) { case ObjCMessageExpr::SuperInstance: ... case ObjCMessageExpr::Instance: ... case ObjCMessageExpr::SuperClass: ... case ObjCMessageExpr::Class:... } There are quite a few places (particularly in the checkers) where send-to-super is effectively ignored. I've placed FIXMEs in most of them, and attempted to address send-to-super in a reasonable way. This could use some review. llvm-svn: 101972
* Add raw_ostream operators to NamedDecl for convenience. Switch over all ↵Benjamin Kramer2010-04-171-7/+7
| | | | | | | | users of getNameAsString on a stream. The next step is to print the name directly into the stream, avoiding a temporary std::string copy. llvm-svn: 101632
* Use CXXPseudoDestructorExpr as the stored representation for dependentDouglas Gregor2010-02-251-1/+4
| | | | | | | | | | | | | | | | expressions that look like pseudo-destructors, e.g., p->T::~T() where p has dependent type. At template instantiate time, we determine whether we actually have a pseudo-destructor or a member access, and funnel down to the appropriate routine in Sema. Fixes PR6380. llvm-svn: 97092
* Add an CXXBindReferenceExpr (not used just yet).Anders Carlsson2010-01-291-0/+4
| | | | llvm-svn: 94791
* Fixes a rewrite bug rewriting a block call argument which has a trvialFariborz Jahanian2010-01-131-0/+7
| | | | | | constructor. Fixes radar 7537770. llvm-svn: 93358
OpenPOWER on IntegriCloud