summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/DelayedTemplateParsing.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [MS] Warn when shadowing template parameters under -fms-compatibilityReid Kleckner2019-09-121-16/+0
| | | | | | | | | | | | | | | | | | | | Summary: C++ does not allow shadowing template parameters, but previously we allowed it under -fms-extensions. Now this behavior is controlled by -fms-compatibility, and we emit a -Wmicrosoft-template warning when it happens. Fixes PR43265 Reviewers: thakis, hans Subscribers: amccarth, rsmith, STL_MSFT, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67463 llvm-svn: 371753
* [MS] Push outermost class DeclContexts only in -fdelayed-template-parsingReid Kleckner2018-11-271-0/+30
| | | | | | | This is more or less a complete rewrite of r347627, and it fixes PR38460 I added a reduced test case to DelayedTemplateParsing.cpp. llvm-svn: 347713
* Revert r347627 "[MS] Push fewer DeclContexts for delayed template parsing"Reid Kleckner2018-11-271-17/+0
| | | | | | | | | | | It broke the Windows self-host: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/1799/steps/stage%202%20build/logs/stdio I can build lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/MachinePostDominators.cpp.obj to repro. llvm-svn: 347630
* [MS] Push fewer DeclContexts for delayed template parsingReid Kleckner2018-11-271-0/+17
| | | | | | | | | | | | | Only push the outermost record as a DeclContext when parsing a function body. See the comments in Sema::getContainingDC about the way the parser pushes contexts. This is intended to match the behavior the parser normally displays where it parses all method bodies from all nested classes at the end of the outermost class, when all nested classes are complete. Fixes PR38460. llvm-svn: 347627
* If a function decl cannot be merged, mark it as invalid.Nico Weber2015-01-171-2/+2
| | | | | | | | | | | | | | | | | | | Clang currently crashes on class C { C() = default; C() = delete; }; My cunning plan for fixing this was to change the `if (!FnD)` in Parser::ParseCXXInlineMethodDef() to `if (!FnD || FnD->isInvalidDecl)` – but alas, the second constructor decl wasn't marked as invalid. This lets Sema::MergeFunctionDecl() return true on function redeclarations, which leads to them being marked invalid. This also improves error messages when functions are redeclared. llvm-svn: 226365
* Handle -fdelayed-template-parsing of out-of-line definitions ofHans Wennborg2014-05-021-0/+58
| | | | | | | | | | | class template member classes (PR19613) Also improve this code in general by implementing suggestions from Richard. Differential Revision: http://reviews.llvm.org/D3555?id=9020 llvm-svn: 207822
* Fix crash if delayed template parsing meets an erroneous trailing return type.Richard Smith2014-03-121-0/+2
| | | | | | | Based on a patch and test by Stephan Tolksdorf! Refactoring and fixing adjacent brokenness by me. llvm-svn: 203733
* Parse: Disable delayed template parsing for constexpr functionsDavid Majnemer2013-10-231-0/+7
| | | | | | | | | | | | | | | Commit r191484 treated constexpr function templates as normal function templates with respect to delaying their parsing. However, this is unnecessarily restrictive because there is no compatibility concern with constexpr, MSVC doesn't support it. Instead, simply disable delayed template parsing for constexpr function templates. This largely reverts the changes made in r191484 but keeps it's unit test. This fixes PR17661. llvm-svn: 193274
* Sema: Respect -fdelayed-template-parsing when parsing constexpr functionsDavid Majnemer2013-09-271-0/+12
| | | | | | | | | | | | | | Functions declared as constexpr must have their parsing delayed in -fdelayed-template-parsing mode so as not to upset later template instantiation. N.B. My reading of the standard makes it seem like delayed template parsing is at odds with constexpr. We may want to make refinements in other places in clang to make constexpr play nicer with this feature. This fixes PR17334. llvm-svn: 191484
* Sema: Do not merge new decls with invalid, old declsDavid Majnemer2013-07-071-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Sema::MergeFunctionDecl attempts merging two decls even if the old decl is invalid. This can lead to interesting circumstances where we successfully merge the decls but the result makes no sense. Take the following for example: template <typename T> int main(void); int main(void); Sema will not consider these to be overloads of the same name because main can't be overloaded, which means that this must be a redeclaration. In this case the templated decl is compatible with the non-templated decl allowing the Sema::CheckFunctionDeclaration machinery to move on and do bizarre things like setting the previous decl of a non-templated decl to a templated decl! The way I see it, we should just bail from MergeFunctionDecl if the old decl is invalid. This fixes PR16531. llvm-svn: 185779
* Support the use of "=delete" and "=default" with delayed templateDouglas Gregor2012-06-281-1/+12
| | | | | | parsing. Fixes <rdar://problem/11700604>. llvm-svn: 159380
* In -fdelayed-template-parsing mode, reenter every scope when late parsing a ↵Francois Pichet2012-02-221-0/+27
| | | | | | | | | | templated function; (Not just the template parameter scope as previously). Also enter the scope stack in the correct order. Otherwise this breaks some invariant during name lookup especially when dealing with shadowed declaration Fix PR11931. llvm-svn: 151140
* Enable delayed template parsing for friend functions declared at template ↵Francois Pichet2011-11-181-0/+4
| | | | | | class scope. llvm-svn: 144980
* [microsoft] Fix a bug in -fdelayed-template-parsing mode where we were not ↵Francois Pichet2011-09-221-2/+21
| | | | | | | | | | reentering the delayed function context correctly. The problem was that all template params were reintroduced inside the same scope. So if we had a situation where we had 2 template params with the same name at different scope then clang would generate an error about ambiguous name. The solution is to create a new ParseScope(Scope::TemplateParamScope) for each template scope that we want to reenter. (from the outmost to the innermost scope) This fixes some errors when parsing MFC code with clang. llvm-svn: 140344
* Remove hard coded dos line endings, let subversion translate them onChandler Carruth2011-04-251-42/+42
| | | | | | | | update. Despite the diff, nothing but line endings changed here. llvm-svn: 130121
* Correctly emit a diagnostic for multiple templated function definitions in ↵Francois Pichet2011-04-221-3/+14
| | | | | | -flate-template-parsing mode. llvm-svn: 130030
* Add -fdelayed-template-parsing option. Using this option all templated ↵Francois Pichet2011-04-221-0/+31
function definitions are parsed at the end of the translation unit only if it is required by an actual instantiation. As such all the symbols of the TU are available during name lookup. Using this flag is necessary for compatibility with Microsoft template code. This also provides some parsing speed improvement. llvm-svn: 130022
OpenPOWER on IntegriCloud