diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-12-30 17:04:44 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-12-30 17:04:44 +0000 |
| commit | 2d435306e52445d173e289e98dc343afe94c7fa8 (patch) | |
| tree | 73b21e19207172c567b1cd248c388a0f0f82e416 /clang/test | |
| parent | ad183ac3c7b70f2d7ddbbaca5405a21e0a23d544 (diff) | |
| download | bcm5719-llvm-2d435306e52445d173e289e98dc343afe94c7fa8.tar.gz bcm5719-llvm-2d435306e52445d173e289e98dc343afe94c7fa8.zip | |
Typo correction for type names when they appear in declarations, e.g., given
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
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/FixIt/typo.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/FixIt/typo.cpp b/clang/test/FixIt/typo.cpp new file mode 100644 index 00000000000..b884ffa7555 --- /dev/null +++ b/clang/test/FixIt/typo.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -fixit -o - | %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ - +namespace std { + template<typename T> class basic_string { }; + typedef basic_string<char> string; +} + +namespace otherstd { + using namespace std; +} + +using namespace std; + +otherstd::strng str1; // expected-error{{no type named 'strng' in namespace 'otherstd'; did you mean 'string'?}} +tring str2; // expected-error{{unknown type name 'tring'; did you mean 'string'?}} |

