summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* In Sema::MaybeBindToTemporary, create a CXXBindTemporaryExpr for anPeter Collingbourne2011-11-271-2/+3
| | | | | | array of objects with non-trivial destructors. PR11365. llvm-svn: 145203
* There's no good reason to track temporaries in ExprWithCleanups,John McCall2011-11-101-19/+21
| | | | | | | but it is sometimes useful to track blocks. Do so. Also optimize the storage of these expressions. llvm-svn: 144263
* Added a flag to identify resolved overloaded function references.Abramo Bagnara2011-10-051-4/+12
| | | | llvm-svn: 141171
* Re-arrange and bitfieldify data members of CXXConstructExpr to save aDouglas Gregor2011-09-261-3/+3
| | | | | | little storage. llvm-svn: 140529
* Rename ExplicitTemplateArgumentList -> ASTTemplateArgumentListInfo, no ↵Argyrios Kyrtzidis2011-09-221-9/+9
| | | | | | functionality change. llvm-svn: 140330
* Teach CXXUnresolvedConstructExpr when it should be anDouglas Gregor2011-07-081-1/+4
| | | | | | | lvalue/xvalue/rvalue, rather than just (incorrectly) assuming it's an lvalue. Fixes PR10285 / <rdar://problem/9743926>. llvm-svn: 134700
* Introduce the notion of instantiation dependence into Clang's AST. ADouglas Gregor2011-07-011-8/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | type/expression/template argument/etc. is instantiation-dependent if it somehow involves a template parameter, even if it doesn't meet the requirements for the more common kinds of dependence (dependent type, type-dependent expression, value-dependent expression). When we see an instantiation-dependent type, we know we always need to perform substitution into that instantiation-dependent type. This keeps us from short-circuiting evaluation in places where we shouldn't, and lets us properly implement C++0x [temp.type]p2. In theory, this would also allow us to properly mangle instantiation-dependent-but-not-dependent decltype types per the Itanium C++ ABI, but we aren't quite there because we still mangle based on the canonical type in cases like, e.g., template<unsigned> struct A { }; template<typename T> void f(A<sizeof(sizeof(decltype(T() + T())))>) { } template void f<int>(A<sizeof(sizeof(int))>); and therefore get the wrong answer. llvm-svn: 134225
* Make yet another placeholder type, this one marking that an expression is a ↵John McCall2011-04-261-0/+27
| | | | | | | | | | | bound member function, i.e. something of the form 'x.f' where 'f' is a non-static member function. Diagnose this in the general case. Some of the new diagnostics are probably worse than the old ones, but we now get this right much more universally, and there's certainly room for improvement in the diagnostics. llvm-svn: 130239
* Add support for C++0x's range-based for loops, as specified by the C++11 ↵Richard Smith2011-04-141-1/+1
| | | | | | draft standard (N3291). llvm-svn: 129541
* Add CXXDynamicCastExpr::isAlwaysNull() which will be replacing the cast kind ↵Anders Carlsson2011-04-111-0/+30
| | | | | | I added. llvm-svn: 129263
* Apply a bug-fix patch from Marcin Kowalczyk to the source locations forChandler Carruth2011-04-021-1/+3
| | | | | | | | | | | a couple of operator overloads which form interesting expressions in the AST. I added test cases for both bugs with the c-index-test's token annotation feature. Also, thanks to John McCall for confirming that this is the correct solution. llvm-svn: 128768
* Begin reworking static analyzer support for C++ method calls. The current ↵Ted Kremenek2011-03-301-2/+13
| | | | | | | | | | | logic was divorced from how we process ordinary function calls, had a tremendous about of redundancy, and relied strictly on inlining behavior (which was incomplete) to provide semantics instead of falling back to the conservative analysis we use for C functions. This is a significant step into making C++ analyzer support more useful. llvm-svn: 128557
* Instead of storing an ASTContext* in FunctionProtoTypes with computed ↵Sebastian Redl2011-03-131-2/+2
| | | | | | noexcept specifiers, unique FunctionProtoTypes with a ContextualFoldingSet, as suggested by John McCall. llvm-svn: 127568
* Propagate the new exception information to FunctionProtoType.Sebastian Redl2011-03-121-1/+1
| | | | | | | | Change the interface to expose the new information and deal with the enormous fallout. Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications. Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support. llvm-svn: 127537
* The conditional needs to be pushed before the branch. Make the test lessJohn McCall2011-03-071-0/+4
| | | | | | trivial to check this. Adjust for style. llvm-svn: 127151
* Fix the source range for a member access expression that includes aDouglas Gregor2011-03-021-37/+2
| | | | | | | nested-name-specifier and improve the detection of implicit 'this' bases. Fixes <rdar://problem/8750392>. llvm-svn: 126880
* Push nested-name-specifier source location information intoDouglas Gregor2011-02-281-15/+60
| | | | | | | | | | | | | UnresolvedLookupExpr and UnresolvedMemberExpr. Also, improve the computation that checks whether the base of a member expression (either unresolved or dependent-scoped) is implicit. The previous check didn't cover all of the cases we use in our representation, which threw off source-location information for these expressions (which, in turn, caused some breakage in libclang's token annotation). llvm-svn: 126681
* Push nested-name-specifier source location information intoDouglas Gregor2011-02-281-17/+17
| | | | | | | | CXXDependentScopeMemberExpr, and clean up instantiation of nested-name-specifiers with dependent template specialization types in the process. llvm-svn: 126663
* Push nested-name-specifier source location information intoDouglas Gregor2011-02-251-9/+8
| | | | | | | DependentScopeDeclRefExpr. Plus, give NestedNameSpecifierLoc == and != operators, since we're going to need 'em elsewhere. llvm-svn: 126508
* Push nested-name-specifier source-location information intoDouglas Gregor2011-02-251-7/+8
| | | | | | | | pseudo-destructor expressions. Also, clean up some template-instantiation and type-checking issues with pseudo-destructors. llvm-svn: 126498
* Pseudo-revirtualize CallExpr::getSourceRange by making it follow theJohn McCall2011-02-211-7/+3
| | | | | | | | logic from CXXMemberCallExpr and by making it check for CXXOperatorCallExpr in order to defer. This is not really an awesome solution, but I don't have a better idea. llvm-svn: 126114
* Remove vtables from the Stmt hierarchy; this was pretty easy asJohn McCall2011-02-091-202/+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
* Implement proper (de-)serialization for explicit template argumentDouglas Gregor2011-02-041-10/+17
| | | | | | | lists with zero template arguments. Fixes some seriously scary crashers in C++ PCH. llvm-svn: 124862
* Do a proper recursive lookup when deciding whether a class's usualJohn McCall2011-01-271-3/+5
| | | | | | | | | deallocation function has a two-argument form. Store the result of this check in new[] and delete[] nodes. Fixes rdar://problem/8913519 llvm-svn: 124373
* Change QualType::getTypePtr() to return a const pointer, then change aJohn McCall2011-01-191-1/+1
| | | | | | thousand other things which were (generally inadvertantly) relying on that. llvm-svn: 123814
* Introduce a new expression kind, SubstNonTypeTemplateParmPackExpr,Douglas Gregor2011-01-151-0/+28
| | | | | | | | | 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
* Add the location of the right parenthesis of a C++ named castDouglas Gregor2011-01-121-8/+15
| | | | | | | (static_cast, dynamic_cast, reinterpret_cast, or const_cast) to improve source-location information. Fixes PR8960. llvm-svn: 123336
* Implement the sizeof...(pack) expression to compute the length of aDouglas Gregor2011-01-041-0/+12
| | | | | | | | | 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/+12
| | | | | | | | | | | | | | | | | 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
* Variadic templates: extend the Expr class with a bit that specifiesDouglas Gregor2010-12-151-85/+182
| | | | | | | | | | | | | | | | | | whether the expression contains an unexpanded parameter pack, in the same vein as the changes to the Type hierarchy. Compute this bit within all of the Expr subclasses. This change required a bunch of reshuffling of dependency calculations, mainly to consolidate them inside the constructors and to fuse multiple loops that iterate over arguments to determine type dependence, value dependence, and (now) containment of unexpanded parameter packs. Again, testing is painfully sparse, because all of the diagnostics will change and it is more important to test the to-be-written visitor that collects unexpanded parameter packs. llvm-svn: 121831
* Restore r121752 without modification.John McCall2010-12-141-0/+19
| | | | llvm-svn: 121763
* Pull out r121752 in case it's causing the selfhost breakage.John McCall2010-12-141-19/+0
| | | | llvm-svn: 121759
* Factor out most of the extra state in a FunctionProtoType into a separateJohn McCall2010-12-141-0/+19
| | | | | | | class to be passed around. The line between argument and return types and everything else is kindof vague, but I think it's justifiable. llvm-svn: 121752
* Type traits intrinsic implementation: __is_base_of(T, U)Francois Pichet2010-12-071-0/+8
| | | | | | New AST node introduced: BinaryTypeTraitExpr; to be reused for more intrinsics. llvm-svn: 121074
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-061-14/+14
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* Add an assertion, fix a whole bunch of bugs, comment the assertionJohn McCall2010-11-181-1/+1
| | | | | | out because there are still bugs left. llvm-svn: 119722
* Calculate the value kind of an expression when it's created andJohn McCall2010-11-181-13/+21
| | | | | | | | | | | | | store it on the expression node. Also store an "object kind", which distinguishes ordinary "addressed" l-values (like variable references and pointer dereferences) and bitfield, @property, and vector-component l-values. Currently we're not using these for much, but I aim to switch pretty much everything calculating l-valueness over to them. For now they shouldn't necessarily be trusted. llvm-svn: 119685
* Have CXXDeleteExpr::getDestroyedType return the actual destroyed typeCraig Silverstein2010-11-161-2/+3
| | | | | | | | | | | | | | | | | | | in more situations. In particular, for code like template<class T> void Fn() { T* x; delete x; } getDestroyedType() will now return T rather than T*, as it would before this change. On the other hand, for code like this: template<class T> void Fn() { T x; delete x; } getDestroyedType() will return an empty QualType(), since it doesn't know what the actual destroyed type would be. Previously, it would return T. OKed by rjmccall llvm-svn: 119334
* Improve source-location information for CXXConstructExpr nodes, byDouglas Gregor2010-11-031-3/+16
| | | | | | | | | ensuring that they cover all of their child nodes. There's still a clang_getCursor()-related issue with CXXFunctionalCastExprs with CXXConstructExprs as children (see FIXME in the test case); I'll look at that separately. llvm-svn: 118132
* Fixes an assertion violation when bind to temporaryFariborz Jahanian2010-11-021-1/+3
| | | | | | | expression is a dependent expression. // rdar: // 8620524 and PR7851 llvm-svn: 118066
* Rename alignof -> alignOf to avoid irritating C++'0x compilers,Chris Lattner2010-10-301-6/+6
| | | | | | PR8423 llvm-svn: 117775
* Add helper for extracting the CXXRecordDecl for the implicit argument toChandler Carruth2010-10-271-0/+11
| | | | | | | a member call expression. This has proved to be a common pattern for users of RecursiveASTVisitor. llvm-svn: 117439
* Improve the tracking of source locations for parentheses in constructor calls.Chandler Carruth2010-10-251-21/+21
| | | | | | | | | | | | This adds them where missing, and traces them through PCH. We fix at least one bug in the extents found by the Index library, and make a lot of refactoring tools which care about the exact formulation of a constructor call easier to write. Also some minor cleanups to more consistently follow the friend pattern instead of the setter pattern when rebuilding a serialized AST. Patch originally by Samuel Benzaquen. llvm-svn: 117254
* Had the wrong type for ArgType. :-( Fixed.Craig Silverstein2010-10-201-1/+1
| | | | llvm-svn: 116893
* The type-to-delete may not be a pointer if it's a dependent type.Craig Silverstein2010-10-201-1/+5
| | | | | | | | | | | | | | | | Here's example code: --- template<class T> class MyClass { struct S { }; S* NewS() { return new S; } void DeleteS() { delete NewS(); } }; --- CXXDeleteExpr::getDestroyedType() on the 'delete NewS()' expression would crash before this change. Now it returns a dependent type object. Solution suggested by dgregor. llvm-svn: 116891
* When marking the declarations in a default argument expression asDouglas Gregor2010-09-141-0/+13
| | | | | | | | | "used", at the time that the default argument itself is used, also mark destructors that will be called by this expression. This fixes a regression that I introduced in r113700, which broke WebKit, and fixes <rdar://problem/8427926>. llvm-svn: 113883
* Eagerly evaluate type traits in Sema instead of lazily in AST. They actually ↵Sebastian Redl2010-09-131-198/+0
| | | | | | need Sema access to be correct, fixes coming up. llvm-svn: 113782
* Define and implement CXXNoexceptExpr. Create it in Sema.Sebastian Redl2010-09-101-0/+7
| | | | llvm-svn: 113623
* Add proper type-source information to UnaryTypeTraitExpr, includingDouglas Gregor2010-09-091-28/+27
| | | | | | libclang visitation. llvm-svn: 113492
* Microsoft's __uuidof operator implementation part 1.Francois Pichet2010-09-081-0/+16
| | | | llvm-svn: 113356
OpenPOWER on IntegriCloud