]> granicus.if.org Git - clang/commitdiff
Don't suggest namespaces if the next token is a '.'
authorKaelyn Uhrain <rikka@google.com>
Fri, 27 Sep 2013 23:54:23 +0000 (23:54 +0000)
committerKaelyn Uhrain <rikka@google.com>
Fri, 27 Sep 2013 23:54:23 +0000 (23:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191589 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseStmt.cpp
test/SemaCXX/typo-correction-pt2.cpp

index f4b03f32f56aa215f001732a1895a41860bca29c..28580ab2bb750bcd1fff2c3bf04604cc132bd1f6 100644 (file)
@@ -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);
   }
 
index e91ed7d18b5bbd8c233d916c5eb68adcf9064cdd..1ccd103ecffe4d1a70d3b5aff10f45a42ff8d79b 100644 (file)
@@ -128,3 +128,10 @@ long readline(const char *, char *, unsigned long);
 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'$}}
+}
+}