Teach libclang to visit OverloadExprs, so that we can reuse this
code. Also, teach it about explicitly-specified template arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112884 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index f30dd61..17afeca 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -391,7 +391,7 @@
   // FIXME: CXXNewExpr has poor source-location information
   bool VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E);
   // FIXME: UnaryTypeTraitExpr has poor source-location information.
-  bool VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E);
+  bool VisitOverloadExpr(OverloadExpr *E);
 };
 
 } // end anonymous namespace
@@ -1610,7 +1610,7 @@
   return false;
 }
 
-bool CursorVisitor::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
+bool CursorVisitor::VisitOverloadExpr(OverloadExpr *E) {
   // Visit the nested-name-specifier.
   if (NestedNameSpecifier *Qualifier = E->getQualifier())
     if (VisitNestedNameSpecifier(Qualifier, E->getQualifierRange()))
@@ -1620,6 +1620,17 @@
   if (VisitDeclarationNameInfo(E->getNameInfo()))
     return true;
   
+  // Visit the explicitly-specified template arguments.
+  if (const ExplicitTemplateArgumentList *ArgList
+                                      = E->getOptionalExplicitTemplateArgs()) {
+    for (const TemplateArgumentLoc *Arg = ArgList->getTemplateArgs(),
+                                *ArgEnd = Arg + ArgList->NumTemplateArgs;
+         Arg != ArgEnd; ++Arg) {
+      if (VisitTemplateArgumentLoc(*Arg))
+        return true;
+    }
+  }
+    
   // FIXME: We don't have a way to visit all of the declarations referenced
   // here.
   return false;