summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Canonicalize else.Mike Stump2009-08-041-65/+48
| | | | llvm-svn: 78102
* Produce a warning that partial ordering of function templates is not yet ↵Douglas Gregor2009-08-021-2/+4
| | | | | | supported llvm-svn: 77928
* Add CK_DerivedToBase and use it PerformObjectMemberConversion.Anders Carlsson2009-07-311-1/+2
| | | | llvm-svn: 77652
* Add a CastKind enum to CastExpr. Right now it's not used for much but it ↵Anders Carlsson2009-07-311-0/+1
| | | | | | will be :) llvm-svn: 77650
* Change uses of:Ted Kremenek2009-07-291-45/+45
| | | | | | | | | | | | | | | | | | | | 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
* Implement C++ semantics for C-style and functional-style casts. This ↵Sebastian Redl2009-07-251-1/+1
| | | | | | | | regresses Clang extension conversions, like vectors, but allows conversions via constructors and conversion operators. Add custom conversions to static_cast. llvm-svn: 77076
* Remove a bunch of FIXME's related to ObjC type checking.Steve Naroff2009-07-231-1/+2
| | | | | | | | - Move Sema::ObjCQualifiedIdTypesAreCompatible(), Sema::QualifiedIdConformsQualifiedId(), and a couple helper functions to ASTContext. - Change ASTContext::canAssignObjCInterfaces() to use ASTContext:: ObjCQualifiedIdTypesAreCompatible(). - Tweak several test cases to accommodate the new/improved type checking. llvm-svn: 76830
* Remove ASTContext::getCanonicalDecl() and use Decl::getCanonicalDecl in its ↵Argyrios Kyrtzidis2009-07-181-2/+2
| | | | | | place. llvm-svn: 76274
* Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methodsTed Kremenek2009-07-171-45/+45
| | | | | | | | | 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-15/+15
| | | | | | Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents. llvm-svn: 76139
* Replace Type::getAsReferenceType() with Type::getAs<ReferenceType>().Ted Kremenek2009-07-171-2/+2
| | | | llvm-svn: 76132
* Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.Ted Kremenek2009-07-161-28/+28
| | | | | | | | | | | | | | | | | | | | | This method is intended to eventually replace the individual Type::getAsXXXType<> methods. The motivation behind this change is twofold: 1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of them are basically copy-and-paste. 2) By centralizing the implementation of the getAs<Type> logic we can more smoothly move over to Doug Gregor's proposed canonical type smart pointer scheme. Along with this patch: a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>. b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>. llvm-svn: 76098
* Remove ASTContext::isObjCObjectPointerType().Steve Naroff2009-07-161-1/+1
| | | | | | Convert all clients to use the new predicate on Type. llvm-svn: 76076
* Implement the ObjC pseudo built-in types as clang "BuiltinType's". I say ↵Steve Naroff2009-07-151-10/+3
| | | | | | | | | | | | pseudo built-in types, since Sema still injects a typedef for recognition (i.e. they aren't truly built-ins from a parser perspective). This removes the static data/methods on ObjCObjectPointerType while preserving the nice API (no need to fiddle with ASTContext:-). This patch also adds Type::isObjCBuiltinType(). This should be the last fairly large patch related to recrafting the ObjC type system. The follow-on patches should be fairly small. llvm-svn: 75808
* Basic support for C++0x unicode types. Support for literals will follow in ↵Alisdair Meredith2009-07-141-1/+2
| | | | | | an incremental patch llvm-svn: 75622
* For C++ overloaded operator calls, set the source location of the ↵Argyrios Kyrtzidis2009-07-141-1/+1
| | | | | | DeclRefExpr to the location of the operator. llvm-svn: 75600
* This patch includes a conceptually simple, but very intrusive/pervasive change. Steve Naroff2009-07-101-69/+57
| | | | | | | | | | | | The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches. This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic. By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks. llvm-svn: 75314
* Add test for C++ [over.over.]p1, the contexts in which one can take the ↵Douglas Gregor2009-07-091-1/+1
| | | | | | address of an overloaded function. llvm-svn: 75146
* Implement the simple form of overload resolution used when taking theDouglas Gregor2009-07-081-11/+62
| | | | | | | address of an overloaded function (which may involve both functions and function templates). llvm-svn: 75069
* Implement template argument deduction when taking the address of aDouglas Gregor2009-07-081-19/+46
| | | | | | | | function template. Most of the change here is in factoring out the common bits used for template argument deduction from a function call and when taking the address of a function template. llvm-svn: 75044
* Overload resolution prefers non-templates to templatesDouglas Gregor2009-07-071-8/+18
| | | | llvm-svn: 74971
* When explicit template arguments are provided for a function call,Douglas Gregor2009-06-301-8/+28
| | | | | | | | | substitute those template arguments into the function parameter types prior to template argument deduction. There's still a bit of work to do to make this work properly when only some of the template arguments are specified. llvm-svn: 74576
* De-ASTContext-ify DeclContext.Argyrios Kyrtzidis2009-06-301-5/+4
| | | | | | | Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating". Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit. llvm-svn: 74506
* Remove the ASTContext parameter from the attribute-related methods of Decl.Argyrios Kyrtzidis2009-06-301-2/+2
| | | | | | | | | The implementations of these methods can Use Decl::getASTContext() to get the ASTContext. This commit touches a lot of files since call sites for these methods are everywhere. I used pre-tokenized "carbon.h" and "cocoa.h" headers to do some timings, and there was no real time difference between before the commit and after it. llvm-svn: 74501
* Improve support for overloaded operator templates.Douglas Gregor2009-06-271-7/+24
| | | | llvm-svn: 74390
* Improved semantic analysis and AST respresentation for functionDouglas Gregor2009-06-251-8/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | templates. For example, this now type-checks (but does not instantiate the body of deref<int>): template<typename T> T& deref(T* t) { return *t; } void test(int *ip) { int &ir = deref(ip); } Specific changes/additions: * Template argument deduction from a call to a function template. * Instantiation of a function template specializations (just the declarations) from the template arguments deduced from a call. * FunctionTemplateDecls are stored directly in declaration contexts and found via name lookup (all forms), rather than finding the FunctionDecl and then realizing it is a template. This is responsible for most of the churn, since some of the core declaration matching and lookup code assumes that all functions are FunctionDecls. llvm-svn: 74213
* Implement matching of function templates, so that one can declare overloaded ↵Douglas Gregor2009-06-241-2/+27
| | | | | | function templates. C++ [temp.over.link] paragraphs 4-8. llvm-svn: 74079
* Keep track of when declarations are "used" according to C andDouglas Gregor2009-06-191-16/+28
| | | | | | | | | | | | C++. This logic is required to trigger implicit instantiation of function templates and member functions of class templates, which will be implemented separately. This commit includes support for -Wunused-parameter, printing warnings for named parameters that are not used within a function/Objective-C method/block. Fixes <rdar://problem/6505209>. llvm-svn: 73797
* Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.Douglas Gregor2009-06-181-2/+2
| | | | llvm-svn: 73702
* Avoid using the built-in type checker for assignment in C++ when classes are ↵Sebastian Redl2009-05-211-0/+9
| | | | | | involved. Patch by Vyacheslav Kononenko. llvm-svn: 72212
* Template instantiation for array subscript expressions. This was farDouglas Gregor2009-05-191-1/+2
| | | | | | | easier than expected because of the limitation that subscript operators must be member functions. llvm-svn: 72076
* Reflow some comments.Mike Stump2009-05-161-11/+11
| | | | llvm-svn: 71936
* Implement C++0x nullptr.Sebastian Redl2009-05-101-1/+9
| | | | llvm-svn: 71405
* When determining whether an expression refers to a bit-field, lookDouglas Gregor2009-05-021-9/+8
| | | | | | | | | 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
* Get rid of the implicit deref call when calling member functions where the ↵Anders Carlsson2009-05-011-12/+22
| | | | | | base is a pointer. llvm-svn: 70562
* Implement semantic analysis for transparent unions. This is largelyDouglas Gregor2009-04-291-1/+5
| | | | | | | based on a patch from Anders Johnsen. CodeGen support is incomplete, in that we do not properly coerce to the first field's type. llvm-svn: 70419
* Conditional operator C++ checking complete. What issues remain are in more ↵Sebastian Redl2009-04-191-12/+67
| | | | | | general code. llvm-svn: 69555
* Fix a crash bug when comparing overload quality of conversion operators with ↵Sebastian Redl2009-04-161-12/+49
| | | | | | | | | | | 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
* Parse deleted member functions. Parsing member declarations goes through a ↵Sebastian Redl2009-04-121-21/+39
| | | | | | | | | 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
* implement rdar://6780761, making sema reject some code that otherwiseChris Lattner2009-04-121-6/+8
| | | | | | crashes codegen. llvm-svn: 68891
* Propagate the ASTContext to various AST traversal and lookup functions.Douglas Gregor2009-04-091-4/+6
| | | | | | No functionality change (really). llvm-svn: 68726
* Hopefully fix the rval regressions. Thanks to Chris for pointing out that ↵Sebastian Redl2009-03-291-0/+2
| | | | | | valgrind complains. llvm-svn: 68021
* Reintroduce r67870 (rval ref overloading), since I can't reproduce any test ↵Sebastian Redl2009-03-291-7/+8
| | | | | | failures on i386 or x86_64. If this fails for someone, please contact me. llvm-svn: 67999
* QualType can go in SmallPtrSet now, simplify code that used to haveChris Lattner2009-03-291-42/+4
| | | | | | to work around this. llvm-svn: 67968
* Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for aChris Lattner2009-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | 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
* Revert Sebastian's rvalue patch (r67870) since it caused test failures inAnders Carlsson2009-03-281-8/+7
| | | | | | | | 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-7/+8
| | | | llvm-svn: 67870
* Type::isObjectType now implements the (more sensible) C++ definitionDouglas Gregor2009-03-241-3/+2
| | | | | | | | | | | | | | | | | | of "object type" rather than the C definition of "object type". The difference is that C's "object type" excludes incomplete types such as struct X; However, C's definition also makes it far too easy to use isObjectType as a means to detect incomplete types when in fact we should use other means (e.g., Sema::RequireCompleteType) that cope with C++ semantics, including template instantiation. I've already audited every use of isObjectType and isIncompleteType to ensure that they are doing the right thing for both C and C++, so this is patch does not change any functionality. llvm-svn: 67648
* Disallow catching exceptions by rvalue reference.Sebastian Redl2009-03-221-6/+17
| | | | llvm-svn: 67492
* Almost complete implementation of rvalue references. One bug, and a few ↵Sebastian Redl2009-03-161-21/+30
| | | | | | unclear areas. Maybe Doug can shed some light on some of the fixmes. llvm-svn: 67059
OpenPOWER on IntegriCloud