summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Wrap to 80 columns. No behavior change.Nico Weber2015-02-181-9/+11
| | | | llvm-svn: 229637
* Don't crash on `struct ::, struct ::` (and the same for enums).Nico Weber2015-02-151-2/+5
| | | | | | | | | | | | | | | | | | | The first part of that line doesn't parse correctly and ParseClassSpecifier() for some reason skips to tok::comma to recover, and then ParseDeclarationSpecifiers() sees the next struct and calls ParseClassSpecifier() again with the same DeclSpec object. However, the first call already called ActOnCXXGlobalScopeSpecifier() on the DeclSpec's CXXScopeSpec, and sema gets confused when this gets called again. As a fix, let ParseClassSpecifier() (and ParseEnumSpecifier()) call ParseOptionalCXXScopeSpec() with a temporary CXXScopeSpec object, and only copy it into the DeclSpec if things work out. (This is also how all the other functions that set the DeclSpec's TypeSpecScope set it.) Found by SLi's bot. llvm-svn: 229288
* Initial support for C++ parameter completionFrancisco Lopes da Silva2015-01-211-1/+5
| | | | | | | | | | | | | | | | | | | | The improved completion in call context now works with: - Functions. - Member functions. - Constructors. - New expressions. - Function call expressions. - Template variants of the previous. There are still rough edges to be fixed: - Provide support for optional parameters. (fix known) - Provide support for member initializers. (fix known) - Provide support for variadic template functions. (fix unknown) - Others? llvm-svn: 226670
* Fix crash-on-invalid and name lookup when recovering from ~X::X() typo.Richard Smith2015-01-151-1/+10
| | | | llvm-svn: 226067
* Parse: Switch to using EOF tokens for late parsed attributesDavid Majnemer2015-01-131-12/+15
| | | | | | | | | The EOF token injection technique is preferable to using isBeforeInTranslationUnit to determine whether or not additional cleanup is needed. I don't have an example off-hand that requires it but it is nicer nonetheless. llvm-svn: 225776
* Parse: Don't crash if missing an initializer expressionDavid Majnemer2015-01-131-1/+2
| | | | llvm-svn: 225768
* Parse: Further simplify ParseLexedMethodDeclarationDavid Majnemer2015-01-131-8/+0
| | | | | | | No functionality change intended, just moving code around to make it simpler. llvm-svn: 225763
* [PowerPC]To provide better compatibility with gcc I added the __bool keyword ↵Bill Seurer2015-01-121-0/+5
| | | | | | | | | | | | | | | | | to the Alitivec support in clang. __bool is functionally identical to using bool when declaring vector types. For example: vector bool char v_bc; vector __bool char v___bc; clang already supported vector/__vector and pixel/__pixel but was missing __bool. http://llvm.org/bugs/show_bug.cgi?id=19220 For reference: https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/PowerPC-AltiVec_002fVSX-Built-in-Functions.html http://reviews.llvm.org/D6882 llvm-svn: 225664
* Parse: Get rid of tok::cxx_defaultarg_end, use EOF insteadDavid Majnemer2015-01-121-1/+2
| | | | | | | I added setEofData/getEofData to solve this sort of problem back in r224505. Use the Param's decl to tell us if this is *our* EOF token. llvm-svn: 225619
* Parse: __attribute__((keyword)) shouldn't errorDavid Majnemer2015-01-031-3/+4
| | | | | | | Weird constructs like __attribute__((inline)) or __attibute__((typename)) should result in warnings, not errors. llvm-svn: 225118
* Parse: Don't crash when 'typename' shows up in an attributeDavid Majnemer2014-12-281-1/+2
| | | | | | | | | isDeclarationSpecifier performs error recovers which jostles the token stream. Specifically, TryAnnotateTypeOrScopeToken will end up consuming a typename token which will confuse the attribute parsing machinery as we no-longer have something identifier-like. llvm-svn: 224903
* PR21969: Improve diagnostics for a conversion function that has any pieces of aRichard Smith2014-12-191-1/+1
| | | | | | declared return type (including a trailing-return-type in C++14). llvm-svn: 224561
* Correct delayed typos in the operand to typeof expressions.Kaelyn Takata2014-12-191-2/+2
| | | | | | Fixes PR21947. llvm-svn: 224558
* 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
OpenPOWER on IntegriCloud