summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Diagnose function template definitions inside functionsReid Kleckner2014-12-151-3/+5
| | | | | | | | | | | | | | | 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
* Parse qualifiers after comma in declarator lists as a Microsoft extensionNico Rieck2014-12-041-0/+40
| | | | | | MSVC parses and ignores these with a warning. llvm-svn: 223413
* Fix PR21684 - Ellipsis following an 'auto' parameter sans name/ID Faisal Vali2014-12-041-7/+8
| | | | | | | | should indicate a c++ parameter pack not a c-variadic. int i = [](auto...) { return 0; }(); // OK now. llvm-svn: 223357
* [OpenCL] Generic address space has been added in OpenCL v2.0.Anastasia Stulova2014-11-261-0/+25
| | | | | | | | | | To support it in the frontend, the following has been added: - generic address space type attribute; - documentation for the OpenCL address space attributes; - parsing of __generic(generic) keyword; - test code for the parser and diagnostics. llvm-svn: 222831
* Enable ActOnIdExpression to use delayed typo correction for non-C++ codeKaelyn Takata2014-11-211-1/+2
| | | | | | when calling DiagnoseEmptyLookup. llvm-svn: 222551
* PR21565: Further refine the conditions for enabling eager parsing ofRichard Smith2014-11-201-2/+18
| | | | | | | | std::X::swap exception specifications (allowing parsing of non-conforming code in libstdc++). The old conditions also matched the functions in MSVC's STL, which were relying on deferred parsing here. llvm-svn: 222471
* Wire up delayed typo correction to DiagnoseEmptyLookup and set upKaelyn Takata2014-11-201-1/+3
| | | | | | | | | Sema::ActOnIdExpression to use the new functionality. Among other things, this allows recovery in several cases where it wasn't possible before (e.g. correcting a mistyped static_cast<>). llvm-svn: 222464
* Update for LLVM API change to make Small(Ptr)Set::insert return ↵David Blaikie2014-11-191-1/+1
| | | | | | pair<iterator, bool> as per the C++ standard's associative container concept. llvm-svn: 222335
* PR21565 Add an egregious hack to support broken libstdc++ headers that declareRichard Smith2014-11-141-1/+2
| | | | | | | | | | | | a member named 'swap' and then expect unqualified lookup for the name 'swap' in its exception specification to find anything else. Without delay-parsed exception specifications, this was ill-formed (NDR) by [basic.scope.class]p1, rule 2. With delay-parsed exception specifications, the call to 'swap' unambiguously finds the function being declared, which then fails because the arguments don't work for that function. llvm-svn: 221955
* PR21437, final part of DR1330: delay-parsing of exception-specifications. ThisRichard Smith2014-11-131-2/+8
| | | | | | | is a re-commit of Doug's r154844 (modernized and updated to fit into current Clang). llvm-svn: 221918
* Improve diagnostics if _Noreturn is placed after a function declarator. ↵Richard Smith2014-11-101-1/+22
| | | | | | (This sometimes happens when a macro is used that expands to either the GNU noreturn attribute or _Noreturn.) llvm-svn: 221630
* Updated the wording for a diagnostic to be more grammatically correct, and ↵Aaron Ballman2014-11-081-1/+1
| | | | | | use a %select. Also ensure that nested namespace definitions are diagnosed properly. Both changes are motivated by post-commit feedback from r221580. llvm-svn: 221581
* [c++1z] Support for attributes on namespaces and enumerators.Aaron Ballman2014-11-081-4/+9
| | | | llvm-svn: 221580
* Patch for small addition to availability attribute.Fariborz Jahanian2014-11-051-0/+13
| | | | | | | | | This is to accept "NA" in place of vesion number for availability attribute. Used on introduced=NA to mean unavailable and deprecated=NA to mean nothing (not deprecated). rdar://18804883 llvm-svn: 221417
* PR21367: Don't accept rvalue references as an extension in C++98 mode if ↵Richard Smith2014-10-281-5/+17
| | | | | | we're in a new-type-id or conversion-type-id, since those things can legitimately be followed by a binary && operator. llvm-svn: 220785
* Add frontend support for __vectorcallReid Kleckner2014-10-241-9/+26
| | | | | | | | | | | | | Wire it through everywhere we have support for fastcall, essentially. This allows us to parse the MSVC "14" CTP headers, but we will miscompile them because LLVM doesn't support __vectorcall yet. Reviewed By: Aaron Ballman Differential Revision: http://reviews.llvm.org/D5808 llvm-svn: 220573
* Remove unused StmtVector& parameters from declaration parsing functions.Rafael Espindola2014-10-221-5/+4
| | | | | | Patch by Eelis van der Weegen! llvm-svn: 220387
* Add RestrictQualifierLoc to DeclaratorChunk::FunctionTypeInfoHal Finkel2014-10-201-0/+3
| | | | | | | | | | | | | | Clang supports __restrict__ as a function qualifier, but DeclaratorChunk::FunctionTypeInfo lacked a field to track the qualifier's source location (as we do with volatile, etc.). This was the subject of a FIXME in GetFullTypeForDeclarator (in SemaType.cpp). This should also prove useful as we add more warnings regarding questionable uses of the restrict qualifier. There is no significant functional change (except for an improved source range associated with the err_invalid_qualified_function_type diagnostic fixit generated by GetFullTypeForDeclarator). llvm-svn: 220215
* Patch to wrap up '_' as separator in version numbersFariborz Jahanian2014-10-061-2/+2
| | | | | | | | | in availability attribute by preserving this info. in VersionTuple and using it in pretty printing of attributes and yet using '.' as separator when diagnosing unavailable message calls. rdar://18490958 llvm-svn: 219124
* Add comment about separators must match inFariborz Jahanian2014-10-031-0/+1
| | | | | | version numbers. llvm-svn: 218993
* Diagnose mixed use of '_' and '.' as versionFariborz Jahanian2014-10-021-2/+7
| | | | | | separators in my previous patch. llvm-svn: 218895
* Patch to accept '_' in addition to '.' as versionFariborz Jahanian2014-10-021-3/+8
| | | | | | | number separator in "availability" attribute. rdar://18490958 llvm-svn: 218884
* -ms-extensions: Implement __super scope specifier (PR13236).Nikola Smiljanic2014-09-261-0/+1
| | | | | | | | | We build a NestedNameSpecifier that records the CXXRecordDecl in which __super appeared. Name lookup is performed in all base classes of the recorded CXXRecordDecl. Use of __super is allowed only inside class and member function scope. llvm-svn: 218484
* Parse: Replace polymorphic functor objects with lambdas and llvm::function_ref.Benjamin Kramer2014-09-031-23/+15
| | | | | | No change in functionality. llvm-svn: 217025
* PR20760: Don't assert (and produce better diagnostics) if a default initializerRichard Smith2014-08-271-2/+1
| | | | | | contains an unmatched closing bracket token. llvm-svn: 216518
* 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
* Reject virt-specifiers on friend declarations. Give anonymous bitfields aRichard Smith2014-08-121-1/+2
| | | | | | location so their diagnostics have somewhere to point. llvm-svn: 215416
* Reject varargs '...' in function prototype if there are more parameters afterRichard Smith2014-08-111-5/+36
| | | | | | | | | | | it. Diagnose with recovery if it appears after a function parameter that was obviously supposed to be a parameter pack. Otherwise, warn if it immediately follows a function parameter pack, because the user most likely didn't intend to write a parameter pack followed by a C-style varargs ellipsis. This warning can be syntactically disabled by using ", ..." instead of "...". llvm-svn: 215408
* Parser: Array decls with static but without array size are illformedDavid Majnemer2014-08-081-0/+5
| | | | | | | | | | | | Array declarators involving the static keyword take on two forms: D[ static type-qualifier-listopt assignment-expression ] D[ type-qualifier-list static assignment-expression ] Raise a diagnostic if the assignment-expression is missing. This fixes PR20584. llvm-svn: 215187
* Parse: Don't crash on trailing whitespace before EOFDavid Majnemer2014-07-261-1/+4
| | | | | | | | | | | | | | | Parser::ParseDeclarationSpecifiers eagerly updates the source range of the DeclSpec with the current token position. However, it might not consume any more tokens. Fix this by only setting the start of the range, not the end. This way the SourceRange will be invalid if we don't consume any more tokens. This fixes PR20413. Differential Revision: http://reviews.llvm.org/D4646 llvm-svn: 214018
* Disallowing GNU-style attributes in new expressions, since they are ↵Aaron Ballman2014-07-221-18/+27
| | | | | | prohibited by GCC as well. llvm-svn: 213650
* Avoid crash if default argument parsed with errors.Serge Pavlov2014-07-221-2/+2
| | | | | | | | | | | | | | If function parameters have default values, and that of the second parameter is parsed with errors, function declaration would have a parameter without default value that follows a parameter with that. Such declaration breaks logic of selecting overloaded function. As a solution, put opaque object as default value in such case. This patch fixes PR20055. Differential Revision: http://reviews.llvm.org/D4378 llvm-svn: 213594
* Parse: Diagnose malformed 'message' arguments for 'availability' attrDavid Majnemer2014-07-181-1/+12
| | | | | | | The parsing code for 'availability' wasn't prepared for string literals like "a" L"b" showing up. Error if this occurs. llvm-svn: 213350
* Removing a FIXME from the attribute parsing code by now passing along the ↵Aaron Ballman2014-07-161-31/+35
| | | | | | scope and syntax information for attributes with custom parsing. It turns out not to matter too much because the FIXME wasn't quite true -- none of these attributes have a C++11 spelling. However, it's still a good change (for instance, we may add an attribute with a type arg in the future for which this code now behaves properly). llvm-svn: 213191
* Improve error recovery around colon.Serge Pavlov2014-07-161-9/+18
| | | | | | | | | | | | Recognize additional cases, when '::' is mistyped as ':'. This is a fix to RP18587 - colons have too much protection in member-declarations Review is tracked by http://reviews.llvm.org/D3653. This is an attempt to recommit the fix, initially committed as r212957 but then reverted in r212965 as it broke self-build. In the updated patch ParseDirectDeclarator turns on colon protection in for context as well. llvm-svn: 213120
* Revert "Improve error recovery around colon."Reid Kleckner2014-07-141-15/+9
| | | | | | | | This reverts commit r212957. It broke the self-host on code like this from LLVM's option library: for (auto Arg: filtered(Id0, Id1, Id2)) llvm-svn: 212965
* Improve error recovery around colon.Serge Pavlov2014-07-141-9/+15
| | | | | | | | | Recognize additional cases, when '::' is mistyped as ':'. This is a fix to RP18587 - colons have too much protection in member-declarations. Differential Revision: http://reviews.llvm.org/D3653 llvm-svn: 212957
* Provide a better diagnostic when braces are put before the identifier.Richard Trieu2014-06-241-6/+116
| | | | | | | | | | | | | | | | | When a user types: int [4] foo; assume that the user means: int foo[4]; Update the information for 'foo' to prevent additional errors, and provide a fix-it hint to move the brackets to the correct location. Additionally, suggest parens for types that require it, such as: int [4] *foo; to: int (*foo)[4]; llvm-svn: 211641
* DiagnoseUnknownTypename always emits a diagnostic and returns trueReid Kleckner2014-06-191-32/+23
| | | | | | | | Make it return void and delete the dead code in the parser that handled the case where it might return false. This has been dead since 2010 when John deleted Action.h. llvm-svn: 211248
* MS static locals mangling: don't count enum scopesHans Wennborg2014-06-171-1/+1
| | | | | | | | | | We may not have the mangling for static locals vs. enums completely figured out, but at least for my simple test cases, enums should not increment the mangling number. Differential Revision: http://reviews.llvm.org/D4164 llvm-svn: 211078
* Delay lookup of simple default template arguments under -fms-compatibilityReid Kleckner2014-06-061-0/+12
| | | | | | | | | | | | | | | | | | MSVC delays parsing of default arguments until instantiation. If the default argument is never used, it is never parsed. We don't model this. Instead, if lookup of a type name fails in a template argument context, we form a DependentNameType, which will be looked up at instantiation time. This fixes errors about 'CControlWinTraits' in atlwin.h. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D3995 llvm-svn: 210382
* PR11306 - Variadic template fix-it suggestion. Recover from misplaced or ↵Nikola Smiljanic2014-06-061-15/+3
| | | | | | redundant ellipsis in parameter pack. llvm-svn: 210304
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-291-14/+14
| | | | | | takeAs to getAs. llvm-svn: 209800
* [C++11] Use 'nullptr'. Parser edition.Craig Topper2014-05-211-57/+59
| | | | llvm-svn: 209275
* Replace a fake enum class with the real thing.Richard Smith2014-05-161-4/+4
| | | | llvm-svn: 208943
* Fix an outdated comment.Richard Smith2014-05-081-4/+3
| | | | llvm-svn: 208366
* Suggest fix-it ':' when '=' used in for-range-declarationIsmail Pazarbasi2014-05-081-7/+24
| | | | | | | | | | Fix for PR19176. Clang will suggest a fix-it hint for cases like: int arr[] = {1, 2, 3, 4}; for (auto i = arr) ^ : llvm-svn: 208299
* During parsing, update the range of the Declarator to include the identifier.Richard Trieu2014-05-051-0/+1
| | | | llvm-svn: 208011
* Wrap a few lines at 80 columns, change a confusing indent. No behavior change.Nico Weber2014-05-031-3/+2
| | | | llvm-svn: 207921
* Fix PR 19630, don't crash when file ends with whitespace.Richard Trieu2014-05-021-1/+2
| | | | llvm-svn: 207883
OpenPOWER on IntegriCloud