summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Friend declarations are only valid inside class definitions.Anders Carlsson2009-05-111-0/+9
| | | | llvm-svn: 71489
* Implement the notions of the "current instantiation" and "unknownDouglas Gregor2009-05-111-2/+2
| | | | | | | | | | | | | | | | | | specialization" within a C++ template, and permit name lookup into the current instantiation. For example, given: template<typename T, typename U> struct X { typedef T type; X* x1; // current instantiation X<T, U> *x2; // current instantiation X<U, T> *x3; // not current instantiation ::X<type, U> *x4; // current instantiation X<typename X<type, U>::type, U>: *x5; // current instantiation }; llvm-svn: 71471
* Back out r70506 (exception spec in AST) again. We won't have exception specs ↵Sebastian Redl2009-05-061-3/+0
| | | | | | until we've had a lot more discussion. llvm-svn: 71125
* When determining whether an expression refers to a bit-field, lookDouglas Gregor2009-05-021-1/+1
| | | | | | | | | into the left-hand side of an assignment expression. This completes most of PR3500; the only remaining part is to deal with the GCC-specific implementation-defined behavior for "unsigned long" (and other) bit-fields. llvm-svn: 70623
* Replace a bunch of static_cast + release with takeAs.Anders Carlsson2009-05-011-1/+1
| | | | llvm-svn: 70566
* C++ destructors can have a single unnamed void parameter. Fixes ↵Anders Carlsson2009-04-301-1/+8
| | | | | | <rdar://problem/6841210>. llvm-svn: 70519
* Rework the way we handle constructor decls to be less hacky and fix PR3948 ↵Anders Carlsson2009-04-301-13/+0
| | | | | | completely. llvm-svn: 70516
* Make a home for exception specs in the AST. Now Sema can hook them up.Sebastian Redl2009-04-301-0/+3
| | | | llvm-svn: 70506
* Track down return statements in the handlers of a function-try-block of ↵Sebastian Redl2009-04-271-0/+21
| | | | | | constructors. Meh ... llvm-svn: 70256
* Don't allow catch declarations to name an abstract classSebastian Redl2009-04-271-0/+5
| | | | llvm-svn: 70248
* change a couple more c++ sema methods to be based on isinvalid bits.Chris Lattner2009-04-251-22/+18
| | | | llvm-svn: 70022
* various "is invalid" cleanups for C++ ctors/dtors.Chris Lattner2009-04-251-47/+48
| | | | llvm-svn: 70021
* This is a pretty big cleanup for how invalid decl/type are handle.Chris Lattner2009-04-251-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This gets rid of a bunch of random InvalidDecl bools in sema, changing us to use the following approach: 1. When analyzing a declspec or declarator, if an error is found, we set a bit in Declarator saying that it is invalid. 2. Once the Decl is created by sema, we immediately set the isInvalid bit on it from what is in the declarator. From this point on, sema consistently looks at and sets the bit on the decl. This gives a very clear separation of concerns and simplifies a bunch of code. In addition to this, this patch makes these changes: 1. it renames DeclSpec::getInvalidType() -> isInvalidType(). 2. various "merge" functions no longer return bools: they just set the invalid bit on the dest decl if invalid. 3. The ActOnTypedefDeclarator/ActOnFunctionDeclarator/ActOnVariableDeclarator methods now set invalid on the decl returned instead of returning an invalid bit byref. 4. In SemaType, refering to a typedef that was invalid now propagates the bit into the resultant type. Stuff declared with the invalid typedef will now be marked invalid. 5. Various methods like CheckVariableDeclaration now return void and set the invalid bit on the decl they check. There are a few minor changes to tests with this, but the only major bad result is test/SemaCXX/constructor-recovery.cpp. I'll take a look at this next. llvm-svn: 70020
* Create a CXXConstructExpr instead of a CXXTemporaryObjectExpr in ↵Anders Carlsson2009-04-241-5/+2
| | | | | | InitializeVarWithConstructor. llvm-svn: 69956
* Implement lvalue test for conditional expressions.Sebastian Redl2009-04-171-0/+2
| | | | | | Add a few commented lines to the test case that point out things that don't work yet. llvm-svn: 69354
* Add support for the __has_trivial_destructor type trait.Anders Carlsson2009-04-171-3/+15
| | | | llvm-svn: 69345
* If a class has a non-trivial constructor that doesn't take any arguments, we ↵Anders Carlsson2009-04-161-10/+14
| | | | | | | | | | | | | | | | | | will now make an implicit CXXTemporaryObjectExpr. So struct S { S(); }; void f() { S s; } 's' here will implicitly be declared as. S s = S(); llvm-svn: 69326
* Fix a crash bug when comparing overload quality of conversion operators with ↵Sebastian Redl2009-04-161-1/+1
| | | | | | | | | | | conversion constructors. Remove an atrocious amount of trailing whitespace in the overloaded operator mangler. Sorry, couldn't help myself. Change the DeclType parameter of Sema::CheckReferenceInit to be passed by value instead of reference. It wasn't changed anywhere. Let the parser handle C++'s irregular grammar around assignment-expression and conditional-expression. And finally, the reason for all this stuff: implement C++ semantics for the conditional operator. The implementation is complete except for determining lvalueness. llvm-svn: 69299
* When we create an implicit CXXTemporaryObjectExpr we don't need to check ↵Anders Carlsson2009-04-161-6/+1
| | | | | | that it's a valid init. Instead, just set it as the VarDecl's initializer. llvm-svn: 69292
* Disable the code I added before until I understand what's causing ↵Anders Carlsson2009-04-161-0/+5
| | | | | | default2.cpp to fail. llvm-svn: 69267
* Add support for the __has_trivial_constructor type trait.Anders Carlsson2009-04-161-0/+30
| | | | llvm-svn: 69245
* When declaring a variable that has a constructor and a direct initializer, ↵Anders Carlsson2009-04-151-9/+13
| | | | | | | | | | | | | | | | | | for example: struct X { X(int, int); }; X x(10, 10); we model that as X x = X(10, 10); inserting a temporary object expr. llvm-svn: 69227
* fix some out of date comments pointed out by SebastianChris Lattner2009-04-121-2/+1
| | | | llvm-svn: 68923
* Parse deleted member functions. Parsing member declarations goes through a ↵Sebastian Redl2009-04-121-3/+7
| | | | | | | | | different code path that I forgot previously. Implement the rvalue reference overload dance for returning local objects. Returning a local object first tries to find a move constructor now. The error message when no move constructor is defined (or is not applicable) and the copy constructor is deleted is quite ugly, though. llvm-svn: 68902
* Propagate the ASTContext to various AST traversal and lookup functions.Douglas Gregor2009-04-091-18/+23
| | | | | | No functionality change (really). llvm-svn: 68726
* Introduce a "-fixit" mode to clang-cc that applies code-modification hints.Douglas Gregor2009-04-021-1/+1
| | | | llvm-svn: 68268
* Add some more code modification hintsDouglas Gregor2009-04-011-2/+3
| | | | llvm-svn: 68261
* Push DeclGroup much farther throughout the compiler. Now the variousChris Lattner2009-03-291-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | productions (except the already broken ObjC cases like @class X,Y;) in the parser that can produce more than one Decl return a DeclGroup instead of a Decl, etc. This allows elimination of the Decl::NextDeclarator field, and exposes various clients that should look at all decls in a group, but which were only looking at one (such as the dumper, printer, etc). These have been fixed. Still TODO: 1) there are some FIXME's in the code about potentially using DeclGroup for better location info. 2) ParseObjCAtDirectives should return a DeclGroup due to @class etc. 3) I'm not sure what is going on with StmtIterator.cpp, or if it can be radically simplified now. 4) I put a truly horrible hack in ParseTemplate.cpp. I plan to bring up #3/4 on the mailing list, but don't plan to tackle #1/2 in the short term. llvm-svn: 68002
* Reintroduce r67870 (rval ref overloading), since I can't reproduce any test ↵Sebastian Redl2009-03-291-22/+38
| | | | | | failures on i386 or x86_64. If this fails for someone, please contact me. llvm-svn: 67999
* various cleanupsChris Lattner2009-03-291-2/+1
| | | | llvm-svn: 67981
* More improvements to namespace aliases. We now support everything except ↵Anders Carlsson2009-03-281-4/+18
| | | | | | aliases in using directives. llvm-svn: 67966
* Fix lookup bugAnders Carlsson2009-03-281-1/+1
| | | | llvm-svn: 67964
* Create AST nodes for namespace aliases.Anders Carlsson2009-03-281-1/+6
| | | | llvm-svn: 67962
* Parse the location of the 'namespace' token to ActOnNamespaceAliasDef. No ↵Anders Carlsson2009-03-281-5/+5
| | | | | | functionality change. llvm-svn: 67961
* Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for aChris Lattner2009-03-281-92/+91
| | | | | | | | | | | | | | | | | | | | pointer. Its purpose in life is to be a glorified void*, but which does not implicitly convert to void* or other OpaquePtr's with a different UID. Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>. Change the entire parser/sema interface to use DeclPtrTy instead of DeclTy*. This makes the C++ compiler enforce that these aren't convertible to other opaque types. We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc, but I don't plan to do that in the short term. The one outstanding known problem with this patch is that we lose the bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to bitmangle the success bit into the low bit of DeclPtrTy. I will rectify this with a subsequent patch. llvm-svn: 67952
* As Eli pointed out, it is possible that a namespace lookup is ambiguous!Anders Carlsson2009-03-281-2/+0
| | | | llvm-svn: 67932
* Check that the alias points to a valid namespace.Anders Carlsson2009-03-281-0/+15
| | | | llvm-svn: 67925
* Check that the namespace alias doesn't conflict with a previous declaration ↵Anders Carlsson2009-03-281-1/+13
| | | | | | in this scope. llvm-svn: 67921
* Add an ActOnNamespaceAliasDef action and have the parser call it.Anders Carlsson2009-03-281-0/+9
| | | | llvm-svn: 67915
* Revert Sebastian's rvalue patch (r67870) since it caused test failures inAnders Carlsson2009-03-281-38/+22
| | | | | | | | SemaCXX//overload-member-call.cpp SemaCXX//overloaded-operator.cpp SemaTemplate//instantiate-method.cpp llvm-svn: 67912
* Better overload resolution for rvalue references.Sebastian Redl2009-03-271-22/+38
| | | | llvm-svn: 67870
* Move Sema::SetMemberAccessSpecifier to SemaAccess.cppAnders Carlsson2009-03-271-25/+0
| | | | llvm-svn: 67820
* Improve recovery when a constructor fails to type-check. Test case from AndersDouglas Gregor2009-03-271-6/+8
| | | | llvm-svn: 67818
* Revamp our representation of C++ nested-name-specifiers. We now have aDouglas Gregor2009-03-261-3/+10
| | | | | | | | | | | 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
* AddAnders Carlsson2009-03-261-17/+2
| | | | | | | | | const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, AccessSpecifier AS); so we can easily add access specifiers to diagnostics. llvm-svn: 67795
* Factor the member access specifier setting code into its own function. No ↵Anders Carlsson2009-03-261-0/+40
| | | | | | intended functionality change. llvm-svn: 67725
* Improve handling of base initializers. We now parse initializers in out of ↵Anders Carlsson2009-03-251-0/+12
| | | | | | | | | | | | | | | | | | | | | | line decls, such as: class C { C() { } int a; }; C::C() : a(10) { } We also diagnose when initializers are used on declarations that aren't constructors: t.cpp:1:10: error: only constructors take base initializers void f() : a(10) { } ^ Doug and/or Sebastian: I'd appreciate a review, especially the nested-name-spec test results (from the looks of it we now match gcc in that test.) llvm-svn: 67672
* Parse deleted function definitions and hook them up to Doug's machinery.Sebastian Redl2009-03-241-0/+16
| | | | llvm-svn: 67653
* Fix the bug that Eli noticed where we wouldn't look at function decls ↵Anders Carlsson2009-03-241-21/+45
| | | | | | outside the class declaration. llvm-svn: 67627
* Template instantiation for constructorsDouglas Gregor2009-03-241-0/+9
| | | | llvm-svn: 67623
OpenPOWER on IntegriCloud