summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add support for the C11 _Alignof keyword.Jordan Rose2012-06-301-1/+1
| | | | | | | This behaves like the existing GNU __alignof and C++11 alignof keywords; most of the patch is simply adding the third token spelling to various places. llvm-svn: 159494
* Use -frewrite-includes for crash reports.David Blaikie2012-06-291-0/+2
| | | | | | | | | | | In future changes we should: * use __builtin_trap rather than derefing 'random' volatile pointers. * avoid dumping temporary files into /tmp when running tests, instead preferring a location that is properly cleaned up by lit. Review by Chandler Carruth. llvm-svn: 159469
* Whitespace.Chad Rosier2012-06-261-147/+147
| | | | llvm-svn: 159235
* Extend the "expected ';' after struct" logic to also apply to enums, and toRichard Smith2012-06-251-4/+23
| | | | | | struct and enum forward-declarations. llvm-svn: 159164
* Recognize GNU attributes after 'enum class'. Fixes the libc++ build.John McCall2012-06-231-1/+8
| | | | llvm-svn: 159089
* Clean up a large number of C++11 attribute parse issues, including parsingAlexis Hunt2012-06-231-18/+51
| | | | | | | | | | | | | | | | | | attributes in more places where we didn't and catching a lot more issues. This implements nearly every aspect of C++11 attribute parsing, except for: - Attributes are permitted on explicit instantiations inside the declarator (but not preceding the decl-spec) - Attributes are permitted on friend declarations of functions. - Multiple instances of the same attribute in an attribute-list (e.g. [[noreturn, noreturn]], not [[noreturn]] [[noreturn]] which is conforming) are allowed. The first two are marked as expected-FIXME in the test file and the latter is probably a defect and is currently untested. Thanks to Richard Smith for providing the lion's share of the testcases. llvm-svn: 159072
* Reapply r158700 and fixup patches, minus one hunk that slipped through andAlexis Hunt2012-06-191-2/+5
| | | | | | | caused a crash in an obscure case. On the plus side, it caused me to catch another bug by inspection. llvm-svn: 158767
* Reapplying the changes from r158717 as they were rolled back to avoid merge ↵Aaron Ballman2012-06-191-37/+143
| | | | | | conflicts from a separate problematic patch. llvm-svn: 158750
* Revert r158700 and dependent patches r158716, r158717, and r158731.Jakob Stoklund Olesen2012-06-191-148/+39
| | | | | | | | The original r158700 caused crashes in the gcc test suite, g++.abi/vtable3a.C among others. It also caused failures in the libc++ test suite. llvm-svn: 158749
* Improves parsing and semantic analysis for MS __declspec attributes. This ↵Aaron Ballman2012-06-191-37/+143
| | | | | | includes support for the align (which fixes PR12631). llvm-svn: 158717
* Improve the specification of spellings in Attr.td.Alexis Hunt2012-06-191-2/+5
| | | | | | | | | | | | | | | | | Note that this is mostly a structural patch that handles the change from the old spelling style to the new one. One consequence of this is that all AT_foo_bar enum values have changed to not be based off of the first spelling, but rather off of the class name, so they are now AT_FooBar and the like (a straw poll on IRC showed support for this). Apologies for code churn. Most attributes have GNU spellings as a temporary solution until everything else is sorted out (such as a Keyword spelling, which I intend to add if someone else doesn't beat me to it). This is definitely a WIP. I've also killed BaseCheckAttr since it was unused, and I had to go through every attribute anyway. llvm-svn: 158700
* Handle C++11 attribute namespaces automatically.Alexis Hunt2012-06-181-11/+16
| | | | | | | | Now, as long as the 'Namespaces' variable is correct inside Attr.td, the generated code will correctly admit a C++11 attribute only when it has the appropriate namespace(s). llvm-svn: 158661
* [MSExtensions] Add support for __forceinline.Michael J. Spencer2012-06-181-3/+8
| | | | | | __forceinline is a combination of the inline keyword and __attribute__((always_inline)) llvm-svn: 158653
* Recover when correcting an unknown type name to a keyword like "struct".Kaelyn Uhrain2012-06-151-3/+7
| | | | llvm-svn: 158573
* If parsing a trailing-return-type fails, don't pretend we didn't have one atRichard Smith2012-06-121-2/+2
| | | | | | all. Suppresses follow-on errors mentioned in PR13074. llvm-svn: 158348
* Recognize the MS inheritance attributes and turn them into attributesJohn McCall2012-05-221-4/+0
| | | | | | | | | on the RecordDecl. Persist the MS portability type attributes and ignore them in Sema rather than the parser. Patch by João Matos! llvm-svn: 157288
* CXXThisScopeRAII objects aren't free, don't compute one if it's unused.Benjamin Kramer2012-05-171-1/+1
| | | | llvm-svn: 156987
* [libclang/AST] When declaring a local class, don't neglect to set the end ↵Argyrios Kyrtzidis2012-05-161-0/+1
| | | | | | | | | | | location of the DeclStmt node, otherwise libclang will not work for anything inside that class. rdar://10837710 llvm-svn: 156966
* Move the warnings for extra semi-colons under -Wextra-semi. Also, addedRichard Trieu2012-05-161-4/+2
| | | | | | | | a warning for an extra semi-colon after function definitions. Added logic so that a block of semi-colons on a line will only get one warning instead of a warning for each semi-colon. llvm-svn: 156934
* Typo.Richard Smith2012-05-151-1/+1
| | | | llvm-svn: 156860
* If we see a declaration which is either missing a type or has a malformed type,Richard Smith2012-05-151-1/+4
| | | | | | | | and the thing we have has a scope specifier, and we're in a context that doesn't allow declaring a qualified name, then the error is a malformed type, not a missing type. llvm-svn: 156856
* Don't use the implicit int rule for error recovery in C++. Instead, try toRichard Smith2012-05-151-5/+54
| | | | | | disambiguate whether the type name was forgotten or mistyped. llvm-svn: 156854
* Push the knowledge that we are parsing a type-id/type-name further into theRichard Smith2012-05-091-2/+5
| | | | | | | parser, and use it to emit better diagnostics in cases where an identifer can't be looked up as a type name. llvm-svn: 156508
* Stop AltiVec parsing from going down the 'implicit int' codepath as part of itsRichard Smith2012-05-091-1/+6
| | | | | | | normal parse for token sequences like 'vector pixel foo'. This incidentally also fixes a couple of wrong-parse issues. llvm-svn: 156503
* Change how we suppress access control in explicit instantiationsJohn McCall2012-05-071-24/+36
| | | | | | | | | | so that we actually accumulate all the delayed diagnostics. Do this so that we can restore those diagnostics to good standing if it turns out that we were wrong to suppress, e.g. if the tag specifier is actually an elaborated type specifier and not a declaration. llvm-svn: 156291
* Refactor DelayedDiagnostics so that it keeps diagnostics inJohn McCall2012-05-071-2/+2
| | | | | | | separate pools owned by the RAII objects that keep pushing decl state. This gives us quite a bit more flexibility. llvm-svn: 156289
* Revert most of r154844, which was disabled in r155975. Keep around theRichard Smith2012-05-021-19/+3
| | | | | | | refactorings in that revision, and some of the subsequent bugfixes, which seem to be relevant even without delayed exception specification parsing. llvm-svn: 156031
* Disable our non-standard delayed parsing of exception specifications. DelayingRichard Smith2012-05-021-0/+6
| | | | | | | the parsing of such things appears to be a conforming extension, but it breaks libstdc++4.7's std::pair. llvm-svn: 155975
* switch some uses of ExpectAndConsume(tok::semi to use ExpectAndConsumeSemi. ↵Chris Lattner2012-04-281-4/+3
| | | | | | | | | | | | | | | | | | | | This allows us to improve this diagnostic (telling us to insert another ")": t.c:2:19: error: expected ';' at end of declaration int x = 4+(5-12)); ^ ; to: t.c:2:19: error: extraneous ')' before ';' int x = 4+(5-12)); ^ ...telling us to remove the ")". This is PR12595. There are more uses of ExpectAndConsumeSemi that could be switched over, but I don't hit them on a daily basis :) llvm-svn: 155759
* Imrpove the note text for when a non-type decl hides a tag typeKaelyn Uhrain2012-04-271-1/+1
| | | | llvm-svn: 155723
* Add note to help explain why a tag such as 'struct' is needed to referKaelyn Uhrain2012-04-261-2/+14
| | | | | | | to a given type, when the reason is that there is a non-type decl with the same name. llvm-svn: 155677
* Don't try to delay parsing the exception specification for a data member of aRichard Smith2012-04-241-0/+2
| | | | | | class; we would never actually parse it and attach it to the type. llvm-svn: 155426
* Implement the last part of C++ [class.mem]p2, delaying the parsing ofDouglas Gregor2012-04-161-5/+12
| | | | | | | | | exception specifications on member functions until after the closing '}' for the containing class. This allows, for example, a member function to throw an instance of its own class. Fixes PR12564 and a fairly embarassing oversight in our C++98/03 support. llvm-svn: 154844
* Implement C++11 [expr.prim.general]p3, which permits the use of 'this'Douglas Gregor2012-04-161-6/+28
| | | | | | | | | | | | | | | | | | | | | | | in the declaration of a non-static member function after the (optional) cv-qualifier-seq, which in practice means in the exception specification and late-specified return type. The new scheme here used to manage 'this' outside of a member function scope is more general than the Scope-based mechanism previously used for non-static data member initializers and late-parsesd attributes, because it can also handle the cv-qualifiers on the member function. Note, however, that a separate pass is required for static member functions to determine whether 'this' was used, because we might not know that we have a static function until after declaration matching. Finally, this introduces name mangling for 'this' and for the implicit 'this', which is intended to match GCC's mangling. Independent verification for the new mangling test case would be appreciated. Fixes PR10036 and PR12450. llvm-svn: 154799
* Delete late parsed attributes instead of leaking them.Benjamin Kramer2012-04-141-0/+1
| | | | llvm-svn: 154746
* Add an AttributedStmt type to represent a statement with C++11 attributesRichard Smith2012-04-141-1/+1
| | | | | | | | | attached. Since we do not support any attributes which appertain to a statement (yet), testing of this is necessarily quite minimal. Patch by Alexander Kornienko! llvm-svn: 154723
* Part of PR10101: after a parse error in a declaration, try harder to find theRichard Smith2012-04-111-4/+62
| | | | | | | right place to pick up parsing. In C++, this had a tendency to skip everything declared within headers if the TU starts with garbage. llvm-svn: 154530
* Support C++11 attributes at the start of a parameter-declaration.Richard Smith2012-04-111-10/+15
| | | | llvm-svn: 154476
* Fix GCC's pedantic return-type warning -- this enum is fully covered.Chandler Carruth2012-04-101-0/+1
| | | | llvm-svn: 154399
* Parsing of C++11 attributes:Richard Smith2012-04-101-3/+3
| | | | | | | | | | * Alternative tokens (such as 'compl') are treated as identifiers in attribute names. * An attribute-list can start with a comma. * An ellipsis may not be used with either of our currently-supported C++11 attributes. llvm-svn: 154381
* Disambiguation of '[[':Richard Smith2012-04-101-36/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * In C++11, '[[' is ill-formed unless it starts an attribute-specifier. Reject array sizes and array indexes which begin with a lambda-expression. Recover by parsing the lambda as a lambda. * In Objective-C++11, either '[' could be the start of a message-send. Fully disambiguate this case: it turns out that the grammars of message-sends, lambdas and attributes do not actually overlap. Accept any occurrence of '[[' where either '[' starts a message send, but reject a lambda in an array index just like in C++11 mode. Implement a couple of changes to the attribute wording which occurred after our attributes implementation landed: * In a function-declaration, the attributes go after the exception specification, not after the right paren. * A reference type can have attributes applied. * An 'identifier' in an attribute can also be a keyword. Support for alternative tokens (iso646 keywords) in attributes to follow. And some bug fixes: * Parse attributes after declarator-ids, even if they are not simple identifiers. * Do not accept attributes after a parenthesized declarator. * Accept attributes after an array size in a new-type-id. * Partially disamiguate 'delete' followed by a lambda. More work is required here for the case where the lambda-introducer is '[]'. llvm-svn: 154369
* Fixed scoping error for late parsed attributes in nested classes.DeLesley Hutchins2012-04-061-0/+9
| | | | llvm-svn: 154173
* For PR11916: Add support for g++'s __int128 keyword. Unlike __int128_t, this isRichard Smith2012-04-041-4/+12
| | | | | | | | | | a type specifier and can be combined with unsigned. This allows libstdc++4.7 to be used with clang in c++98 mode. Several other changes are still required for libstdc++4.7 to work with clang in c++11 mode. llvm-svn: 153999
* Reject 'template<typename...Ts> void f(Ts ...(x));'. Add a special-caseRichard Smith2012-03-291-11/+52
| | | | | | | diagnostic and a fix-it to explain to the user where the ellipsis is supposed to go. llvm-svn: 153622
* If we see '(...' where we're expecting an abstract-declarator, that doesn'tRichard Smith2012-03-271-4/+7
| | | | | | | necessarily mean we've found a function declarator. If the next token is not a ')', this is actually a parenthesized pack expansion. llvm-svn: 153544
* Add cross-referencing comments to ParseDirectDeclarator to note thatRichard Smith2012-03-271-2/+6
| | | | | | | isConstructorDeclaration also needs updating for any extension to the grammar of a direct-declarator. llvm-svn: 153490
* When we see 'Class(X' or 'Class::Class(X' and we suspect that it names aRichard Smith2012-03-271-1/+36
| | | | | | | | | | | | | constructor, but X is not a known typename, check whether the tokens could possibly match the syntax of a declarator before concluding that it isn't a constructor. If it's definitely ill-formed, assume it is a constructor. Empirical evidence suggests that this pattern is much more often a constructor with a typoed (or not-yet-declared) type name than any of the other possibilities, so the extra cost of the check is not expected to be problematic. llvm-svn: 153488
* Support for definitions of member enumerations of class templates outside theRichard Smith2012-03-231-23/+48
| | | | | | | class template's definition, and for explicit specializations of such enum members. llvm-svn: 153304
* Add the missing compatibility warning for braced initializers as default ↵Sebastian Redl2012-03-181-2/+3
| | | | | | arguments. llvm-svn: 153026
* Small cleanup: move trailing-return-type special-casing intoRichard Smith2012-03-151-3/+3
| | | | | | getDeclSpecContextFromDeclaratorContext. llvm-svn: 152766
OpenPOWER on IntegriCloud