r191589 - Don't suggest namespaces if the next token is a '.'

Kaelyn Uhrain rikka at google.com
Fri Sep 27 16:54:23 PDT 2013


Author: rikka
Date: Fri Sep 27 18:54:23 2013
New Revision: 191589

URL: http://llvm.org/viewvc/llvm-project?rev=191589&view=rev
Log:
Don't suggest namespaces if the next token is a '.'

Modified:
    cfe/trunk/lib/Parse/ParseStmt.cpp
    cfe/trunk/test/SemaCXX/typo-correction-pt2.cpp

Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=191589&r1=191588&r2=191589&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Fri Sep 27 18:54:23 2013
@@ -132,6 +132,9 @@ public:
       return isa<ObjCIvarDecl>(FD);
     if (NextToken.is(tok::equal))
       return candidate.getCorrectionDeclAs<VarDecl>();
+    if (NextToken.is(tok::period) &&
+        candidate.getCorrectionDeclAs<NamespaceDecl>())
+      return false;
     return CorrectionCandidateCallback::ValidateCandidate(candidate);
   }
 

Modified: cfe/trunk/test/SemaCXX/typo-correction-pt2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/typo-correction-pt2.cpp?rev=191589&r1=191588&r2=191589&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/typo-correction-pt2.cpp (original)
+++ cfe/trunk/test/SemaCXX/typo-correction-pt2.cpp Fri Sep 27 18:54:23 2013
@@ -128,3 +128,10 @@ long readline(const char *, char *, unsi
 void assign_to_unknown_var() {
     deadline_ = 1;  // expected-error-re {{use of undeclared identifier 'deadline_'$}}
 }
+
+namespace no_ns_before_dot {
+namespace re2 {}
+void test() {
+    req.set_check(false);  // expected-error-re {{use of undeclared identifier 'req'$}}
+}
+}





More information about the cfe-commits mailing list