[cfe-commits] r76507 - in /cfe/trunk/lib/Index: ASTLocation.cpp DeclReferenceMap.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Mon Jul 20 17:05:38 PDT 2009
Author: akirtzidis
Date: Mon Jul 20 19:05:38 2009
New Revision: 76507
URL: http://llvm.org/viewvc/llvm-project?rev=76507&view=rev
Log:
Handle references from ObjCIvarRefExprs.
Modified:
cfe/trunk/lib/Index/ASTLocation.cpp
cfe/trunk/lib/Index/DeclReferenceMap.cpp
Modified: cfe/trunk/lib/Index/ASTLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/ASTLocation.cpp?rev=76507&r1=76506&r2=76507&view=diff
==============================================================================
--- cfe/trunk/lib/Index/ASTLocation.cpp (original)
+++ cfe/trunk/lib/Index/ASTLocation.cpp Mon Jul 20 19:05:38 2009
@@ -16,6 +16,7 @@
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/Expr.h"
+#include "clang/AST/ExprObjC.h"
using namespace clang;
using namespace idx;
@@ -24,6 +25,9 @@
return RefExpr->getDecl();
if (MemberExpr *ME = dyn_cast<MemberExpr>(E))
return ME->getMemberDecl();
+ if (ObjCIvarRefExpr *RE = dyn_cast<ObjCIvarRefExpr>(E))
+ return RE->getDecl();
+
if (CallExpr *CE = dyn_cast<CallExpr>(E))
return getDeclFromExpr(CE->getCallee());
if (CastExpr *CE = dyn_cast<CastExpr>(E))
Modified: cfe/trunk/lib/Index/DeclReferenceMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/DeclReferenceMap.cpp?rev=76507&r1=76506&r2=76507&view=diff
==============================================================================
--- cfe/trunk/lib/Index/DeclReferenceMap.cpp (original)
+++ cfe/trunk/lib/Index/DeclReferenceMap.cpp Mon Jul 20 19:05:38 2009
@@ -35,6 +35,7 @@
void VisitDeclStmt(DeclStmt *Node);
void VisitDeclRefExpr(DeclRefExpr *Node);
void VisitMemberExpr(MemberExpr *Node);
+ void VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node);
void VisitStmt(Stmt *Node);
};
@@ -48,6 +49,7 @@
void VisitDeclContext(DeclContext *DC);
void VisitVarDecl(VarDecl *D);
void VisitFunctionDecl(FunctionDecl *D);
+ void VisitObjCMethodDecl(ObjCMethodDecl *D);
void VisitBlockDecl(BlockDecl *D);
void VisitDecl(Decl *D);
};
@@ -75,6 +77,10 @@
Map.insert(std::make_pair(PrimD, ASTLocation(Parent, Node)));
}
+void StmtMapper::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
+ Map.insert(std::make_pair(Node->getDecl(), ASTLocation(Parent, Node)));
+}
+
void StmtMapper::VisitStmt(Stmt *Node) {
for (Stmt::child_iterator
I = Node->child_begin(), E = Node->child_end(); I != E; ++I)
@@ -92,10 +98,13 @@
}
void DeclMapper::VisitFunctionDecl(FunctionDecl *D) {
- if (!D->isThisDeclarationADefinition())
- return;
-
- StmtMapper(Map, D).Visit(D->getBody());
+ if (D->isThisDeclarationADefinition())
+ StmtMapper(Map, D).Visit(D->getBody());
+}
+
+void DeclMapper::VisitObjCMethodDecl(ObjCMethodDecl *D) {
+ if (D->getBody())
+ StmtMapper(Map, D).Visit(D->getBody());
}
void DeclMapper::VisitBlockDecl(BlockDecl *D) {
More information about the cfe-commits
mailing list