[cfe-commits] r112981 - in /cfe/trunk: test/Index/load-stmts.cpp tools/libclang/CIndex.cpp
Douglas Gregor
dgregor at apple.com
Fri Sep 3 11:01:25 PDT 2010
Author: dgregor
Date: Fri Sep 3 13:01:25 2010
New Revision: 112981
URL: http://llvm.org/viewvc/llvm-project?rev=112981&view=rev
Log:
Implement libclang visitation for UnresolvedMemberExpr. This is the
last of the C++-specific expressions where we have decent source
information in the AST already. In particular, various
object-construction expressions (CXXNewExpr, CXXTemporaryObjectExpr)
still have poor source-location information that needs to be addressed.
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=112981&r1=112980&r2=112981&view=diff
==============================================================================
--- cfe/trunk/test/Index/load-stmts.cpp (original)
+++ cfe/trunk/test/Index/load-stmts.cpp Fri Sep 3 13:01:25 2010
@@ -55,6 +55,21 @@
t->type::template f<type*>();
}
+struct Y {
+ int f(int);
+ float f(float);
+
+ template<typename T> T g(T);
+ template<typename T> T g(T*);
+};
+
+template<typename T>
+void test_more_dependent_exprs(T t, Y y) {
+ y.Y::f(t);
+ typedef T type;
+ y.g<type>(t);
+}
+
// RUN: c-index-test -test-load-source all %s | FileCheck %s
// CHECK: load-stmts.cpp:1:13: TypedefDecl=T:1:13 (Definition) Extent=[1:13 - 1:14]
// CHECK: load-stmts.cpp:2:8: StructDecl=X:2:8 (Definition) Extent=[2:1 - 2:23]
@@ -136,3 +151,12 @@
// CHECK: load-stmts.cpp:55:3: CallExpr= Extent=[55:3 - 55:31]
// CHECK: load-stmts.cpp:55:3: DeclRefExpr=t:50:29 Extent=[55:3 - 55:4]
// CHECK: load-stmts.cpp:55:23: TypeRef=type:52:13 Extent=[55:23 - 55:27]
+// CHECK: load-stmts.cpp:67:6: FunctionTemplate=test_more_dependent_exprs:67:6 (Definition)
+// CHECK: load-stmts.cpp:68:3: CallExpr= Extent=[68:3 - 68:12]
+// CHECK: load-stmts.cpp:68:3: DeclRefExpr=y:67:39 Extent=[68:3 - 68:4]
+// CHECK: load-stmts.cpp:68:5: TypeRef=struct Y:58:8 Extent=[68:5 - 68:6]
+// CHECK: load-stmts.cpp:68:10: DeclRefExpr=t:67:34 Extent=[68:10 - 68:11]
+// CHECK: load-stmts.cpp:70:3: CallExpr= Extent=[70:3 - 70:15]
+// CHECK: load-stmts.cpp:70:3: DeclRefExpr=y:67:39 Extent=[70:3 - 70:4]
+// CHECK: load-stmts.cpp:70:7: TypeRef=type:69:13 Extent=[70:7 - 70:11]
+// CHECK: load-stmts.cpp:70:13: DeclRefExpr=t:67:34 Extent=[70:13 - 70:14]
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=112981&r1=112980&r2=112981&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Fri Sep 3 13:01:25 2010
@@ -393,7 +393,9 @@
// FIXME: UnaryTypeTraitExpr has poor source-location information.
bool VisitOverloadExpr(OverloadExpr *E);
bool VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E);
+ // FIXME: CXXUnresolvedConstructExpr has poor source-location information.
bool VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E);
+ bool VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E);
};
} // end anonymous namespace
@@ -1693,6 +1695,14 @@
return false;
}
+bool CursorVisitor::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
+ // Visit the base expression, if there is one.
+ if (!E->isImplicitAccess() &&
+ Visit(MakeCXCursor(E->getBase(), StmtParent, TU)))
+ return true;
+
+ return VisitOverloadExpr(E);
+}
bool CursorVisitor::VisitObjCMessageExpr(ObjCMessageExpr *E) {
if (TypeSourceInfo *TSInfo = E->getClassReceiverTypeInfo())
More information about the cfe-commits
mailing list