summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Use function overloading instead of template specialization for diagnosis of ↵Larisse Voufo2013-07-191-22/+29
| | | | | | bad template argument deductions. llvm-svn: 186727
* Reinstate r186040, with additional fixes and more test coverage (reverted inRichard Smith2013-07-171-2/+1
| | | | | | | | | | | | | r186331). Original commit log: If we friend a declaration twice, that should not make it visible to name lookup in the surrounding context. Slightly rework how we handle friend declarations to inherit the visibility of the prior declaration, rather than setting a friend declaration to be visible whenever there was a prior declaration. llvm-svn: 186546
* Re-revert r86040, which was un-reverted in r186199.Chandler Carruth2013-07-151-1/+2
| | | | | | | | | | | | | | | This breaks the build of basic patterns with repeated friend declarations. See the added test case in SemaCXX/friend.cpp or the test case reported to the original commit log. Original commit log: If we friend a declaration twice, that should not make it visible to name lookup in the surrounding context. Slightly rework how we handle friend declarations to inherit the visibility of the prior declaration, rather than setting a friend declaration to be visible whenever there was a prior declaration. llvm-svn: 186331
* Unrevert r186040, reverted in r186185, with fix for PR16597.Richard Smith2013-07-121-2/+1
| | | | | | | | | | | Original commit log: If we friend a declaration twice, that should not make it visible to name lookup in the surrounding context. Slightly rework how we handle friend declarations to inherit the visibility of the prior declaration, rather than setting a friend declaration to be visible whenever there was a prior declaration. llvm-svn: 186199
* Revert r186040 to fix PR16597 while Richard investigates what the bestChandler Carruth2013-07-121-1/+2
| | | | | | | | | | | | | fix is. Original commit log: If we friend a declaration twice, that should not make it visible to name lookup in the surrounding context. Slightly rework how we handle friend declarations to inherit the visibility of the prior declaration, rather than setting a friend declaration to be visible whenever there was a prior declaration. llvm-svn: 186185
* If we friend a declaration twice, that should not make it visible to nameRichard Smith2013-07-101-2/+1
| | | | | | | | | lookup in the surrounding context. Slightly rework how we handle friend declarations to inherit the visibility of the prior declaration, rather than setting a friend declaration to be visible whenever there was a prior declaration. llvm-svn: 186040
* Part of PR15673: If a function template has a default argument in whichRichard Smith2013-07-041-3/+9
| | | | | | | | | substitution failed, report that as a substitution failure rather than pretending that there was no default argument. The test cases in PR15673 have exposed some pre-existing poor diagnostics here. llvm-svn: 185604
* Allow typo correction to try removing nested name specifiers.Kaelyn Uhrain2013-07-021-3/+7
| | | | | | | | | | | | | | | | | The removal is tried by retrying the failed lookup of a correction candidate with either the MemberContext or SS (CXXScopeSpecifier) or both set to NULL if they weren't already. If the candidate identifier is then looked up successfully, make a note in the candidate that the SourceRange should include any existing nested name specifier even if the candidate isn't adding a different one (i.e. the candidate has a NULL NestedNameSpecifier). Also tweak the diagnostic messages to differentiate between a suggestion that just replaces the identifer but leaves the existing nested name specifier intact and one that replaces the entire qualified identifier, in cases where the suggested replacement is unqualified. llvm-svn: 185487
* Remove unnecessary check.Eli Friedman2013-06-271-1/+1
| | | | llvm-svn: 185108
* PR8302: Check for shadowing a template parameter when declaring a templateRichard Smith2013-06-251-23/+19
| | | | | | template parameter. llvm-svn: 184884
* Implement DR21David Majnemer2013-06-251-7/+9
| | | | | | | | | | A default template-argument shall not be specified in a friend template declaration. Interestingly, we properly handled default template arguments on friend class members but not on just friend classes. llvm-svn: 184882
* Fix assert if an attempt is made to explicitly instantiate an alias template.Richard Smith2013-06-221-3/+11
| | | | | | Patch by Ismail Pazarbasi! llvm-svn: 184650
* Use FPT::getArgTypes() instead of manually building ArrayRefsReid Kleckner2013-06-101-3/+1
| | | | | | | | Made significantly easier with git-clang-format. Differential Revision: http://llvm-reviews.chandlerc.com/D947 llvm-svn: 183694
* PR16273: Weaken a bogus assertion.Richard Smith2013-06-071-1/+2
| | | | llvm-svn: 183550
* When the template specialization header is missing, set a valid source ↵Argyrios Kyrtzidis2013-06-051-0/+1
| | | | | | | | | | | location for the template keyword when recovering. Otherwise ClassTemplateSpecializationDecl::getSourceRange() will mistakenly consider itself as an implicit partial specialization and lead to a crash. Fixes rdar://14063074 llvm-svn: 183325
* A little ArrayRef'ization.Richard Smith2013-05-171-1/+1
| | | | llvm-svn: 182074
* Cleanup handling of UniqueExternalLinkage.Rafael Espindola2013-05-131-2/+2
| | | | | | | | | | | | | This patch renames getLinkage to getLinkageInternal. Only code that needs to handle UniqueExternalLinkage specially should call this. Linkage, as defined in the c++ standard, is provided by getFormalLinkage. It maps UniqueExternalLinkage to ExternalLinkage. Most places in the compiler actually want isExternallyVisible, which handles UniqueExternalLinkage as internal. llvm-svn: 181677
* When modifying an implicit instantiation with information from an explicit ↵Argyrios Kyrtzidis2013-04-221-0/+1
| | | | | | | | | | one, make sure to reset the "right brace" location. Otherwise the source range of the explicit instantiation may become invalid (begin location will be after the end location). rdar://13706991 llvm-svn: 180070
* Annotate flavor of TLS variable (statically or dynamically initialized) onto ↵Richard Smith2013-04-131-2/+1
| | | | | | the AST. llvm-svn: 179447
* Add 178663 back.Rafael Espindola2013-04-031-2/+1
| | | | | | | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green before it processed the reverted 178663, so it could not have been the culprit. Revert "Revert 178663." This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41. llvm-svn: 178682
* Revert 178663.Rafael Espindola2013-04-031-1/+2
| | | | | | | | | | Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb Revert "Don't compute a patched/semantic storage class." This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05. llvm-svn: 178681
* Don't compute a patched/semantic storage class.Rafael Espindola2013-04-031-2/+1
| | | | | | | | | | | For variables and functions clang used to store two storage classes. The one "as written" in the code and a patched one, which, for example, propagates static to the following decls. This apparently is from the days clang lacked linkage computation. It is now redundant and this patch removes it. llvm-svn: 178663
* Add TagDecl::hasNameForLinkage(), which is true if the tagJohn McCall2013-03-091-1/+1
| | | | | | is non-anonymous or is defined in a typedef of itself. llvm-svn: 176742
* Sema: Preserve attributes on parameters in instantiated function templates.Jordan Rose2013-03-081-1/+5
| | | | | | | | | | | | | | | | | | This was causing correctness issues for ARC and the static analyzer when a function template has "consumed" Objective-C object parameters (i.e. parameters that will be released by the function before returning). The fix is threefold: (1) Actually copy over the attributes from old ParmVarDecls to new ones. (2) Have Sema::BuildFunctionType only work for building FunctionProtoTypes, which it was doing anyway. This allows us to pass an ExtProtoInfo instead of a plain ExtInfo and several flags. (3) Drop param attributes as part of StripImplicitInstantiation, which is used when an implicit instantiation is followed by an explicit one. <rdar://problem/12685622> llvm-svn: 176728
* ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.Jordan Rose2013-03-081-2/+3
| | | | | | No (intended) functionality change. llvm-svn: 176726
* PR15360: nullptr as a non-type template argument to a function type non-type ↵David Blaikie2013-02-271-9/+10
| | | | | | template parameter llvm-svn: 176216
* Use None rather than Optional<T>() where possible.David Blaikie2013-02-211-1/+1
| | | | llvm-svn: 175705
* Include llvm::Optional in clang/Basic/LLVM.hDavid Blaikie2013-02-201-4/+4
| | | | | | Post-commit CR feedback from Jordan Rose regarding r175594. llvm-svn: 175679
* Replace TypeLoc llvm::cast support to be well-defined.David Blaikie2013-02-181-8/+8
| | | | | | | | | | | | | | The TypeLoc hierarchy used the llvm::cast machinery to perform undefined behavior by casting pointers/references to TypeLoc objects to derived types and then using the derived copy constructors (or even returning pointers to derived types that actually point to the original TypeLoc object). Some context is in this thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html Though it's spread over a few months which can be hard to read in the mail archive. llvm-svn: 175462
* This patch makes "&Cls::purevfn" not an odr use. This isn't what the standardNick Lewycky2013-02-021-1/+1
| | | | | | | | | says, but that's a defect (to be filed). "Cls::purevfn()" is still an odr use. Also fixes a bug that caused us to not mark the function referenced just because we didn't want to mark it odr used. llvm-svn: 174242
* Apply adjustment to function- and array-typed non-type templateDouglas Gregor2013-01-161-0/+13
| | | | | | | parameters (per C++ [temp.param]p8) when computing the type of a reference to a non-type template parameter. Fixes <rdar://problem/13000548>. llvm-svn: 172585
OpenPOWER on IntegriCloud