summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implementation of new and delete parsing and sema.Sebastian Redl2008-11-211-0/+194
| | | | | | This version uses VLAs to represent arrays. I'll try an alternative way next, but I want this safe first. llvm-svn: 59835
* remove another old-school Diag method.Chris Lattner2008-11-201-4/+4
| | | | llvm-svn: 59712
* remove the type_info identifier cache. Compared to the costChris Lattner2008-11-201-12/+7
| | | | | | | | | | | of doing the lookup_decl, the hash lookup is cheap. Also, typeid doesn't happen enough in real world code to worry about it. I'd like to eventually get rid of KnownFunctionIDs from Sema also, but today is not that day. llvm-svn: 59711
* Some tweaks suggested by ArgirisDouglas Gregor2008-11-191-14/+13
| | | | llvm-svn: 59661
* remove one more old-style Diag method.Chris Lattner2008-11-191-9/+9
| | | | llvm-svn: 59589
* As threatened previously: consolidate name lookup and the creation ofDouglas Gregor2008-11-181-68/+3
| | | | | | | | | | | | | | DeclRefExprs and BlockDeclRefExprs into a single function Sema::ActOnDeclarationNameExpr, eliminating a bunch of duplicate lookup-name-and-check-the-result code. Note that we still have the three parser entry points for identifiers, operator-function-ids, and conversion-function-ids, since the parser doesn't (and shouldn't) know about DeclarationNames. This is a Good Thing (TM), and there will be more entrypoints coming (e.g., for C++ pseudo-destructor expressions). llvm-svn: 59527
* Extend DeclarationName to support C++ overloaded operators, e.g.,Douglas Gregor2008-11-181-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Updated IdentifierResolver to deal with DeclarationNames. The names ofDouglas Gregor2008-11-171-0/+50
| | | | | | | | | | | | | | | | | | | | | C++ constructors, destructors, and conversion functions now have a FETokenInfo field that IdentifierResolver can access, so that these special names are handled just like ordinary identifiers. A few other Sema routines now use DeclarationNames instead of IdentifierInfo*'s. To validate this design, this code also implements parsing and semantic analysis for id-expressions that name conversion functions, e.g., return operator bool(); The new parser action ActOnConversionFunctionExpr takes the result of parsing "operator type-id" and turning it into an expression, using the IdentifierResolver with the DeclarationName of the conversion function. ActOnDeclarator pushes those conversion function names into scope so that the IdentifierResolver can find them, of course. llvm-svn: 59462
* Implement C++ 'typeid' parsing and sema.Sebastian Redl2008-11-111-0/+28
| | | | llvm-svn: 59042
* Basic support for taking the address of an overloaded functionDouglas Gregor2008-11-101-1/+10
| | | | llvm-svn: 59000
* Move named cast sema functions to their own file.Sebastian Redl2008-11-051-660/+0
| | | | llvm-svn: 58769
* A small error message improvement and some comment cleanup for static_cast.Sebastian Redl2008-11-051-13/+27
| | | | llvm-svn: 58762
* Initial implementation of parsing, semantic analysis, and AST-buildingDouglas Gregor2008-11-051-1/+1
| | | | | | | | | | | | | for constructor initializations, e.g., class A { }; class B : public A { int m; public: B() : A(), m(17) { }; }; llvm-svn: 58749
* Some cleanup of the cast checkers. Don't canonicalize types when not needed. ↵Sebastian Redl2008-11-041-45/+28
| | | | | | Use distinct diagnostics for distinct errors. llvm-svn: 58700
* Create a new expression class, CXXThisExpr, to handle the C++ 'this' primary ↵Douglas Gregor2008-11-041-2/+1
| | | | | | expression. Remove CXXThis from PredefinedExpr llvm-svn: 58695
* Standard conversion sequences now have a CopyConstructor field, toDouglas Gregor2008-11-031-7/+7
| | | | | | | | | | | | | | | cope with the case where a user-defined conversion is actually a copy construction, and therefore can be compared against other standard conversion sequences. While I called this a hack before, now I'm convinced that it's the right way to go. Compare overloads based on derived-to-base conversions that invoke copy constructors. Suppress user-defined conversions when attempting to call a user-defined conversion. llvm-svn: 58629
* Add implicitly-declared default and copy constructors to C++ classes,Douglas Gregor2008-11-031-0/+7
| | | | | | | | | | | when appropriate. Conversions for class types now make use of copy constructors. I've replaced the egregious hack allowing class-to-class conversions with a slightly less egregious hack calling these conversions standard conversions (for overloading reasons). llvm-svn: 58622
* Source ranges for named cast diagnostics.Sebastian Redl2008-11-021-43/+53
| | | | llvm-svn: 58570
* Implement basic support for converting constructors in user-defined Douglas Gregor2008-10-311-2/+2
| | | | | | | | | | | | | conversions. Notes: - Overload resolution for converting constructors need to prohibit user-defined conversions (hence, the test isn't -verify safe yet). - We still use hacks for conversions from a class type to itself. This will be the case until we start implicitly declaring the appropriate special member functions. (That's next on my list) llvm-svn: 58513
* Implement semantic checking of static_cast and dynamic_cast.Sebastian Redl2008-10-311-25/+335
| | | | llvm-svn: 58509
* Implement initialization of a reference (C++ [dcl.init.ref]) as partDouglas Gregor2008-10-291-1/+1
| | | | | | | | | | | | | | | | | | | of copy initialization. Other pieces of the puzzle: - Try/Perform-ImplicitConversion now handles implicit conversions that don't involve references. - Try/Perform-CopyInitialization uses CheckSingleAssignmentConstraints for C. PerformCopyInitialization is now used for all argument passing and returning values from a function. - Diagnose errors with declaring references and const values without an initializer. (Uses a new Action callback, ActOnUninitializedDecl). We do not yet have implicit conversion sequences for reference binding, which means that we don't have any overloading support for reference parameters yet. llvm-svn: 58353
* Improve our handling of (C++) references within Clang. Specifically:Douglas Gregor2008-10-281-8/+0
| | | | | | | | | | | - Do not allow expressions to ever have reference type - Extend Expr::isLvalue to handle more cases where having written a reference into the source implies that the expression is an lvalue (e.g., function calls, C++ casts). - Make GRExprEngine::VisitCall treat the call arguments as lvalues when they are being bound to a reference parameter. llvm-svn: 58306
* Refactor the expression class hierarchy for casts. Most importantly:Douglas Gregor2008-10-271-17/+21
| | | | | | | | | | | | | | | | | | | | | | - 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
* Some cleanups for the ambiguous derived-to-base conversion checksDouglas Gregor2008-10-241-3/+4
| | | | llvm-svn: 58096
* Semantic analysis for C++ reinterpret_cast and const_cast. Patch by ↵Douglas Gregor2008-10-241-6/+333
| | | | | | Sebastian Redl. llvm-svn: 58094
* First non-embarrassing cut at checking for ambiguous derived-to-base Douglas Gregor2008-10-241-0/+125
| | | | | | | | | | conversions. Added PerformImplicitConversion, which follows an implicit conversion sequence computed by TryCopyInitialization and actually performs the implicit conversions, including the extra check for ambiguity mentioned above. llvm-svn: 58071
* Use getCustomDiagID() instead of specifying the diagnostic in the ↵Argyrios Kyrtzidis2008-10-061-2/+4
| | | | | | 'DiagnosticKinds.def' file. llvm-svn: 57220
* Give string literals const element typesin C++, and cope with the deprecated ↵Douglas Gregor2008-09-121-0/+31
| | | | | | C++ conversion from a string literal to a pointer-to-non-const-character llvm-svn: 56137
* Implement Sema support for the 'condition' part of C++ selection-statements ↵Argyrios Kyrtzidis2008-09-101-0/+70
| | | | | | and iteration-statements (if/switch/while/for). llvm-svn: 56044
* Add support for C++'s "type-specifier ( expression-list )" expression:Argyrios Kyrtzidis2008-08-221-0/+64
| | | | | | | | | | -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
* Minor #include cleaningDaniel Dunbar2008-08-111-0/+1
| | | | | | | - Drop TokenKinds.h from Action.h - Move DeclSpec.h from Sema.h into individual Sema .cpp files llvm-svn: 54625
* rename PreDefinedExpr -> PredefinedExprChris Lattner2008-08-101-2/+2
| | | | llvm-svn: 54605
* Add Sema support for C++ classes.Argyrios Kyrtzidis2008-07-011-0/+18
| | | | llvm-svn: 52956
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+51
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