summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/typo-correction.cpp
diff options
context:
space:
mode:
authorKaelyn Uhrain <rikka@google.com>2012-01-11 21:17:51 +0000
committerKaelyn Uhrain <rikka@google.com>2012-01-11 21:17:51 +0000
commit8811b3904c4f3648c958e24a51a05e6b1c311e5a (patch)
treea25cbd72625f3dd1e34f14637b05abd9e93565fb /clang/test/SemaCXX/typo-correction.cpp
parentbf570b98f221226e667863fa73281dd2aadc75c6 (diff)
downloadbcm5719-llvm-8811b3904c4f3648c958e24a51a05e6b1c311e5a.tar.gz
bcm5719-llvm-8811b3904c4f3648c958e24a51a05e6b1c311e5a.zip
Fix the caching in CorrectTypo so that other non-keyword identifiers
are still added if the cached correction fails validation. Also fix a copy-and-paste error in a comment from my previous commit. Finally, add an example of the benefit the typo correction callback adds to TryNamespaceTypoCorrection--which happens to also tickle the above caching problem, as the only way a non-namespace Decl would be added to the possible corrections is if it was cached as the correction for a previous instance of the same typo where the typo was corrected to a non-namespace via a different code path. llvm-svn: 147968
Diffstat (limited to 'clang/test/SemaCXX/typo-correction.cpp')
-rw-r--r--clang/test/SemaCXX/typo-correction.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/typo-correction.cpp b/clang/test/SemaCXX/typo-correction.cpp
index 0fb33bc7813..c3e8480b293 100644
--- a/clang/test/SemaCXX/typo-correction.cpp
+++ b/clang/test/SemaCXX/typo-correction.cpp
@@ -40,3 +40,10 @@ struct Derived : public BaseType { // expected-note {{base class 'BaseType' spec
static int base_type;
Derived() : basetype() {} // expected-error{{initializer 'basetype' does not name a non-static data member or base class; did you mean the base class 'BaseType'?}}
};
+
+// In this example, somename should not be corrected to the cached correction
+// "some_name" since "some_name" is a class and a namespace name is needed.
+class some_name {}; // expected-note {{'some_name' declared here}}
+somename Foo; // expected-error {{unknown type name 'somename'; did you mean 'some_name'?}}
+namespace SomeName {} // expected-note {{namespace 'SomeName' defined here}}
+using namespace somename; // expected-error {{no namespace named 'somename'; did you mean 'SomeName'?}}
OpenPOWER on IntegriCloud