summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* PR18234: Mark a tag definition as invalid early if it appears in aRichard Smith2014-01-081-1/+2
| | | | | | | | type-specifier in C++. Some checks will assert in this case otherwise (in particular, the access specifier may be missing if this happens inside a class definition, due to a violation of an AST invariant). llvm-svn: 198721
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-071-1/+1
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* It turns out the problem was a bit more wide-spread. Removing a lot of ↵Aaron Ballman2014-01-031-11/+7
| | | | | | | | unneeded typecasts. getScopeRep() already returns a NestedNameSpecifier. No functional changes intended. llvm-svn: 198414
* PR18246: When performing template argument deduction to decide which templateRichard Smith2013-12-141-3/+3
| | | | | | | | | | is specialized by an explicit specialization, start from the first declaration in case we've got a member of a class template (redeclarations might not number the template parameters the same way). Our recover here is still far from ideal. llvm-svn: 197305
* Take into consideration calling convention when processing specializations.Rafael Espindola2013-12-101-1/+4
| | | | | | This fixes pr18141. llvm-svn: 196855
* Sema: Enforce C++11 pointer-to-member template arguments should rulesDavid Majnemer2013-12-101-3/+1
| | | | | | | | | | | | The standard is pretty clear on what it allows inside of template arguments for non-type template parameters of pointer-to-member. They must be of the form &qualified-id and cannot come from sources like constexpr VarDecls or things of that nature. This fixes PR18192. llvm-svn: 196852
* Give a more appropriate diagnostic when a template specialization orRichard Smith2013-12-071-31/+33
| | | | | | | instantiation appears in a non-enclosing namespace (the previous diagnostic talked about the C++98 rule even in C++11 mode). llvm-svn: 196642
* Per [dcl.meaning]p1, a name in an inline namespace can be redeclared using aRichard Smith2013-12-051-1/+2
| | | | | | | name from the enclosing namespace set if the name is specified as a qualified-id. llvm-svn: 196464
* Reject template-ids containing literal-operator-ids that have a dependentRichard Smith2013-12-051-2/+1
| | | | | | | | | nested-name-specifier, rather than crashing. (In fact, reject all literal-operator-ids that have a non-namespace nested-name-specifier). The grammar doesn't allow these in some cases, and in other cases does allow them but instantiation will always fail. llvm-svn: 196443
* Fix crash if a dependent template-id was assumed to be a type but instantiatesRichard Smith2013-12-041-1/+2
| | | | | | to a variable template specialization. llvm-svn: 196337
* Fix several crash-on-invalids when using template-ids that aren'tRichard Smith2013-12-041-1/+1
| | | | | | simple-template-ids (eg, 'operator+<int>') in weird places. llvm-svn: 196333
* Handle CC and NoReturn when instantiating members of class templates.Rafael Espindola2013-12-011-1/+2
| | | | | | | | Before we were considering them only when instantiating templates. This fixes pr18033. llvm-svn: 196050
* Sema: Instantiate local class and their members appropriatelyDavid Majnemer2013-11-271-1/+4
| | | | | | | | | | | We would fail to instantiate them when the surrounding function was instantiated. Instantiate the class and add it's members to the list of pending instantiations, they should be resolved when we are finished with the function's body. This fixes PR9685. llvm-svn: 195827
* Remove a whole lot of unused variablesAlp Toker2013-11-271-5/+0
| | | | | | | There are about 30 removed in this patch, generated by a new FixIt I haven't got round to submitting yet. llvm-svn: 195814
* Further fixes when thiscall is the default for methods.Rafael Espindola2013-11-191-16/+3
| | | | | | | | | | | | | | | | | | The previous patches tried to deduce the correct function type. I now realize this is not possible in general. Consider class foo { template <typename T> static void bar(T v); }; extern template void foo::bar(const void *); We will only know that bar is static after a lookup, so we have to handle this in the template instantiation code. This patch reverts my previous two changes (but not the tests) and instead handles the issue in DeduceTemplateArguments. llvm-svn: 195154
* Issue a diagnostic if we see a templated friend declaration that we do notRichard Smith2013-11-081-3/+4
| | | | | | support. llvm-svn: 194273
* Sema: Emit a nicer diagnostic when IndirectFieldDecls show up ↵David Majnemer2013-10-261-2/+2
| | | | | | inappropriately in non-type template arguments llvm-svn: 193462
* Sema: Correctly build pointer-to-member arguments from a template argument ↵David Majnemer2013-10-261-1/+2
| | | | | | | | | | | | with an IndirectFieldDecl We only considered FieldDecl and CXXMethodDecl as appropriate which would cause us to believe the IndirectFieldDecl corresponded to an argument of it's field type instead of a pointer-to-member type. This fixes PR17696. llvm-svn: 193461
* Sema: Allow IndirectFieldDecl to appear in a non-type template argumentDavid Majnemer2013-10-221-1/+4
| | | | | | | | | | | We would not identify pointer-to-member construction in a non-type template argument if it was either a FieldDecl or a CXXMethodDecl. However, this would incorrectly reject declarations that were injected via an IndirectFieldDecl (e.g. a field inside of an anonymous union). This fixes PR17657. llvm-svn: 193203
* Sema: Do not allow template declarations inside local classesDavid Majnemer2013-10-221-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Enforce the rule in C++11 [temp.mem]p2 that local classes cannot have member templates. This fixes PR16947. N.B. C++14 has slightly different wording to afford generic lambdas declared inside of functions. Fun fact: Some formulations of local classes with member templates would cause clang to crash during Itanium mangling, such as the following: void outer_mem() { struct Inner { template <typename = void> struct InnerTemplateClass { static void itc_mem() {} }; }; Inner::InnerTemplateClass<>::itc_mem(); } Reviewers: eli.friedman, rsmith, doug.gregor, faisalv Reviewed By: doug.gregor CC: cfe-commits, ygao Differential Revision: http://llvm-reviews.chandlerc.com/D1866 llvm-svn: 193144
* Convert anachronistic use of 'void *' to 'DeclContext *' in Scope that was a ↵Ted Kremenek2013-10-081-1/+1
| | | | | | holdover from the long-dead Action interface. llvm-svn: 192203
* Make InstantiatingTemplate depth checks clearerAlp Toker2013-10-081-11/+10
| | | | | | | | | | The bool conversion operator on InstantiatingTemplate never added value and only served to obfuscate the template instantiation routines. This replaces the conversion and its callers with an explicit isInvalid() function to make it clear what's going on at a glance. llvm-svn: 192177
* Fix a bug where we failed to diagnose class template specializationChandler Carruth2013-09-271-0/+3
| | | | | | | | | uses. This fixes one of the two remaining failures to implement [[deprecated]] as specified for C++14. llvm-svn: 191572
* Variable templates: handle instantiation of static data member templatesRichard Smith2013-09-271-7/+2
| | | | | | appropriately, especially when they appear within class templates. llvm-svn: 191548
* Implement restriction that a partial specialization must actually specializeRichard Smith2013-09-241-3/+82
| | | | | | something, for variable templates. llvm-svn: 191278
* Remove some dead code.Richard Smith2013-09-181-6/+3
| | | | llvm-svn: 190959
* Fix accepts-invalid if a variable template explicit instantiation is missing anRichard Smith2013-09-181-9/+19
| | | | | | argument list, but could be instantiated with argument list of <>. llvm-svn: 190913
* getMostSpecialized for function template sets is never used in the context of aRichard Smith2013-09-101-2/+2
| | | | | | | call; remove its 'number of explicit arguments' and 'what kind of call' parameters. llvm-svn: 190444
* Ignore noreturn when checking function template specializationsReid Kleckner2013-09-101-2/+5
| | | | | | | | | | As requested when applying the same logic to calling conventions. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1634 llvm-svn: 190441
* Ignore calling conventions when checking function template specializationsReid Kleckner2013-09-101-3/+13
| | | | | | | | | | | | | | | | | | | | Summary: Calling conventions are inherited during decl merging. Before this change, deduction would fail due to a type mismatch between the template and the specialization. This change adjusts the CCs to match before deduction, and lets the decl merging logic diagnose mismatch or inherit the CC from the template. This allows specializations of static member function templates in the Microsoft C++ ABI. Reviewers: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1570 llvm-svn: 190377
* Simplify. This function bails out a few lines above if !Found.empty().Richard Smith2013-09-031-1/+1
| | | | llvm-svn: 189857
* Sema: Subst type default template args earlierDavid Majnemer2013-08-281-32/+41
| | | | | | | | | | | | | | | | | Summary: We would not perform substitution at an appropriate point, allowing strange results to appear. We would accepts things that we shouldn't or mangle things incorrectly. Note that this hasn't fixed the other cases like template-template parameters or non-type template parameters. Reviewers: doug.gregor, rjmccall, rsmith Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1507 llvm-svn: 189540
* Cleanup of OpaquePtr. No functionality changes.Serge Pavlov2013-08-271-4/+4
| | | | | | | | - Some documenation were added. - Usages of OpaquePtr<A>.getAsVal<A>() were replaced by OpaquePtr<A>.get(). - Methods getAs and getAsVal were renamed to getPtrTo and getPtrAs respectively. llvm-svn: 189346
* A clean-up pass, exploring the unification of traversals of class, variable ↵Larisse Voufo2013-08-231-3/+4
| | | | | | and function templates. llvm-svn: 189152
* Use pop_back_val() instead of both back() and pop_back().Robert Wilhelm2013-08-231-2/+1
| | | | | | No functionality change intended. llvm-svn: 189112
* Sema: Properly support Microsoft-mode template argumentsDavid Majnemer2013-08-231-95/+148
| | | | | | | | | | | | | | | | | | | | | | | | Summary: There were two things known to be wrong with our implementation of MSVC mode template arguments: - We didn't properly handle __uuidof/CXXUuidofExpr and skipped all type checking completely. - We didn't allow for MSVC's extension of allowing certain constant "foldable" expressions from showing up in template arguments. They allow various casts dereference and address-of operations. We can make it more general as we find further peculiarities but this is the known extent. Reviewers: rsmith, doug.gregor, rjmccall Reviewed By: doug.gregor CC: cfe-commits, rnk Differential Revision: http://llvm-reviews.chandlerc.com/D1444 llvm-svn: 189087
* Remove SequenceNumber from class/variable template partial specializations.Richard Smith2013-08-221-8/+2
| | | | | | | | This was only used to ensure that the traversal order was the same as the insertion order, but that guarantee was already being provided by the use of a FoldingSetVector. llvm-svn: 189075
* Improve support for static data member templates. This revision still has at ↵Larisse Voufo2013-08-221-1/+4
| | | | | | least one bug, as it does not respect the variable template specialization hierarchy well. llvm-svn: 188969
* Sema: Remove dead code in CheckTemplateArgumentAddressOfObjectOrFunctionDavid Majnemer2013-08-191-8/+0
| | | | | | | | | | | | | | | | Summary: DeclRefExpr::getDecl gives us back a ValueDecl, this isa<> check will never fire. Reviewers: eli.friedman, doug.gregor, majnemer Reviewed By: majnemer CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1434 llvm-svn: 188647
* Refactor all diagnosing of TypoCorrections through a common function, inRichard Smith2013-08-171-14/+6
| | | | | | | preparation for teaching this function how to diagnose a correction that includes importing a module. llvm-svn: 188602
* Bug fix: disallow a variable template to be redeclared as a non-templated ↵Larisse Voufo2013-08-141-33/+0
| | | | | | variable llvm-svn: 188350
* Implement [class.friend]p11's special name lookup rules for friend declarationsRichard Smith2013-08-091-2/+2
| | | | | | | | of local classes. We were previously handling this by performing qualified lookup within a function declaration(!!); replace it with the proper scope lookup. llvm-svn: 188050
* PR9992: Serialize and deserialize the token sequence for a function template inRichard Smith2013-08-071-3/+18
| | | | | | -fdelayed-template-parsing mode. Patch by Will Wilson! llvm-svn: 187916
* A bit of clean up based on peer's feedback...Larisse Voufo2013-08-061-5/+5
| | | | llvm-svn: 187784
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-061-61/+584
| | | | | | fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention... llvm-svn: 187762
* PR16288: A template is only missing a default template argument if it providesRichard Smith2013-07-221-4/+1
| | | | | | any default template arguments, not if it inherits some. llvm-svn: 186804
* SemaTemplate.cpp: Prune a stray "\param NumParamLists" in comment. ↵NAKAMURA Takumi2013-07-221-2/+0
| | | | | | [-Wdocumentation] llvm-svn: 186802
* Convert Sema::MatchTemplateParametersToScopeSpecifier to ArrayRef.Robert Wilhelm2013-07-211-36/+25
| | | | llvm-svn: 186794
* FIXME fix: improving diagnostics for template arguments deduction of class ↵Larisse Voufo2013-07-191-22/+29
| | | | | | | | templates and explicit specializations This patch essentially removes all the FIXMEs following calls to DeduceTemplateArguments() that want to keep track of deduction failure info. llvm-svn: 186730
* Revert "Use function overloading instead of template specialization for ↵Larisse Voufo2013-07-191-29/+22
| | | | | | | | diagnosis of bad template argument deductions." This reverts commit a730f548325756d050d4caaa28fcbffdae8dfe95. llvm-svn: 186729
OpenPOWER on IntegriCloud