summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor the Microsoft inheritance attribute handling so that it no longer ↵Aaron Ballman2013-12-181-1/+1
| | | | | | has special treatment. Also fixes a minor bug where the attributes were being parsed as though they were GNU-style attributes when they were in fact keyword attributes. llvm-svn: 197629
* Simplify RevertibleTypeTraits as a form of contextual keywordAlp Toker2013-12-171-25/+11
| | | | | | | | | | | Now that we emit diagnostics for keyword-as-identifier hacks (-Wkeyword-compat) we can go ahead and simplify some of the old revertible keyword support. This commit adds a TryIdentKeywordUpgrade() function to mirror the recently added TryKeywordIdentFallback() and uses it to replace the hard-coded list of REVERTIBLE_TYPE_TRAITs. llvm-svn: 197496
* Parse: Recover better from bad definitions with base specifiersDavid Majnemer2013-12-051-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | We would skip until the next comma, hoping good things whould lie there, however this would fail when we have such things as this: struct A {}; template <typename> struct D; template <> struct D<C> : B, A::D; Once this happens, we would believe that D with a nested namespace specifier of A was a variable that was being declared. We would go on to complain that there was an extraneous 'template <>' on their variable declaration. Crashes would happen when 'A' gets defined as 'enum class A {}' as various asserts would fire. Instead, we should skip up until the semicolon if we see that we are in the middle of a definition and the current token is a ':' This fixes PR17084. llvm-svn: 196453
* Fix several crash-on-invalids when using template-ids that aren'tRichard Smith2013-12-041-0/+1
| | | | | | simple-template-ids (eg, 'operator+<int>') in weird places. llvm-svn: 196333
* Emit an extension warning when changing system header tokensAlp Toker2013-12-031-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | clang converts keywords to identifiers for compatibility with various system headers such as GNU libc. Implement a -Wkeyword-compat extension warning to diagnose those cases. The warning is on by default but will generally be ignored in system headers. It can however be enabled globally to aid standards conformance testing. This also changes the __uptr keyword avoidance from r195710 to no longer special-case system headers, bringing it in line with other similar workarounds in clang. Implementation returns bool for symmetry with token annotation functions. Some examples: warning: keyword '__is_pod' will be treated as an identifier for the remainder of the translation unit [-Wkeyword-compat] struct __is_pod warning: keyword '__uptr' will be treated as an identifier here [-Wkeyword-compat] union w *__uptr; llvm-svn: 196212
* Parse Microsoft __declspec appearing after class bodyAlp Toker2013-11-241-0/+1
| | | | | | | | | | MSVC applies these to the following declaration only if present, otherwise silently ignores them whereas we'll issue a warning. Handling differs from ordinary attributes appearing in the same place, so add a Sema test to make sure we get it right. llvm-svn: 195577
* Generate a marker token when entering or leaving a submodule when building aRichard Smith2013-11-231-5/+5
| | | | | | | | | module. Use the marker to diagnose cases where we try to transition between submodules when not at the top level (most likely because a closing brace was missing at the end of a header file, but is also possible if submodule headers attempt to do something fundamentally non-modular, like our .def files). llvm-svn: 195543
* PR9547: If we're parsing a simple-declaration that contains a tag definition,Richard Smith2013-11-191-0/+8
| | | | | | | | and we see an ill-formed declarator that would probably be well-formed if the tag definition were just missing a semicolon, use that as the diagnostic instead of producing some other mysterious error. llvm-svn: 195163
* Replaced bool parameters in SkipUntil function with single bit-based parameter.Alexey Bataev2013-11-181-30/+29
| | | | llvm-svn: 194994
* PR17949: Fix crash if someone puts a namespace inside a class template.Richard Smith2013-11-151-5/+5
| | | | llvm-svn: 194872
* Try to recover a bit better if a close brace is missing from the end of a classRichard Smith2013-11-091-5/+30
| | | | | | | definition. If we see something that looks like a namespace definition inside a class, that strongly indicates that a close brace was missing somewhere. llvm-svn: 194319
* Fix %select numbering confusion between diagnostic and Diag call.Richard Smith2013-11-081-1/+1
| | | | llvm-svn: 194281
* Untabify.Richard Smith2013-11-081-29/+25
| | | | llvm-svn: 194274
* Support GNU attributes in alias-declarations now that GCC has implemented themRichard Smith2013-10-241-4/+3
| | | | | | and we know where they go. llvm-svn: 193297
* [-fms-extensions] Permit 'override' in C++98 and 'sealed' as a synonym for ↵David Majnemer2013-10-181-15/+36
| | | | | | | | | | | | | | 'final' Summary: Some MS headers use these features. Reviewers: rnk, rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1948 llvm-svn: 192936
* Tidy up and improve error recovery for C++11 attributes in bad places. Based onRichard Smith2013-10-151-7/+49
| | | | | | a patch by Michael Han. llvm-svn: 192666
* Consolidating the notion of a GNU attribute parameter with the attribute ↵Aaron Ballman2013-08-311-4/+3
| | | | | | argument list. llvm-svn: 189711
* Remove Inheritable/NonInheritable flags from ProcessDeclAttributes. They don'tRichard Smith2013-08-291-2/+1
| | | | | | do anything useful. llvm-svn: 189548
* Avoid spurious error messages if parent template class cannot be instantiatedSerge Pavlov2013-08-101-1/+6
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D924 llvm-svn: 188133
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-061-0/+8
| | | | | | fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention... llvm-svn: 187762
* Parse: Don't consider attributes of broken member declaratorsDavid Majnemer2013-08-011-31/+32
| | | | | | | | | | | | | | ParseCXXClassMemberDeclaration was trying to use the result of ActOnCXXMemberDeclarator to attach it to some late parsed attributes. However when failures arise, we have no decl to attach to which eventually leads us to a NULL pointer dereference. While we are here, clean up the code a bit. Fixes PR16765 llvm-svn: 187557
* Improve clarity/consistency of a few UsingDecl methods and related helpers.Enea Zaffanella2013-07-221-11/+13
| | | | | | | | | | | | No functionality change. In Sema helper functions: * renamed isTypeName as HasTypenameKeyword In UsingDecl: * renamed get/setUsingLocation to get/setUsingLoc * renamed is/setTypeName as has/setTypename llvm-svn: 186816
* ArrayRef'ize Sema::FinalizeDeclaratorGroup, Sema::BuildDeclaratorGroup andRafael Espindola2013-07-091-2/+1
| | | | | | | | Sema::ActOnDocumentableDecls. Patch by Robert Wilhelm. llvm-svn: 185931
* Fixed source location info for UnaryTransformTypeLoc nodes.Enea Zaffanella2013-07-061-0/+1
| | | | llvm-svn: 185765
* Use SmallVectorImpl instead of SmallVector for iterators and references to ↵Craig Topper2013-07-041-1/+1
| | | | | | avoid specifying the vector size unnecessarily. llvm-svn: 185610
* ArrayRef'ize Sema::CodeCompleteConstructorInitializerDmitri Gribenko2013-06-231-3/+2
| | | | | | Patch by Robert Wilhelm. llvm-svn: 184675
* Instantiation bug fix extension (cf. r184503) -- minor code fixes, including ↵Larisse Voufo2013-06-221-20/+30
| | | | | | 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-0/+8
| | | | | | (FixIts yet to be tested.) llvm-svn: 184503
* Fix for PR 16367, display the name of a function in a diagnostic instead ofRichard Trieu2013-06-191-1/+1
| | | | | | showing "(null)". llvm-svn: 184377
* Add -Wdeprecated warnings and fixits for things deprecated in C++11:Richard Smith2013-06-131-0/+13
| | | | | | | | | - 'register' storage class - dynamic exception specifications Only the former check is enabled by default for now (the latter might be quite noisy). llvm-svn: 183881
* ArrayRef'ize Sema::ActOnMemInitializerDmitri Gribenko2013-05-091-3/+2
| | | | llvm-svn: 181565
* Implement C++1y decltype(auto).Richard Smith2013-04-261-30/+49
| | | | llvm-svn: 180610
* Implement special-case name lookup for inheriting constructors: memberRichard Smith2013-03-261-10/+26
| | | | | | | using-declarations with names which look constructor-like are interpreted as constructor names. llvm-svn: 177957
* OpenMP threadprivate directive parsing and semantic analysisAlexey Bataev2013-03-221-0/+5
| | | | llvm-svn: 177705
* Don't accidentally and silently accept C++11 attributes in decl-specifier-seqsRichard Smith2013-02-221-0/+2
| | | | | | in C++98. llvm-svn: 175879
* Don't skip '_Alignas' when disambiguating 'final'. '_Alignas' can't appear here,Richard Smith2013-02-221-10/+3
| | | | | | and we used to assert if it did. llvm-svn: 175866
* Process and handle attributes on conditions and for loop variables. Process andRichard Smith2013-02-201-20/+17
| | | | | | | diagnose attributes on alias declarations, using directives, and attribute declarations. llvm-svn: 175649
* PR15300: Support C++11 attributes on base-specifiers. We don't support any suchRichard Smith2013-02-191-25/+25
| | | | | | | | attributes yet, so just issue the appropriate diagnostics. Also generalize the fixit for attributes-in-the-wrong-place code and reuse it here, if attributes are placed after the access-specifier or 'virtual' in a base specifier. llvm-svn: 175575
* Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose2013-02-081-1/+2
| | | | | | | Nearly all of these changes are one-to-one replacements; the few that aren't have to do with custom identifier validation. llvm-svn: 174768
* Provide a fixit for constexpr non-static data members.David Blaikie2013-01-301-3/+3
| | | | | | | | | | | | | | | | If the member has an initializer, assume it was probably intended to be static and suggest/recover with that. If the member doesn't have an initializer, assume it was probably intended to be const instead of constexpr and suggest that. (if the attempt to apply these changes fails, don't make any suggestion & produce the same diagnostic experience as before. The only case where this can come up that I know of is with a mutable constexpr with an initializer, since mutable is incompatible with static (but it's already incompatible with const anyway)) llvm-svn: 173873
* Downgrade 'attribute ignored when parsing type' from error to warning, to matchRichard Smith2013-01-291-3/+3
| | | | | | | | | the diagnostic's warn_ name. Switch some places (notably C++11 attributes) which really wanted an error over to a different diagnostic. Finally, suppress the diagnostic entirely for __ptr32, __ptr64 and __w64, to avoid producing diagnostics in important system headers. llvm-svn: 173788
* PR15017: A '>' can appear after a type-specifier in a template-argument-list.Richard Smith2013-01-291-0/+3
| | | | | | | It turns out that there's no correctness bug here (because we can't have a type definition in this location), but there was a diagnostic bug. llvm-svn: 173766
* Fix five more cases of tokens which can legally follow a type specifier.Richard Smith2013-01-191-2/+13
| | | | llvm-svn: 172886
* Fix parsing of class specifiers before '\n' 'operator'.Nico Weber2013-01-181-0/+1
| | | | | | | | | | | | | r159549 / r159164 regressed clang to reject struct s {}; struct s operator++(struct s a) { return a; } This fixes the regression. Richard, pleas check if this looks right. llvm-svn: 172834
* ArrayRef-ize some ctor initializer related APIsDavid Blaikie2013-01-171-2/+1
| | | | llvm-svn: 172701
* Implement C++11 semantics for [[noreturn]] attribute. This required splittingRichard Smith2013-01-171-1/+8
| | | | | | | | it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as affecting the function type, whereas [[noreturn]] does not). llvm-svn: 172691
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-1/+1
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Tighten types a bit. No functionality change.Rafael Espindola2013-01-081-1/+1
| | | | llvm-svn: 171894
* Add fixit hints for misplaced C++11 attributes around class specifiers.Michael Han2013-01-071-8/+45
| | | | | | | | | | Following r168626, in class declaration or definition, there are a combination of syntactic locations where C++11 attributes could appear, and among those the only valid location permitted by standard is between class-key and class-name. So for those attributes appear at wrong locations, fixit is used to move them to expected location and we recover by applying them to the class specifier. llvm-svn: 171757
* s/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few ↵Richard Smith2013-01-021-23/+23
| | | | | | nearby 'C++0x' comments. llvm-svn: 171372
OpenPOWER on IntegriCloud