Add proper type-source information to UnaryTypeTraitExpr, including
libclang visitation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113492 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index a561b4a..83ae84e 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -366,7 +366,6 @@
   bool VisitCaseStmt(CaseStmt *S);
   bool VisitWhileStmt(WhileStmt *S);
   bool VisitForStmt(ForStmt *S);
-//  bool VisitSwitchCase(SwitchCase *S);
 
   // Expression visitors
   bool VisitDeclRefExpr(DeclRefExpr *E);
@@ -385,12 +384,13 @@
   // FIXME: InitListExpr (for the designators)
   // FIXME: DesignatedInitExpr
   bool VisitCXXTypeidExpr(CXXTypeidExpr *E);
+  bool VisitCXXUuidofExpr(CXXUuidofExpr *E);
   bool VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) { return false; }
   bool VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E);
   bool VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E);
   bool VisitCXXNewExpr(CXXNewExpr *E);
   bool VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E);
-  // FIXME: UnaryTypeTraitExpr has poor source-location information.
+  bool VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E);
   bool VisitOverloadExpr(OverloadExpr *E);
   bool VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E);
   bool VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E);
@@ -1590,6 +1590,17 @@
   return VisitExpr(E);
 }
 
+bool CursorVisitor::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
+  if (E->isTypeOperand()) {
+    if (TypeSourceInfo *TSInfo = E->getTypeOperandSourceInfo())
+      return Visit(TSInfo->getTypeLoc());
+    
+    return false;
+  }
+  
+  return VisitExpr(E);  
+}
+
 bool CursorVisitor::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {
   if (TypeSourceInfo *TSInfo = E->getTypeSourceInfo())
     return Visit(TSInfo->getTypeLoc());
@@ -1651,6 +1662,10 @@
   return false;
 }
 
+bool CursorVisitor::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) {
+  return Visit(E->getQueriedTypeSourceInfo()->getTypeLoc());
+}
+
 bool CursorVisitor::VisitOverloadExpr(OverloadExpr *E) {
   // Visit the nested-name-specifier.
   if (NestedNameSpecifier *Qualifier = E->getQualifier())