summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/cxx-template-decl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Diagnose function template definitions inside functionsReid Kleckner2014-12-151-0/+13
| | | | | | | | | | | | | | | 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
* Suggest fix-it for missing '{' after base-clauseIsmail Pazarbasi2014-09-251-0/+15
| | | | llvm-svn: 218468
* [C++1z] Implement N4051: 'typename' is permitted instead of 'class' when ↵Richard Smith2014-06-161-0/+6
| | | | | | declaring a template template parameter. llvm-svn: 211031
* Fix PR17637: incorrect calculation of template parameter depthFaisal Vali2013-12-041-0/+77
| | | | | | 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
* Fix name in test.Rafael Espindola2013-11-081-1/+1
| | | | llvm-svn: 194291
* Fix %select numbering confusion between diagnostic and Diag call.Richard Smith2013-11-081-0/+1
| | | | llvm-svn: 194281
* PR8302: Check for shadowing a template parameter when declaring a templateRichard Smith2013-06-251-0/+13
| | | | | | template parameter. llvm-svn: 184884
* Fix bugs found by -Wconstant-conversion improvements currently under review.David Blaikie2012-04-091-0/+7
| | | | | | | | | | | | | | | | | | 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-1/+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
* Fix diagnostic text for r154163.David Blaikie2012-04-061-2/+2
| | | | llvm-svn: 154164
* Restrict fixit for missing 'class' in template template parameters.David Blaikie2012-04-061-2/+2
| | | | | | | | | | | 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-2/+2
| | | | | | | | parameter. Change suggested by Sebastian Redl on review feedback from r153887. llvm-svn: 154102
* Correct error recovery when missing 'class' in a template template parameter.David Blaikie2012-04-021-4/+2
| | | | | | | | | | | | | | | | | 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
* When we are missing the ',' or '>' to terminate a template parameterDouglas Gregor2010-10-151-1/+3
| | | | | | list, complain about it! Fixes PR7053. llvm-svn: 116551
* Downgrade the "declaration does not declare anything" error to aDouglas Gregor2010-04-081-1/+1
| | | | | | | warning. It's not harmful to have such pointless declarations, and GCC does not diagnose this issue consistently. llvm-svn: 100814
* Teach C++ name lookup that it's okay to look in a scope without aDouglas Gregor2010-02-051-0/+10
| | | | | | | | context. This happens fairly rarely (which is why we got away with this bug). Fixes PR6184, where we skipped over the template parameter scope while tentatively parsing. llvm-svn: 95376
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Remove unnecessary -fms-extensions=0 from tests (this command line syntax is ↵Daniel Dunbar2009-11-291-1/+1
| | | | | | going away). llvm-svn: 90066
* Implement support for default template arguments of function templates.Douglas Gregor2009-11-251-1/+1
| | | | llvm-svn: 89874
* Improve diagnostics when parsing something likeDouglas Gregor2009-10-301-0/+4
| | | | | | | | template<> struct foo<int> { ... }; where "foo" does not refer to a template. Fixes PR3844. llvm-svn: 85616
* Disabling some MS extensions which cause these tests to failJohn Thompson2009-10-271-1/+1
| | | | llvm-svn: 85236
* Improve checking for specializations of member classes of classDouglas Gregor2009-10-081-3/+6
| | | | | | | | | | | templates, and keep track of how those member classes were instantiated or specialized. Make sure that we don't try to instantiate an explicitly-specialized member class of a class template, when that explicit specialization was a declaration rather than a definition. llvm-svn: 83547
* WIP implementation of explicit instantiation of function templates,Douglas Gregor2009-09-251-1/+2
| | | | | | | | member functions of class template specializations, and static data members. The mechanics are (mostly) present, but the semantic analysis is very weak. llvm-svn: 82789
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-1/+1
| | | | llvm-svn: 81346
* Implement support for out-of-line definitions of the class members of classDouglas Gregor2009-07-221-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | templates, e.g., template<typename T> struct Outer { struct Inner; }; template<typename T> struct Outer<T>::Inner { // ... }; Implementing this feature required some extensions to ActOnTag, which now takes a set of template parameter lists, and is the precursor to removing the ActOnClassTemplate function from the parser Action interface. The reason for this approach is simple: the parser cannot tell the difference between a class template definition and the definition of a member of a class template; both have template parameter lists, and semantic analysis determines what that template parameter list means. There is still some cleanup to do with ActOnTag and ActOnClassTemplate. This commit provides the basic functionality we need, however. llvm-svn: 76820
* Implement parsing and semantic analysis for out-of-line definitions of staticDouglas Gregor2009-07-221-1/+2
| | | | | | | data members of class templates. We don't instantiate the definitions yet, however. llvm-svn: 76756
* Improved semantic analysis and AST respresentation for functionDouglas Gregor2009-06-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | templates. For example, this now type-checks (but does not instantiate the body of deref<int>): template<typename T> T& deref(T* t) { return *t; } void test(int *ip) { int &ir = deref(ip); } Specific changes/additions: * Template argument deduction from a call to a function template. * Instantiation of a function template specializations (just the declarations) from the template arguments deduced from a call. * FunctionTemplateDecls are stored directly in declaration contexts and found via name lookup (all forms), rather than finding the FunctionDecl and then realizing it is a template. This is responsible for most of the churn, since some of the core declaration matching and lookup code assumes that all functions are FunctionDecls. llvm-svn: 74213
* Make sure that the template parameter lists get from the parser down to ↵Douglas Gregor2009-06-241-1/+1
| | | | | | ActOnFunctionDeclarator for function template definitions llvm-svn: 74040
* Diagnose class members that shadow a template parameter. FixesDouglas Gregor2009-06-171-0/+11
| | | | | | | | | | <rdar://problem/6952203>. To do this, we actually remove a not-quite-correct optimization in the C++ name lookup routines. We'll revisit this optimization for the general case once more C++ is working. llvm-svn: 73659
* Parse typeof-specifier the same way as sizeof/alignof are parsed.Argyrios Kyrtzidis2009-05-221-0/+5
| | | | | | | | -Makes typeof consistent with sizeof/alignof -Fixes a bug when '>' is in a typeof expression, inside a template type param: A<typeof(x>1)> a; llvm-svn: 72255
* Refactor the parsing of declarations so that template declarations canDouglas Gregor2009-05-121-2/+1
| | | | | | | | | | parse just a single declaration and provide a reasonable diagnostic when the "only one declarator per template declaration" rule is violated. This eliminates some ugly, ugly hackery where we used to require thatn the layout of a DeclGroup of a single element be the same as the layout of a single declaration. llvm-svn: 71596
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Make "implicit int" an error in C++ (unless we're allowing MicrosoftDouglas Gregor2009-02-161-8/+10
| | | | | | extensions). This caught a couple bugs in our test suite :) llvm-svn: 64686
* Implement parsing, semantic analysis and ASTs for default templateDouglas Gregor2009-02-101-2/+2
| | | | | | | | | arguments. This commit covers checking and merging default template arguments from previous declarations, but it does not cover the actual use of default template arguments when naming class template specializations. llvm-svn: 64229
* Basic representation of C++ class templates, from Andrew Sutton.Douglas Gregor2009-02-041-3/+3
| | | | llvm-svn: 63750
* Diagnose declarations that don't declare anything, and fix PR3020.Sebastian Redl2008-12-281-4/+6
| | | | | | | | Examples: int; typedef int; llvm-svn: 61454
* Keep track of template arguments when we parse them. Right now, we don't ↵Douglas Gregor2008-12-241-1/+2
| | | | | | actually do anything with the template arguments, but they'll be used to create template declarations llvm-svn: 61413
* Representation of template type parameters and non-type templateDouglas Gregor2008-12-051-1/+25
| | | | | | | | | | | | | | | parameters, with some semantic analysis: - Template parameters are introduced into template parameter scope - Complain about template parameter shadowing (except in Microsoft mode) Note that we leak template parameter declarations like crazy, a problem we'll remedy once we actually create proper declarations for templates. Next up: dependent types and value-dependent/type-dependent expressions. llvm-svn: 60597
* A little more scaffolding for parsing templates:Douglas Gregor2008-12-021-3/+2
| | | | | | | | | - Template parameter scope to hold the template parameters - Template parameter context for parsing declarators - Actions for template type parameters and non-type template parameters llvm-svn: 60387
* Basic support for parsing templates, from Andrew SuttonDouglas Gregor2008-12-011-0/+50
llvm-svn: 60384
OpenPOWER on IntegriCloud