CINDEX_LINKAGE CXCursor clang_getCursorFromDecl(CXDecl);
CINDEX_LINKAGE CXEntity clang_getEntityFromDecl(CXIndex, CXDecl);
CINDEX_LINKAGE CXString clang_getDeclSpelling(CXDecl);
-CINDEX_LINKAGE unsigned clang_getDeclLine(CXDecl); /* deprecate */
-CINDEX_LINKAGE unsigned clang_getDeclColumn(CXDecl); /* deprecate */
-CINDEX_LINKAGE const char *clang_getDeclSource(CXDecl); /* deprecate */
-CINDEX_LINKAGE CXFile clang_getDeclSourceFile(CXDecl); /* deprecate */
/**
* \brief Identifies a specific source location within a translation
*/
CINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range);
-/* clang_getDeclExtent() returns the physical extent of a declaration. The
- * beginning line/column pair points to the start of the first token in the
- * declaration, and the ending line/column pair points to the last character in
- * the last token of the declaration.
- */
-CINDEX_LINKAGE CXSourceRange clang_getDeclExtent(CXDecl);
-
/*
* CXCursor Operations.
*/
// CXDecl Operations.
//===----------------------------------------------------------------------===//
-static const FileEntry *getFileEntryFromSourceLocation(SourceManager &SMgr,
- SourceLocation SLoc) {
- FileID FID;
- if (SLoc.isFileID())
- FID = SMgr.getFileID(SLoc);
- else
- FID = SMgr.getDecomposedSpellingLoc(SLoc).first;
- return SMgr.getFileEntryForID(FID);
-}
-
extern "C" {
CXString clang_getDeclSpelling(CXDecl AnonDecl) {
assert(AnonDecl && "Passed null CXDecl");
return CIndexer::createCXString("");
}
-unsigned clang_getDeclLine(CXDecl AnonDecl) {
- assert(AnonDecl && "Passed null CXDecl");
- NamedDecl *ND = static_cast<NamedDecl *>(AnonDecl);
- SourceManager &SourceMgr = ND->getASTContext().getSourceManager();
- return SourceMgr.getSpellingLineNumber(ND->getLocation());
-}
-
-unsigned clang_getDeclColumn(CXDecl AnonDecl) {
- assert(AnonDecl && "Passed null CXDecl");
- NamedDecl *ND = static_cast<NamedDecl *>(AnonDecl);
- SourceManager &SourceMgr = ND->getASTContext().getSourceManager();
- return SourceMgr.getSpellingColumnNumber(ND->getLocation());
-}
-
-CXSourceRange clang_getDeclExtent(CXDecl AnonDecl) {
- return clang_getCursorExtent(clang_getCursorFromDecl(AnonDecl));
-}
-
-const char *clang_getDeclSource(CXDecl AnonDecl) {
- assert(AnonDecl && "Passed null CXDecl");
- FileEntry *FEnt = static_cast<FileEntry *>(clang_getDeclSourceFile(AnonDecl));
- assert(FEnt && "Cannot find FileEntry for Decl");
- return clang_getFileName(FEnt);
-}
-
-
-CXFile clang_getDeclSourceFile(CXDecl AnonDecl) {
- assert(AnonDecl && "Passed null CXDecl");
- NamedDecl *ND = static_cast<NamedDecl *>(AnonDecl);
- SourceManager &SourceMgr = ND->getASTContext().getSourceManager();
- return (void *)getFileEntryFromSourceLocation(SourceMgr, ND->getLocation());
-}
} // end: extern "C"
//===----------------------------------------------------------------------===//