summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Reject overloading of two static extern C functions.Rafael Espindola2012-12-281-1/+9
| | | | | | | | This patch moves hasCLanguageLinkage to be VarDecl and FunctionDecl methods so that they can be used from SemaOverload.cpp and then fixes the logic in Sema::IsOverload. llvm-svn: 171193
* Improve diagnostic wording for when an implicitly-deleted special memberRichard Smith2012-12-281-9/+6
| | | | | | function is selected by overload resolution. llvm-svn: 171190
* PR14695: Fix assert from bad cast<>. Not every namespace is a NamespaceDecl; ↵Richard Smith2012-12-221-5/+12
| | | | | | it might instead be a TranslationUnitDecl. llvm-svn: 170976
* Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as ↵David Blaikie2012-12-191-4/+4
| | | | | | | | | | | | | | | per review discussion in r170365 This does limit these typedefs to being sequences, but no current usage requires them to be contiguous (we could expand this to a more general iterator pair range concept at some point). Also, it'd be nice if SmallVector were constructible directly from an ArrayRef but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the inverse conversion. (& generalizing over all range-like things, while nice, would require some nontrivial SFINAE I haven't thought about yet) llvm-svn: 170482
* Fix overload resolution for the initialization of a multi-dimensionalRichard Smith2012-12-091-1/+1
| | | | | | | | | | array from a braced-init-list. There seems to be a core wording wart here (it suggests we should be testing whether the elements of the init list are implicitly convertible to the array element type, not whether there is an implicit conversion sequence) but our prior behavior appears to be a bug, not a deliberate effort to implement the standard as written. llvm-svn: 169690
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-8/+9
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Don't return a pointer to an UnresolvedSetImpl in the CXXRecordDecl interface,Argyrios Kyrtzidis2012-11-281-25/+30
| | | | | | expose only the iterators instead. llvm-svn: 168770
* Sema: Provide a valid source location when instantiating templates based on ↵Benjamin Kramer2012-11-231-1/+1
| | | | | | | | a CXXDefaultArgExpr. Fixes PR13758. llvm-svn: 168521
* When we have a MemberExpr referring to an overloaded static member function,Richard Smith2012-11-141-0/+1
| | | | | | | | | and we resolve it to a specific function based on the type which it's used as, don't forget to mark it as referenced. Fixes a regression introduced in r167514. llvm-svn: 167918
* When filtering the list of associated namespaces so that we don't suggest peopleNick Lewycky2012-11-131-11/+9
| | | | | | | add functions to namespace 'std', also filter out namespaces with '__' anywhere in the name. llvm-svn: 167786
* Use isInvalidDecl() instead of isStatic() as suggested by dblaikie.Nico Weber2012-11-091-1/+1
| | | | | | | I couldn't think of a way to make an operator() invalid without returning earlier from this function other than making it static, so no new test. llvm-svn: 167609
* Don't crash on calling static member overloaded operator, PR14120Nico Weber2012-11-091-0/+5
| | | | | | Patch from Brian Brooks! llvm-svn: 167604
* Fix a bug I found while preparing my devmtg talk: When passing NULL to aMatt Beaumont-Gay2012-11-081-2/+12
| | | | | | | | | | | | function that takes a const Foo&, where Foo is convertible from a large number of pointer types, we print ALL the overloads, no matter the setting of -fshow-overloads. There is potential follow-on work in unifying the "print candidates, but not too many" logic between OverloadCandidateSet::NoteCandidates and ImplicitConversionSequence::DiagnoseAmbiguousConversion. llvm-svn: 167596
* PR11851 (and duplicates): Whenever a constexpr function is referenced,Richard Smith2012-11-071-9/+0
| | | | | | | | | instantiate it if it can be instantiated and implicitly define it if it can be implicitly defined. This matches g++'s approach. Remove some cases from SemaOverload which were marking functions as referenced when just planning how overload resolution would proceed; such cases are not actually references. llvm-svn: 167514
* Use a .def file for most of the diagnostic options.Douglas Gregor2012-10-231-3/+2
| | | | llvm-svn: 166520
* DR1442: In a range-based for statement, namespace 'std' is not an associatedRichard Smith2012-10-181-13/+5
| | | | | | namespace. llvm-svn: 166194
* Clearing a SmallPtrSet is still expensive, split it out from ↵Benjamin Kramer2012-10-091-1/+5
| | | | | | OverloadCandidateSet::clear and don't do it on destruction. llvm-svn: 165501
* StringRef-ify Binary/UnaryOperator::getOpcodeStrDavid Blaikie2012-10-081-2/+2
| | | | llvm-svn: 165383
* Add FP_CONTRACT support for clang.Lang Hames2012-10-021-14/+16
| | | | | | | | Clang will now honor the FP_CONTRACT pragma and emit LLVM fmuladd intrinsics for expressions of the form A * B + C (when they occur in a single statement). llvm-svn: 164989
* Fix crash when a decltype expression in a trailing return type refers to theRichard Smith2012-09-251-0/+23
| | | | | | | | | | function being instantiated. An error recovery codepath was recursively performing name lookup (and triggering an unbounded stack of template instantiations which blew out the stack before hitting the depth limit). Patch by Wei Pan! llvm-svn: 164586
* Remove Context argument from TemplateDeductionInfo constructor. It was no ↵Craig Topper2012-09-191-5/+5
| | | | | | longer needed after the unused Context member was removed in r164104. llvm-svn: 164196
* Fix a small bug in the way we handle builtin candidates forEli Friedman2012-09-181-10/+12
| | | | | | relational operators of enumeration type. From the gcc testsuite. llvm-svn: 164171
* Revert r163829. The world (or libstdc++, at least) is not ready.Richard Smith2012-09-131-0/+6
| | | | llvm-svn: 163846
* Implement C++11 [conv.prom]p4: an enumeration with a fixed underlying type hasRichard Smith2012-09-131-1/+15
| | | | | | | | | integral promotions to both its underlying type and to its underlying type's promoted type. This matters now that boolean conversions aren't permitted in converted constant expressions (a la DR1407): an enumerator with a fixed underlying type of bool still can be. llvm-svn: 163841
* Don't perform template argument deduction against invalid templates;Douglas Gregor2012-09-131-0/+7
| | | | | | | it's likely to lead to a crash later on. Fixes PR12933 / <rdar://problem/11525335>. llvm-svn: 163838
* Remove speculative fix for C++ core issue 1407, since it was resolved as NAD.Richard Smith2012-09-131-6/+0
| | | | llvm-svn: 163829
* Instantiate class template specializations during ADL.John McCall2012-08-241-1/+1
| | | | llvm-svn: 162586
* Push ArrayRef through the Expr hierarchy.Benjamin Kramer2012-08-241-15/+20
| | | | | | No functionality change. llvm-svn: 162552
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-3/+3
| | | | | | | These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475
* Better diagnostics for range-based for loops with bad range types.Sam Panzer2012-08-211-57/+176
| | | | | | | | | | | | | The old error message stating that 'begin' was an undeclared identifier is replaced with a new message explaining that the error is in the range expression, along with which of the begin() and end() functions was problematic if relevant. Additionally, if the range was a pointer type or defines operator*, attempt to dereference the range, and offer a FixIt if the modified range works. llvm-svn: 162248
* Test commit: deleted whitespace on blank lineSam Panzer2012-08-161-1/+1
| | | | llvm-svn: 162006
* Implement warning for integral null pointer constants other than the literal 0.David Blaikie2012-08-081-7/+11
| | | | | | | | | | | | | | | | | | | | This is effectively a warning for code that violates core issue 903 & thus will become standard error in the future, hopefully. It catches strange null pointers such as: '\0', 1 - 1, const int null = 0; etc... There's currently a flaw in this warning (& the warning for 'false' as a null pointer literal as well) where it doesn't trigger on comparisons (ptr == '\0' for example). Fix to come in a future patch. Also, due to this only being a warning, not an error, it triggers quite frequently on gtest code which tests expressions for null-pointer-ness in a SFINAE context (so it wouldn't be a problem if this was an error as in an actual implementation of core issue 903). To workaround this for now, the diagnostic does not fire in unevaluated contexts. Review by Sean Silva and Richard Smith. llvm-svn: 161501
* Fix some minor typosSylvestre Ledru2012-07-311-1/+1
| | | | llvm-svn: 161036
* Fix a typo (the the => the)Sylvestre Ledru2012-07-231-1/+1
| | | | llvm-svn: 160622
* No longer assuming the number of prototype arguments is always less than the ↵Aaron Ballman2012-07-201-1/+1
| | | | | | number of formal parameters for a variadic function call. llvm-svn: 160570
* Fix OverloadCandidateSet::clear to not leak PartialDiagnostics, found by SamuelRichard Smith2012-07-181-1/+4
| | | | | | | | Panzer. I've not been able to trigger a failure caused by this, so no test yet. Also included is a small change from Paul Robinson to only consider the FailureKind if the overload candidate did actually fail. llvm-svn: 160470
* Unrevert r158887, reverted in r158949, along with a fix for the bug whichRichard Smith2012-06-251-3/+3
| | | | | | | | | | | | | | | | | | | | resulted in it being reverted. A test for that bug was added in r158950. Original comment: If an object (such as a std::string) with an appropriate c_str() member function is passed to a variadic function in a position where a format string indicates that c_str()'s return type is desired, provide a note suggesting that the user may have intended to call the c_str() member. Factor the non-POD-vararg checking out of DefaultVariadicArgumentPromotion and move it to SemaChecking in order to facilitate this. Factor the call checking out of function call checking and block call checking, and extend it to cover constructor calls too. Patch by Sam Panzer! llvm-svn: 159159
* Documentation cleanup: making \param and \returns docs match the code.James Dennett2012-06-221-1/+1
| | | | llvm-svn: 158985
* Diagnostics cleanup: Fixing \params to match the code.James Dennett2012-06-221-24/+4
| | | | llvm-svn: 158981
* Documentation cleanup:James Dennett2012-06-221-5/+3
| | | | | | | | | | | | | | | * Primarily fixed \param commands with names not matching any actual parameters of the documented functions. In many cases this consists just of fixing up the parameter name in the \param to match the code, in some it means deleting obsolete documentation and occasionally it means documenting the parameter that has replaced the older one that was documented, which sometimes means some simple reverse-engineering of the docs from the implementation; * Fixed \param ParamName [out] to the correct format with [out] before the parameter name; * Fixed some \brief summaries. llvm-svn: 158980
* Revert r158887. This fixes pr13168.Rafael Espindola2012-06-211-3/+3
| | | | | | | | Revert "If an object (such as a std::string) with an appropriate c_str() member function" This reverts commit 7d96f6106bfbd85b1af06f34fdbf2834aad0e47e. llvm-svn: 158949
* If an object (such as a std::string) with an appropriate c_str() member functionRichard Smith2012-06-211-3/+3
| | | | | | | | | | | | | | | is passed to a variadic function in a position where a format string indicates that c_str()'s return type is desired, provide a note suggesting that the user may have intended to call the c_str() member. Factor the non-POD-vararg checking out of DefaultVariadicArgumentPromotion and move it to SemaChecking in order to facilitate this. Factor the call checking out of function call checking and block call checking, and extend it to cover constructor calls too. Patch by Sam Panzer! llvm-svn: 158887
* Fix -Wc++11-narrowing warnings for narrowing negative values to larger unsignedRichard Smith2012-06-191-8/+11
| | | | | | types to actually includes the value, rather than saying <uninitialized>. llvm-svn: 158745
* Remove some debugging code that snuck into r158691.Kaelyn Uhrain2012-06-191-5/+0
| | | | llvm-svn: 158733
* Improve the error message when a function overload candidate is rejectedKaelyn Uhrain2012-06-191-5/+20
| | | | | | | | | | | | | | | | | because it expects a reference and receives a non-l-value. For example, given: int foo(int &); template<int x> void b() { foo(x); } clang will now print "expects an l-value for 1st argument" instead of "no known conversion from 'int' to 'int &' for 1st argument". The change in wording (and associated code to detect the case) was prompted by comment #5 in PR3104, and should be the last bit of work needed for the bug. llvm-svn: 158691
* Documentation cleanup:James Dennett2012-06-151-1/+1
| | | | | | | | | * Removed \param comments for parameters that no longer exist; * Fixed a "\para" typo to "\param"; * Escaped @, # and \ symbols as needed in Doxygen comments; * Added use of \brief to output short summaries. llvm-svn: 158498
* Add missing narrowing check: converting from a signed integral type to a widerRichard Smith2012-06-131-5/+11
| | | | | | unsigned type is narrowing if the source is non-constant or negative. llvm-svn: 158377
* PR12964: __int128 and unsigned __int128 are promoted integral types, be sure toRichard Smith2012-06-101-17/+23
| | | | | | consider them when enumerating builtin operator candidates. llvm-svn: 158293
* When adding built-in operator candidates for overload resolutionDouglas Gregor2012-06-041-26/+110
| | | | | | | | involving 'restrict', place restrict on the pointer type rather than on the pointee type. Also make sure that we gather restrict from the pointer type. Fixes PR12854 and the major part of PR11093. llvm-svn: 157910
* DR1152 / PR12931 / PR6177: A candidate function which requires binding a constRichard Smith2012-05-241-1/+1
| | | | | | | | volatile reference to a temporary is not viable. My interpretation is that DR1152 was a bugfix, not a rule change for C++11, so this is not conditional on the language mode. This matches g++'s behavior. llvm-svn: 157370
OpenPOWER on IntegriCloud