summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser
Commit message (Collapse)AuthorAgeFilesLines
* Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs2012-10-1921-0/+21
| | | | | | VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. llvm-svn: 166280
* DR1528: C++11 doesn't allow repeated cv-qualifiers in declarators after all.Richard Smith2012-10-171-6/+8
| | | | llvm-svn: 166152
* Handle a "#pragma options align" inside a class.Argyrios Kyrtzidis2012-10-121-0/+5
| | | | llvm-svn: 165810
* Improve C++11 attribute parsing.Michael Han2012-10-033-35/+79
| | | | | | | | - General C++11 attributes were previously parsed and ignored. Now they are parsed and stored in AST. - Add support to parse arguments of attributes that in 'gnu' namespace. - Differentiate unknown attributes and known attributes that can't be applied to statements when emitting diagnostic. llvm-svn: 165082
* Cleaning up the self initialization checker.Richard Trieu2012-10-011-4/+5
| | | | | | | | | | | -Allow Sema to do more processing on the initial Expr before checking it. -Remove the special conditions in HandleExpr() -Move the code so that only one call site is needed. -Removed the function from Sema and only call it locally. -Warn on potentially evaluated reference variables, not just casts to r-values. -Update tests. llvm-svn: 164951
* If a comma operator is followed by a token which unambiguously indicates theRichard Smith2012-09-183-0/+38
| | | | | | | | start of a statement or the end of a compound-statement, diagnose the comma as a typo for a semicolon. Patch by Ahmed Bougacha! Additional test cases and minor refactoring by me. llvm-svn: 164085
* Recover properly after a parse error in a static_assert declaration.Richard Smith2012-09-131-0/+2
| | | | llvm-svn: 163826
* PR13775: When checking for a tag type being shadowed by some other declaration,Richard Smith2012-09-061-0/+14
| | | | | | don't trample over the caller's LookupResult in the case where the check fails. llvm-svn: 163281
* Revert r163083 per chandlerc's request.Joao Matos2012-09-041-6/+0
| | | | llvm-svn: 163149
* Implemented parsing and AST support for the MS __leave exception statement. ↵Joao Matos2012-09-021-0/+6
| | | | | | Also a minor fix to __except printing in StmtPrinter.cpp. Thanks to Aaron Ballman for review. llvm-svn: 163083
* Normalize line endings of r163013 (part 2).Joao Matos2012-08-311-44/+44
| | | | llvm-svn: 163032
* Improved MSVC __interface support by adding first class support for it, ↵Joao Matos2012-08-311-13/+21
| | | | | | instead of aliasing to "struct" which had some incorrect behaviour. Patch by David Robins. llvm-svn: 163013
* Change the representation of builtin functions in the ASTEli Friedman2012-08-311-1/+1
| | | | | | | | | (__builtin_* etc.) so that it isn't possible to take their address. Specifically, introduce a new type to represent a reference to a builtin function, and a new cast kind to convert it to a function pointer in the operand of a call. Fixes PR13195. llvm-svn: 162962
* PR13652: Don't assume the parameter array on a FunctionTypeLoc for a lambda willRichard Smith2012-08-301-0/+1
| | | | | | | be filled in; they won't if the lambda's declarator has an invalid type. Instead take the parameters from the declarator directly. llvm-svn: 162904
* Splitting the duplicated decl spec extension warning into two: one is an ↵Aaron Ballman2012-08-282-1/+5
| | | | | | ExtWarn and the other a vanilla warning. This addresses PR13705, where const char const * wouldn't warn unless -pedantic was specified under the right conditions. llvm-svn: 162793
* [ms-inline asm] Change the -fenable-experimental-ms-inline-asm option from a Chad Rosier2012-08-241-4/+4
| | | | | | | | | CodeGen option to a LangOpt option. In turn, hoist the guard into the parser so that we avoid the new (and fairly unstable) Sema/AST/CodeGen logic. This should restore the behavior of clang to that prior to r158325. <rdar://problem/12163681> llvm-svn: 162602
* When disambiguating an expression-statement from a declaraton-statement, if theRichard Smith2012-08-231-0/+3
| | | | | | | statement starts with an identifier for which name lookup will fail either way, look at later tokens to disambiguate in order to improve error recovery. llvm-svn: 162464
* PR13619: Make sure we're not at EOF before looking at NextToken().Richard Smith2012-08-201-0/+3
| | | | llvm-svn: 162212
* PR41111, PR5925, PR13210: Teach tentative parsing to annotate identifiers andRichard Smith2012-08-183-5/+24
| | | | | | | | | | | | | | | | | nested names as id-expressions, using the annot_primary_expr annotation, where possible. This removes some redundant lookups, and also allows us to typo-correct within tentative parsing, and to carry on disambiguating past an identifier which we can determine will fail lookup as both a type and as a non-type, allowing us to disambiguate more declarations (and thus offer improved error recovery for such cases). This also introduces to the parser the notion of a tentatively-declared name, which is an identifier which we *might* have seen a declaration for in a tentative parse (but only if we end up disambiguating the tokens as a declaration). This is necessary to correctly disambiguate cases where a variable is used within its own initializer. llvm-svn: 162159
* [ms-inline asm] MSVC parses multiple __asm statements on a single line as oneChad Rosier2012-08-151-2/+2
| | | | | | | | | | | | statement. For example, if (x) __asm out dx, ax __asm out dx, ax results in a single inline asm statement (i.e., both "out dx, ax" statements are predicated on if(x)). llvm-svn: 161986
* [ms-inline asm] Add a helpful assert.Chad Rosier2012-08-141-5/+5
| | | | llvm-svn: 161890
* In 'delete []', the '[]' never starts a lambda. Update a FIXME with a ↵Richard Smith2012-08-091-0/+7
| | | | | | standard reference and add a test. llvm-svn: 161604
* Unify the codepaths for emitting deprecation warnings. The test changes are ↵Eli Friedman2012-08-081-3/+3
| | | | | | just to account for us emitting notes more consistently. llvm-svn: 161528
* Improvements to vexing-parse warnings. Make the no-parameters case moreRichard Smith2012-07-301-1/+2
| | | | | | | | | | | | | accurate by asking the parser whether there was an ambiguity rather than trying to reverse-engineer it from the DeclSpec. Make the with-parameters case have better diagnostics by using semantic information to drive the warning, improving the diagnostics and adding a fixit. Patch by Nikola Smiljanic. Some minor changes by me to suppress diagnostics for declarations of the form 'T (*x)(...)', which seem to have a very high false positive rate, and to reduce indentation in 'warnAboutAmbiguousFunction'. llvm-svn: 160998
* objective-c parsing. Don't crash when selector nameFariborz Jahanian2012-07-261-0/+52
| | | | | | is missing in method prototype. // rdar://11939584 llvm-svn: 160789
* Pedantic -pedantic correction. Duplicate cv-qualifiers are permitted in C++11Richard Smith2012-07-241-0/+3
| | | | | | unless they appear in a decl-specifier-seq. llvm-svn: 160688
* Do not warn about a function decl / direct init ambiguity if the function ↵Richard Smith2012-07-231-1/+3
| | | | | | has a trailing return type. llvm-svn: 160646
* Add diagnostics for comma at end of enum and for extra semicolon at namespaceRichard Smith2012-07-234-12/+39
| | | | | | | | scope to -Wc++11-extensions. Move extra semicolon after member function definition diagnostic out of -pedantic, since C++ allows a single semicolon there. Keep it in -Wextra-semi, though, since it's still questionable. llvm-svn: 160618
* Revert r160319, it caused PR13417. Add a test for PR13417.Nico Weber2012-07-201-0/+8
| | | | llvm-svn: 160542
* Better parser recovery in Objective-C containers.Jordan Rose2012-07-091-0/+64
| | | | | | | | | | | | | | Previously it was possible to get an infinite-loop-on-invalid with a namespace decl within @interface. Since 'namespace' is normally a safe place to retry top-level parsing, we just didn't consume the token. This adds a flag that tracks whether we have temporarily left Objective-C scope to parse a C-like declaration, and uses that to better recover from parse problems by stopping at possible method declarations and at @end. To fix the original problem, we do /not/ stop at 'namespace' when in an Objective-C @interface or @protocol context (but still do in @implementation). llvm-svn: 159941
* A ':' after an enum-specifier at class scope is a bitfield, not a typo for a ↵Richard Smith2012-07-021-0/+5
| | | | | | ';'. llvm-svn: 159549
* Add support for the C11 _Alignof keyword.Jordan Rose2012-06-301-1/+7
| | | | | | | 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
* Support the use of "=delete" and "=default" with delayed templateDouglas Gregor2012-06-281-1/+12
| | | | | | parsing. Fixes <rdar://problem/11700604>. llvm-svn: 159380
* Extend the "expected ';' after struct" logic to also apply to enums, and toRichard Smith2012-06-251-1/+1
| | | | | | struct and enum forward-declarations. llvm-svn: 159164
* Recognize GNU attributes after 'enum class'. Fixes the libc++ build.John McCall2012-06-231-0/+5
| | | | llvm-svn: 159089
* Clean up a large number of C++11 attribute parse issues, including parsingAlexis Hunt2012-06-231-2/+128
| | | | | | | | | | | | | | | | | | 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
* objective-c: improve diagnostic when collection expression isFariborz Jahanian2012-06-221-2/+2
| | | | | | not a pointer to a fast-enumerable object. // rdar://11488666 llvm-svn: 158998
* [ms-style asm] Change the fatal error to an extension warning. Apparently, thisChad Rosier2012-06-202-13/+13
| | | | | | | error was asserting on anything that included Windows.h. MS-style inline asm is still dropped, but at least now we're not completely silent about it. llvm-svn: 158833
* 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
OpenPOWER on IntegriCloud