summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-10-14 22:11:03 +0000
committerDouglas Gregor <dgregor@apple.com>2010-10-14 22:11:03 +0000
commit57756eabc9a12450404f649daac86a620230e05d (patch)
tree3d92cb4b9e2b2123e1a185bcefc923c29684b475 /clang/test
parentc3bbf48f477dfd914d26c20ad9a01c9f5363e3ce (diff)
downloadbcm5719-llvm-57756eabc9a12450404f649daac86a620230e05d.tar.gz
bcm5719-llvm-57756eabc9a12450404f649daac86a620230e05d.zip
When performing typo correction, look through the set of known
identifiers to determine good typo-correction candidates. Once we've identified those candidates, we perform name lookup on each of them and the consider the results. This optimization makes typo correction > 2x faster on a benchmark example using a single typo (NSstring) in a tiny file that includes Cocoa.h from a precompiled header, since we are deserializing far less information now during typo correction. There is a semantic change here, which is interesting. The presence of a similarly-named entity that is not visible can now affect typo correction. This is both good (you won't get weird corrections if the thing you wanted isn't in scope) and bad (you won't get good corrections if there is a similarly-named-but-completely-unrelated thing). Time will tell whether it was a good choice or not. llvm-svn: 116528
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/PCH/Inputs/typo.h6
-rw-r--r--clang/test/PCH/typo.m6
-rw-r--r--clang/test/SemaObjC/synth-provisional-ivars.m2
3 files changed, 13 insertions, 1 deletions
diff --git a/clang/test/PCH/Inputs/typo.h b/clang/test/PCH/Inputs/typo.h
new file mode 100644
index 00000000000..63b553b9169
--- /dev/null
+++ b/clang/test/PCH/Inputs/typo.h
@@ -0,0 +1,6 @@
+
+
+@interface NSString
++ (id)alloc;
+@end
+
diff --git a/clang/test/PCH/typo.m b/clang/test/PCH/typo.m
new file mode 100644
index 00000000000..c6f0275bc2f
--- /dev/null
+++ b/clang/test/PCH/typo.m
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -x objective-c-header -emit-pch -o %t %S/Inputs/typo.h
+// RUN: %clang_cc1 -include-pch %t -verify %s
+// In header: expected-note{{declared here}}
+void f() {
+ [NSstring alloc]; // expected-error{{unknown receiver 'NSstring'; did you mean 'NSString'?}}
+}
diff --git a/clang/test/SemaObjC/synth-provisional-ivars.m b/clang/test/SemaObjC/synth-provisional-ivars.m
index 973c771ad77..8ad2233ba4a 100644
--- a/clang/test/SemaObjC/synth-provisional-ivars.m
+++ b/clang/test/SemaObjC/synth-provisional-ivars.m
@@ -18,7 +18,7 @@ int bar;
@end
@implementation I
-- (int) Meth { return PROP; } // expected-note {{'PROP' declared here}}
+- (int) Meth { return PROP; }
@dynamic PROP1;
- (int) Meth1 { return PROP1; } // expected-error {{use of undeclared identifier 'PROP1'}}
OpenPOWER on IntegriCloud