summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseTemplate.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-2/+0
| | | | | | | These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475
* Clean up a large number of C++11 attribute parse issues, including parsingAlexis Hunt2012-06-231-1/+4
| | | | | | | | | | | | | | | | | | attributes in more places where we didn't and catching a lot more issues. This implements nearly every aspect of C++11 attribute parsing, except for: - Attributes are permitted on explicit instantiations inside the declarator (but not preceding the decl-spec) - Attributes are permitted on friend declarations of functions. - Multiple instances of the same attribute in an attribute-list (e.g. [[noreturn, noreturn]], not [[noreturn]] [[noreturn]] which is conforming) are allowed. The first two are marked as expected-FIXME in the test file and the latter is probably a defect and is currently untested. Thanks to Richard Smith for providing the lion's share of the testcases. llvm-svn: 159072
* Extend the error recovery for a template-argument-list terminated by '>>' toRichard Smith2012-06-181-21/+96
| | | | | | | | | also deal with '>>>' (in CUDA), '>=', and '>>='. Fix the FixItHints logic to deal with cases where the token is followed by an adjacent '=', '==', '>=', '>>=', or '>>>' token, where a naive fix-it would result in a differing token stream on a re-lex. llvm-svn: 158652
* Refactor DelayedDiagnostics so that it keeps diagnostics inJohn McCall2012-05-071-4/+7
| | | | | | | separate pools owned by the RAII objects that keep pushing decl state. This gives us quite a bit more flexibility. llvm-svn: 156289
* switch some uses of ExpectAndConsume(tok::semi to use ExpectAndConsumeSemi. ↵Chris Lattner2012-04-281-1/+1
| | | | | | | | | | | | | | | | | | | | This allows us to improve this diagnostic (telling us to insert another ")": t.c:2:19: error: expected ';' at end of declaration int x = 4+(5-12)); ^ ; to: t.c:2:19: error: extraneous ')' before ';' int x = 4+(5-12)); ^ ...telling us to remove the ")". This is PR12595. There are more uses of ExpectAndConsumeSemi that could be switched over, but I don't hit them on a daily basis :) llvm-svn: 155759
* Add a missing ExpressionEvaluationContext for template default arguments. ↵Eli Friedman2012-04-261-0/+1
| | | | | | Fixes PR12581. llvm-svn: 155670
* Parser: Don't manage TemplateAnnotationIds in a delayed cleanup pool.Benjamin Kramer2012-04-141-1/+1
| | | | | | | | | | Instead, make it the allocation function's responsibility to add them to a list and clear it when a top-level decl is finished. This plugs leakage of TemplateAnnotationIds. DelayedCleanupPool is ugly and unused, remove it. llvm-svn: 154743
* Fix bugs found by -Wconstant-conversion improvements currently under review.David Blaikie2012-04-091-18/+14
| | | | | | | | | | | | | | | | | | Specifically, using a an integer outside [0, 1] as a boolean constant seems to be an easy mistake to make with things like "x == a || b" where the author intended "x == a || x == b". The bug caused by calling SkipUntil with three token kinds was also identified by a VC diagnostic & reported by Francois Pichet as review feedback for my commit r154163. I've included test cases to verify the error recovery that was broken/poorly implemented due to this bug. The other fix (lib/Sema/SemaExpr.cpp) seems like that code was never actually reached in any of Clang's tests & is related to Objective C features I'm not familiar with, so I've not been able to construct a test case for it. Perhaps someone else can. llvm-svn: 154325
* Remove "parse error" in favor of more descriptive diagnostics.David Blaikie2012-04-061-6/+1
| | | | | | | | | | | In a few cases clang emitted a rather content-free diagnostic: 'parse error'. This change replaces two actual cases (template parameter parsing and K&R parameter declaration parsing) with more specific diagnostics and removes a third dead case of this in the BalancedDelimiterTracker (the ctor already checked the invariant necessary to ensure that the diag::parse_error was never actually used). llvm-svn: 154224
* Restrict fixit for missing 'class' in template template parameters.David Blaikie2012-04-061-15/+29
| | | | | | | | | | | Based on Doug's feedback to r153887 this omits the FixIt if the following token isn't syntactically valid for the context. (not a comma, '...', identifier, '>', or '>>') There's a bunch of work to handle the '>>' case, but it makes for a much more pleasant diagnostic in this case. llvm-svn: 154163
* Improve & simplify diagnostic for missing 'class' in template template ↵David Blaikie2012-04-051-5/+3
| | | | | | | | parameter. Change suggested by Sebastian Redl on review feedback from r153887. llvm-svn: 154102
* Remove windows line endings.David Blaikie2012-04-021-105/+105
| | | | llvm-svn: 153895
* Correct error recovery when missing 'class' in a template template parameter.David Blaikie2012-04-021-6/+11
| | | | | | | | | | | | | | | | | The diagnostic message correctly informs the user that they have omitted the 'class' keyword, but neither suggests this insertion as a fixit, nor attempts to recover as if they had provided the keyword. This fixes the recovery, adds the fixit, and adds a separate diagnostic and corresponding replacement fixit for cases where the user wrote 'struct' or 'typename' instead of 'class' (suggested by Richard Smith as a possible common mistake). I'm not sure the diagnostic message for either the original or new cases feel very Clang-esque, so I'm open to suggestions there. The fixit hints make it fairly easy to see what's required, though. llvm-svn: 153887
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-4/+4
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* In -fdelayed-template-parsing mode, reenter every scope when late parsing a ↵Francois Pichet2012-02-221-102/+106
| | | | | | | | | | 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
* Fix typo correction of template arguments to once again allow type names.Kaelyn Uhrain2012-02-221-1/+1
| | | | llvm-svn: 151112
* Allow thread safety attributes on function definitions.DeLesley Hutchins2012-02-161-1/+8
| | | | | | | | For compatibility with gcc, clang will now parse gcc attributes on function definitions, but issue a warning if the attribute is not a thread safety attribute. Warning controlled by -Wgcc-compat. llvm-svn: 150698
* PR11684, core issue 1417:Richard Smith2012-02-101-2/+3
| | | | | | | | | | | | | | o Correct the handling of the restrictions on usage of cv-qualified and ref-qualified function types. o Fix a bug where such types were rejected in template type parameter default arguments, due to such arguments not being treated as a template type arg context. o Remove the ExtWarn for usage of such types as template arguments; that was a standard defect, not a GCC extension. o Improve the wording and unify the code for diagnosing cv-qualifiers with the code for diagnosing ref-qualifiers. llvm-svn: 150244
* Added location for template keyword in TemplateSpecializationTypeLoc. In the ↵Abramo Bagnara2012-02-061-3/+3
| | | | | | process removed some naming ambiguities. llvm-svn: 149870
* Added source location for the template keyword in AST template-id expressions.Abramo Bagnara2012-01-271-4/+5
| | | | llvm-svn: 149127
* Pass context and access to Parser::ParseExplicitInstantiation() forArgyrios Kyrtzidis2011-12-231-6/+9
| | | | | | | | good parser error recovery and for not crashing. We still have a accepts-invalid-code bug. llvm-svn: 147216
* Revert most of r145372 for now. Lookahead beyond the ';' in a functionRichard Smith2011-11-301-14/+0
| | | | | | | | | declaration tickles a bug in the way we handle visibility pragmas. The improvement to error recovery for template function definitions declared with the 'typedef' specifier in r145372 is unrelated and not reverted here. llvm-svn: 145541
* Add fix-it to remove 'typedef' from function template definitions. Such a tokenRichard Smith2011-11-291-3/+5
| | | | | | | was probably meant to be 'typename', which we will have already suggested if it is appropriate. llvm-svn: 145395
* PR10101: Recover better from a common copy-paste error: if a functionRichard Smith2011-11-291-10/+16
| | | | | | | | declaration at namespace scope is followed by a semicolon and an open-brace (or in C++, a 'try', ':' or '='), then the error is probably a function definition with a spurious ';', rather than a mysterious '{'. llvm-svn: 145372
* Implement -Wc++98-compat warnings for the parser.Richard Smith2011-10-151-9/+9
| | | | llvm-svn: 142056
* Reinstate r141898 (reverted in r141921), without the ↵Richard Smith2011-10-141-4/+8
| | | | | | | | -Wc++98-compat-variadic-templates flag. Consensus is that -Wc++98-compat is a useful addition to clang, but per-C++11-feature warnings may not be. Original patch by Jeffrey Yasskin. llvm-svn: 141985
* Revert the -Wc++98-compat flag because dgregor doesn't like it.Jeffrey Yasskin2011-10-141-8/+4
| | | | llvm-svn: 141921
* Implement the first piece of a -Wc++98-compat flag so that people can build inJeffrey Yasskin2011-10-131-4/+8
| | | | | | | | C++11 mode but keep their sources compatible with C++98. This patch implements the -Wc++98-compat-variadic-templates sub-flag and -Wc++98-compat to include it. llvm-svn: 141898
* Allow for annotate attributes after access specifiers. When suchErik Verbruggen2011-10-131-6/+11
| | | | | | attributes are found, propagate them to subsequent declarations. llvm-svn: 141861
OpenPOWER on IntegriCloud