[cfe-commits] r112873 - in /cfe/trunk: test/Index/load-stmts.cpp tools/libclang/CIndex.cpp

Douglas Gregor dgregor at apple.com
Thu Sep 2 15:09:03 PDT 2010


Author: dgregor
Date: Thu Sep  2 17:09:03 2010
New Revision: 112873

URL: http://llvm.org/viewvc/llvm-project?rev=112873&view=rev
Log:
Add libclang visitation for C++ pseudo-destructor expressions.

Modified:
    cfe/trunk/test/Index/load-stmts.cpp
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/test/Index/load-stmts.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/load-stmts.cpp?rev=112873&r1=112872&r2=112873&view=diff
==============================================================================
--- cfe/trunk/test/Index/load-stmts.cpp (original)
+++ cfe/trunk/test/Index/load-stmts.cpp Thu Sep  2 17:09:03 2010
@@ -33,6 +33,9 @@
   int typeid_marker;
   typeid(C);
   typeid(c);
+  typedef int Integer;
+  Integer *int_ptr;
+  int_ptr->Integer::~Integer();
 }
 
 // RUN: c-index-test -test-load-source all %s | FileCheck %s
@@ -95,3 +98,8 @@
 // CHECK: load-stmts.cpp:33:7: VarDecl=typeid_marker:33:7 (Definition)
 // CHECK: load-stmts.cpp:34:10: TypeRef=class C:22:7 Extent=[34:10 - 34:11]
 // CHECK: load-stmts.cpp:35:10: DeclRefExpr=c:32:20 Extent=[35:10 - 35:11]
+// CHECK: load-stmts.cpp:37:12: VarDecl=int_ptr:37:12 (Definition) Extent=[37:3 - 37:19]
+// CHECK: load-stmts.cpp:37:3: TypeRef=Integer:36:15 Extent=[37:3 - 37:10]
+// CHECK: load-stmts.cpp:38:3: DeclRefExpr=int_ptr:37:12 Extent=[38:3 - 38:10]
+// CHECK: load-stmts.cpp:38:12: TypeRef=Integer:36:15 Extent=[38:12 - 38:19]
+// CHECK: load-stmts.cpp:38:22: TypeRef=Integer:36:15 Extent=[38:22 - 38:29]

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=112873&r1=112872&r2=112873&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Thu Sep  2 17:09:03 2010
@@ -386,6 +386,10 @@
   // FIXME: DesignatedInitExpr
   bool VisitCXXTypeidExpr(CXXTypeidExpr *E);
   bool VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) { return false; }
+  // FIXME: CXXTemporaryObjectExpr has poor source-location information
+  // FIXME: CXXScalarValueInitExpr has poor source-location information
+  // FIXME: CXXNewExpr has poor source-location information
+  bool VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E);
 };
 
 } // end anonymous namespace
@@ -1580,6 +1584,30 @@
   return VisitExpr(E);
 }
 
+bool CursorVisitor::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
+  // Visit base expression.
+  if (Visit(MakeCXCursor(E->getBase(), StmtParent, TU)))
+    return true;
+  
+  // Visit the nested-name-specifier.
+  if (NestedNameSpecifier *Qualifier = E->getQualifier())
+    if (VisitNestedNameSpecifier(Qualifier, E->getQualifierRange()))
+      return true;
+  
+  // Visit the scope type that looks disturbingly like the nested-name-specifier
+  // but isn't.
+  if (TypeSourceInfo *TSInfo = E->getScopeTypeInfo())
+    if (Visit(TSInfo->getTypeLoc()))
+      return true;
+  
+  // Visit the name of the type being destroyed.
+  if (TypeSourceInfo *TSInfo = E->getDestroyedTypeInfo())
+    if (Visit(TSInfo->getTypeLoc()))
+      return true;
+  
+  return false;
+}
+
 bool CursorVisitor::VisitObjCMessageExpr(ObjCMessageExpr *E) {
   if (TypeSourceInfo *TSInfo = E->getClassReceiverTypeInfo())
     if (Visit(TSInfo->getTypeLoc()))





More information about the cfe-commits mailing list