summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser
Commit message (Collapse)AuthorAgeFilesLines
...
* Add support for cooked forms of user-defined-integer-literal andRichard Smith2012-03-081-21/+20
| | | | | | | user-defined-floating-literal. Support for raw forms of these literals to follow. llvm-svn: 152302
* Implement C++11 [lex.ext]p10 for string and character literals: a ud-suffix notRichard Smith2012-03-081-3/+5
| | | | | | | | | | | | | | | | | | starting with an underscore is ill-formed. Since this rule rejects programs that were using <inttypes.h>'s macros, recover from this error by treating the ud-suffix as a separate preprocessing-token, with a DefaultError ExtWarn. The approach of treating such cases as two tokens is under discussion for standardization, but is in any case a conforming extension and allows existing codebases to keep building while the committee makes up its mind. Reword the warning on the definition of literal operators not starting with underscores (which are, strangely, legal) to more explicitly state that such operators can't be called by literals. Remove the special-case diagnostic for hexfloats, since it was both triggering in the wrong cases and incorrect. llvm-svn: 152287
* User-defined literal support for character literals.Richard Smith2012-03-081-1/+24
| | | | llvm-svn: 152277
* AST representation for user-defined literals, plus just enough of semanticRichard Smith2012-03-071-5/+17
| | | | | | | | | | | | | | | | | | | | | analysis to make the AST representation testable. They are represented by a new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic properties, including full CodeGen support, are achieved for free by this representation. UserDefinedLiterals can never be dependent, so no custom instantiation behavior is required. They are mangled as if they were direct calls to the underlying literal operator. This matches g++'s apparent behavior (but not its actual mangling, which is broken for literal-operator-ids). User-defined *string* literals are now fully-operational, but the semantic analysis is quite hacky and needs more work. No other forms of user-defined literal are created yet, but the AST support for them is present. This patch committed after midnight because we had already hit the quota for new kinds of literal yesterday. llvm-svn: 152211
* User-defined literals: reject string and character UDLs in all places where theRichard Smith2012-03-063-0/+71
| | | | | | | | | | grammar requires a string-literal and not a user-defined-string-literal. The two constructs are still represented by the same TokenKind, in order to prevent a combinatorial explosion of different kinds of token. A flag on Token tracks whether a ud-suffix is present, in order to prevent clients from needing to look at the token's spelling. llvm-svn: 152098
* Added support for parsing declspecs on enumerations. Fixes PR8783Aaron Ballman2012-03-011-2/+2
| | | | llvm-svn: 151798
* Fix decltype crash-on-invalid, if we don't find a matching ')' for an ill-formedRichard Smith2012-02-271-2/+2
| | | | | | decltype expression. llvm-svn: 151515
* Update parser's disambiguation to cope with braced function-style casts inRichard Smith2012-02-232-4/+96
| | | | | | | | | C++11, and with braced-init-list initializers in conditions. This exposed an ambiguity with enum underlying types versus bitfields, which we resolve by treating 'enum E : T {' as always defining an enumeration (even if it would only successfully parse as a bitfield). This appears to be g++ compatible. llvm-svn: 151227
* In -fdelayed-template-parsing mode, reenter every scope when late parsing a ↵Francois Pichet2012-02-221-0/+27
| | | | | | | | | | templated function; (Not just the template parameter scope as previously). Also enter the scope stack in the correct order. Otherwise this breaks some invariant during name lookup especially when dealing with shadowed declaration Fix PR11931. llvm-svn: 151140
* Accept braced-init-lists in conditions, and, in passing, dramatically improveRichard Smith2012-02-222-1/+42
| | | | | | the diagnostic for using a parenthesized direct-initializer in a condition. llvm-svn: 151137
* Disambiguate between C++11 lambda expressions and C99 arrayDouglas Gregor2012-02-171-0/+11
| | | | | | | | | designators in the parser. In the worst case, this disambiguation requires tentative parsing just past the closing ']', but for most cases we'll be able to tell by looking ahead just one token (without going into the heavyweight tentative parsing machinery). llvm-svn: 150790
* Improve recovery for lambda expressions that have 'mutable' or aDouglas Gregor2012-02-161-0/+2
| | | | | | | trailing return type but not a '()'. Recover by inserting the parentheses. Thanks to Xeo on IRC for the example. llvm-svn: 150727
* Allow thread safety attributes on function definitions.DeLesley Hutchins2012-02-161-0/+35
| | | | | | | | For compatibility with gcc, clang will now parse gcc attributes on function definitions, but issue a warning if the attribute is not a thread safety attribute. Warning controlled by -Wgcc-compat. llvm-svn: 150698
* Improve typo correction involving nested name specifiers.Kaelyn Uhrain2012-02-151-4/+2
| | | | | | | | | | | | Snooping in other namespaces when the identifier being corrected is already qualified (i.e. a valid CXXScopeSpec is passed to CorrectTypo) and ranking synthesized namespace qualifiers relative to the existing qualifier is now performed. Support for disambiguating the string representation of synthesized namespace qualifers has also been added (the change to test/Parser/cxx-using-directive.cpp is an example of an ambiguous relative qualifier). llvm-svn: 150622
* Generalize -Wempty-body: warn when statement body is empty (closes: PR11329)Dmitri Gribenko2012-02-142-5/+5
| | | | | | | | | | | | | | * if, switch, range-based for: warn if semicolon is on the same line. * for, while: warn if semicolon is on the same line and either next statement is compound statement or next statement has more indentation. Replacing the semicolon with {} or moving the semicolon to the next line will always silence the warning. Tests from SemaCXX/if-empty-body.cpp merged into SemaCXX/warn-empty-body.cpp. llvm-svn: 150515
* Drive-by fix of incorrect diagnostic, and a test case for said diagnostic. ↵Sebastian Redl2012-02-111-2/+6
| | | | | | The double error is unfortunate, but I really don't see an alternative whose effort is worth it. llvm-svn: 150317
* Remove the "unsupported" error for lambda expressions. It's annoying,Douglas Gregor2012-02-092-13/+13
| | | | | | and rapidly becoming untrue. llvm-svn: 150165
* Fix yet one more testDouglas Gregor2012-02-091-1/+1
| | | | llvm-svn: 150129
* Fix tests for r150123Douglas Gregor2012-02-092-2/+2
| | | | llvm-svn: 150126
* In C++11 mode, when an integral constant expression is desired and we have aRichard Smith2012-02-041-2/+2
| | | | | | | | | | | | | | | | | | value of class type, look for a unique conversion operator converting to integral or unscoped enumeration type and use that. Implements [expr.const]p5. Sema::VerifyIntegerConstantExpression now performs the conversion and returns the converted result. Some important callers of Expr::isIntegralConstantExpr have been switched over to using it (including all of those required for C++11 conformance); this switch brings a side-benefit of improved diagnostics and, in several cases, simpler code. However, some language extensions and attributes have not been moved across and will not perform implicit conversions on constant expressions of literal class type where an ICE is required. In passing, fix static_assert to perform a contextual conversion to bool on its argument. llvm-svn: 149776
* Refactor to share code for handling return statements between lambda ↵Eli Friedman2012-01-261-2/+1
| | | | | | expressions and block literals. As it turns out, almost all the logic can be shared. llvm-svn: 149031
* Fix code so that a SkipUntil will ignore semicolons when skipping aRichard Trieu2012-01-211-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function body. This keeps the brace count accurate to prevent additional errors. Also, moved the caret from the brace to the function name. Code: class F{ int Foo{ return 1; } }; Fixed error: parameters.cc:1:14: error: function definition does not declare parameters class F{ int Foo{ return 1; } }; ^ 1 error generated. Old errors: parameters.cc:1:17: error: function definition does not declare parameters class F{ int Foo{ return 1; } }; ^ parameters.cc:1:30: error: expected ';' after class class F{ int Foo{ return 1; } }; ^ ; parameters.cc:1:31: error: expected external declaration class F{ int Foo{ return 1; } }; ^ 3 errors generated. llvm-svn: 148621
* Improve diagnostics for dangling '}'.Nico Weber2012-01-172-2/+2
| | | | | | Fixes PR6484. Patch from Jason Switzer! llvm-svn: 148270
* More lambda work: semantic analysis of capturing 'this'. It's a bit ↵Eli Friedman2012-01-071-1/+2
| | | | | | complicated, but we have to be careful about when exactly captures are marked given PotentiallyPotentiallyEvaluated contexts. (Actually, it's not 100% correct yet, but it's close enough for the moment.) llvm-svn: 147723
* More lambda work. Tweak the Sema interface slightly. Start adding the ↵Eli Friedman2012-01-051-4/+1
| | | | | | pieces to build the lambda class and its call operator. Create an actual scope for the lambda body. llvm-svn: 147595
* Stub out the Sema interface for lambda expressions, and change the parser to ↵Eli Friedman2012-01-043-14/+14
| | | | | | use it. Unconditionally error on lambda expressions because they don't work in any meaningful way yet. llvm-svn: 147515
* Change the diagnostics which said 'accepted as an extension' to instead sayRichard Smith2011-12-292-8/+8
| | | | | | | 'is an extension'. The former is inappropriate and confusing when building with -Werror/-pedantic-errors. llvm-svn: 147357
* Add -Wdangling-else.Nico Weber2011-12-221-0/+55
| | | | | | | This works like described in http://drdobbs.com/blogs/cpp/231602010 Fixes http://llvm.org/PR11609 llvm-svn: 147202
* PR11297: Provide a better diagnostic for code which contains aRichard Smith2011-12-201-0/+30
| | | | | | | | reasonable-looking but ill-formed for-range statement of the form: for (expression : expression) llvm-svn: 147006
* In Parser::SkipUntil do not stop at '@' unconditionally.Argyrios Kyrtzidis2011-12-171-11/+0
| | | | | | | | | | | | | | | Stopping at '@' was originally intended to avoid skipping an '@' at the @interface context when doing parser recovery, but we should not stop at all '@' tokens because they may be part of expressions (e.g. in @"string", @selector(), etc.), so in most cases we will want to skip them. This commit caused 'test/Parser/method-def-in-class.m' to fail for the cases where we tried to recover from unmatched angle bracket but IMO it is not a big deal to not have good recovery from such broken code and the way we did recovery would not always work anyway (e.g. if there was '@' in an expression). The case that rdar://7029784 is about still passes. llvm-svn: 146815
* Modify how the -verify flag works. Currently, the verification string andRichard Trieu2011-12-159-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostic message are compared. If either is a substring of the other, then no error is given. This gives rise to an unexpected case: // expect-error{{candidate function has different number of parameters}} will match the following error messages from Clang: candidate function has different number of parameters (expected 1 but has 2) candidate function has different number of parameters It will also match these other error messages: candidate function function has different number of parameters number of parameters This patch will change so that the verification string must be a substring of the diagnostic message before accepting. Also, all the failing tests from this change have been corrected. Some stats from this cleanup: 87 - removed extra spaces around verification strings 70 - wording updates to diagnostics 40 - extra leading or trailing characters (typos, unmatched parens or quotes) 35 - diagnostic level was included (error:, warning:, or note:) 18 - flag name put in the warning (-Wprotocol) llvm-svn: 146619
* objc: diagnose duplicate declaration of methodsFariborz Jahanian2011-12-131-1/+1
| | | | | | in classes. // rdar://10535349 llvm-svn: 146504
* Implement the Microsoft __if_exists/if_not_exists extension in initializer-list.Francois Pichet2011-12-121-0/+29
| | | | | | | | | | | | | | | Necessary to parse Microsoft ATL code. Example: int array[] = { 0, __if_exists(CLASS::Type) {2, } 3 }; will declare an array of 2 or 3 elements depending on if CLASS::Type exists or not. llvm-svn: 146447
* Add ability to supply additional message to availability macros,Fariborz Jahanian2011-12-101-0/+8
| | | | | | // rdar://10095131 llvm-svn: 146304
* Fix: allow @protocol forward declarations inside @implementation-s.Erik Verbruggen2011-12-081-0/+51
| | | | llvm-svn: 146147
* Extend warnings for missing '@end'.Erik Verbruggen2011-12-065-13/+13
| | | | | | Fixes PR2709. llvm-svn: 145928
* Diagnose use of wide string literal in 'asm' instead of crashing. Fixes ↵Ted Kremenek2011-12-021-0/+3
| | | | | | <rdar://problem/10465079>. llvm-svn: 145656
* Change the Microsoft __interface keyword to be an alias for struct (not ↵Francois Pichet2011-12-011-0/+5
| | | | | | class) since members are public by default. llvm-svn: 145580
* Enable delayed template parsing for friend functions declared at template ↵Francois Pichet2011-11-181-0/+4
| | | | | | class scope. llvm-svn: 144980
* PR11148: Fix crash-on-invalid if an invalid member declaration is marked asRichard Smith2011-11-101-0/+4
| | | | | | defaulted or deleted. llvm-svn: 144270
* Improve the diagnostic when a comma ends up at the end of a declarator groupRichard Smith2011-10-192-1/+39
| | | | | | | | | instead of a semicolon (as sometimes happens during refactorings). When such a comma is seen at the end of a line, and is followed by something which can't possibly be a declarator (or even something which might be a plausible typo for a declarator), suggest that a semicolon was intended. llvm-svn: 142544
* Refactor __attribute__ parsing, and add a diagnostic if the r_paren at the endRichard Smith2011-10-171-0/+5
| | | | | | of an attrib is missing. gcc does not allow the closing parenthesis to be omitted. llvm-svn: 142255
* Testcase for half of r142048.Richard Smith2011-10-151-0/+5
| | | | llvm-svn: 142053
* Use of override keywords in C++98 should produce a warning by default.Richard Smith2011-10-151-0/+8
| | | | llvm-svn: 142050
* Update all tests other than Driver/std.cpp to use -std=c++11 rather thanRichard Smith2011-10-1311-11/+11
| | | | | | -std=c++0x. Patch by Ahmed Charles! llvm-svn: 141900
* Allow for annotate attributes after access specifiers. When suchErik Verbruggen2011-10-131-0/+12
| | | | | | attributes are found, propagate them to subsequent declarations. llvm-svn: 141861
* Fix crash-on-invalid, improve error recovery, and test coverage for missing ↵David Blaikie2011-10-131-0/+17
| | | | | | colon after access specifiers in C++ llvm-svn: 141852
* Switch diagnostic text from "C++0x" over to "C++11".Douglas Gregor2011-10-123-10/+10
| | | | | | | | We'd also like for "C++11" or "c++11" to be used for the warning groups, but without removing the old warning flags. Patches welcome; I've run out of time to work on this today. llvm-svn: 141801
* Introduce BalancedDelimiterTracker, to better track open/closeDouglas Gregor2011-10-121-0/+7
| | | | | | | delimiter pairs and detect when we exceed the implementation limit for nesting depth, from Aaron Ballman! llvm-svn: 141782
* OpenCL: add a non-standard extension, cl_clang_storage_class_specifiers,Peter Collingbourne2011-10-061-0/+6
| | | | | | | | | which enables support for C99 storage-class specifiers. This extension is intended to be used by implementations to implement OpenCL C built-in functions. llvm-svn: 141271
OpenPOWER on IntegriCloud