summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Reinstate r185229, reverted in r185256, with a tweak: further ignore theRichard Smith2013-06-301-35/+13
| | | | | | | | | | | | | | | | | | | | | | | standard's rule that an extern "C" declaration conflicts with any entity in the global scope with the same name. Now we only care if the global scope entity is a variable declaration (and so might have the same mangled name as the extern "C" declaration). This has been reported as a standard defect. Original commit message: PR7927, PR16247: Reimplement handling of matching extern "C" declarations across scopes. When we declare an extern "C" name that is not a redeclaration of an entity in the same scope, check whether it redeclares some extern "C" entity from another scope, and if not, check whether it conflicts with a (non-extern-"C") entity in the translation unit. When we declare a name in the translation unit that is not a redeclaration, check whether it conflicts with any extern "C" entities (possibly from other scopes). llvm-svn: 185281
* Revert r185229 as it breaks compilation of <windows.h>Timur Iskhodzhanov2013-06-291-13/+35
| | | | llvm-svn: 185256
* PR7927, PR16247: Reimplement handling of matching extern "C" declarationsRichard Smith2013-06-281-35/+13
| | | | | | | | | | | | | | | across scopes. When we declare an extern "C" name that is not a redeclaration of an entity in the same scope, check whether it redeclares some extern "C" entity from another scope, and if not, check whether it conflicts with a (non-extern-"C") entity in the translation unit. When we declare a name in the translation unit that is not a redeclaration, check whether it conflicts with any extern "C" entities (possibly from other scopes). llvm-svn: 185229
* A bit of program simplification from r185056Larisse Voufo2013-06-271-2/+1
| | | | llvm-svn: 185058
* Fix a conversion to incomplete type bug -- The error message now ↵Larisse Voufo2013-06-271-4/+9
| | | | | | specifically states that the type is incomplete and points to the forward declaration of the incomplete type. llvm-svn: 185056
* More of N3652: don't add an implicit 'const' to 'constexpr' member functions ↵Richard Smith2013-06-251-1/+2
| | | | | | when checking for overloads in C++1y. llvm-svn: 184865
* Extend -Wnon-pod-varargs to check calls made from member pointers.Richard Trieu2013-06-221-0/+3
| | | | llvm-svn: 184629
* Introduce a new mangling for protocol-qualified ObjC types in C++. This allowsEli Friedman2013-06-181-36/+3
| | | | | | | | | | | | to provide proper overloading, and also prevents mangling conflicts with template arguments of protocol-qualified type. This is a non-backward-compatible mangling change, but per discussion with John, the benefits outweigh this cost. Fixes <rdar://problem/14074822>. llvm-svn: 184250
* A quick fix to allow return type deduction on member templatesFaisal Vali2013-06-151-2/+19
| | | | | | | | | | by ensuring DiagnoseUseOfDecl is called both on the found decl and the decl being used (i.e the specialization in the case of member templates) whenever they are different. Per the exchange captured in http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130610/081636.html a more comprehensive fix that allows both decls to be passed into DiagnoseUseOfDecl is (or should be) forthcoming relatively soon. llvm-svn: 184043
* Don't suggest putting 'operator new' or 'operator delete' in a namespace to ↵Richard Smith2013-06-121-15/+30
| | | | | | fix a two-phase lookup issue. That's not permitted. llvm-svn: 183874
* Support for contextual conversion tweaks (N3323) was added, as Revision 183637Larisse Voufo2013-06-101-2/+2
| | | | llvm-svn: 183639
* reverted testLarisse Voufo2013-06-101-93/+241
| | | | llvm-svn: 183637
* Refactor places which perform contextual implicit conversions to go through aRichard Smith2013-05-211-44/+39
| | | | | | | | | | | | | common function. The C++1y contextual implicit conversion rules themselves are not yet implemented, however. This also fixes a subtle bug where template instantiation context notes were dropped for diagnostics coming from conversions for integral constant expressions -- we were implicitly slicing a SemaDiagnosticBuilder into a DiagnosticBuilder when producing these diagnostics, and losing their context notes in the process. llvm-svn: 182406
* PR15966: don't get confused by a complex integer -> complex integer conversionRichard Smith2013-05-101-1/+1
| | | | | | and misclassify it as a complex-real conversion. llvm-svn: 181626
* ArrayRef'ize Sema::BuildCallToObjectOfClassTypeDmitri Gribenko2013-05-091-25/+19
| | | | llvm-svn: 181562
* ArrayRef'ize some SemaOverload methodsDmitri Gribenko2013-05-091-56/+44
| | | | | | Patch by Robert Wilhelm. llvm-svn: 181544
* Grab-bag of bit-field fixes:John McCall2013-05-061-1/+1
| | | | | | | | | | | | | | - References to ObjC bit-field ivars are bit-field lvalues; fixes rdar://13794269, which got me started down this. - Introduce Expr::refersToBitField, switch a couple users to it where semantically important, and comment the difference between this and the existing API. - Discourage Expr::getBitField by making it a bit longer and less general-sounding. - Lock down on const_casts of bit-field gl-values until we hear back from the committee as to whether they're allowed. llvm-svn: 181252
* Replace 'MultiExprArg()' with 'None'Dmitri Gribenko2013-05-051-2/+2
| | | | llvm-svn: 181166
* ArrayRef'ization of some methods in SemaOverload. Patch by Robert Wilhelm!Richard Smith2013-05-051-117/+98
| | | | llvm-svn: 181158
* Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef ↵Dmitri Gribenko2013-05-051-2/+1
| | | | | | | | constructor from None Patch by Robert Wilhelm. llvm-svn: 181139
* Implement most of N3638 (return type deduction for normal functions).Richard Smith2013-05-041-0/+20
| | | | | | | Missing (somewhat ironically) is support for the new deduction rules in lambda functions, plus PCH support for return type patching. llvm-svn: 181108
* Don't build a call expression referring to a function which we're not allowedRichard Smith2013-05-041-4/+9
| | | | | | | | | to use. This makes very little difference right now (other than suppressing follow-on errors in some cases), but will matter more once we support deduced return types (we don't want expressions with undeduced return types in the AST). llvm-svn: 181107
* Use ArrayRef in AddMethodCandidate.Rafael Espindola2013-04-291-6/+9
| | | | | | Patch by Robert Wilhelm! llvm-svn: 180724
* Implement core issue 1608: class members can be found via operator lookup in ↵Richard Smith2013-04-201-6/+8
| | | | | | a trailing return type in that class's body. llvm-svn: 179941
* Fix PR15291: noreturn adjustment in overload resolution for function ↵Douglas Gregor2013-04-171-5/+8
| | | | | | templates, from Alexander Zinenko! llvm-svn: 179680
* Remove hasExternalLinkageUncached.Rafael Espindola2013-04-151-0/+3
| | | | | | | | It was being used correctly, but it is a very dangerous API to have around. Instead, move the logic from the filtering to when we are deciding if we should link two decls. llvm-svn: 179523
* <rdar://problem/13584715> Converted constant expressions are expected to ↵Douglas Gregor2013-04-081-1/+1
| | | | | | | | | | | | | | have integral values. We were assuming that any expression used as a converted constant expression would either not have a folded constant value or would be an integer, which is not the case for some ill-formed constant expressions. Because converted constant expressions are only used where integral values are expected, we can simply treat this as an error path. If that ever changes, we'll need to widen the interface of Sema::CheckConvertedConstantExpression() anyway. llvm-svn: 179068
* Fix PR15634, better error message for template deduction failure.Richard Trieu2013-04-081-4/+26
| | | | | | | | | | | | | When two template decls with the same name are used in this diagnostic, force them to print their qualified names. This changes the bad message of: candidate template ignored: could not match 'array' against 'array' to the better message of: candidate template ignored: could not match 'NS2::array' against 'NS1::array' llvm-svn: 179056
* Complain about attempts to befriend declarations via a usingJohn McCall2013-04-031-1/+2
| | | | | | declaration. Patch by Stephen Lin! llvm-svn: 178698
* <rdar://problem/13267210> Ensure that Sema::CompareReferenceRelationship ↵Douglas Gregor2013-03-261-1/+11
| | | | | | | | | | | | | returns consistent results with invalid types. When Sema::RequireCompleteType() is given a class template specialization type that then fails to instantiate, it returns 'true'. On subsequent invocations, it can return false. Make sure that this difference doesn't change the result of Sema::CompareReferenceRelationship, which is expected to remain stable while we're checking an initialization sequence. llvm-svn: 178088
* Avoid computing the linkage too early. Don't invalidate it.Rafael Espindola2013-03-141-15/+23
| | | | | | | | | | | | | | | | | | Before this patch we would compute the linkage lazily and cache it. When the AST was modified in ways that could change the value, we would invalidate the cache. That was fairly brittle, since any code could ask for the a linkage before the correct value was available. We should change the API to one where the linkage is computed explicitly and trying to get it when it is not available asserts. This patch is a first step in that direction. We still compute the linkage lazily, but instead of invalidating a cache, we assert that the AST modifications didn't change the result. llvm-svn: 176999
* Fix initializer for variables with attribute address_space set.Matt Arsenault2013-02-261-5/+1
| | | | | | | | | | | | This would error in C++ mode unless the variable also had a cv qualifier. e.g. __attribute__((address_space(2))) float foo = 1.0f; would error but __attribute__((address_space(2))) const float foo = 1.0f; would not. llvm-svn: 176121
* Remove the hack that avoided mangling static functions in extern C contexts.Rafael Espindola2013-02-231-8/+0
| | | | | | | | | | | | | | | | | Weather we should give C language linkage to functions and variables with internal linkage probably depends on how much code assumes it. The standard says they should have no language linkage, but gcc and msvc assign them C language linkage. This commit removes the hack that was preventing the mangling on static functions declare in extern C contexts. It is an experiment to see if we can implement the rules in the standard. If it turns out that many users depend on these functions and variables having C language linkage, we should change isExternC instead and try to convince the CWG to change the standard. llvm-svn: 175937
* Partially revert r175117 so that we don't break assumptions about howRafael Espindola2013-02-141-0/+8
| | | | | | | static functions in extern "C" contexts are mangled. Should fix the bootstrap. llvm-svn: 175132
* merge hasCLanguageLinkage and isExternC. Keep the shorter name.Rafael Espindola2013-02-141-1/+1
| | | | | | | | | | I added hasCLanguageLinkage while fixing some language linkage bugs some time ago so that I wouldn't have to check all users of isExternC. It turned out to be a much longer detour than expected, but this patch finally merges the two again. The isExternC function now implements just the standard notion of having C language linkage. llvm-svn: 175119
* The meat of this patch is in BuildCXXMemberCalLExpr where we make it useNick Lewycky2013-02-121-2/+0
| | | | | | | | | | | | MarkMemberReferenced instead of marking functions referenced directly. An audit of callers to MarkFunctionReferenced and DiagnoseUseOfDecl also caused a few other changes: * don't mark functions odr-used when considering them for an initialization sequence. Do mark them referenced though. * the function nominated by the cleanup attribute should be diagnosed. * operator new/delete should be diagnosed when building a 'new' expression. llvm-svn: 174951
* Enable overloading of OpenCL events - this is needed for the overloaded ↵Guy Benyei2013-02-071-0/+6
| | | | | | OpenCL builtin functions. llvm-svn: 174630
* Add OpenCL samplers as Clang builtin types and check sampler related ↵Guy Benyei2013-02-071-1/+3
| | | | | | restrictions. llvm-svn: 174601
* Apply the pure-virtual odr rule to other constructs which can call overloadedNick Lewycky2013-02-071-25/+14
| | | | | | operators. llvm-svn: 174584
* Improve 'failed template argument deduction' diagnostic for the case where weRichard Smith2013-01-311-31/+57
| | | | | | | | have a direct mismatch between some component of the template and some component of the argument. The diagnostic now says what the mismatch was, but doesn't yet say which part of the template doesn't match. llvm-svn: 174039
* Replace "failed template argument deduction" diagnostic with something usefulRichard Smith2013-01-311-2/+22
| | | | | | in the one case where we've already factored out a reason code. llvm-svn: 174036
* Fix mismatch between pointer and pointee type when diagnosing an incorrectRichard Smith2013-01-261-3/+2
| | | | | | object argument type for a member call. llvm-svn: 173554
* Start checking nonnull (as well as format and argument_with_type_tag) onNick Lewycky2013-01-241-0/+7
| | | | | | overloaded binary operators. llvm-svn: 173315
* Fix some wonky formatting, remove spurious emacs major mode marker. NoNick Lewycky2013-01-241-1/+1
| | | | | | functionality change! llvm-svn: 173314
* Add a new LangOpt NativeHalfType. This option allows for native half/fp16Joey Gouly2013-01-231-1/+2
| | | | | | | | operations (as opposed to storage only half/fp16). Also add some semantic checks for OpenCL half types. llvm-svn: 173254
* Fix regression in r172376. Don't try to detect missing 'constexpr' specifiersRichard Smith2013-01-141-2/+1
| | | | | | | on redeclarations, since that makes us pick wrong prior declarations under some circumstances. llvm-svn: 172384
* PR12008: defer adding the implicit 'const' to a constexpr member function untilRichard Smith2013-01-141-19/+28
| | | | | | we know whether it is static. llvm-svn: 172376
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-16/+16
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Fix a regression from 171193: main cannot be overloaded.Rafael Espindola2013-01-121-0/+5
| | | | | | Thanks Eli Friedman for noticing it. llvm-svn: 172292
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-4/+4
| | | | llvm-svn: 171367
OpenPOWER on IntegriCloud