[cfe-commits] r145750 - in /cfe/trunk: test/Index/get-cursor.cpp tools/libclang/CIndex.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Fri Dec 2 19:49:44 PST 2011
Author: akirtzidis
Date: Fri Dec 2 21:49:44 2011
New Revision: 145750
URL: http://llvm.org/viewvc/llvm-project?rev=145750&view=rev
Log:
[libclang] Allow indexing/get-cursor/etc. for the exception variable in a C++ catch.
Modified:
cfe/trunk/test/Index/get-cursor.cpp
cfe/trunk/tools/libclang/CIndex.cpp
Modified: cfe/trunk/test/Index/get-cursor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/get-cursor.cpp?rev=145750&r1=145749&r2=145750&view=diff
==============================================================================
--- cfe/trunk/test/Index/get-cursor.cpp (original)
+++ cfe/trunk/test/Index/get-cursor.cpp Fri Dec 2 21:49:44 2011
@@ -33,6 +33,11 @@
void test() {
X foo;
+
+ try {
+ } catch (X e) {
+ X x;
+ }
}
// RUN: c-index-test -cursor-at=%s:6:4 %s | FileCheck -check-prefix=CHECK-COMPLETION-1 %s
@@ -80,3 +85,7 @@
// RUN: c-index-test -cursor-at=%s:21:3 %s | FileCheck -check-prefix=CHECK-MEMBER %s
// CHECK-MEMBER: FieldDecl=member:21:7 (Definition)
// CHECK-MEMBER-NEXT: Completion string: {ResultType int}{TypedText member}
+
+// RUN: c-index-test -cursor-at=%s:38:12 -cursor-at=%s:39:5 %s | FileCheck -check-prefix=CHECK-CXXCATCH %s
+// CHECK-CXXCATCH: TypeRef=struct X:3:8
+// CHECK-CXXCATCH-NEXT: TypeRef=struct X:3:8
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=145750&r1=145749&r2=145750&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Fri Dec 2 21:49:44 2011
@@ -1737,6 +1737,7 @@
void VisitCXXTypeidExpr(CXXTypeidExpr *E);
void VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E);
void VisitCXXUuidofExpr(CXXUuidofExpr *E);
+ void VisitCXXCatchStmt(CXXCatchStmt *S);
void VisitDeclRefExpr(DeclRefExpr *D);
void VisitDeclStmt(DeclStmt *S);
void VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E);
@@ -1909,6 +1910,12 @@
if (E->isTypeOperand())
AddTypeLoc(E->getTypeOperandSourceInfo());
}
+
+void EnqueueVisitor::VisitCXXCatchStmt(CXXCatchStmt *S) {
+ EnqueueChildren(S);
+ AddDecl(S->getExceptionDecl());
+}
+
void EnqueueVisitor::VisitDeclRefExpr(DeclRefExpr *DR) {
if (DR->hasExplicitTemplateArgs()) {
AddExplicitTemplateArgs(&DR->getExplicitTemplateArgs());
More information about the cfe-commits
mailing list