summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Improve handling of initialization by constructor, by ensuring thatDouglas Gregor2009-09-091-15/+13
| | | | | | | | such initializations properly convert constructor arguments and fill in default arguments where necessary. This also makes the ownership model more clear. llvm-svn: 81394
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-58/+53
| | | | llvm-svn: 81346
* Initial stab at implement dependent member references to memberDouglas Gregor2009-09-091-0/+71
| | | | | | | | | | | | | templates, e.g., x.template get<T> We can now parse these, represent them within an UnresolvedMemberExpr expression, then instantiate that expression node in simple cases. This allows us to stumble through parsing LLVM's Casting.h. llvm-svn: 81300
* Clean up the CXXConstructExpr constructor, add Arg getters.Anders Carlsson2009-09-081-7/+14
| | | | llvm-svn: 81178
* Reapply 81096, now with a fix. Spot the bug:Anders Carlsson2009-09-061-0/+2
| | | | | | | | | for (unsigned i = numargs; i < NumArgs; ++i) Args[0] = 0; ;) llvm-svn: 81123
* Revert "Initialize default CXXConstructExpr arguments to 0. Fixes a crash whenDaniel Dunbar2009-09-061-2/+0
| | | | | | | destroying the CXXConstructExpr.", this is causing test failures across the board. llvm-svn: 81100
* Initialize default CXXConstructExpr arguments to 0. Fixes a crash when ↵Anders Carlsson2009-09-051-0/+2
| | | | | | destroying the CXXConstructExpr. llvm-svn: 81096
* Implement AST, semantics, and CodeGen for C++ pseudo-destructorDouglas Gregor2009-09-041-0/+6
| | | | | | | | | | | | | expressions, e.g., p->~T() when p is a pointer to a scalar type. We don't currently diagnose errors when pseudo-destructor expressions are used in any way other than by forming a call. llvm-svn: 81009
* Implement __is_empty. Patch by Sean Hunt.Eli Friedman2009-08-151-0/+6
| | | | llvm-svn: 79143
* Get rid of Stmt::Clone now that we can reference count statements instead.Anders Carlsson2009-08-081-22/+0
| | | | llvm-svn: 78452
* Separate Stmt::Destroy into the entrypoint for destroying a statementDouglas Gregor2009-08-071-14/+8
| | | | | | | or expression (Destroy) from the virtual function used to actually destroy a given expression (DoDestroy). llvm-svn: 78375
* Support for use of default argument in constructors.Fariborz Jahanian2009-08-051-1/+5
| | | | | | work in progress. llvm-svn: 78132
* Change uses of:Ted Kremenek2009-07-291-7/+7
| | | | | | | | | | | | | | | | | | | | Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsRecordType() -> Type::getAs<RecordType>() Type::getAsPointerType() -> Type::getAs<PointerType>() Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>() Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>() Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>() Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>() Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsTagType() -> Type::getAs<TagType>() And remove Type::getAsReferenceType(), etc. This change is similar to one I made a couple weeks ago, but that was partly reverted pending some additional design discussion. With Doug's pending smart pointer changes for Types, it seemed natural to take this approach. llvm-svn: 77510
* This patch fixes the implementations of the __has_trivial_destructorDouglas Gregor2009-07-231-3/+50
| | | | | | | | and __has_trivial_constructor builtin pseudo-functions and additionally implements __has_trivial_copy and __has_trivial_assign, from John McCall! llvm-svn: 76916
* Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methodsTed Kremenek2009-07-171-5/+5
| | | | | | | | | until Doug Gregor's Type smart pointer code lands (or more discussion occurs). These methods just call the new Type::getAs<XXX> methods, so we still have reduced implementation redundancy. Having explicit getAsXXXType() methods makes it easier to set breakpoints in the debugger. llvm-svn: 76193
* Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), ↵Ted Kremenek2009-07-171-5/+5
| | | | | | Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents. llvm-svn: 76139
* Preliminary parsing and ASTs for template-ids that refer to functionDouglas Gregor2009-06-301-0/+60
| | | | | | | templates, such as make<int&>. These template-ids are only barely functional for function calls; much more to come. llvm-svn: 74563
* Handle temporaries in default arguments.Anders Carlsson2009-06-161-4/+5
| | | | llvm-svn: 73462
* Improvements to CXXExprWithTemporaries in preparation for fixing a bug with ↵Anders Carlsson2009-06-051-4/+7
| | | | | | default arguments that have temporaries. llvm-svn: 72944
* Clean up the newly added C++ AST nodes.Anders Carlsson2009-05-301-2/+25
| | | | llvm-svn: 72643
* Stop using CXXTempVarDecl and use CXXTemporary instead.Anders Carlsson2009-05-301-8/+8
| | | | llvm-svn: 72634
* Remove VarDecl from CXXConstructExpr.Anders Carlsson2009-05-301-10/+8
| | | | llvm-svn: 72633
* Small fixes to CXXTemporary and CXXBindTemporaryExpr.Anders Carlsson2009-05-301-2/+2
| | | | llvm-svn: 72628
* Add a CXXBindTemporaryExpr.Anders Carlsson2009-05-301-0/+18
| | | | llvm-svn: 72627
* Add a CXXTemporary class. Not used yet.Anders Carlsson2009-05-301-0/+6
| | | | llvm-svn: 72626
* Representation of and template instantiation for memberDouglas Gregor2009-05-221-0/+8
| | | | | | | | | | | | expressions. This change introduces another AST node, CXXUnresolvedMemberExpr, that captures member references (x->m, x.m) when the base of the expression (the "x") is type-dependent, and we therefore cannot resolve the member reference yet. Note that our parsing of member references for C++ is still quite poor, e.g., we don't handle x->Base::m or x->operator int. llvm-svn: 72281
* Template instantiation for the various kinds of AST nodes that occurDouglas Gregor2009-05-201-0/+4
| | | | | | due to C++ type construction of the form T(a1, a2, ..., aN). llvm-svn: 72183
* Introduce a new expression type, CXXUnresolvedConstructExpr, toDouglas Gregor2009-05-201-0/+39
| | | | | | | | | | | | | | | | | | describe the construction of a value of a given type using function syntax, e.g., T(a1, a2, ..., aN) when the type or any of its arguments are type-dependent. In this case, we don't know what kind of type-construction this will be: it might construct a temporary of type 'T' (which might be a class or non-class type) or might perform a conversion to type 'T'. Also, implement printing of and template instantiation for this new expression type. Due to the change in Sema::ActOnCXXTypeConstructExpr, our existing tests cover template instantiation of this new expression node. llvm-svn: 72176
* Template instantiation for call expressions.Douglas Gregor2009-05-191-0/+5
| | | | llvm-svn: 72081
* Implement instantiation of a few boring, simple expressions. I don't think ↵Sebastian Redl2009-05-161-0/+12
| | | | | | these are testable yet, though. llvm-svn: 71953
* Implement C++0x nullptr.Sebastian Redl2009-05-101-0/+8
| | | | llvm-svn: 71405
* Get rid of CXXDestroyExpr.Anders Carlsson2009-05-011-16/+6
| | | | llvm-svn: 70586
* Rename CXXExprWithCleanup to CXXExprWithTemporaries.Anders Carlsson2009-05-011-7/+8
| | | | llvm-svn: 70584
* Silence gcc warnings.Eli Friedman2009-04-251-1/+1
| | | | llvm-svn: 70086
* Add CXXExprWithCleanupAnders Carlsson2009-04-241-0/+21
| | | | llvm-svn: 70000
* Make CXXTemporaryObjectExpr inherit from CXXConstructExpr.Anders Carlsson2009-04-241-23/+3
| | | | llvm-svn: 69981
* Add an ASTContext parameter to CXXTemporaryObjectExpr.Anders Carlsson2009-04-241-1/+1
| | | | llvm-svn: 69959
* Add a VarDecl parameter to the CXXTemporaryObjectExpr constructor. It's ↵Anders Carlsson2009-04-241-1/+2
| | | | | | unused for now, so no functionality change yet. Also, create CXXTempVarDecls to pass to the CXXTemporaryObjectExpr ctor. llvm-svn: 69957
* Make the CXXConstructExpr public and add a StmtClass to it. No functionality ↵Anders Carlsson2009-04-241-3/+4
| | | | | | change. llvm-svn: 69954
* Add a CXXConstructExpr that represents an implicit call to a C++ ↵Anders Carlsson2009-04-231-0/+40
| | | | | | constructor. I think CXXTemporaryObjectExpr is going to become a subclass of CXXConstructExpr, since CXXTemporaryObjectExpr represents a syntactic temporary, for example T() llvm-svn: 69854
* Add a CXXDestroyExpr. Add classof member functions to CXXTempVarDecl.Anders Carlsson2009-04-211-0/+14
| | | | llvm-svn: 69654
* Add support for the __has_trivial_destructor type trait.Anders Carlsson2009-04-171-1/+5
| | | | llvm-svn: 69345
* Add support for the __has_trivial_constructor type trait.Anders Carlsson2009-04-161-0/+4
| | | | llvm-svn: 69245
* Revamp our representation of C++ nested-name-specifiers. We now have aDouglas Gregor2009-03-261-48/+0
| | | | | | | | | | | uniqued representation that should both save some memory and make it far easier to properly build canonical types for types involving dependent nested-name-specifiers, e.g., "typename T::Nested::type". This approach will greatly simplify the representation of CXXScopeSpec. That'll be next. llvm-svn: 67799
* Keep track of whether a class is abstract or not. This is currently only ↵Anders Carlsson2009-03-221-0/+4
| | | | | | used for the __is_abstract type trait. llvm-svn: 67461
* Introduce a new expression type, UnresolvedDeclRefExpr, that describesDouglas Gregor2009-03-191-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | dependent qualified-ids such as Fibonacci<N - 1>::value where N is a template parameter. These references are "unresolved" because the name is dependent and, therefore, cannot be resolved to a declaration node (as we would do for a DeclRefExpr or QualifiedDeclRefExpr). UnresolvedDeclRefExprs instantiate to DeclRefExprs, QualifiedDeclRefExprs, etc. Also, be a bit more careful about keeping only a single set of specializations for a class template, and instantiating from the definition of that template rather than a previous declaration. In general, we need a better solution for this for all TagDecls, because it's too easy to accidentally look at a declaration that isn't the definition. We can now process a simple Fibonacci computation described as a template metaprogram. llvm-svn: 67308
* Generalize printing of nested-name-specifier sequences for use in bothDouglas Gregor2009-03-191-0/+25
| | | | | | | | QualifiedNameType and QualifiedDeclRefExpr. We now keep track of the exact nested-name-specifier spelling for a QualifiedDeclRefExpr, and use that spelling when printing ASTs. This fixes PR3493. llvm-svn: 67283
* Implement template instantiation for several more kinds of expressions:Douglas Gregor2009-03-131-1/+4
| | | | | | | | | | | | - C++ function casts, e.g., T(foo) - sizeof(), alignof() More importantly, this allows us to verify that we're performing overload resolution during template instantiation, with argument-dependent lookup and the "cached" results of name lookup from the template definition. llvm-svn: 66947
* Refactor the way we handle operator overloading and templateDouglas Gregor2009-03-131-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | | instantiation for binary operators. This change moves most of the operator-overloading code from the parser action ActOnBinOp to a new, parser-independent semantic checking routine CreateOverloadedBinOp. Of particular importance is the fact that CreateOverloadedBinOp does *not* perform any name lookup based on the current parsing context (it doesn't take a Scope*), since it has to be usable during template instantiation, when there is no scope information. Rather, it takes a pre-computed set of functions that are visible from the context or via argument-dependent lookup, and adds to that set any member operators and built-in operator candidates. The set of functions is computed in the parser action ActOnBinOp based on the current context (both operator name lookup and argument-dependent lookup). Within a template, the set computed by ActOnBinOp is saved within the type-dependent AST node and is augmented with the results of argument-dependent name lookup at instantiation time (see TemplateExprInstantiator::VisitCXXOperatorCallExpr). Sadly, we can't fully test this yet. I'll follow up with template instantiation for sizeof so that the real fun can begin. llvm-svn: 66923
* Make more AST nodes and semantic checkers dependent-expression-aware.Sebastian Redl2009-02-261-1/+2
| | | | llvm-svn: 65529
OpenPOWER on IntegriCloud