summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser
Commit message (Collapse)AuthorAgeFilesLines
...
* Restructure how the driver communicates information about theJohn McCall2012-06-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | target Objective-C runtime down to the frontend: break this down into a single target runtime kind and version, and compute all the relevant information from that. This makes it relatively painless to add support for new runtimes to the compiler. Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z, available at the driver level as a better and more general alternative to -fgnu-runtime and -fnext-runtime. This new concept of an Objective-C runtime also encompasses what we were previously separating out as the "Objective-C ABI", so fragile vs. non-fragile runtimes are now really modelled as different kinds of runtime, paving the way for better overall differentiation. As a sort of special case, continue to accept the -cc1 flag -fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak. I won't go so far as to say "no functionality change", even ignoring the new driver flag, but subtle changes in driver semantics are almost certainly not intended. llvm-svn: 158793
* Reapplying the changes from r158717 as they were rolled back to avoid merge ↵Aaron Ballman2012-06-191-3/+25
| | | | | | conflicts from a separate problematic patch. llvm-svn: 158750
* Revert r158700 and dependent patches r158716, r158717, and r158731.Jakob Stoklund Olesen2012-06-191-25/+3
| | | | | | | | 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-3/+25
| | | | | | includes support for the align (which fixes PR12631). llvm-svn: 158717
* Extend the error recovery for a template-argument-list terminated by '>>' toRichard Smith2012-06-182-0/+22
| | | | | | | | | also deal with '>>>' (in CUDA), '>=', and '>>='. Fix the FixItHints logic to deal with cases where the token is followed by an adjacent '=', '==', '>=', '>>=', or '>>>' token, where a naive fix-it would result in a differing token stream on a re-lex. llvm-svn: 158652
* Recover when correcting an unknown type name to a keyword like "struct".Kaelyn Uhrain2012-06-151-6/+6
| | | | llvm-svn: 158573
* [ms-inline-asm] The __asm keyword is a statement separator, so multiple asmChad Rosier2012-06-121-0/+6
| | | | | | statements are allowed on the same line. llvm-svn: 158372
* [ms-inline-asm] Cleanup MS style inline assembly parsing.Chad Rosier2012-06-121-1/+8
| | | | | | | | | | Specifically, improve the handling of whitespace, stop saving tokens that are in comments and fix the case where we have a comment followed by a closing brace on the next line. Unfortunately, there's no easy way of testing this code. llvm-svn: 158367
* If parsing a trailing-return-type fails, don't pretend we didn't have one atRichard Smith2012-06-121-4/+1
| | | | | | all. Suppresses follow-on errors mentioned in PR13074. llvm-svn: 158348
* Allow CorrectTypo to add/modify nested name qualifiers to typos thatKaelyn Uhrain2012-06-061-2/+3
| | | | | | | | | are otherwise too short to try to correct. The TODOs added to two of the tests are for existing deficiencies in the typo correction code that could be exposed by using longer identifiers. llvm-svn: 158109
* Add pedantic warning -Wempty-translation-unit (C11 6.9p1).Jordan Rose2012-06-063-1/+11
| | | | | | | | | | | | | | | | | | | In standard C since C89, a 'translation-unit' is syntactically defined to have at least one "external-declaration", which is either a decl or a function definition. In Clang the latter gives us a declaration as well. The tricky bit about this warning is that our predefines can contain external declarations (__builtin_va_list and the 128-bit integer types). Therefore our AST parser now makes sure we have at least one declaration that doesn't come from the predefines buffer. Also, remove bogus warning about empty source files. This doesn't catch source files that only contain comments, and never fired anyway because of our predefines. PR12665 and <rdar://problem/9165548> llvm-svn: 158085
* Recognize the MS inheritance attributes and turn them into attributesJohn McCall2012-05-222-2/+8
| | | | | | | | | 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
* Fix line endings.John McCall2012-05-221-23/+18
| | | | llvm-svn: 157287
* Add _alignof and __builtin_alignof as aliases for __alignof inDouglas Gregor2012-05-161-0/+5
| | | | | | Microsoft mode, from Will Wilson! llvm-svn: 156940
* Move the warnings for extra semi-colons under -Wextra-semi. Also, addedRichard Trieu2012-05-162-2/+27
| | | | | | | | 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
* Don't use the implicit int rule for error recovery in C++. Instead, try toRichard Smith2012-05-151-0/+12
| | | | | | disambiguate whether the type name was forgotten or mistyped. llvm-svn: 156854
* Recover properly from a redundant 'typename' before a non-nested name. This isRichard Smith2012-05-141-0/+13
| | | | | | | permitted as a Microsoft extension. Patch by William Wilson! (Plus some minor tweaking by me.) llvm-svn: 156786
* Push the knowledge that we are parsing a type-id/type-name further into theRichard Smith2012-05-092-0/+9
| | | | | | | 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-0/+10
| | | | | | | normal parse for token sequences like 'vector pixel foo'. This incidentally also fixes a couple of wrong-parse issues. llvm-svn: 156503
* Restore paren, bracket and brace counts in parser whenDouglas Gregor2012-04-301-0/+259
| | | | | | | TentativeParsingAction is reverted, from Pasi Parviainen! Fixes PR12480 / <rdar://problem/11341251>. llvm-svn: 155823
* improve error recovery for extra ')'s after a if/switch/while condition. ↵Chris Lattner2012-04-281-2/+3
| | | | | | | | | | | | | | | | | | Before: t.c:3:9: error: expected expression if (x)) { ^ .. which isn't even true - a statement or expression is fine. After: t.c:3:9: error: extraneous ')' after condition, expected a statement if (x)) { ^ This is the second part of PR12595 llvm-svn: 155762
* switch some uses of ExpectAndConsume(tok::semi to use ExpectAndConsumeSemi. ↵Chris Lattner2012-04-281-0/+7
| | | | | | | | | | | | | | | | | | | | 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-0/+16
| | | | | | | to a given type, when the reason is that there is a non-type decl with the same name. llvm-svn: 155677
* Implements boxed expressions for Objective-C. <rdar://problem/10194391>Patrick Beard2012-04-191-0/+26
| | | | llvm-svn: 155082
* Emulate a MSVC bug where the creation of pointer-to-member to protected ↵Francois Pichet2012-04-171-1/+26
| | | | | | | | member of base class is allowed but only from a static function. This fixes a regression when parsing MFC code with clang. llvm-svn: 154924
* The result of the Microsoft __uuidof operator must be considered a global ↵Francois Pichet2012-04-161-2/+2
| | | | | | | | | | | | | lvalue during constant expression evaluation. Otherwise we would get this error in C++11 mode (because of a recent change): error: non-type template argument of type 'const _GUID *' is not a constant expression For code like: template <const GUID* g = &__uuidof(struct_with_uuid)> class COM_CLASS { }; llvm-svn: 154790
* Add an AttributedStmt type to represent a statement with C++11 attributesRichard Smith2012-04-142-3/+59
| | | | | | | | | 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
* Added a flag to the parser to skip method bodies.Erik Verbruggen2012-04-121-0/+45
| | | | llvm-svn: 154584
* Part of PR10101: after a parse error in a declaration, try harder to find theRichard Smith2012-04-111-0/+42
| | | | | | | 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-112-0/+16
| | | | llvm-svn: 154476
* Parsing of C++11 attributes:Richard Smith2012-04-102-1/+9
| | | | | | | | | | * 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-102-3/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Fix bugs found by -Wconstant-conversion improvements currently under review.David Blaikie2012-04-091-0/+7
| | | | | | | | | | | | | | | | | | Specifically, using a an integer outside [0, 1] as a boolean constant seems to be an easy mistake to make with things like "x == a || b" where the author intended "x == a || x == b". The bug caused by calling SkipUntil with three token kinds was also identified by a VC diagnostic & reported by Francois Pichet as review feedback for my commit r154163. I've included test cases to verify the error recovery that was broken/poorly implemented due to this bug. The other fix (lib/Sema/SemaExpr.cpp) seems like that code was never actually reached in any of Clang's tests & is related to Objective C features I'm not familiar with, so I've not been able to construct a test case for it. Perhaps someone else can. llvm-svn: 154325
* Remove "parse error" in favor of more descriptive diagnostics.David Blaikie2012-04-062-1/+4
| | | | | | | | | | | In a few cases clang emitted a rather content-free diagnostic: 'parse error'. This change replaces two actual cases (template parameter parsing and K&R parameter declaration parsing) with more specific diagnostics and removes a third dead case of this in the BalancedDelimiterTracker (the ctor already checked the invariant necessary to ensure that the diag::parse_error was never actually used). llvm-svn: 154224
* Added a new attribute, objc_root_class, which informs the compiler when a ↵Patrick Beard2012-04-067-8/+8
| | | | | | | | | root class is intentionally declared. The warning this inhibits, -Wobjc-root-class, is opt-in for now. However, all clang unit tests that would trigger the warning have been updated to use -Wno-objc-root-class. <rdar://problem/7446698> llvm-svn: 154187
* Fix diagnostic text for r154163.David Blaikie2012-04-061-2/+2
| | | | llvm-svn: 154164
* Restrict fixit for missing 'class' in template template parameters.David Blaikie2012-04-061-2/+2
| | | | | | | | | | | Based on Doug's feedback to r153887 this omits the FixIt if the following token isn't syntactically valid for the context. (not a comma, '...', identifier, '>', or '>>') There's a bunch of work to handle the '>>' case, but it makes for a much more pleasant diagnostic in this case. llvm-svn: 154163
* Improve & simplify diagnostic for missing 'class' in template template ↵David Blaikie2012-04-051-2/+2
| | | | | | | | parameter. Change suggested by Sebastian Redl on review feedback from r153887. llvm-svn: 154102
* Improve diagnostics for invalid use of non-static members / this:Richard Smith2012-04-051-1/+1
| | | | | | | | | | | | * s/nonstatic/non-static/ in the diagnostics, since the latter form outvoted the former by 28-2 in our diagnostics. * Fix the "use of member in static member function" diagnostic to correctly detect this situation inside a block or lambda. * Produce a more specific "invalid use of non-static member" diagnostic for the case where a nested class member refers to a member of a lexically-surrounding class. llvm-svn: 154073
* Correct error recovery when missing 'class' in a template template parameter.David Blaikie2012-04-021-4/+2
| | | | | | | | | | | | | | | | | The diagnostic message correctly informs the user that they have omitted the 'class' keyword, but neither suggests this insertion as a fixit, nor attempts to recover as if they had provided the keyword. This fixes the recovery, adds the fixit, and adds a separate diagnostic and corresponding replacement fixit for cases where the user wrote 'struct' or 'typename' instead of 'class' (suggested by Richard Smith as a possible common mistake). I'm not sure the diagnostic message for either the original or new cases feel very Clang-esque, so I'm open to suggestions there. The fixit hints make it fairly easy to see what's required, though. llvm-svn: 153887
* Don't try to parse a malformed parameter list after a constructor or operatorRichard Smith2012-03-291-5/+4
| | | | | | name as a direct initializer. llvm-svn: 153628
* If we see '(...' where we're expecting an abstract-declarator, that doesn'tRichard Smith2012-03-271-0/+25
| | | | | | | 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
* When we see 'Class(X' or 'Class::Class(X' and we suspect that it names aRichard Smith2012-03-271-0/+24
| | | | | | | | | | | | | 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
* Adding some more specific tests for enum declspec parsing, to prove that it ↵Aaron Ballman2012-03-151-0/+7
| | | | | | really works. llvm-svn: 152757
* Fix a crash-on-invalid found by -Wlogical-op-parentheses.David Blaikie2012-03-121-0/+1
| | | | llvm-svn: 152559
* Fix parsing of trailing-return-type. Types are syntactically prohibited fromRichard Smith2012-03-123-2/+24
| | | | | | | | being defined here: [] () -> struct S {} does not define struct S. In passing, implement DR1318 (syntactic disambiguation of 'final'). llvm-svn: 152551
* Fix parsing of type-specifier-seq's. Types are syntactically allowed to beRichard Smith2012-03-121-0/+20
| | | | | | | | | | | | | | | | | | defined here, but not semantically, so new struct S {}; is always ill-formed, even if there is a struct S in scope. We also had a couple of bugs in ParseOptionalTypeSpecifier caused by it being under-loved (due to it only being used in a few places) so merge it into ParseDeclarationSpecifiers with a new DeclSpecContext. To avoid regressing, this required improving ParseDeclarationSpecifiers' diagnostics in some cases. This also required teaching ParseSpecifierQualifierList about constexpr... which incidentally fixes an issue where we'd allow the constexpr specifier in other bad places. llvm-svn: 152549
* Support for raw and template forms of numeric user-defined literals,Richard Smith2012-03-091-4/+4
| | | | | | and lots of tidying up. llvm-svn: 152392
* Fix a couple of issues with literal-operator-id parsing, and provide recoveryRichard Smith2012-03-081-0/+18
| | | | | | | | | | | | for a few kinds of error. Specifically: Since we're after translation phase 6, the "" token might be formed by multiple source-level string literals. Checking the token width is not a correct way of detecting empty string literals, due to escaped newlines. Diagnose and recover from a missing space between "" and suffix, and from string literals other than "", which are followed by a suffix. llvm-svn: 152348
OpenPOWER on IntegriCloud