When typo correction produces a result that is not of the kind we're
looking for, reset the name within the LookupResult structure in
addition to clearing out the results. Fixes PR7508.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107197 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp
index c0ec9e9..42c346f 100644
--- a/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/lib/Sema/SemaCXXScopeSpec.cpp
@@ -458,8 +458,10 @@
       if (NamedDecl *ND = Found.getAsSingle<NamedDecl>())
         Diag(ND->getLocation(), diag::note_previous_decl)
           << ND->getDeclName();
-    } else
+    } else {
       Found.clear();
+      Found.setLookupName(&II);
+    }
   }
 
   NamedDecl *SD = Found.getAsSingle<NamedDecl>();