summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge some similar diagnostics using %select.Craig Topper2015-11-141-4/+4
| | | | llvm-svn: 253136
* Fix 80 column violation. NFC.Craig Topper2015-11-141-2/+2
| | | | llvm-svn: 253134
* Fix Clang-tidy modernize-use-nullptr warnings in source directories; other ↵Hans Wennborg2015-10-061-7/+6
| | | | | | | | | | minor cleanups Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13406 llvm-svn: 249484
* SourceRanges are small and trivially copyable, don't them by reference.Craig Topper2015-10-041-1/+1
| | | | llvm-svn: 249259
* [Modules] More descriptive diagnostics for misplaced import directiveSerge Pavlov2015-09-191-3/+5
| | | | | | | | | | If an import directive was put into wrong context, the error message was obscure, complaining on misbalanced braces. To get more descriptive messages, annotation tokens related to modules are processed where they must not be seen. Differential Revision: http://reviews.llvm.org/D11844 llvm-svn: 248085
* Delay emitting members of dllexport classes until the class is fully parsed ↵Hans Wennborg2015-08-151-1/+1
| | | | | | | | | | | | | | | | | (PR23542) This enables Clang to correctly handle code such as: struct __declspec(dllexport) S { int x = 42; }; where it would otherwise error due to trying to generate the default constructor before the in-class initializer for x has been parsed. Differential Revision: http://reviews.llvm.org/D11850 llvm-svn: 245139
* Outline function Parser::ParseCXXClassMemberDeclarationWithPragmas(), NFC.Alexey Bataev2015-07-311-123/+122
| | | | | | Parsing of pragmas followed by a class member declaration is outlined into a separate function Parser::ParseCXXClassMemberDeclarationWithPragmas(). llvm-svn: 243739
* [MS Compat] Allow _Atomic(Type) and 'struct _Atomic' to coexistDavid Majnemer2015-07-221-0/+38
| | | | | | | | | | | | | | | | | | | | | | MSVC 2013 ships, as part of its STL implementation, a class named '_Atomic'. This is unfortunate because this keyword is in conflict with the C11 keyword with the same name. Our solution was to disable this keyword when targeting MSVC 2013 and reenable it for 2015. However, this makes it impossible for clang's headers to make use of _Atomic. This is problematic in the case of libc++ as it makes heavy use of this keyword. Let the keywordness of _Atomic float under certain circumstances: the body of a class named _Atomic, or a class with a base specifier named _Atomic, will not have the keyword variant of _Atomic for the duration of the class body. This is sufficient to allow us to correctly handle _Atomic in the STL while permitting us to use _Atomic as a keyword everywhere else. Differential Revision: http://reviews.llvm.org/D11233 llvm-svn: 242970
* Fix crash-on-invalid: don't look ahead past an unknown token, it might be EOF.Richard Smith2015-07-211-1/+2
| | | | llvm-svn: 242744
* Ignore the "novtable" declspec when not using the Microsoft C++ ABI.Bob Wilson2015-07-201-1/+1
| | | | | | | | | | | | | | Clang used to silently ignore __declspec(novtable). It is implemented now, but leaving the vtable uninitialized does not work when using the Itanium ABI, where the class layout for complex class hierarchies is stored in the vtable. It might be possible to honor the novtable attribute in some simple cases and either report an error or ignore it in more complex situations, but it’s not clear if that would be worthwhile. There is also value in having a simple and predictable behavior, so this changes clang to simply ignore novtable when not using the Microsoft C++ ABI. llvm-svn: 242730
* Classes inside lambdas are local not nested.Serge Pavlov2015-07-141-10/+4
| | | | | | | | | | | | | If a lambda used as default argument in a method declaration contained a local class, that class was incorrectly recognized as nested class. In this case compiler tried to postpone parsing of this class until the enclosing class is finished, which caused crashes in some cases. This change fixes PR13987. Differential Revision: http://reviews.llvm.org/D11006 llvm-svn: 242132
* Revert "parser: wordsmith diagnostic message" and "parser: diagnose empty ↵David Majnemer2015-07-081-3/+1
| | | | | | | | | | | | attribute blocks" This reverts commit r239846 and r239879. They caused clang's -fms-extensions behavior to incorrectly parse lambdas and includes a testcase to ensure we don't regress again. This issue was found in PR24027. llvm-svn: 241668
* DR1909: Diagnose all invalid cases of a class member sharing its name with ↵Richard Smith2015-07-061-4/+5
| | | | | | the class. llvm-svn: 241425
* [modules] Skip trailing attributes when skipping a class definition during ↵Richard Smith2015-07-011-0/+5
| | | | | | parse-merging. llvm-svn: 241180
* Unbreak the Visual C++ 2013 build after r241032.Yaron Keren2015-06-301-1/+1
| | | | | | clang\lib\Parse\ParseDeclCXX.cpp(2396): error C3486: a parameter for a lambda cannot have a default argument llvm-svn: 241046
* Rework parsing of pure-specifiers. Perform the grammar matching andRichard Smith2015-06-301-34/+61
| | | | | | disambiguation in the parser rather than trying to do it in Sema. llvm-svn: 241032
* Instantiation of local class members.Serge Pavlov2015-06-291-3/+6
| | | | | | | | | | | | If a function containing a local class is instantiated, instantiate all of local class member, including default arguments and exception specifications. This change fixes PR21332 and thus implements DR1484. Differential Revision: http://reviews.llvm.org/D9990 llvm-svn: 240974
* [clang] Refactoring of conditions so they use isOneOf() instead of multiple ↵Daniel Marjamaki2015-06-181-71/+69
| | | | | | is(). llvm-svn: 240008
* parser: diagnose empty attribute blocksSaleem Abdulrasool2015-06-161-1/+3
| | | | | | | | | | | MS attributes do not permit empty attribute blocks. Correctly diagnose those. We continue to parse to ensure that we recover correctly. Because the block is empty, we do not need to skip any tokens. Bonus: tweak the comment that I updated but forgot to remove the function name in a previous commit. llvm-svn: 239846
* parser: improve diagnostics for MS attributesSaleem Abdulrasool2015-06-151-6/+8
| | | | | | | | Switch to using BalancedDelimiterTracker to get better diagnostics for unbalanced delimiters. This still does not handle any of the attributes, simply improves the parsing. llvm-svn: 239758
* [modules] Fix assert/crash when parsing and merging a definition of a class ↵Richard Smith2015-06-111-2/+3
| | | | | | with a base-specifier inside a namespace. llvm-svn: 239569
* Refactored some common functionality into MaybeParseMicrosoftDeclSpecs; NFC.Aaron Ballman2015-05-201-4/+1
| | | | llvm-svn: 237835
* [modules] Support for merging a parsed class template specialization ↵Richard Smith2015-05-181-1/+2
| | | | | | definition into an imported but hidden definition. llvm-svn: 237612
* [modules] Suport for merging a parsed enum definition into an existing ↵Richard Smith2015-05-071-2/+2
| | | | | | imported but not visible definition. llvm-svn: 236690
* [MS ABI] Correctly associate align attrs before the class-keyDavid Majnemer2015-04-191-0/+2
| | | | | | | | | | | | __declspec(align(...)) is unlike all other attributes in that it is not applied to a variable if it appears before the class-key. If the tag in question isn't part of a variable declaration, it is not ignored. Instead, the alignment attribute is applied to the tag. This fixes PR18024. llvm-svn: 235272
* Don't eagerly typo-correct to a keyword if the next token is a right paren.Kaelyn Takata2015-04-101-1/+4
| | | | | | | | | Take advantage of the delayed typo no longer being eagerly corrected to a keyword to filter out keyword corrections (and other things like unresolved & overloaded expressions, which have placeholder types) when correcting typos inside of a decltype(). llvm-svn: 234623
* [parse] Don't crash on alternative operator spellings from macros in c++11 ↵Benjamin Kramer2015-03-291-1/+3
| | | | | | | | attributes. Found by afl-fuzz. llvm-svn: 233499
* [modules] If we reach a definition of a class for which we already have aRichard Smith2015-03-261-2/+56
| | | | | | | | non-visible definition, skip the new definition and make the old one visible instead of trying to parse it again and failing horribly. C++'s ODR allows us to assume that the two definitions are identical. llvm-svn: 233250
* Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit ↵Ehsan Akhgari2015-03-251-2/+18
| | | | | | | | | | | | | | hints Summary: Follow-up to the fix of PR22075. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7012 llvm-svn: 233161
* Diagnose declspecs occuring after virt-specifier-seq and generate fixit hintsEhsan Akhgari2015-03-251-1/+51
| | | | | | | | | | | | Summary: This fixes PR22075. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6828 llvm-svn: 233160
* Revert "Diagnose declspecs occuring after virt-specifier-seq and generate ↵Ehsan Akhgari2015-03-241-49/+1
| | | | | | | | fixit hints" This reverts commit 2131e63e2fdff7c831ab3bfe31facf2e3ebab03d. llvm-svn: 233074
* Revert "Diagnose ref-qualifiers occuring after virt-specifier-seq and ↵Ehsan Akhgari2015-03-241-18/+2
| | | | | | | | generate fixit hints" This reverts commit 49079d45966a3f57cd82edb35bde2e8e88fccf40. llvm-svn: 233073
* Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit ↵Ehsan Akhgari2015-03-241-2/+18
| | | | | | | | | | | | | | hints Summary: Follow-up to the fix of PR22075. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7012 llvm-svn: 233070
* Diagnose declspecs occuring after virt-specifier-seq and generate fixit hintsEhsan Akhgari2015-03-241-1/+49
| | | | | | | | | | | | Summary: This fixes PR22075. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6828 llvm-svn: 233069
* Cleanup: no need to pass DefinitionKind into ParseCXXInlineMethodDefEli Bendersky2015-03-231-1/+2
| | | | | | | | | | All ParseCXXInlineMethodDef does with it is assign it on the ParsingDeclarator. Since that is passed in as well, the (single) caller may as well set the DefinitionKind, thus simplifying the code. No change in functionality. llvm-svn: 233043
* MS ABI: Build C++ default argument exprs for exported template classesReid Kleckner2015-03-171-1/+1
| | | | | | This was an omission from r232229. llvm-svn: 232554
* MS ABI: Delay default constructor closure checking until the outermost class ↵Reid Kleckner2015-03-171-0/+4
| | | | | | | | | | | | | | | | | scope ends Previously, we would error out on this code because the default argument wasn't parsed until the end of Outer: struct __declspec(dllexport) Outer { struct __declspec(dllexport) Inner { Inner(void *p = 0); }; }; Now we do the checking on the closing brace of Outer instead of Inner. llvm-svn: 232519
* Sema: Properly track mangling number/name for linkage for using declsDavid Majnemer2015-03-111-5/+8
| | | | | | | | | | | | Using declarations which are aliases to struct types have their name used as the struct type's name for linkage purposes. Otherwise, make sure to give an anonymous struct defined inside a using declaration a mangling number to disambiguate it from other anonymous structs in the same context. This fixes PR22809. llvm-svn: 231909
* Wrap to 80 columns. No behavior change.Nico Weber2015-03-071-2/+4
| | | | llvm-svn: 231573
* FIX PR 18432, default args, friends & late-parsed members.Nathan Sidwell2015-02-191-3/+6
| | | | | | | | | | | | Sema::MergeCXXFunctionDecl: propagate hasUnparsedDefaultArg to new decl. Parser::HandleMemberFunctionDeclDelays: check hasUnparsedDefaultArg flag. Parser::ParseLexedMethodDeclaration: handle inherited unparsed default arg case. llvm-svn: 229852
* Parse: return true from ParseCXX11AttributeArgs if an attribute was addedSaleem Abdulrasool2015-02-161-2/+0
| | | | | | | | | | | | | | | | | | In the case that we diagnosed an invalid attribute due to missing or present arguments, we would return false, indicating to the caller that the parsing failed. However, we would have added the attribute in ParseAttributeArgsCommon (which may have been called indirectly through ParseGNUAttributeArgs). Returning true in this case ensures that a second copy of the attribute is not added. I haven't added a test case for this as the existing test will cover this with the next commit which diagnoses a C++14 attribute applied in C++11 mode. Rather than duplicating the existing test case, allow the tree to remain without a test between this and the next change. We would see double warnings in the [[deprecated()]] applied to a declaration in C++11 mode, which will cause an error in the cxx0x-attributes test. llvm-svn: 229446
* Don't crash on `struct ::, struct ::` (and the same for enums).Nico Weber2015-02-151-3/+11
| | | | | | | | | | | | | | | | | | | 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
* Remove duplicate codeNathan Sidwell2015-01-251-32/+18
| | | | llvm-svn: 227024
* Address review feedback from r226306. No intended behavior change.Nico Weber2015-01-171-2/+2
| | | | llvm-svn: 226363
* Spell 0 in an enum-appropriate way. No behavior change.Nico Weber2015-01-161-1/+1
| | | | llvm-svn: 226307
* Don't crash if a declarator in a friend decl doesn't have a name.Nico Weber2015-01-161-12/+16
| | | | | | | | | | | There was already an explicit check for that for the first decl. Move that to a different place so that it's called for the following decls too. Also don't randomly set the BitfieldSize ExprResult to true (this sets a pointer to true internally). Found by SLi's bot. llvm-svn: 226306
* [cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.pyChandler Carruth2015-01-141-1/+1
| | | | | | | | | | Sorry for the noise, I managed to miss a bunch of recent regressions of include orderings here. This should actually sort all the includes for Clang. Again, no functionality changed, this is just a mechanical cleanup that I try to run periodically to keep the #include lines as regular as possible across the project. llvm-svn: 225979
* Parse: Further simplify ParseLexedMethodDeclarationDavid Majnemer2015-01-131-8/+0
| | | | | | | No functionality change intended, just moving code around to make it simpler. llvm-svn: 225763
* If we don't find a matching ) for a ( in an exception specification, keep ↵Richard Smith2015-01-131-9/+4
| | | | | | the tokens around so we can diagnose an error rather than silently discarding them. llvm-svn: 225755
* Parse: Get rid of cxx_exceptspec_end, use EOF insteadDavid Majnemer2015-01-121-1/+2
| | | | | | | | Similar to r225619, use a special EOF token to mark the end of the exception specification instead of cxx_exceptspec_end. Use the current scope as the marker. llvm-svn: 225622
OpenPOWER on IntegriCloud