]> granicus.if.org Git - clang/commitdiff
Don't give suggest things like function names on the left side of "=".
authorKaelyn Uhrain <rikka@google.com>
Fri, 27 Sep 2013 19:40:16 +0000 (19:40 +0000)
committerKaelyn Uhrain <rikka@google.com>
Fri, 27 Sep 2013 19:40:16 +0000 (19:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191545 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseStmt.cpp
test/SemaCXX/typo-correction-pt2.cpp
test/SemaObjC/ivar-ref-misuse.m

index 63fd1a51e49411e738ea65e01337a4813eea85f7..f4b03f32f56aa215f001732a1895a41860bca29c 100644 (file)
@@ -130,6 +130,8 @@ public:
   virtual bool ValidateCandidate(const TypoCorrection &candidate) {
     if (FieldDecl *FD = candidate.getCorrectionDeclAs<FieldDecl>())
       return isa<ObjCIvarDecl>(FD);
+    if (NextToken.is(tok::equal))
+      return candidate.getCorrectionDeclAs<VarDecl>();
     return CorrectionCandidateCallback::ValidateCandidate(candidate);
   }
 
index 59eb0609c35d5ed25eeaadf10e9a3ebd0ae0aa8a..e91ed7d18b5bbd8c233d916c5eb68adcf9064cdd 100644 (file)
@@ -123,3 +123,8 @@ void testAccess() {
   }
 }
 }
+
+long readline(const char *, char *, unsigned long);
+void assign_to_unknown_var() {
+    deadline_ = 1;  // expected-error-re {{use of undeclared identifier 'deadline_'$}}
+}
index 3115f5bd23322deb82316a80bcbb88cc9d8d88de..2c2fb2f4618f1a79063042423ebeb58d62491867 100644 (file)
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
 
-@interface Sprite { // expected-note{{'Sprite' declared here}}
+@interface Sprite {
   int sprite, spree;
   int UseGlobalBar;
 }
@@ -17,8 +17,7 @@ int UseGlobalBar;
 + (void)setFoo:(int)foo {
   sprite = foo;   // expected-error {{instance variable 'sprite' accessed in class method}}
   spree = foo;
-  Xsprite = foo; // expected-error {{unknown type name 'Xsprite'; did you mean 'Sprite'?}}  \
-  // expected-error{{expected identifier or '('}}
+  Xsprite = foo; // expected-error {{use of undeclared identifier 'Xsprite'}}
   UseGlobalBar = 10;
 }
 + (void)setSprite:(int)sprite {