Some name-lookup-related fixes, from Piotr Rak!

- Changes Lookup*Name functions to return NamedDecls, instead of
Decls. Unfortunately my recent statement that it will simplify lot of
code, was not quite right, but it simplifies some...
- Makes MergeLookupResult SmallPtrSet instead of vector, following
Douglas suggestions.
- Adds %qN format for printing qualified names to Diagnostic.
- Avoids searching for using-directives in Scopes, which are not
DeclScope, during unqualified name lookup.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63739 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 6041736..03a6b3c 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -36,8 +36,7 @@
     assert(ModLen == 0 && ArgLen == 0 &&
            "Invalid modifier for QualType argument");
     
-  } else {
-    assert(Kind == Diagnostic::ak_declarationname);
+  } else if (Kind == Diagnostic::ak_declarationname) {
    
     DeclarationName N = DeclarationName::getFromOpaqueInteger(Val);
     S = N.getAsString();
@@ -49,6 +48,13 @@
     else
       assert(ModLen == 0 && ArgLen == 0 &&
              "Invalid modifier for DeclarationName argument");
+  } else {
+    assert(Kind == Diagnostic::ak_nameddecl);
+    assert(ModLen == 1 && Modifier[0] == 'q' && ArgLen == 0 &&
+           "Invalid modifier for NamedDecl* argument");
+
+    S = reinterpret_cast<NamedDecl*>(Val)->getQualifiedNameAsString();
+
   }
   Output.append(S.begin(), S.end());
 }