Parser support for C++ using directives, from Piotr Rak

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61486 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 5ba2850..e3c8373 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -1349,6 +1349,34 @@
   PopDeclContext();
 }
 
+Sema::DeclTy *Sema::ActOnUsingDirective(Scope *S,
+                                        SourceLocation UsingLoc,
+                                        SourceLocation NamespcLoc,
+                                        const CXXScopeSpec &SS,
+                                        SourceLocation IdentLoc,
+                                        IdentifierInfo *NamespcName,
+                                        AttributeList *AttrList) {
+  assert(!SS.isInvalid() && "Invalid CXXScopeSpec.");
+  assert(NamespcName && "Invalid NamespcName.");
+  assert(IdentLoc.isValid() && "Invalid NamespceName location.");
+
+  // FIXME: This still requires lot more checks, and AST support.
+  // Lookup namespace name.
+  DeclContext *DC = static_cast<DeclContext*>(SS.getScopeRep());
+  Decl *NS = 0;
+
+  if ((NS = LookupNamespaceName(NamespcName, S, DC))) {
+    assert(isa<NamespaceDecl>(NS) && "expected namespace decl");
+  } else {
+    DiagnosticBuilder Builder = Diag(IdentLoc, diag::err_expected_namespace_name);
+    if (SS.isSet())
+      Builder << SS.getRange();
+  }
+
+  // FIXME: We ignore AttrList for now, and delete it to avoid leak.
+  delete AttrList;
+  return 0;
+}
 
 /// AddCXXDirectInitializerToDecl - This action is called immediately after 
 /// ActOnDeclarator, when a C++ direct initializer is present.