summaryrefslogtreecommitdiffstats
path: root/clang/test/FixIt/typo.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Attempt typo correction for function calls with the wrong number of arguments.Kaelyn Uhrain2013-07-081-0/+8
| | | | | | | | | | | | | | | Combined with typo correction's new ability to apply global/absolute nested name specifiers to possible corrections, cases such as in PR12287 where the desired function is being shadowed by a lexically closer function with the same name but a different number of parameters will now include a FixIt. On a side note, since the test for this change caused test/SemaCXX/typo-correction.cpp to exceed the typo correction limit for a single file, I've included a test case for exceeding the limit and added some comments to both the original and part two of typo-correction.cpp warning future editors of the files about the limit. llvm-svn: 185881
* Allow typo correction to try removing nested name specifiers.Kaelyn Uhrain2013-07-021-3/+2
| | | | | | | | | | | | | | | | | The removal is tried by retrying the failed lookup of a correction candidate with either the MemberContext or SS (CXXScopeSpecifier) or both set to NULL if they weren't already. If the candidate identifier is then looked up successfully, make a note in the candidate that the SourceRange should include any existing nested name specifier even if the candidate isn't adding a different one (i.e. the candidate has a NULL NestedNameSpecifier). Also tweak the diagnostic messages to differentiate between a suggestion that just replaces the identifer but leaves the existing nested name specifier intact and one that replaces the entire qualified identifier, in cases where the suggested replacement is unqualified. llvm-svn: 185487
* Add the global namespace (the "::" namespace specifier) to the list ofKaelyn Uhrain2013-06-241-2/+6
| | | | | | namespaces to try for potential typo corrections. llvm-svn: 184762
* Fix typo correction of one qualified name to another.David Blaikie2012-10-121-2/+40
| | | | | | | | | | | | | | When suggesting "foo::bar" as a correction for "fob::bar" we mistakenly replaced only "bar" with "foo::bar" producing "fob::foo::bar" which was broken. This corrects that replacement in as many places as I could find & provides test cases for all those cases I could find a test case for. There are a couple that don't seem to be reachable (one looks entirely dead, the other just doesn't seem to ever get called with a namespace to namespace change). Review by Richard Smith ( http://llvm-reviews.chandlerc.com/D57 ). llvm-svn: 165817
* 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
* 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
* Improve diagnostics for typo correction via Sema::ClassifyName(), byDouglas Gregor2011-04-271-1/+2
| | | | | | | | 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
* Fix handling of property and ivar lookup in typo correction; the twoDouglas Gregor2010-10-201-3/+1
| | | | | | | kinds of lookup into Objective-C classes were tangled together, a situation that was compounded by automatically synthesized ivars. llvm-svn: 116907
* Disable this test while I track down the platform-specific issueDouglas Gregor2010-10-201-0/+3
| | | | llvm-svn: 116904
* 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
* Teach clang -fixit to modify files in-place, or -fixit=suffix to create newNick Lewycky2010-04-241-1/+3
| | | | | | files with the additional suffix in the middle. llvm-svn: 102230
* 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
* 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 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-071-6/+6
| | | | | | | pointing to the declaration that we found that has that name (if it is unique). llvm-svn: 92877
* 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-011-1/+1
| | | | llvm-svn: 92396
* 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
OpenPOWER on IntegriCloud