[cfe-commits] r94051 - in /cfe/trunk: include/clang-c/Index.h tools/CIndex/CIndex.cpp tools/CIndex/CXCursor.cpp tools/CIndex/CXCursor.h tools/c-index-test/c-index-test.c
Douglas Gregor
dgregor at apple.com
Wed Jan 20 15:57:44 PST 2010
Author: dgregor
Date: Wed Jan 20 17:57:43 2010
New Revision: 94051
URL: http://llvm.org/viewvc/llvm-project?rev=94051&view=rev
Log:
Stash a CXXUnit pointer into each cursor. This allows us to simplify
the interface to clang_visitChildren() by eliminating the
CXTranslationUnit pointer.
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/tools/CIndex/CIndex.cpp
cfe/trunk/tools/CIndex/CXCursor.cpp
cfe/trunk/tools/CIndex/CXCursor.h
cfe/trunk/tools/c-index-test/c-index-test.c
Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=94051&r1=94050&r2=94051&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Wed Jan 20 17:57:43 2010
@@ -303,7 +303,7 @@
* TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
*
* // This will load all the symbols from 'IndexTest.pch'
- * clang_visitChildren(TU, clang_getTranslationUnitCursor(TU),
+ * clang_visitChildren(clang_getTranslationUnitCursor(TU),
* TranslationUnitVisitor, 0);
* clang_disposeTranslationUnit(TU);
*
@@ -311,8 +311,8 @@
* // from 'IndexTest.pch'.
* char *args[] = { "-Xclang", "-include-pch=IndexTest.pch", 0 };
* TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args);
- * clang_loadTranslationUnit(TU, clang_getTranslationUnitCursor(TU),
- * TranslationUnitVisitor, 0);
+ * clang_visitChildren(clang_getTranslationUnitCursor(TU),
+ * TranslationUnitVisitor, 0);
* clang_disposeTranslationUnit(TU);
*
* This process of creating the 'pch', loading it separately, and using it (via
@@ -451,8 +451,7 @@
* \returns a non-zero value if the traversal was terminated
* prematurely by the visitor returning \c CXChildVisit_Break.
*/
-CINDEX_LINKAGE unsigned clang_visitChildren(CXTranslationUnit tu,
- CXCursor parent,
+CINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent,
CXCursorVisitor visitor,
CXClientData client_data);
Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=94051&r1=94050&r2=94051&view=diff
==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Wed Jan 20 17:57:43 2010
@@ -141,6 +141,7 @@
// Cursor visitor.
class CursorVisitor : public DeclVisitor<CursorVisitor, bool> {
+ ASTUnit *TU;
CXCursor Parent;
CXCursorVisitor Visitor;
CXClientData ClientData;
@@ -153,9 +154,9 @@
using DeclVisitor<CursorVisitor, bool>::Visit;
public:
- CursorVisitor(CXCursorVisitor Visitor, CXClientData ClientData,
+ CursorVisitor(ASTUnit *TU, CXCursorVisitor Visitor, CXClientData ClientData,
unsigned MaxPCHLevel)
- : Visitor(Visitor), ClientData(ClientData), MaxPCHLevel(MaxPCHLevel)
+ : TU(TU), Visitor(Visitor), ClientData(ClientData), MaxPCHLevel(MaxPCHLevel)
{
Parent.kind = CXCursor_NoDeclFound;
Parent.data[0] = 0;
@@ -242,12 +243,12 @@
}
if (clang_isTranslationUnit(Cursor.kind)) {
- ASTUnit *CXXUnit = static_cast<ASTUnit *>(Cursor.data[0]);
+ ASTUnit *CXXUnit = getCursorASTUnit(Cursor);
if (!CXXUnit->isMainFileAST() && CXXUnit->getOnlyLocalDecls()) {
const std::vector<Decl*> &TLDs = CXXUnit->getTopLevelDecls();
for (std::vector<Decl*>::const_iterator it = TLDs.begin(),
ie = TLDs.end(); it != ie; ++it) {
- if (Visit(MakeCXCursor(*it)))
+ if (Visit(MakeCXCursor(*it, CXXUnit)))
return true;
}
} else {
@@ -271,7 +272,7 @@
bool CursorVisitor::VisitDeclContext(DeclContext *DC) {
for (DeclContext::decl_iterator
I = DC->decls_begin(), E = DC->decls_end(); I != E; ++I) {
- if (Visit(MakeCXCursor(*I)))
+ if (Visit(MakeCXCursor(*I, TU)))
return true;
}
@@ -296,13 +297,14 @@
}
bool CursorVisitor::VisitObjCCategoryDecl(ObjCCategoryDecl *ND) {
- if (Visit(MakeCursorObjCClassRef(ND->getClassInterface(), ND->getLocation())))
+ if (Visit(MakeCursorObjCClassRef(ND->getClassInterface(), ND->getLocation(),
+ TU)))
return true;
ObjCCategoryDecl::protocol_loc_iterator PL = ND->protocol_loc_begin();
for (ObjCCategoryDecl::protocol_iterator I = ND->protocol_begin(),
E = ND->protocol_end(); I != E; ++I, ++PL)
- if (Visit(MakeCursorObjCProtocolRef(*I, *PL)))
+ if (Visit(MakeCursorObjCProtocolRef(*I, *PL, TU)))
return true;
return VisitDeclContext(ND);
@@ -312,13 +314,14 @@
// Issue callbacks for super class.
if (D->getSuperClass() &&
Visit(MakeCursorObjCSuperClassRef(D->getSuperClass(),
- D->getSuperClassLoc())))
+ D->getSuperClassLoc(),
+ TU)))
return true;
ObjCInterfaceDecl::protocol_loc_iterator PL = D->protocol_loc_begin();
for (ObjCInterfaceDecl::protocol_iterator I = D->protocol_begin(),
E = D->protocol_end(); I != E; ++I, ++PL)
- if (Visit(MakeCursorObjCProtocolRef(*I, *PL)))
+ if (Visit(MakeCursorObjCProtocolRef(*I, *PL, TU)))
return true;
return VisitDeclContext(D);
@@ -336,7 +339,7 @@
ObjCProtocolDecl::protocol_loc_iterator PL = PID->protocol_loc_begin();
for (ObjCProtocolDecl::protocol_iterator I = PID->protocol_begin(),
E = PID->protocol_end(); I != E; ++I, ++PL)
- if (Visit(MakeCursorObjCProtocolRef(*I, *PL)))
+ if (Visit(MakeCursorObjCProtocolRef(*I, *PL, TU)))
return true;
return VisitDeclContext(PID);
@@ -513,7 +516,7 @@
}
CXCursor clang_getTranslationUnitCursor(CXTranslationUnit TU) {
- CXCursor Result = { CXCursor_TranslationUnit, { TU, 0, 0 } };
+ CXCursor Result = { CXCursor_TranslationUnit, { 0, 0, TU } };
return Result;
}
@@ -641,11 +644,10 @@
extern "C" {
-unsigned clang_visitChildren(CXTranslationUnit tu,
- CXCursor parent,
+unsigned clang_visitChildren(CXCursor parent,
CXCursorVisitor visitor,
CXClientData client_data) {
- ASTUnit *CXXUnit = static_cast<ASTUnit *>(tu);
+ ASTUnit *CXXUnit = getCursorASTUnit(parent);
unsigned PCHLevel = Decl::MaxPCHLevel;
@@ -658,7 +660,7 @@
++PCHLevel;
}
- CursorVisitor CursorVis(visitor, client_data, PCHLevel);
+ CursorVisitor CursorVis(CXXUnit, visitor, client_data, PCHLevel);
return CursorVis.VisitChildren(parent);
}
@@ -686,7 +688,7 @@
CXString clang_getCursorSpelling(CXCursor C) {
assert(getCursorDecl(C) && "CXCursor has null decl");
if (clang_isTranslationUnit(C.kind))
- return clang_getTranslationUnitSpelling(C.data[0]);
+ return clang_getTranslationUnitSpelling(C.data[2]);
if (clang_isReference(C.kind)) {
switch (C.kind) {
@@ -787,15 +789,15 @@
Stmt *Stm = ALoc.dyn_AsStmt();
if (Dcl) {
if (Stm)
- return MakeCXCursor(Stm, Dcl);
+ return MakeCXCursor(Stm, Dcl, CXXUnit);
if (ALoc.isNamedRef()) {
if (ObjCInterfaceDecl *Class = dyn_cast<ObjCInterfaceDecl>(Dcl))
- return MakeCursorObjCClassRef(Class, ALoc.AsNamedRef().Loc);
+ return MakeCursorObjCClassRef(Class, ALoc.AsNamedRef().Loc, CXXUnit);
if (ObjCProtocolDecl *Proto = dyn_cast<ObjCProtocolDecl>(Dcl))
- return MakeCursorObjCProtocolRef(Proto, ALoc.AsNamedRef().Loc);
+ return MakeCursorObjCProtocolRef(Proto, ALoc.AsNamedRef().Loc, CXXUnit);
}
- return MakeCXCursor(Dcl);
+ return MakeCXCursor(Dcl, CXXUnit);
}
return MakeCXCursorInvalid(CXCursor_NoDeclFound);
}
@@ -933,13 +935,17 @@
}
CXCursor clang_getCursorReferenced(CXCursor C) {
+ if (clang_isInvalid(C.kind))
+ return clang_getNullCursor();
+
+ ASTUnit *CXXUnit = getCursorASTUnit(C);
if (clang_isDeclaration(C.kind))
return C;
if (clang_isExpression(C.kind)) {
Decl *D = getDeclFromExpr(getCursorExpr(C));
if (D)
- return MakeCXCursor(D);
+ return MakeCXCursor(D, CXXUnit);
return clang_getNullCursor();
}
@@ -948,13 +954,13 @@
switch (C.kind) {
case CXCursor_ObjCSuperClassRef:
- return MakeCXCursor(getCursorObjCSuperClassRef(C).first);
+ return MakeCXCursor(getCursorObjCSuperClassRef(C).first, CXXUnit);
case CXCursor_ObjCProtocolRef: {
- return MakeCXCursor(getCursorObjCProtocolRef(C).first);
+ return MakeCXCursor(getCursorObjCProtocolRef(C).first, CXXUnit);
case CXCursor_ObjCClassRef:
- return MakeCXCursor(getCursorObjCClassRef(C).first);
+ return MakeCXCursor(getCursorObjCClassRef(C).first, CXXUnit);
default:
// We would prefer to enumerate all non-reference cursor kinds here.
@@ -967,6 +973,11 @@
}
CXCursor clang_getCursorDefinition(CXCursor C) {
+ if (clang_isInvalid(C.kind))
+ return clang_getNullCursor();
+
+ ASTUnit *CXXUnit = getCursorASTUnit(C);
+
bool WasReference = false;
if (clang_isReference(C.kind) || clang_isExpression(C.kind)) {
C = clang_getCursorReferenced(C);
@@ -1016,10 +1027,11 @@
break;
case Decl::UsingDirective:
- return MakeCXCursor(cast<UsingDirectiveDecl>(D)->getNominatedNamespace());
+ return MakeCXCursor(cast<UsingDirectiveDecl>(D)->getNominatedNamespace(),
+ CXXUnit);
case Decl::NamespaceAlias:
- return MakeCXCursor(cast<NamespaceAliasDecl>(D)->getNamespace());
+ return MakeCXCursor(cast<NamespaceAliasDecl>(D)->getNamespace(), CXXUnit);
case Decl::Enum:
case Decl::Record:
@@ -1027,7 +1039,7 @@
case Decl::ClassTemplateSpecialization:
case Decl::ClassTemplatePartialSpecialization:
if (TagDecl *Def = cast<TagDecl>(D)->getDefinition(D->getASTContext()))
- return MakeCXCursor(Def);
+ return MakeCXCursor(Def, CXXUnit);
return clang_getNullCursor();
case Decl::Function:
@@ -1037,7 +1049,7 @@
case Decl::CXXConversion: {
const FunctionDecl *Def = 0;
if (cast<FunctionDecl>(D)->getBody(Def))
- return MakeCXCursor(const_cast<FunctionDecl *>(Def));
+ return MakeCXCursor(const_cast<FunctionDecl *>(Def), CXXUnit);
return clang_getNullCursor();
}
@@ -1047,7 +1059,7 @@
// Variables with initializers have definitions.
const VarDecl *Def = 0;
if (Var->getDefinition(Def))
- return MakeCXCursor(const_cast<VarDecl *>(Def));
+ return MakeCXCursor(const_cast<VarDecl *>(Def), CXXUnit);
// extern and private_extern variables are not definitions.
if (Var->hasExternalStorage())
@@ -1064,7 +1076,7 @@
case Decl::FunctionTemplate: {
const FunctionDecl *Def = 0;
if (cast<FunctionTemplateDecl>(D)->getTemplatedDecl()->getBody(Def))
- return MakeCXCursor(Def->getDescribedFunctionTemplate());
+ return MakeCXCursor(Def->getDescribedFunctionTemplate(), CXXUnit);
return clang_getNullCursor();
}
@@ -1072,7 +1084,8 @@
if (RecordDecl *Def = cast<ClassTemplateDecl>(D)->getTemplatedDecl()
->getDefinition(D->getASTContext()))
return MakeCXCursor(
- cast<CXXRecordDecl>(Def)->getDescribedClassTemplate());
+ cast<CXXRecordDecl>(Def)->getDescribedClassTemplate(),
+ CXXUnit);
return clang_getNullCursor();
}
@@ -1087,7 +1100,8 @@
return clang_getNullCursor();
}
- Def = clang_getCursorDefinition(MakeCXCursor((*S)->getTargetDecl()));
+ Def = clang_getCursorDefinition(MakeCXCursor((*S)->getTargetDecl(),
+ CXXUnit));
}
return Def;
@@ -1095,7 +1109,8 @@
case Decl::UsingShadow:
return clang_getCursorDefinition(
- MakeCXCursor(cast<UsingShadowDecl>(D)->getTargetDecl()));
+ MakeCXCursor(cast<UsingShadowDecl>(D)->getTargetDecl(),
+ CXXUnit));
case Decl::ObjCMethod: {
ObjCMethodDecl *Method = cast<ObjCMethodDecl>(D);
@@ -1111,7 +1126,7 @@
if (ObjCMethodDecl *Def = ClassImpl->getMethod(Method->getSelector(),
Method->isInstanceMethod()))
if (Def->isThisDeclarationADefinition())
- return MakeCXCursor(Def);
+ return MakeCXCursor(Def, CXXUnit);
return clang_getNullCursor();
}
@@ -1119,7 +1134,7 @@
case Decl::ObjCCategory:
if (ObjCCategoryImplDecl *Impl
= cast<ObjCCategoryDecl>(D)->getImplementation())
- return MakeCXCursor(Impl);
+ return MakeCXCursor(Impl, CXXUnit);
return clang_getNullCursor();
case Decl::ObjCProtocol:
@@ -1138,7 +1153,7 @@
return C;
} else if (ObjCImplementationDecl *Impl
= cast<ObjCInterfaceDecl>(D)->getImplementation())
- return MakeCXCursor(Impl);
+ return MakeCXCursor(Impl, CXXUnit);
return clang_getNullCursor();
case Decl::ObjCProperty:
@@ -1150,7 +1165,7 @@
if (ObjCInterfaceDecl *Class
= cast<ObjCCompatibleAliasDecl>(D)->getClassInterface())
if (!Class->isForwardDecl())
- return MakeCXCursor(Class);
+ return MakeCXCursor(Class, CXXUnit);
return clang_getNullCursor();
@@ -1158,7 +1173,8 @@
ObjCForwardProtocolDecl *Forward = cast<ObjCForwardProtocolDecl>(D);
if (Forward->protocol_size() == 1)
return clang_getCursorDefinition(
- MakeCXCursor(*Forward->protocol_begin()));
+ MakeCXCursor(*Forward->protocol_begin(),
+ CXXUnit));
// FIXME: Cannot return multiple definitions.
return clang_getNullCursor();
@@ -1169,7 +1185,7 @@
if (Class->size() == 1) {
ObjCInterfaceDecl *IFace = Class->begin()->getInterface();
if (!IFace->isForwardDecl())
- return MakeCXCursor(IFace);
+ return MakeCXCursor(IFace, CXXUnit);
return clang_getNullCursor();
}
@@ -1179,12 +1195,12 @@
case Decl::Friend:
if (NamedDecl *Friend = cast<FriendDecl>(D)->getFriendDecl())
- return clang_getCursorDefinition(MakeCXCursor(Friend));
+ return clang_getCursorDefinition(MakeCXCursor(Friend, CXXUnit));
return clang_getNullCursor();
case Decl::FriendTemplate:
if (NamedDecl *Friend = cast<FriendTemplateDecl>(D)->getFriendDecl())
- return clang_getCursorDefinition(MakeCXCursor(Friend));
+ return clang_getCursorDefinition(MakeCXCursor(Friend, CXXUnit));
return clang_getNullCursor();
}
Modified: cfe/trunk/tools/CIndex/CXCursor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CXCursor.cpp?rev=94051&r1=94050&r2=94051&view=diff
==============================================================================
--- cfe/trunk/tools/CIndex/CXCursor.cpp (original)
+++ cfe/trunk/tools/CIndex/CXCursor.cpp Wed Jan 20 17:57:43 2010
@@ -71,12 +71,12 @@
return CXCursor_NotImplemented;
}
-CXCursor cxcursor::MakeCXCursor(Decl *D) {
- CXCursor C = { GetCursorKind(D), { D, 0, 0 } };
+CXCursor cxcursor::MakeCXCursor(Decl *D, ASTUnit *TU) {
+ CXCursor C = { GetCursorKind(D), { D, 0, TU } };
return C;
}
-CXCursor cxcursor::MakeCXCursor(Stmt *S, Decl *Parent) {
+CXCursor cxcursor::MakeCXCursor(Stmt *S, Decl *Parent, ASTUnit *TU) {
CXCursorKind K = CXCursor_NotImplemented;
switch (S->getStmtClass()) {
@@ -207,14 +207,15 @@
break;
}
- CXCursor C = { K, { Parent, S, 0 } };
+ CXCursor C = { K, { Parent, S, TU } };
return C;
}
CXCursor cxcursor::MakeCursorObjCSuperClassRef(ObjCInterfaceDecl *Super,
- SourceLocation Loc) {
+ SourceLocation Loc,
+ ASTUnit *TU) {
void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding());
- CXCursor C = { CXCursor_ObjCSuperClassRef, { Super, RawLoc, 0 } };
+ CXCursor C = { CXCursor_ObjCSuperClassRef, { Super, RawLoc, TU } };
return C;
}
@@ -227,9 +228,10 @@
}
CXCursor cxcursor::MakeCursorObjCProtocolRef(ObjCProtocolDecl *Super,
- SourceLocation Loc) {
+ SourceLocation Loc,
+ ASTUnit *TU) {
void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding());
- CXCursor C = { CXCursor_ObjCProtocolRef, { Super, RawLoc, 0 } };
+ CXCursor C = { CXCursor_ObjCProtocolRef, { Super, RawLoc, TU } };
return C;
}
@@ -242,9 +244,10 @@
}
CXCursor cxcursor::MakeCursorObjCClassRef(ObjCInterfaceDecl *Class,
- SourceLocation Loc) {
+ SourceLocation Loc,
+ ASTUnit *TU) {
void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding());
- CXCursor C = { CXCursor_ObjCClassRef, { Class, RawLoc, 0 } };
+ CXCursor C = { CXCursor_ObjCClassRef, { Class, RawLoc, TU } };
return C;
}
@@ -274,55 +277,11 @@
}
ASTContext &cxcursor::getCursorContext(CXCursor Cursor) {
- switch (Cursor.kind) {
- case CXCursor_TypedefDecl:
- case CXCursor_StructDecl:
- case CXCursor_UnionDecl:
- case CXCursor_ClassDecl:
- case CXCursor_EnumDecl:
- case CXCursor_FieldDecl:
- case CXCursor_EnumConstantDecl:
- case CXCursor_FunctionDecl:
- case CXCursor_VarDecl:
- case CXCursor_ParmDecl:
- case CXCursor_ObjCInterfaceDecl:
- case CXCursor_ObjCCategoryDecl:
- case CXCursor_ObjCProtocolDecl:
- case CXCursor_ObjCPropertyDecl:
- case CXCursor_ObjCIvarDecl:
- case CXCursor_ObjCInstanceMethodDecl:
- case CXCursor_ObjCClassMethodDecl:
- case CXCursor_ObjCImplementationDecl:
- case CXCursor_ObjCCategoryImplDecl:
- case CXCursor_UnexposedDecl:
- return static_cast<Decl *>(Cursor.data[0])->getASTContext();
-
- case CXCursor_ObjCSuperClassRef:
- case CXCursor_ObjCProtocolRef:
- case CXCursor_ObjCClassRef:
- return static_cast<Decl *>(Cursor.data[0])->getASTContext();
-
- case CXCursor_InvalidFile:
- case CXCursor_NoDeclFound:
- case CXCursor_NotImplemented:
- llvm_unreachable("No context in an invalid cursor");
- break;
+ return getCursorASTUnit(Cursor)->getASTContext();
+}
- case CXCursor_UnexposedExpr:
- case CXCursor_DeclRefExpr:
- case CXCursor_MemberRefExpr:
- case CXCursor_CallExpr:
- case CXCursor_ObjCMessageExpr:
- case CXCursor_UnexposedStmt:
- return static_cast<Decl *>(Cursor.data[0])->getASTContext();
-
- case CXCursor_TranslationUnit: {
- ASTUnit *CXXUnit = static_cast<ASTUnit *>(Cursor.data[0]);
- return CXXUnit->getASTContext();
- }
- }
-
- llvm_unreachable("No context available");
+ASTUnit *cxcursor::getCursorASTUnit(CXCursor Cursor) {
+ return static_cast<ASTUnit *>(Cursor.data[2]);
}
bool cxcursor::operator==(CXCursor X, CXCursor Y) {
Modified: cfe/trunk/tools/CIndex/CXCursor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CXCursor.h?rev=94051&r1=94050&r2=94051&view=diff
==============================================================================
--- cfe/trunk/tools/CIndex/CXCursor.h (original)
+++ cfe/trunk/tools/CIndex/CXCursor.h Wed Jan 20 17:57:43 2010
@@ -21,6 +21,7 @@
namespace clang {
class ASTContext;
+class ASTUnit;
class Decl;
class Expr;
class NamedDecl;
@@ -31,12 +32,13 @@
namespace cxcursor {
CXCursor MakeCXCursorInvalid(CXCursorKind K);
-CXCursor MakeCXCursor(clang::Stmt *S, clang::Decl *Parent);
-CXCursor MakeCXCursor(clang::Decl *D);
+CXCursor MakeCXCursor(clang::Stmt *S, clang::Decl *Parent, ASTUnit *TU);
+CXCursor MakeCXCursor(clang::Decl *D, ASTUnit *TU);
/// \brief Create an Objective-C superclass reference at the given location.
CXCursor MakeCursorObjCSuperClassRef(ObjCInterfaceDecl *Super,
- SourceLocation Loc);
+ SourceLocation Loc,
+ ASTUnit *TU);
/// \brief Unpack an ObjCSuperClassRef cursor into the interface it references
/// and optionally the location where the reference occurred.
@@ -44,7 +46,8 @@
getCursorObjCSuperClassRef(CXCursor C);
/// \brief Create an Objective-C protocol reference at the given location.
-CXCursor MakeCursorObjCProtocolRef(ObjCProtocolDecl *Proto, SourceLocation Loc);
+CXCursor MakeCursorObjCProtocolRef(ObjCProtocolDecl *Proto, SourceLocation Loc,
+ ASTUnit *TU);
/// \brief Unpack an ObjCProtocolRef cursor into the protocol it references
/// and optionally the location where the reference occurred.
@@ -52,7 +55,8 @@
getCursorObjCProtocolRef(CXCursor C);
/// \brief Create an Objective-C class reference at the given location.
-CXCursor MakeCursorObjCClassRef(ObjCInterfaceDecl *Class, SourceLocation Loc);
+CXCursor MakeCursorObjCClassRef(ObjCInterfaceDecl *Class, SourceLocation Loc,
+ ASTUnit *TU);
/// \brief Unpack an ObjCClassRef cursor into the class it references
/// and optionally the location where the reference occurred.
@@ -63,6 +67,7 @@
Expr *getCursorExpr(CXCursor Cursor);
Stmt *getCursorStmt(CXCursor Cursor);
ASTContext &getCursorContext(CXCursor Cursor);
+ASTUnit *getCursorASTUnit(CXCursor Cursor);
bool operator==(CXCursor X, CXCursor Y);
Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=94051&r1=94050&r2=94051&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Wed Jan 20 17:57:43 2010
@@ -230,7 +230,7 @@
Data.TU = TU;
Data.Filter = ck;
- clang_visitChildren(TU, clang_getTranslationUnitCursor(TU), Visitor, &Data);
+ clang_visitChildren(clang_getTranslationUnitCursor(TU), Visitor, &Data);
clang_disposeTranslationUnit(TU);
return 0;
}
More information about the cfe-commits
mailing list