summaryrefslogtreecommitdiffstats
path: root/clang/test/FixIt
Commit message (Collapse)AuthorAgeFilesLines
* Tests for the fixits which Doug added in r150727.Richard Smith2012-02-171-0/+2
| | | | llvm-svn: 150777
* Reject continue/break statements within members of local functions nested withinRichard Smith2012-02-171-19/+42
| | | | | | | | | | | | | | | loop and switch statements, by teaching Scope that a function scope never has a continue/break parent for the purposes of control flow. Remove the hack in block and lambda expressions which worked around this by pretending that such expressions were continue/break scopes. Remove Scope::ControlParent, since it's unused. In passing, teach default statements to recover properly from a missing ';', and add a fixit for same to both default and case labels (the latter already recovered correctly). llvm-svn: 150776
* Allow implicit capture of 'this' in a lambda even when the captureDouglas Gregor2012-02-101-0/+12
| | | | | | | | | | | | default is '=', and reword the warning about explicitly capturing 'this' in such lambdas to indicate that only explicit capture is banned. Introduce Fix-Its for this and other "save the programmer from themself" rules regarding what can be explicitly captured and what must be implicitly captured. llvm-svn: 150256
* PR11684, core issue 1417:Richard Smith2012-02-101-3/+3
| | | | | | | | | | | | | | o Correct the handling of the restrictions on usage of cv-qualified and ref-qualified function types. o Fix a bug where such types were rejected in template type parameter default arguments, due to such arguments not being treated as a template type arg context. o Remove the ExtWarn for usage of such types as template arguments; that was a standard defect, not a GCC extension. o Improve the wording and unify the code for diagnosing cv-qualifiers with the code for diagnosing ref-qualifiers. llvm-svn: 150244
* Introduce 3 new fixit options:Argyrios Kyrtzidis2012-01-261-0/+6
| | | | | | | | | | | | | | -fixit-recompile applies fixits and recompiles the result -fixit-to-temporary applies fixits to temporary files -fix-only-warnings">, applies fixits for warnings only, not errors Combining "-fixit-recompile -fixit-to-temporary" allows testing the result of fixits without touching the original sources. llvm-svn: 149027
* Extend the error of invalid token after declarations to include fixits for Richard Trieu2012-01-191-11/+59
| | | | | | !=, %=, ^=, &=, *=, -=, |=, /=, <<=, <=, >=, and >>= to =. llvm-svn: 148499
* Change the error when a '+=' follows a declaration to suggest a fixit to '=' ↵Richard Trieu2012-01-181-0/+6
| | | | | | | | | | | | | | | | | | | instead of just suggesting a ';'. Old error: plusequaldeclare1.cc:3:8: error: expected ';' at end of declaration int x += 6; ^ ; New error: plusequaldeclare1.cc:3:9: error: invalid '+=' at end of declaration; did you mean '='? int x += 6; ^~ = llvm-svn: 148433
* Improve 0-argument -Wvexing-parse diagnostic by adding notes with fix-its:Richard Smith2012-01-121-0/+80
| | | | | | | | | | | | | | | | | | | | | | | - If the declarator is at the start of a line, and the previous line contained another declarator and ended with a comma, then that comma was probably a typo for a semicolon: int n = 0, m = 1, l = 2, // k = 5; myImportantFunctionCall(); // oops! - If removing the parentheses would correctly initialize the object, then produce a note suggesting that fix. - Otherwise, if there is a simple initializer we can suggest which performs value-initialization, then provide a note suggesting a correction to that initializer. Sema::Declarator now tracks the location of the comma prior to the declarator in the declaration, if there is one, to facilitate providing the note. The code to determine an appropriate initializer from the -Wuninitialized warning has been factored out to allow use in both that and -Wvexing-parse. llvm-svn: 148072
* Update C++11 scoped enumeration support to match the final proposal:Richard Smith2012-01-101-0/+9
| | | | | | | | - reject definitions of enums within friend declarations - require 'enum', not 'enum class', for non-declaring references to scoped enumerations llvm-svn: 147824
* Extend the diagnostic for a ',' at the end of a declaration where a ';' wasRichard Smith2012-01-092-0/+27
| | | | | | intended to cover C++ class definitions. llvm-svn: 147808
* Fix constexpr handling to allow 'extern constexpr' variable declarations. We noRichard Smith2011-12-251-35/+0
| | | | | | | longer have access to the source locations we need to produce the 'replace constexpr with const' fixits, so they're gone for now. llvm-svn: 147273
* Modify how the -verify flag works. Currently, the verification string andRichard Trieu2011-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert most of r145372 for now. Lookahead beyond the ';' in a functionRichard Smith2011-11-303-41/+0
| | | | | | | | | declaration tickles a bug in the way we handle visibility pragmas. The improvement to error recovery for template function definitions declared with the 'typedef' specifier in r145372 is unrelated and not reverted here. llvm-svn: 145541
* Add fix-it to remove 'typedef' from function template definitions. Such a tokenRichard Smith2011-11-291-3/+10
| | | | | | | was probably meant to be 'typename', which we will have already suggested if it is appropriate. llvm-svn: 145395
* PR10101: Recover better from a common copy-paste error: if a functionRichard Smith2011-11-293-0/+41
| | | | | | | | declaration at namespace scope is followed by a semicolon and an open-brace (or in C++, a 'try', ':' or '='), then the error is probably a function definition with a spurious ';', rather than a mysterious '{'. llvm-svn: 145372
* Make the -verify bits in this test actually test something, and fix a few casesRichard Smith2011-10-201-11/+12
| | | | | | where the test didn't work. llvm-svn: 142563
* Improve the diagnostic when a comma ends up at the end of a declarator groupRichard Smith2011-10-193-0/+26
| | | | | | | | | 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
* Improve the warning for cv-qualifiers on free functions, from Ahmed Charles!Douglas Gregor2011-10-191-0/+3
| | | | llvm-svn: 142478
* Update all tests other than Driver/std.cpp to use -std=c++11 rather thanRichard Smith2011-10-131-3/+3
| | | | | | -std=c++0x. Patch by Ahmed Charles! llvm-svn: 141900
* Catch placeholder types in DefaultLvalueConversionJohn McCall2011-10-111-2/+2
| | | | | | | | | | | and DefaultFunctionArrayLvalueConversion. To prevent significant regression for should-this-be-a-call fixits, and to repair some such regression from the introduction of bound member placeholders, make those placeholder checks try to build calls appropriately. Harden the build-a-call logic while we're at it. llvm-svn: 141738
* Remove FIXME obsoleted by change r141279 for PR11067.Richard Smith2011-10-071-5/+0
| | | | llvm-svn: 141351
* Make -fobjc-nonfragile-abi the -cc1 default, since it's theJohn McCall2011-10-021-3/+3
| | | | | | | | | | | | | | | | | | | increasingly prevailing case to the point that new features like ARC don't even support the fragile ABI anymore. This required a little bit of reshuffling with exceptions because a check was assuming that ObjCNonFragileABI was only being set in ObjC mode, and that's actually a bit obnoxious to do. Most, though, it involved a perl script to translate a ton of test cases. Mostly no functionality change for driver users, although there are corner cases with disabling language-specific exceptions that we should handle more correctly now. llvm-svn: 140957
* Mark the ExtWarn for in-class initialization of static const float members ↵Richard Smith2011-09-291-4/+2
| | | | | | as a GNU extension. Don't extend the scope of this extension to all literal types in C++0x mode. llvm-svn: 140820
* constexpr: semantic checking for constexpr variables.Richard Smith2011-09-291-1/+43
| | | | | | We had an extension which allowed const static class members of floating-point type to have in-class initializers, 'as a C++0x extension'. However, C++0x does not allow this. The extension has been kept, and extended to all literal types in C++0x mode (with a fixit to add the 'constexpr' specifier). llvm-svn: 140801
* PR10867: Work around a bug in lit. Multiple RUN: lines are joined with &&, so:Richard Smith2011-09-068-11/+11
| | | | | | | | | | | | | | | | | RUN: foo RUN: bar || true is equivalent to: RUN: foo && bar || true which is equivalent to: RUN: (foo && bar) || true This resulted in several of the fixit tests not really testing anything. llvm-svn: 139132
* Improve overloaded function handling in the typo correction code.Kaelyn Uhrain2011-08-031-5/+6
| | | | | | | | Change TypoCorrection to store a set of NamedDecls instead of a single NamedDecl. Also add initial support for performing function overload resolution to Sema::DiagnoseEmptyLookup. llvm-svn: 136807
* Introduce a Fix-It for the "missing sentinel" warning, adding anDouglas Gregor2011-07-301-0/+14
| | | | | | | appropriate sentinel at the end of the argument list. Also, put the sentinel warnings under -Wsentinel. Fixes <rdar://problem/8764236>. llvm-svn: 136566
* Add a fixit for removal of unused label.Anna Zaks2011-07-281-2/+13
| | | | llvm-svn: 136389
* Another test case for the &/* mismatch fixit.Anna Zaks2011-07-281-1/+15
| | | | llvm-svn: 136380
* Add */& mismatch fixit generation to the Sema::DiagnoseAssignmentResult().Anna Zaks2011-07-282-0/+33
| | | | llvm-svn: 136379
* Provide fixit for static use of objective-c typeFariborz Jahanian2011-07-261-0/+11
| | | | | | | in few more places and in each instance, fix up the type to the expected type. // rdar://9603056 llvm-svn: 136103
* objective-c: Provide a 'fixit' when class was usedFariborz Jahanian2011-07-251-0/+18
| | | | | | to declare a static object. // rdar://9603056 llvm-svn: 135970
* Add FixIt hint for missing 'id' type.Fariborz Jahanian2011-07-211-0/+24
| | | | | | // rdar://9615045 llvm-svn: 135685
* Addressing code review comments for commit 135509 - Add FixItHints in case a ↵Anna Zaks2011-07-211-2/+19
| | | | | | C++ function call is missing * or & operators on llvm-svn: 135643
* Add FixItHints in case a C++ function call is missing * or & operators on ↵Anna Zaks2011-07-191-0/+87
| | | | | | one/several of it's parameters (addresses http://llvm.org/PR5941). llvm-svn: 135509
* Add a hackaround to avoid the crash in PR10355. However, our recoveryDouglas Gregor2011-07-141-0/+11
| | | | | | | is still terrible here because typo correction is not behaving well in the presence of overloaded functions. llvm-svn: 135128
* When adding boolean keywords for typo correction, add either "bool" orDouglas Gregor2011-07-011-0/+6
| | | | | | | "_Bool" (depending on dialect), but not both, since they have the same edit distance from "Bool". llvm-svn: 134263
* Add support for C++ namespace-aware typo correction, e.g., correctingDouglas Gregor2011-06-281-0/+6
| | | | | | | | | | | | | | | vector<int> to std::vector<int> Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes PR5776/<rdar://problem/8652971>. Thanks Kaelyn! llvm-svn: 134007
* Provide fix-it for '.' <-> '->' for Objective-C ivar/property access.Fariborz Jahanian2011-06-281-0/+14
| | | | | | // rdar://7811841 llvm-svn: 133970
* Allow the fixit for missing ':' in the ?: ternary operator if it is pointingArgyrios Kyrtzidis2011-06-241-0/+5
| | | | | | at the start of a macro instantiation. llvm-svn: 133801
* Fixed test case asserts due to checkin of r130710.Chad Rosier2011-05-021-1/+1
| | | | llvm-svn: 130720
* Extend Sema::ClassifyName() to support C++, ironing out a few issuesDouglas Gregor2011-04-271-0/+9
| | | | | | | | | in the classification of template names and using declarations. We now properly typo-correct the leading identifiers in statements to types, templates, values, etc. As an added bonus, this reduces the number of lookups required for disambiguation. llvm-svn: 130288
* Fix testDouglas Gregor2011-04-271-2/+2
| | | | llvm-svn: 130285
* Improve diagnostics for typo correction via Sema::ClassifyName(), byDouglas Gregor2011-04-272-3/+4
| | | | | | | | looking at the context and the correction and using a custom diagnostic. Also, enable some Fix-It tests that were somewhat lamely disabled. llvm-svn: 130283
* Implement a new identifier-classification scheme where SemaDouglas Gregor2011-04-243-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | performs name lookup for an identifier and resolves it to a type/expression/template/etc. in the same step. This scheme is intended to improve both performance (by reducing the number of redundant name lookups for a given identifier token) and error recovery (by giving Sema a chance to correct type names before the parser has decided that the identifier isn't a type name). For example, this allows us to properly typo-correct type names at the beginning of a statement: t.c:6:3: error: use of undeclared identifier 'integer'; did you mean 'Integer'? integer *i = 0; ^~~~~~~ Integer t.c:1:13: note: 'Integer' declared here typedef int Integer; ^ Previously, we wouldn't give a Fix-It because the typo correction occurred after the parser had checked whether "integer" was a type name (via Sema::getTypeName(), which isn't allowed to typo-correct) and therefore decided to parse "integer * i = 0" as an expression. By typo-correcting earlier, we typo-correct to the type name Integer and parse this as a declaration. Moreover, in this context, we can also typo-correct identifiers to keywords, e.g., t.c:7:3: error: use of undeclared identifier 'vid'; did you mean 'void'? vid *p = i; ^~~ void and recover appropriately. Note that this is very much a work-in-progress. The new Sema::ClassifyName is only used for expression-or-declaration disambiguation in C at the statement level. The next steps will be to make this work for the same disambiguation in C++ (where functional-style casts make some trouble), then push it further into the parser to eliminate more redundant name lookups. Fixes <rdar://problem/7963833> for C and starts us down the path of <rdar://problem/8172000>. llvm-svn: 130082
* Fixit suggestion for adding missing tag name should have a space after the ↵Argyrios Kyrtzidis2011-04-211-0/+6
| | | | | | tag name. Fixes rdar://9295072 llvm-svn: 129917
* Support for C++11 (non-template) alias declarations.Richard Smith2011-04-151-0/+3
| | | | llvm-svn: 129567
* Issue the 2nd fixit even if fix-it hint is supressed.Fariborz Jahanian2011-04-131-1/+2
| | | | | | // rdar://9091893 llvm-svn: 129481
* No fixit hint for builtin expressions which areFariborz Jahanian2011-04-131-0/+15
| | | | | | defined in a macro. // rdar://9091893 llvm-svn: 129465
* Improve recovery (error + fix-it) when parsing type dependent template name ↵Francois Pichet2011-03-271-0/+19
| | | | | | | | | | | without the "template" keyword. For example: typename C1<T>:: /*template*/ Iterator<0> pos; Also the error is downgraded to an ExtWarn in Microsoft mode. llvm-svn: 128387
OpenPOWER on IntegriCloud