summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make more AST nodes and semantic checkers dependent-expression-aware.Sebastian Redl2009-02-261-1/+2
| | | | llvm-svn: 65529
* Rename UnaryTypeTraitExpr::Evaluate to EvaluateTrait to not collideDaniel Dunbar2009-02-171-1/+1
| | | | | | with Expr::Evaluate(). llvm-svn: 64850
* Overhaul of Stmt allocation:Ted Kremenek2009-02-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Made allocation of Stmt objects using vanilla new/delete a *compiler error* by making this new/delete "protected" within class Stmt. - Now the only way to allocate Stmt objects is by using the new operator that takes ASTContext& as an argument. This ensures that all Stmt nodes are allocated from the same (pool) allocator. - Naturally, these two changes required that *all* creation sites for AST nodes use new (ASTContext&). This is a large patch, but the majority of the changes are just this mechanical adjustment. - The above changes also mean that AST nodes can no longer be deallocated using 'delete'. Instead, one most do StmtObject->Destroy(ASTContext&) or do ASTContextObject.Deallocate(StmtObject) (the latter not running the 'Destroy' method). Along the way I also... - Made CompoundStmt allocate its array of Stmt* using the allocator in ASTContext (previously it used std::vector). There are a whole bunch of other Stmt classes that need to be similarly changed to ensure that all memory allocated for ASTs comes from the allocator in ASTContext. - Added a new smart pointer ExprOwningPtr to Sema.h. This replaces the uses of llvm::OwningPtr within Sema, as llvm::OwningPtr used 'delete' to free memory instead of a Stmt's 'Destroy' method. Big thanks to Doug Gregor for helping with the acrobatics of making 'new/delete' private and the new smart pointer ExprOwningPtr! llvm-svn: 63997
* Fix the symptom of the regression, by having the CXXConditionDeclExpr not ↵Sebastian Redl2009-02-051-1/+3
| | | | | | | | destroy its Decl. However, the cause still remains: the Decl is linked into the chain of its DeclContext and remains there despite being deleted. llvm-svn: 63868
* Fix our semantic analysis ofDouglas Gregor2009-02-041-3/+3
| | | | | | | | | | | | | | | | | | | | | unqualified-id '(' in C++. The unqualified-id might not refer to any declaration in our current scope, but declarations by that name might be found via argument-dependent lookup. We now do so properly. As part of this change, CXXDependentNameExpr, which was previously designed to express the unqualified-id in the above constructor within templates, has become UnresolvedFunctionNameExpr, which does effectively the same thing but will work for both templates and non-templates. Additionally, we cope with all unqualified-ids, since ADL also applies in cases like operator+(x, y) llvm-svn: 63733
* Part one of handling C++ functional casts. This handles semanticDouglas Gregor2009-01-161-0/+28
| | | | | | | | analysis and AST-building for the cases where we have N != 1 arguments. For N == 1 arguments, we need to finish the C++ implementation of explicit type casts (C++ [expr.cast]). llvm-svn: 62329
* PODness and Type TraitsSebastian Redl2009-01-051-0/+29
| | | | | | | | | | | | | | | Make C++ classes track the POD property (C++ [class]p4) Track the existence of a copy assignment operator. Implicitly declare the copy assignment operator if none is provided. Implement most of the parsing job for the G++ type traits extension. Fully implement the low-hanging fruit of the type traits: __is_pod: Whether a type is a POD. __is_class: Whether a type is a (non-union) class. __is_union: Whether a type is a union. __is_enum: Whether a type is an enum. __is_polymorphic: Whether a type is polymorphic (C++ [class.virtual]p1). llvm-svn: 61746
* Add support for calls to overloaded member functions. Things to note:Douglas Gregor2008-12-221-0/+8
| | | | | | | | | | | | - Overloading has to cope with having both static and non-static member functions in the overload set. - The call may or may not have an implicit object argument, depending on the syntax (x.f() vs. f()) and the context (static vs. non-static member function). - We now generate MemberExprs for implicit member access expression. - We now cope with mutable whenever we're building MemberExprs. llvm-svn: 61329
* Add support for calls to dependent names within templates, e.g.,Douglas Gregor2008-12-061-0/+8
| | | | | | | | | | | | | | | | | | template<typename T> void f(T x) { g(x); // g is a dependent name, so don't even bother to look it up g(); // error: g is not a dependent name } Note that when we see "g(", we build a CXXDependentNameExpr. However, if none of the call arguments are type-dependent, we will force the resolution of the name "g" and replace the CXXDependentNameExpr with its result. GCC actually produces a nice error message when you make this mistake, and even offers to compile your code with -fpermissive. I'll do the former next, but I don't plan to do the latter. llvm-svn: 60618
* Fix some type punning errors in SizeOfAlignOf and Typeid AST nodes. This ↵Sebastian Redl2008-12-031-2/+2
| | | | | | should satisfy compilers and language lawyers alike. llvm-svn: 60511
* Handle new by passing the Declaration to the Action, not a processed type.Sebastian Redl2008-12-021-7/+9
| | | | llvm-svn: 60413
* Implementation of new and delete parsing and sema.Sebastian Redl2008-11-211-0/+33
| | | | | | This version uses VLAs to represent arrays. I'll try an alternative way next, but I want this safe first. llvm-svn: 59835
* Extend DeclarationName to support C++ overloaded operators, e.g.,Douglas Gregor2008-11-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | operator+, directly, using the same mechanism as all other special names. Removed the "special" identifiers for the overloaded operators from the identifier table and IdentifierInfo data structure. IdentifierInfo is back to representing only real identifiers. Added a new Action, ActOnOperatorFunctionIdExpr, that builds an expression from an parsed operator-function-id (e.g., "operator +"). ActOnIdentifierExpr used to do this job, but operator-function-ids are no longer represented by IdentifierInfo's. Extended Declarator to store overloaded operator names. Sema::GetNameForDeclarator now knows how to turn the operator name into a DeclarationName for the overloaded operator. Except for (perhaps) consolidating the functionality of ActOnIdentifier, ActOnOperatorFunctionIdExpr, and ActOnConversionFunctionExpr into a common routine that builds an appropriate DeclRefExpr by looking up a DeclarationName, all of the work on normalizing declaration names should be complete with this commit. llvm-svn: 59526
* Add a new expression node, CXXOperatorCallExpr, which expresses aDouglas Gregor2008-11-141-0/+48
| | | | | | | | | | | | | | | | | | | function call created in response to the use of operator syntax that resolves to an overloaded operator in C++, e.g., "str1 + str2" that resolves to std::operator+(str1, str2)". We now build a CXXOperatorCallExpr in C++ when we pick an overloaded operator. (But only for binary operators, where we actually implement overloading) I decided *not* to refactor the current CallExpr to make it abstract (with FunctionCallExpr and CXXOperatorCallExpr as derived classes). Doing so would allow us to make CXXOperatorCallExpr a little bit smaller, at the cost of making the argument and callee accessors virtual. We won't know if this is going to be a win until we can parse lots of C++ code to determine how much memory we'll save by making this change vs. the performance penalty due to the extra virtual calls. llvm-svn: 59306
* Implement C++ 'typeid' parsing and sema.Sebastian Redl2008-11-111-0/+7
| | | | llvm-svn: 59042
* Create a new expression class, CXXThisExpr, to handle the C++ 'this' primary ↵Douglas Gregor2008-11-041-0/+4
| | | | | | expression. Remove CXXThis from PredefinedExpr llvm-svn: 58695
* Refactor the expression class hierarchy for casts. Most importantly:Douglas Gregor2008-10-271-4/+17
| | | | | | | | | | | | | | | | | | | | | | - CastExpr is the root of all casts - ImplicitCastExpr is (still) used for all explicit casts - ExplicitCastExpr is now the root of all *explicit* casts - ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++ - CXXFunctionalCastExpr inherits from ExplicitCastExpr - CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all of the C++ named cast expression types (static_cast, dynamic_cast, etc.) - Added classes CXXStaticCastExpr, CXXDynamicCastExpr, CXXReinterpretCastExpr, and CXXConstCastExpr to Also, fixed returned-stack-addr.cpp, which broke once when we fixed reinterpret_cast to diagnose double->int* conversions and again when we eliminated implicit conversions to reference types. The fix is in both testcase and SemaChecking.cpp. Most of this patch is simply support for the renaming. There's very little actual change in semantics. llvm-svn: 58264
* Change line endings: CRLF -> LFArgyrios Kyrtzidis2008-09-101-4/+4
| | | | llvm-svn: 56043
* Add new 'CXXConditionDeclExpr' expression node used for a 'condition' ↵Argyrios Kyrtzidis2008-09-091-0/+14
| | | | | | | | declaration, e.g: "if (int x=0) {...}". It is a subclass of DeclRefExpr and the main difference is that CXXConditionDeclExpr owns the declaration that it references. llvm-svn: 56033
* Add support for C++'s "type-specifier ( expression-list )" expression:Argyrios Kyrtzidis2008-08-221-0/+8
| | | | | | | | | | -The Parser calls a new "ActOnCXXTypeConstructExpr" action. -Sema, depending on the type and expressions number: -If the type is a class, it will treat it as a class constructor. [TODO] -If there's only one expression (i.e. "int(0.5)" ), creates a new "CXXFunctionalCastExpr" Expr node -If there are no expressions (i.e "int()" ), creates a new "CXXZeroInitValueExpr" Expr node. llvm-svn: 55177
* Fix more strict-aliasing warnings.Ted Kremenek2008-06-171-12/+4
| | | | | | Fix indentation of class declarations in ExprCXX.h llvm-svn: 52380
* Several improvements from Doug Gregor related to defaultChris Lattner2008-04-101-2/+2
| | | | | | argument handling. I'll fix up the c89 (void) thing next. llvm-svn: 49459
* Add support for C++ default arguments, and rework Parse-Sema Chris Lattner2008-04-081-0/+8
| | | | | | | | interaction for function parameters, fixing PR2046. Patch by Doug Gregor! llvm-svn: 49369
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+47
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. llvm-svn: 48402
OpenPOWER on IntegriCloud