Teach the cursor visitor to recurse into the type information of
explicit casts, sizeof, alignof, and compound literals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94265 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 6cd545f..a988962 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -292,6 +292,11 @@
   // FIXME: LabelStmt label?
   bool VisitIfStmt(IfStmt *S);
   bool VisitSwitchStmt(SwitchStmt *S);
+  
+  // Expression visitors
+  bool VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E);
+  bool VisitExplicitCastExpr(ExplicitCastExpr *E);
+  bool VisitCompoundLiteralExpr(CompoundLiteralExpr *E);
 };
   
 } // end anonymous namespace
@@ -824,6 +829,33 @@
   return false;
 }
 
+bool CursorVisitor::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
+  if (E->isArgumentType()) {
+    if (TypeSourceInfo *TSInfo = E->getArgumentTypeInfo())
+      return Visit(TSInfo->getTypeLoc());
+    
+    return false;
+  }
+  
+  return VisitExpr(E);
+}
+
+bool CursorVisitor::VisitExplicitCastExpr(ExplicitCastExpr *E) {
+  if (TypeSourceInfo *TSInfo = E->getTypeInfoAsWritten())
+    if (Visit(TSInfo->getTypeLoc()))
+      return true;
+  
+  return VisitCastExpr(E);
+}
+
+bool CursorVisitor::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
+  if (TypeSourceInfo *TSInfo = E->getTypeSourceInfo())
+    if (Visit(TSInfo->getTypeLoc()))
+      return true;
+  
+  return VisitExpr(E);
+}
+
 CXString CIndexer::createCXString(const char *String, bool DupString){
   CXString Str;
   if (DupString) {