Add CXCursor support for C++ namespaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103211 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index ef802f5..f221d16a 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -285,6 +285,7 @@
   // FIXME: ObjCCompatibleAliasDecl requires aliased-class locations.
   bool VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *D);
   bool VisitObjCClassDecl(ObjCClassDecl *D);
+  bool VisitNamespaceDecl(NamespaceDecl *D);
 
   // Type visitors
   // FIXME: QualifiedTypeLoc doesn't provide any location information
@@ -722,6 +723,10 @@
   return false;
 }
 
+bool CursorVisitor::VisitNamespaceDecl(NamespaceDecl *D) {
+  return VisitDeclContext(D);
+}
+
 bool CursorVisitor::VisitBuiltinTypeLoc(BuiltinTypeLoc TL) {
   ASTContext &Context = TU->getASTContext();
 
@@ -1638,6 +1643,8 @@
     return createCXString("macro definition");
   case CXCursor_MacroInstantiation:
     return createCXString("macro instantiation");
+  case CXCursor_Namespace:
+    return createCXString("Namespace");
   }
 
   llvm_unreachable("Unhandled CXCursorKind");
diff --git a/tools/libclang/CXCursor.cpp b/tools/libclang/CXCursor.cpp
index c8eb482..df20d26 100644
--- a/tools/libclang/CXCursor.cpp
+++ b/tools/libclang/CXCursor.cpp
@@ -56,6 +56,7 @@
     case Decl::ParmVar:            return CXCursor_ParmDecl;
     case Decl::Typedef:            return CXCursor_TypedefDecl;
     case Decl::Var:                return CXCursor_VarDecl;
+    case Decl::Namespace:          return CXCursor_Namespace;
     default:
       if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
         switch (TD->getTagKind()) {