summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseTemplate.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [Concepts] Parsing of requires-clause in template-declarationHubert Tong2015-06-251-1/+12
| | | | | | | | | | | | | | | | | | | Summary: This change implements parse-only acceptance of the optional requires-clause in a template-declaration. Diagnostic testing is added for cases where the grammar is ambiguous with the expectation that the longest token sequence which matches the syntax of a constraint-expression is consumed without backtracking. Reviewers: faisalv, fraggamuffin, rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D10462 llvm-svn: 240611
* [clang] Refactoring of conditions so they use isOneOf() instead of multiple ↵Daniel Marjamaki2015-06-181-22/+19
| | | | | | is(). llvm-svn: 240008
* PR20625: Instantiate static constexpr member function of a local struct in a ↵Richard Smith2015-05-111-1/+3
| | | | | | | | | | | | | | | function template earlier. This is necessary in order to allow the use of a constexpr member function, or a member function with deduced return type, of a local class within a surrounding instantiated function template specialization. Patch by Michael Park! This re-commits r236063, which was reverted in r236134, along with a fix for a delayed template parsing bug that was exposed by this change. llvm-svn: 237064
* Diagnose function template definitions inside functionsReid Kleckner2014-12-151-0/+10
| | | | | | | | | | | | | | | The parser can only be tricked into parsing a function template definition by inserting a typename keyword before the function template declaration. This used to make us crash, and now it's fixed. While here, remove an unneeded boolean parameter from ParseDeclGroup. This boolean always corresponded to non-typedef declarators at file scope. ParseDeclGroup already has precise diagnostics for the function definition typedef case, so we can let that through. Fixes PR21839. llvm-svn: 224287
* Ensure typos in the default values of template parameters get diagnosed.Kaelyn Takata2014-12-021-1/+1
| | | | llvm-svn: 223177
* C++1y is now C++14!Aaron Ballman2014-08-191-1/+1
| | | | | | Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording. llvm-svn: 215982
* Wrap to 80 columns, no behavior change.Nico Weber2014-08-151-1/+2
| | | | llvm-svn: 215776
* A static_assert declaration cannot be a template; adding the diagnostic for ↵Aaron Ballman2014-08-041-0/+8
| | | | | | this instead of silently accepting and producing possibly-unexpected behavior. llvm-svn: 214770
* Fix PR20081: Parsing templates in the presence of -x cuda -std=c++11Eli Bendersky2014-06-201-2/+5
| | | | | | http://reviews.llvm.org/D4222 llvm-svn: 211357
* [C++1z] Implement N4051: 'typename' is permitted instead of 'class' when ↵Richard Smith2014-06-161-10/+22
| | | | | | declaring a template template parameter. llvm-svn: 211031
* Remove an unused variableTimur Iskhodzhanov2014-06-061-2/+0
| | | | llvm-svn: 210324
* PR11306 - Variadic template fix-it suggestion. Recover from misplaced or ↵Nikola Smiljanic2014-06-061-3/+40
| | | | | | redundant ellipsis in parameter pack. llvm-svn: 210304
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-291-2/+2
| | | | | | takeAs to getAs. llvm-svn: 209800
* [C++11] Use 'nullptr'. Parser edition.Craig Topper2014-05-211-16/+16
| | | | llvm-svn: 209275
* Replace a fake enum class with the real thing.Richard Smith2014-05-161-1/+1
| | | | llvm-svn: 208943
* Handle -fdelayed-template-parsing of out-of-line definitions ofHans Wennborg2014-05-021-31/+10
| | | | | | | | | | | 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
* Improve error recovery around colon.Serge Pavlov2014-04-131-0/+1
| | | | | | | | | | Parse of nested name spacifier is modified so that it properly recovers if colon is mistyped as double colon in case statement. This patch fixes PR15133. Differential Revision: http://llvm-reviews.chandlerc.com/D2870 llvm-svn: 206135
* Introduce and use Decl::getAsFunction() to simplify templated function checksAlp Toker2014-01-221-5/+5
| | | | | | | | | | | | | | Lift the getFunctionDecl() utility out of the parser into a general Decl::getAsFunction() and use it to simplify other parts of the implementation. Reduce isFunctionOrFunctionTemplate() to a simple type check that works the same was as the other is* functions and move unwrapping of shadowed decls to callers so it doesn't get run twice. Shuffle around canSkipFunctionBody() to reduce virtual dispatch on ASTConsumer. There's no need to query when we already know the body can't be skipped. llvm-svn: 199794
* Parse: Token consumption modernization and loop de-nestingAlp Toker2014-01-051-5/+3
| | | | | | Cleanup only. llvm-svn: 198539
* ExpectAndConsume: Diagnose errors automaticallyAlp Toker2014-01-011-5/+3
| | | | | | | | | | | | | | 1) Teach ExpectAndConsume() to emit expected and expected-after diagnostics using the generic diagnostic descriptions added in r197972, eliminating another set of trivial err_expected_* variations while maintaining existing behaviour. 2) Lift SkipUntil() recovery out of ExpectAndConsume(). The Expect/Consume family of functions are primitive parser operations that now have the well-defined property of operating on single tokens. Factoring out recovery exposes opportunities for more consistent and tailored error recover at the call sites instead of just relying on a bottled SkipUntil formula. llvm-svn: 198270
* Support and use token kinds as diagnostic argumentsAlp Toker2013-12-241-2/+2
| | | | | | | | | | | | | | | | | | | Introduce proper facilities to render token spellings using the diagnostic formatter. Replaces most of the hard-coded diagnostic messages related to expected tokens, which all shared the same semantics but had to be multiply defined due to variations in token order or quote marks. The associated parser changes are largely mechanical but they expose commonality in whole chunks of the parser that can now be factored away. This commit uses C++11 typed enums along with a speculative legacy fallback until the transition is complete. Requires corresponding changes in LLVM r197895. llvm-svn: 197972
* Refactor and micro-optimize ConsumeToken()Alp Toker2013-12-171-47/+20
| | | | | | | | | | | | 1) Introduce TryConsumeToken() to handle the common test-and-consume pattern. This brings about readability improvements in the parser and optimizes to avoid redundant checks in the common case. 2) Eliminate the ConsumeCodeCompletionTok special case from ConsumeToken(). This was used by only one caller which has been switched over to the more appropriate ConsumeCodeCompletionToken() function. llvm-svn: 197497
* Fix PR17637: incorrect calculation of template parameter depthFaisal Vali2013-12-041-2/+4
| | | | | | In delayed template parsing mode, adjust the template depth counter for each template parameter list associated with an out of line member template specialization. llvm-svn: 196351
* Replaced bool parameters in SkipUntil function with single bit-based parameter.Alexey Bataev2013-11-181-10/+15
| | | | llvm-svn: 194994
* Parse: Do not 'HandleTopLevelDecl' on templated functions.David Majnemer2013-08-161-5/+1
| | | | | | | | | | | | | | | | Summary: HandleTopLevelDecl on a templated function leads us to try and mangle it. Reviewers: rsmith Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1412 llvm-svn: 188536
* Avoid spurious error messages if parent template class cannot be instantiatedSerge Pavlov2013-08-101-0/+2
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D924 llvm-svn: 188133
* PR9992: Serialize and deserialize the token sequence for a function template inRichard Smith2013-08-071-28/+17
| | | | | | -fdelayed-template-parsing mode. Patch by Will Wilson! llvm-svn: 187916
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-061-17/+16
| | | | | | 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
* Use SmallVectorImpl::reverse_iterator instead of SmallVector to avoid ↵Craig Topper2013-07-081-2/+2
| | | | | | specifying the vector size. llvm-svn: 185784
* Instantiation bug fix extension (cf. r184503) -- minor code fixes, including ↵Larisse Voufo2013-06-221-10/+9
| | | | | | a typo that caused a runtime assertion after firing diagnosis for class definitions, with the 'template' keyword as template header, in friend declarations. llvm-svn: 184634
* Bug Fix: Template explicit instantiations should not have definitions ↵Larisse Voufo2013-06-211-1/+32
| | | | | | (FixIts yet to be tested.) llvm-svn: 184503
* Fix the parser's updating of the template depth when parsing local templates ↵Faisal Vali2013-06-081-3/+5
| | | | | | | | | and late-parsed templates. This is a slight tweak of r180708; It avoids incrementing depth when non-template local classes nested within member templates of local classes are encountered. This patch was LGTM'd by Doug http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130506/079656.html and passed the regression tests that normally pass (i.e. excluding many Module and Index tests on Windows that fail regardless) llvm-svn: 183620
* Revert r183618. Faisal Vali2013-06-081-1355/+1354
| | | | | | I ran clang-format on my patch but it seemed to have wreaked havoc with new lines - might have to do with using it on windows :( will resubmit once i've cleaned this issue up. sorry. llvm-svn: 183619
* Fix the parser's updating of the template depth when parsing local templates ↵Faisal Vali2013-06-081-1354/+1355
| | | | | | | | and late-parsed templates. This is a slight tweak of r180708; It avoids incrementing depth when non-template local classes nested within member templates of local classes are encountered. This patch was LGTM'd by Doug http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130506/079656.html and passed the regression tests that normally pass (i.e. excluding many Module and Index tests on Windows that fail regardless) llvm-svn: 183618
* <rdar://problem/13806270> A template argument list is a constant-evaluated ↵Douglas Gregor2013-05-031-0/+3
| | | | | | context. llvm-svn: 181076
* Keep the parser's template depth up to date when parsing local templates andRichard Smith2013-04-291-43/+27
| | | | | | late-parsed templates. Patch by Faisal Vali! llvm-svn: 180708
* Properly reenter multiple contexts when parsing a late-parsed function templateRichard Smith2013-04-291-34/+32
| | | | | | within a dependent context. Patch by Will Wilson (+clang-format)! llvm-svn: 180702
* [Parser] Don't code-complete twice.Argyrios Kyrtzidis2013-03-271-1/+1
| | | | | | | | | | | | | | | When we are consuming the current token just to enter a new token stream, we push the current token in the back of the stream so that we get it again. Unfortunately this had the effect where if the current token is a code-completion one, we would code-complete once during consuming it and another time after the stream ended. Fix this by making sure that, in this case, ConsumeAnyToken() will consume a code-completion token without invoking code-completion. rdar://12842503 llvm-svn: 178199
* Add missing diagnostic for a nested-name-specifier on a free-standing type ↵Richard Smith2013-03-181-2/+6
| | | | | | definition. Bump some related diagnostics from warning to extension in C++, since they're errors there. Add some missing checks for function specifiers on non-function declarations. llvm-svn: 177335
* Per the grammar in [dcl.dcl]p1, a simple-declaration can only have attributesRichard Smith2013-02-221-6/+7
| | | | | | if it has declarators. We were missing the check for this in a couple of places. llvm-svn: 175876
* PR14918: Don't confuse braced-init-lists after template variable declarationsRichard Smith2013-01-151-27/+17
| | | | | | | | | | | with function definitions. We really should remove Parser::isDeclarationAfterDeclarator entirely, since it's meaningless in C++11 (an open brace could be either a function definition or an initializer, which is what it's trying to differentiate between). The other caller of it happens to be correct right now... llvm-svn: 172510
* s/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few ↵Richard Smith2013-01-021-1/+1
| | | | | | nearby 'C++0x' comments. llvm-svn: 171372
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-3/+3
| | | | llvm-svn: 171367
* Don't require a space between the two ">" in "vector<id<protocol>>" in objc++11.Nico Weber2012-12-141-44/+58
| | | | | | | | C++11 allowed writing "vector<vector<int>>" without a space between the two ">". This change allows this for protocols in template lists too in -std=c++11 mode, and improves the diagnostic in c++98 mode. llvm-svn: 170223
* fix spelloNico Weber2012-12-141-1/+1
| | | | llvm-svn: 170176
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+3
| | | | | | | | | | | | | 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
* ParseTemplate.cpp: Prune obsolete descriptions in ↵NAKAMURA Takumi2012-11-141-10/+0
| | | | | | | | | | | | | | | | ParseSingleDeclarationAfterTemplate(), for now. [-Wdocumentation] /// \param TemplateParams if non-NULL, the template parameter lists /// that preceded this declaration. In this case, the declaration is a /// template declaration, out-of-line definition of a template, or an /// explicit template specialization. When NULL, the declaration is an /// explicit template instantiation. /// /// \param TemplateLoc when TemplateParams is NULL, the location of /// the 'template' keyword that indicates that we have an explicit /// template instantiation. llvm-svn: 167982
* ParseTemplate.cpp: Doxygen fix in AnnotateTemplateIdToken(). [-Wdocumentation]NAKAMURA Takumi2012-11-141-1/+1
| | | | llvm-svn: 167908
* Thread safety analysis: Fixed ICE caused by double delete when late parsedDeLesley Hutchins2012-11-021-1/+1
| | | | | | attributes are attached to function declarations nested inside a class method. llvm-svn: 167321
* Now that ASTMultiPtr is nothing more than a array reference, make it a ↵Benjamin Kramer2012-08-231-4/+2
| | | | | | | | MutableArrayRef. This required changing all get() calls to data() and using the simpler constructors. llvm-svn: 162501
OpenPOWER on IntegriCloud