2009-08-26 22:36:44 +00:00
|
|
|
//===- CIndex.cpp - Clang-C Source Indexing Library -----------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the Clang-C Source Indexing library.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "clang-c/Index.h"
|
2009-08-28 15:28:48 +00:00
|
|
|
#include "clang/Index/Program.h"
|
|
|
|
#include "clang/Index/Indexer.h"
|
|
|
|
#include "clang/AST/DeclVisitor.h"
|
2009-09-02 13:28:54 +00:00
|
|
|
#include "clang/AST/Decl.h"
|
2009-08-29 12:56:35 +00:00
|
|
|
#include "clang/Basic/FileManager.h"
|
2009-08-31 14:26:51 +00:00
|
|
|
#include "clang/Basic/SourceManager.h"
|
2009-08-29 12:56:35 +00:00
|
|
|
#include "clang/Frontend/ASTUnit.h"
|
|
|
|
#include <cstdio>
|
2009-08-28 15:28:48 +00:00
|
|
|
using namespace clang;
|
|
|
|
using namespace idx;
|
|
|
|
|
2009-08-31 00:59:03 +00:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
// Translation Unit Visitor.
|
|
|
|
class TUVisitor : public DeclVisitor<TUVisitor> {
|
|
|
|
CXTranslationUnit TUnit;
|
|
|
|
CXTranslationUnitIterator Callback;
|
2009-09-01 15:55:40 +00:00
|
|
|
CXClientData CData;
|
|
|
|
|
|
|
|
void Call(enum CXCursorKind CK, NamedDecl *ND) {
|
|
|
|
CXCursor C = { CK, ND };
|
|
|
|
Callback(TUnit, C, CData);
|
|
|
|
}
|
2009-08-31 00:59:03 +00:00
|
|
|
public:
|
2009-09-01 15:55:40 +00:00
|
|
|
TUVisitor(CXTranslationUnit CTU,
|
|
|
|
CXTranslationUnitIterator cback, CXClientData D) :
|
|
|
|
TUnit(CTU), Callback(cback), CData(D) {}
|
2009-08-31 00:59:03 +00:00
|
|
|
|
|
|
|
void VisitTranslationUnitDecl(TranslationUnitDecl *D) {
|
|
|
|
VisitDeclContext(dyn_cast<DeclContext>(D));
|
|
|
|
}
|
|
|
|
void VisitDeclContext(DeclContext *DC) {
|
|
|
|
for (DeclContext::decl_iterator
|
|
|
|
I = DC->decls_begin(), E = DC->decls_end(); I != E; ++I)
|
|
|
|
Visit(*I);
|
|
|
|
}
|
2009-09-01 15:55:40 +00:00
|
|
|
void VisitTypedefDecl(TypedefDecl *ND) {
|
|
|
|
Call(CXCursor_TypedefDecl, ND);
|
2009-08-31 00:59:03 +00:00
|
|
|
}
|
|
|
|
void VisitTagDecl(TagDecl *ND) {
|
2009-09-02 13:28:54 +00:00
|
|
|
switch (ND->getTagKind()) {
|
|
|
|
case TagDecl::TK_struct:
|
|
|
|
Call(CXCursor_StructDecl, ND);
|
|
|
|
break;
|
|
|
|
case TagDecl::TK_class:
|
|
|
|
Call(CXCursor_ClassDecl, ND);
|
|
|
|
break;
|
|
|
|
case TagDecl::TK_union:
|
|
|
|
Call(CXCursor_UnionDecl, ND);
|
|
|
|
break;
|
|
|
|
case TagDecl::TK_enum:
|
|
|
|
Call(CXCursor_EnumDecl, ND);
|
|
|
|
break;
|
|
|
|
}
|
2009-08-31 00:59:03 +00:00
|
|
|
}
|
|
|
|
void VisitFunctionDecl(FunctionDecl *ND) {
|
2009-09-02 13:28:54 +00:00
|
|
|
Call(ND->isThisDeclarationADefinition() ? CXCursor_FunctionDefn
|
|
|
|
: CXCursor_FunctionDecl, ND);
|
2009-08-31 00:59:03 +00:00
|
|
|
}
|
|
|
|
void VisitObjCInterfaceDecl(ObjCInterfaceDecl *ND) {
|
2009-09-01 15:55:40 +00:00
|
|
|
Call(CXCursor_ObjCInterfaceDecl, ND);
|
2009-08-31 00:59:03 +00:00
|
|
|
}
|
|
|
|
void VisitObjCCategoryDecl(ObjCCategoryDecl *ND) {
|
2009-09-01 15:55:40 +00:00
|
|
|
Call(CXCursor_ObjCCategoryDecl, ND);
|
2009-08-31 00:59:03 +00:00
|
|
|
}
|
|
|
|
void VisitObjCProtocolDecl(ObjCProtocolDecl *ND) {
|
2009-09-01 15:55:40 +00:00
|
|
|
Call(CXCursor_ObjCProtocolDecl, ND);
|
2009-08-31 00:59:03 +00:00
|
|
|
}
|
2009-09-02 13:28:54 +00:00
|
|
|
void VisitObjCImplementationDecl(ObjCImplementationDecl *ND) {
|
|
|
|
Call(CXCursor_ObjCClassDefn, ND);
|
|
|
|
}
|
|
|
|
void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *ND) {
|
|
|
|
Call(CXCursor_ObjCCategoryDefn, ND);
|
|
|
|
}
|
2009-08-31 00:59:03 +00:00
|
|
|
};
|
|
|
|
|
2009-09-02 13:28:54 +00:00
|
|
|
// Declaration visitor.
|
|
|
|
class CDeclVisitor : public DeclVisitor<CDeclVisitor> {
|
|
|
|
CXDecl CDecl;
|
|
|
|
CXDeclIterator Callback;
|
|
|
|
CXClientData CData;
|
|
|
|
|
|
|
|
void Call(enum CXCursorKind CK, NamedDecl *ND) {
|
|
|
|
CXCursor C = { CK, ND };
|
|
|
|
Callback(CDecl, C, CData);
|
|
|
|
}
|
2009-08-31 00:59:03 +00:00
|
|
|
public:
|
2009-09-02 13:28:54 +00:00
|
|
|
CDeclVisitor(CXDecl C, CXDeclIterator cback, CXClientData D) :
|
|
|
|
CDecl(C), Callback(cback), CData(D) {}
|
|
|
|
|
|
|
|
void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {
|
2009-09-02 18:26:48 +00:00
|
|
|
// Issue callbacks for super class and protocols.
|
|
|
|
if (D->getSuperClass())
|
|
|
|
Call(CXCursor_ObjCSuperClassRef, D);
|
|
|
|
|
2009-09-02 13:28:54 +00:00
|
|
|
VisitDeclContext(dyn_cast<DeclContext>(D));
|
|
|
|
}
|
|
|
|
void VisitTagDecl(TagDecl *D) {
|
|
|
|
VisitDeclContext(dyn_cast<DeclContext>(D));
|
|
|
|
}
|
|
|
|
void VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
|
|
|
|
VisitDeclContext(dyn_cast<DeclContext>(D));
|
|
|
|
}
|
|
|
|
void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) {
|
|
|
|
VisitDeclContext(dyn_cast<DeclContext>(D));
|
|
|
|
}
|
2009-08-31 00:59:03 +00:00
|
|
|
void VisitDeclContext(DeclContext *DC) {
|
|
|
|
for (DeclContext::decl_iterator
|
|
|
|
I = DC->decls_begin(), E = DC->decls_end(); I != E; ++I)
|
|
|
|
Visit(*I);
|
|
|
|
}
|
|
|
|
void VisitEnumConstantDecl(EnumConstantDecl *ND) {
|
2009-09-02 13:28:54 +00:00
|
|
|
Call(CXCursor_EnumConstantDecl, ND);
|
2009-08-31 00:59:03 +00:00
|
|
|
}
|
|
|
|
void VisitFieldDecl(FieldDecl *ND) {
|
2009-09-02 13:28:54 +00:00
|
|
|
Call(CXCursor_FieldDecl, ND);
|
|
|
|
}
|
|
|
|
void VisitObjCPropertyDecl(ObjCPropertyDecl *ND) {
|
|
|
|
Call(CXCursor_ObjCPropertyDecl, ND);
|
2009-08-31 00:59:03 +00:00
|
|
|
}
|
|
|
|
void VisitObjCIvarDecl(ObjCIvarDecl *ND) {
|
2009-09-02 13:28:54 +00:00
|
|
|
Call(CXCursor_ObjCIvarDecl, ND);
|
|
|
|
}
|
|
|
|
void VisitObjCMethodDecl(ObjCMethodDecl *ND) {
|
|
|
|
if (ND->getBody()) {
|
|
|
|
Call(ND->isInstanceMethod() ? CXCursor_ObjCInstanceMethodDefn
|
|
|
|
: CXCursor_ObjCClassMethodDefn, ND);
|
2009-09-03 05:59:50 +00:00
|
|
|
// FIXME: load body.
|
2009-09-02 13:28:54 +00:00
|
|
|
} else
|
|
|
|
Call(ND->isInstanceMethod() ? CXCursor_ObjCInstanceMethodDecl
|
|
|
|
: CXCursor_ObjCClassMethodDecl, ND);
|
2009-08-31 00:59:03 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-08-27 19:51:58 +00:00
|
|
|
extern "C" {
|
2009-08-26 22:36:44 +00:00
|
|
|
|
2009-08-27 19:51:58 +00:00
|
|
|
CXIndex clang_createIndex()
|
2009-08-28 15:28:48 +00:00
|
|
|
{
|
|
|
|
return new Indexer(*new Program(), *new FileManager());
|
2009-08-27 19:51:58 +00:00
|
|
|
}
|
|
|
|
|
2009-08-28 15:28:48 +00:00
|
|
|
// FIXME: need to pass back error info.
|
|
|
|
CXTranslationUnit clang_createTranslationUnit(
|
|
|
|
CXIndex CIdx, const char *ast_filename)
|
2009-08-27 19:51:58 +00:00
|
|
|
{
|
2009-08-28 15:28:48 +00:00
|
|
|
assert(CIdx && "Passed null CXIndex");
|
|
|
|
Indexer *CXXIdx = static_cast<Indexer *>(CIdx);
|
|
|
|
std::string astName(ast_filename);
|
|
|
|
std::string ErrMsg;
|
|
|
|
|
|
|
|
return ASTUnit::LoadFromPCHFile(astName, CXXIdx->getFileManager(), &ErrMsg);
|
2009-08-27 19:51:58 +00:00
|
|
|
}
|
|
|
|
|
2009-08-28 16:30:07 +00:00
|
|
|
|
2009-09-02 13:28:54 +00:00
|
|
|
void clang_loadTranslationUnit(CXTranslationUnit CTUnit,
|
|
|
|
CXTranslationUnitIterator callback,
|
|
|
|
CXClientData CData)
|
2009-08-27 19:51:58 +00:00
|
|
|
{
|
2009-08-28 15:28:48 +00:00
|
|
|
assert(CTUnit && "Passed null CXTranslationUnit");
|
|
|
|
ASTUnit *CXXUnit = static_cast<ASTUnit *>(CTUnit);
|
|
|
|
ASTContext &Ctx = CXXUnit->getASTContext();
|
|
|
|
|
2009-09-01 15:55:40 +00:00
|
|
|
TUVisitor DVisit(CTUnit, callback, CData);
|
2009-08-28 15:28:48 +00:00
|
|
|
DVisit.Visit(Ctx.getTranslationUnitDecl());
|
2009-08-27 19:51:58 +00:00
|
|
|
}
|
|
|
|
|
2009-09-02 13:28:54 +00:00
|
|
|
void clang_loadDeclaration(CXDecl Dcl,
|
|
|
|
CXDeclIterator callback,
|
|
|
|
CXClientData CData)
|
2009-08-27 19:51:58 +00:00
|
|
|
{
|
2009-09-02 13:28:54 +00:00
|
|
|
assert(Dcl && "Passed null CXDecl");
|
|
|
|
|
|
|
|
CDeclVisitor DVisit(Dcl, callback, CData);
|
|
|
|
DVisit.Visit(static_cast<Decl *>(Dcl));
|
2009-08-27 19:51:58 +00:00
|
|
|
}
|
|
|
|
|
2009-08-28 12:07:44 +00:00
|
|
|
// Some notes on CXEntity:
|
|
|
|
//
|
|
|
|
// - Since the 'ordinary' namespace includes functions, data, typedefs,
|
|
|
|
// ObjC interfaces, thecurrent algorithm is a bit naive (resulting in one
|
|
|
|
// entity for 2 different types). For example:
|
|
|
|
//
|
|
|
|
// module1.m: @interface Foo @end Foo *x;
|
|
|
|
// module2.m: void Foo(int);
|
|
|
|
//
|
|
|
|
// - Since the unique name spans translation units, static data/functions
|
|
|
|
// within a CXTranslationUnit are *not* currently represented by entities.
|
|
|
|
// As a result, there will be no entity for the following:
|
|
|
|
//
|
|
|
|
// module.m: static void Foo() { }
|
|
|
|
//
|
|
|
|
|
|
|
|
|
2009-08-27 19:51:58 +00:00
|
|
|
const char *clang_getDeclarationName(CXEntity)
|
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
const char *clang_getURI(CXEntity)
|
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
CXEntity clang_getEntity(const char *URI)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// CXDecl Operations.
|
|
|
|
//
|
|
|
|
CXCursor clang_getCursorFromDecl(CXDecl)
|
|
|
|
{
|
2009-08-31 00:59:03 +00:00
|
|
|
return CXCursor();
|
2009-08-27 19:51:58 +00:00
|
|
|
}
|
|
|
|
CXEntity clang_getEntityFromDecl(CXDecl)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2009-08-31 00:59:03 +00:00
|
|
|
const char *clang_getDeclSpelling(CXDecl AnonDecl)
|
|
|
|
{
|
|
|
|
assert(AnonDecl && "Passed null CXDecl");
|
|
|
|
NamedDecl *ND = static_cast<NamedDecl *>(AnonDecl);
|
2009-09-02 13:28:54 +00:00
|
|
|
|
|
|
|
if (ObjCMethodDecl *OMD = dyn_cast<ObjCMethodDecl>(ND)) {
|
|
|
|
return OMD->getSelector().getAsString().c_str();
|
|
|
|
}
|
2009-08-31 00:59:03 +00:00
|
|
|
if (ND->getIdentifier())
|
|
|
|
return ND->getIdentifier()->getName();
|
2009-09-02 13:28:54 +00:00
|
|
|
else
|
2009-08-31 00:59:03 +00:00
|
|
|
return "";
|
|
|
|
}
|
2009-09-02 18:26:48 +00:00
|
|
|
|
|
|
|
const char *clang_getCursorSpelling(CXCursor C)
|
|
|
|
{
|
|
|
|
assert(C.decl && "CXCursor has null decl");
|
|
|
|
NamedDecl *ND = static_cast<NamedDecl *>(C.decl);
|
|
|
|
|
|
|
|
if (clang_isReference(C.kind)) {
|
|
|
|
switch (C.kind) {
|
2009-09-02 18:58:52 +00:00
|
|
|
case CXCursor_ObjCSuperClassRef:
|
|
|
|
{
|
2009-09-02 18:26:48 +00:00
|
|
|
ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(ND);
|
|
|
|
assert(OID && "clang_getCursorLine(): Missing interface decl");
|
|
|
|
return OID->getSuperClass()->getIdentifier()->getName();
|
2009-09-02 18:58:52 +00:00
|
|
|
}
|
2009-09-02 18:26:48 +00:00
|
|
|
default:
|
|
|
|
return "<not implemented>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return clang_getDeclSpelling(C.decl);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *clang_getCursorKindSpelling(enum CXCursorKind Kind)
|
2009-08-31 00:59:03 +00:00
|
|
|
{
|
|
|
|
switch (Kind) {
|
|
|
|
case CXCursor_FunctionDecl: return "FunctionDecl";
|
|
|
|
case CXCursor_TypedefDecl: return "TypedefDecl";
|
|
|
|
case CXCursor_EnumDecl: return "EnumDecl";
|
|
|
|
case CXCursor_EnumConstantDecl: return "EnumConstantDecl";
|
2009-09-02 13:28:54 +00:00
|
|
|
case CXCursor_StructDecl: return "StructDecl";
|
|
|
|
case CXCursor_UnionDecl: return "UnionDecl";
|
|
|
|
case CXCursor_ClassDecl: return "ClassDecl";
|
2009-08-31 00:59:03 +00:00
|
|
|
case CXCursor_FieldDecl: return "FieldDecl";
|
|
|
|
case CXCursor_VarDecl: return "VarDecl";
|
|
|
|
case CXCursor_ParmDecl: return "ParmDecl";
|
|
|
|
case CXCursor_ObjCInterfaceDecl: return "ObjCInterfaceDecl";
|
|
|
|
case CXCursor_ObjCCategoryDecl: return "ObjCCategoryDecl";
|
|
|
|
case CXCursor_ObjCProtocolDecl: return "ObjCProtocolDecl";
|
|
|
|
case CXCursor_ObjCPropertyDecl: return "ObjCPropertyDecl";
|
|
|
|
case CXCursor_ObjCIvarDecl: return "ObjCIvarDecl";
|
2009-09-02 13:28:54 +00:00
|
|
|
case CXCursor_ObjCInstanceMethodDecl: return "ObjCInstanceMethodDecl";
|
|
|
|
case CXCursor_ObjCClassMethodDecl: return "ObjCClassMethodDecl";
|
|
|
|
case CXCursor_FunctionDefn: return "FunctionDefn";
|
|
|
|
case CXCursor_ObjCInstanceMethodDefn: return "ObjCInstanceMethodDefn";
|
|
|
|
case CXCursor_ObjCClassMethodDefn: return "ObjCClassMethodDefn";
|
|
|
|
case CXCursor_ObjCClassDefn: return "ObjCClassDefn";
|
|
|
|
case CXCursor_ObjCCategoryDefn: return "ObjCCategoryDefn";
|
2009-09-02 18:26:48 +00:00
|
|
|
case CXCursor_ObjCSuperClassRef: return "ObjCSuperClassRef";
|
2009-08-31 00:59:03 +00:00
|
|
|
default: return "<not implemented>";
|
|
|
|
}
|
2009-08-27 19:51:58 +00:00
|
|
|
}
|
2009-08-31 00:59:03 +00:00
|
|
|
|
2009-08-27 19:51:58 +00:00
|
|
|
//
|
|
|
|
// CXCursor Operations.
|
|
|
|
//
|
|
|
|
CXCursor clang_getCursor(CXTranslationUnit, const char *source_name,
|
|
|
|
unsigned line, unsigned column)
|
|
|
|
{
|
2009-08-31 00:59:03 +00:00
|
|
|
return CXCursor();
|
2009-08-27 19:51:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CXCursorKind clang_getCursorKind(CXCursor)
|
|
|
|
{
|
2009-08-31 00:59:03 +00:00
|
|
|
return CXCursor_Invalid;
|
2009-08-27 19:51:58 +00:00
|
|
|
}
|
|
|
|
|
2009-08-31 00:59:03 +00:00
|
|
|
unsigned clang_isDeclaration(enum CXCursorKind K)
|
|
|
|
{
|
|
|
|
return K >= CXCursor_FirstDecl && K <= CXCursor_LastDecl;
|
|
|
|
}
|
2009-08-31 14:26:51 +00:00
|
|
|
|
2009-09-02 18:26:48 +00:00
|
|
|
unsigned clang_isReference(enum CXCursorKind K)
|
|
|
|
{
|
|
|
|
return K >= CXCursor_FirstRef && K <= CXCursor_LastRef;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned clang_isDefinition(enum CXCursorKind K)
|
|
|
|
{
|
|
|
|
return K >= CXCursor_FirstDefn && K <= CXCursor_LastDefn;
|
|
|
|
}
|
|
|
|
|
|
|
|
static SourceLocation getLocationFromCursor(CXCursor C,
|
|
|
|
SourceManager &SourceMgr,
|
|
|
|
NamedDecl *ND) {
|
|
|
|
if (clang_isReference(C.kind)) {
|
|
|
|
switch (C.kind) {
|
|
|
|
case CXCursor_ObjCSuperClassRef:
|
2009-09-02 18:58:52 +00:00
|
|
|
{
|
2009-09-02 18:26:48 +00:00
|
|
|
ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(ND);
|
|
|
|
assert(OID && "clang_getCursorLine(): Missing interface decl");
|
2009-09-02 18:58:52 +00:00
|
|
|
return OID->getSuperClassLoc();
|
|
|
|
}
|
2009-09-02 18:26:48 +00:00
|
|
|
default:
|
2009-09-02 18:58:52 +00:00
|
|
|
return SourceLocation();
|
2009-09-02 18:26:48 +00:00
|
|
|
}
|
|
|
|
} else { // We have a declaration or a definition.
|
2009-09-02 18:58:52 +00:00
|
|
|
SourceLocation SLoc = ND->getLocation();
|
2009-09-02 18:26:48 +00:00
|
|
|
if (SLoc.isInvalid())
|
|
|
|
return SourceLocation();
|
2009-09-02 18:58:52 +00:00
|
|
|
return SourceMgr.getSpellingLoc(SLoc); // handles macro instantiations.
|
2009-09-02 18:26:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-31 14:26:51 +00:00
|
|
|
unsigned clang_getCursorLine(CXCursor C)
|
|
|
|
{
|
|
|
|
assert(C.decl && "CXCursor has null decl");
|
|
|
|
NamedDecl *ND = static_cast<NamedDecl *>(C.decl);
|
|
|
|
SourceManager &SourceMgr = ND->getASTContext().getSourceManager();
|
2009-09-02 18:26:48 +00:00
|
|
|
|
|
|
|
SourceLocation SLoc = getLocationFromCursor(C, SourceMgr, ND);
|
2009-08-31 14:26:51 +00:00
|
|
|
return SourceMgr.getSpellingLineNumber(SLoc);
|
|
|
|
}
|
2009-09-02 18:26:48 +00:00
|
|
|
|
2009-08-31 14:26:51 +00:00
|
|
|
unsigned clang_getCursorColumn(CXCursor C)
|
|
|
|
{
|
|
|
|
assert(C.decl && "CXCursor has null decl");
|
|
|
|
NamedDecl *ND = static_cast<NamedDecl *>(C.decl);
|
|
|
|
SourceManager &SourceMgr = ND->getASTContext().getSourceManager();
|
2009-09-02 18:26:48 +00:00
|
|
|
|
|
|
|
SourceLocation SLoc = getLocationFromCursor(C, SourceMgr, ND);
|
2009-08-31 14:26:51 +00:00
|
|
|
return SourceMgr.getSpellingColumnNumber(SLoc);
|
|
|
|
}
|
|
|
|
const char *clang_getCursorSource(CXCursor C)
|
|
|
|
{
|
|
|
|
assert(C.decl && "CXCursor has null decl");
|
|
|
|
NamedDecl *ND = static_cast<NamedDecl *>(C.decl);
|
|
|
|
SourceManager &SourceMgr = ND->getASTContext().getSourceManager();
|
2009-09-02 18:26:48 +00:00
|
|
|
|
|
|
|
SourceLocation SLoc = getLocationFromCursor(C, SourceMgr, ND);
|
2009-08-31 14:26:51 +00:00
|
|
|
return SourceMgr.getBufferName(SLoc);
|
2009-08-27 19:51:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// If CXCursorKind == Cursor_Reference, then this will return the referenced declaration.
|
|
|
|
// If CXCursorKind == Cursor_Declaration, then this will return the declaration.
|
|
|
|
CXDecl clang_getCursorDecl(CXCursor)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // end extern "C"
|