summaryrefslogtreecommitdiffstats
path: root/clang/test/FixIt
Commit message (Collapse)AuthorAgeFilesLines
...
* Improve diagnostic and recovery when missing a comma between base orDouglas Gregor2010-09-071-0/+9
| | | | | | member initializers in a C++ constructor. Fixes <rdar://problem/7796492>. llvm-svn: 113199
* When complaining about a duplicate declspec, provide a Fix-It thatDouglas Gregor2010-08-231-0/+3
| | | | | | | removes the copy. Patch from Eelis van der Weegen, tweaked/updated by me. llvm-svn: 111807
* Introduce -f{no-}spell-checking options to enable/disableDouglas Gregor2010-07-091-0/+6
| | | | | | | spell-checking. By default, spell-checking is enabled for Clang (obviously) but disabled in CIndex for performance reasons. llvm-svn: 107992
* Fix broken testcaseDouglas Gregor2010-06-291-2/+2
| | | | llvm-svn: 107194
* Typo correction for namespace alias definitionsDouglas Gregor2010-06-291-2/+5
| | | | llvm-svn: 107191
* Allow a using directive to refer to the implicitly-defined namespaceDouglas Gregor2010-06-291-1/+6
| | | | | | | | "std", with a warning, to improve GCC compatibility. Fixes PR7517. As a drive-by, add typo correction for using directives. llvm-svn: 107172
* Tweak test for non-64-bit DarwinDouglas Gregor2010-05-311-4/+6
| | | | llvm-svn: 105222
* When we see the a '[' in a postfix expression in Objective-C, performDouglas Gregor2010-05-311-1/+7
| | | | | | | | | | | | | | | | | | | a simple, quick check to determine whether the expression starting with '[' can only be an Objective-C message send. If so, don't parse it as an array subscript expression. This improves recovery for, e.g., [a method1] [a method2] so that we now produce t.m:10:13: error: expected ';' after expression [a method] ^ instead of some mess about expecting ']'. llvm-svn: 105221
* Fix typo test caseDouglas Gregor2010-05-181-1/+1
| | | | llvm-svn: 104027
* Give a slight edge to the context-sensitive keyword 'super' overDouglas Gregor2010-05-181-4/+2
| | | | | | | | | non-function-local declarations with names similar to what the user typed. For example, this allows us to correct 'supper' to 'super' in an Objective-C message send, even though the C function 'isupper' has the same edit distance. llvm-svn: 104023
* Tweak typo-correction logic a bit regarding "super", so that weDouglas Gregor2010-05-181-1/+16
| | | | | | | | | consider "super" as a candidate whenever we're parsing an expression within an Objective-C method in an interface that has a superclass. At some point, we'd like to give "super" a little edge over non-local names; that will come later. llvm-svn: 104022
* Clean up test case and remove XFAIL. This test can now distinguish betweenTed Kremenek2010-05-171-21/+16
| | | | | | | cases where Clang can suggest and fix and suggest and not auto-fix (because of current limitations). llvm-svn: 103987
* Teach clang -fixit to modify files in-place, or -fixit=suffix to create newNick Lewycky2010-04-2414-28/+51
| | | | | | files with the additional suffix in the middle. llvm-svn: 102230
* fix the ?: fixit that ted added to recover properly.Chris Lattner2010-04-201-3/+3
| | | | llvm-svn: 101943
* When searching for code-completion and typo-correction candidates,Douglas Gregor2010-04-191-0/+34
| | | | | | | | look from an Objective-C class or category to its implementation, to pick up synthesized ivars. Fixes a problem reported by David Chisnall. llvm-svn: 101792
* Teach -fixit to modify all of its inputs instead of just the main file, unlessNick Lewycky2010-04-153-0/+3
| | | | | | -fixit-at specified a particular fixit to fix, or the -o flag was used. llvm-svn: 101359
* Thread a Scope pointer into BuildRecoveryCallExpr to help typoDouglas Gregor2010-04-141-0/+9
| | | | | | | correction find names when a call failed. Fixes <rdar://problem/7853795>. llvm-svn: 101278
* Teach typo correction about various language keywords. We can'tDouglas Gregor2010-04-143-0/+38
| | | | | | | | | | | | | generally recover from typos in keywords (since we would effectively have to mangle the token stream). However, there are still benefits to typo-correcting with keywords: - We don't make stupid suggestions when the user typed something that is similar to a keyword. - We can suggest the keyword in a diagnostic (did you mean "static_cast"?), even if we can't recover and therefore don't have a fix-it. llvm-svn: 101274
* Implement typo correction for Objective-C message sends when theDouglas Gregor2010-04-141-3/+2
| | | | | | | | | | | | | | | | | | | | | receiver is a mis-typed class name. Previously, we would give a non-specific typo-correction diagnostic from the expression-parsing code, but there was no fix-it because it was too late to recover. Now, we give a nice diagnostic honk.m:6:4: error: unknown receiver 'Hnk'; did you mean 'Honk'? [Hnk method]; ^~~ Honk honk.m:1:1: note: 'Honk' declared here @interface Honk ^ which includes a fix-it. We still need to recover better from mis-typing "super". llvm-svn: 101211
* Add fixit hint for missing ':' in ternary expressions.Ted Kremenek2010-04-121-0/+5
| | | | llvm-svn: 101073
* Remove fixit for string literal comparison. Telling the user to use ↵Ted Kremenek2010-04-091-6/+0
| | | | | | | | | 'strcmp' is bad, and we don't have enough information to tell them how to use 'strncmp'. Instead, change the diagnostic to indicate they should use 'strncmp'. llvm-svn: 100890
* Turn access control on by default in -cc1.John McCall2010-04-091-0/+1
| | | | | | | | Remove -faccess-control from -cc1; add -fno-access-control. Make the driver pass -fno-access-control by default. Update a bunch of tests to be correct under access control. llvm-svn: 100880
* Improve diagnostics like "initializing <type> from an expression ofDouglas Gregor2010-04-091-1/+1
| | | | | | | type..." with "initializing <type> with an expression of type...", which reads better. Thanks to John for the improved wording. llvm-svn: 100873
* Improve diagnostics when we fail to convert from a source type to aDouglas Gregor2010-04-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | destination type for initialization, assignment, parameter-passing, etc. The main issue fixed here is that we used rather confusing wording for diagnostics such as t.c:2:9: warning: initializing 'char const [2]' discards qualifiers, expected 'char *' [-pedantic] char *name = __func__; ^ ~~~~~~~~ We're not initializing a 'char const [2]', we're initializing a 'char *' with an expression of type 'char const [2]'. Similar problems existed for other diagnostics in this area, so I've normalized them all with more precise descriptive text to say what we're initializing/converting/assigning/etc. from and to. The warning for the code above is now: t.c:2:9: warning: initializing 'char *' from an expression of type 'char const [2]' discards qualifiers [-pedantic] char *name = __func__; ^ ~~~~~~~~ Fixes <rdar://problem/7447179>. llvm-svn: 100832
* When a declaration of a function is missing an exception specificationDouglas Gregor2010-03-241-0/+3
| | | | | | | | | | | | | | | | | | | | | that was present in a prior declaration, emit a warning rather than a hard error (which we did before, and still do with mismatched exception specifications). Moreover, provide a fix-it hint with the throw() clause that should be added, e.g., t.C:10:7: warning: 'operator new' is missing exception specification 'throw(std::bad_alloc)' void *operator new(unsigned long sz) ^ throw(std::bad_alloc) As part of this, disable the warning when we're missing an exception specification on operator new, operator new[], operator delete, or operator delete[] when exceptions are turned off (-fno-exceptions). Fixes PR5957. llvm-svn: 99388
* When pretty-printing tag types, only print the tag if we're in C (andJohn McCall2010-03-101-3/+3
| | | | | | | | | | therefore not creating ElaboratedTypes, which are still pretty-printed with the written tag). Most of these testcase changes were done by script, so don't feel too sorry for my fingers. llvm-svn: 98149
* Fix a crash with ill-formed code within a method in an ill-formedDouglas Gregor2010-02-042-1/+7
| | | | | | | category implementation, which showed up during (attempted) typo correction. Fixes <rdar://problem/7605289>. llvm-svn: 95334
* Make this fix-it test case actually fail when there is a problem; addDouglas Gregor2010-02-011-8/+9
| | | | | | | a test for access declarations and remove a (broken) test for removal of default arguments. llvm-svn: 95032
* Patch to implement required warnings for unimplementedFariborz Jahanian2010-01-201-0/+1
| | | | | | properties imported frfom protocol. Fixes radar 7544809. llvm-svn: 93965
* Fix the search for visible declarations within a Scope to ensure thatDouglas Gregor2010-01-071-2/+3
| | | | | | | | we look into a Scope that corresponds to a compound statement whose scope was combined with the scope of the function that owns it. This improves typo correction in many common cases. llvm-svn: 92879
* When we typo-correct a base class initializer, point to the base classDouglas Gregor2010-01-071-1/+1
| | | | | | specifier that we corrected to. llvm-svn: 92878
* Whenever we emit a typo-correction diagnostic, also emit a noteDouglas Gregor2010-01-073-17/+18
| | | | | | | pointing to the declaration that we found that has that name (if it is unique). llvm-svn: 92877
* Implement typo correction for a variety of Objective-C-specificDouglas Gregor2010-01-031-0/+80
| | | | | | | | | | | | | | constructs: - Instance variable lookup ("foo->ivar" and, in instance methods, "ivar") - Property name lookup ("foo.prop") - Superclasses - Various places where a class name is required - Protocol names (e.g., id<proto>) This seems to cover many of the common places where typos could occur. llvm-svn: 92449
* Make sure that the search for visible declarations looks into the semantic ↵Douglas Gregor2010-01-011-0/+10
| | | | | | parents of out-of-line function contexts llvm-svn: 92397
* Fix typo test RUN linesDouglas Gregor2010-01-013-3/+3
| | | | llvm-svn: 92396
* When typo correction for an id-expression finds a type (or Objective-CDouglas Gregor2010-01-011-0/+9
| | | | | | | | | | | | | | | | class), provide a suggestion for the type or class found. However, since we can't recover properly in this case, don't provide a fix-it hint. Example: test/FixIt/typo.m:8:3: error: use of undeclared identifier 'NSstring'; did you mean 'NSString'? NSstring *str = @"A string"; ... ^ 1 diagnostic generated. llvm-svn: 92379
* Typo correction for C99 designated field initializers, e.g.,Douglas Gregor2010-01-011-0/+22
| | | | | | | | | | test/FixIt/typo.c:19:4: error: field designator 'bunds' does not refer to any field in type 'struct Window'; did you mean 'bounds'? .bunds. ^~~~~ bounds llvm-svn: 92376
* Typo correction for C++ base and member initializers, e.g.,Douglas Gregor2009-12-311-0/+8
| | | | | | | | | | | | | | | test/FixIt/typo.cpp:41:15: error: initializer 'base' does not name a non-static data member or base class; did you mean the base class 'Base'? Derived() : base(), ^~~~ Base test/FixIt/typo.cpp:42:15: error: initializer 'ember' does not name a non-static data member or base class; did you mean the member 'member'? ember() { } ^~~~~ member llvm-svn: 92355
* Add another typo test for nested-name-specifiersDouglas Gregor2009-12-311-0/+2
| | | | llvm-svn: 92351
* Typo correction for identifiers within nested name specifiers, e.g.,Douglas Gregor2009-12-311-1/+2
| | | | | | | | | | typo.cpp:18:1: error: use of undeclared identifier 'other_std'; did you mean 'otherstd'? other_std::strng str1; ^~~~~~~~~ otherstd llvm-svn: 92350
* Typo correction for template names, e.g.,Douglas Gregor2009-12-311-0/+4
| | | | | | | | | | typo.cpp:27:8: error: no template named 'basic_sting' in namespace 'std'; did you mean 'basic_string'? std::basic_sting<char> b2; ~~~~~^~~~~~~~~~~ basic_string llvm-svn: 92348
* Typo correction for member access into classes/structs/unions, e.g.,Douglas Gregor2009-12-311-1/+2
| | | | | | s.fnd("hello") llvm-svn: 92345
* Implement typo correction for id-expressions, e.g.,Douglas Gregor2009-12-311-1/+13
| | | | | | | | | | | | | typo.cpp:22:10: error: use of undeclared identifier 'radious'; did you mean 'radius'? return radious * pi; ^~~~~~~ radius This was super-easy, since we already had decent recovery by looking for names in dependent base classes. llvm-svn: 92341
* Typo correction for type names when they appear in declarations, e.g., givenDouglas Gregor2009-12-301-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | tring str2; we produce the following diagnostic + fix-it: typo.cpp:15:1: error: unknown type name 'tring'; did you mean 'string'? tring str2; ^~~~~ string To make this really useful, we'll need to introduce typo correction in many more places (wherever we do name lookup), and implement declaration-vs-expression heuristics that cope with typos better. However, for now this will handle the simple cases where we already get good "unknown type name" diagnostics. The LookupVisibleDecls functions are intended to be used by code completion as well as typo correction; that refactoring will happen later. llvm-svn: 92308
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-159-11/+11
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Make tests use the new clang -cc1 flag.Fariborz Jahanian2009-12-141-2/+2
| | | | llvm-svn: 91303
* Implement conversion from a switch condition with class type to anDouglas Gregor2009-11-231-0/+14
| | | | | | integral or enumeration type (vi user-defined conversions). Fixes PR5518. llvm-svn: 89655
* Drop unnecessary #include.Daniel Dunbar2009-11-171-1/+3
| | | | llvm-svn: 89154
* Improve test to make sure -fixit is really working.Daniel Dunbar2009-11-141-1/+9
| | | | llvm-svn: 88801
* Update FixIt tests to make it more obvious they use a separate mode.Daniel Dunbar2009-11-148-9/+9
| | | | llvm-svn: 88758
OpenPOWER on IntegriCloud