]> granicus.if.org Git - clang/commitdiff
Add clang_getDeclSource().
authorSteve Naroff <snaroff@apple.com>
Fri, 25 Sep 2009 21:45:39 +0000 (21:45 +0000)
committerSteve Naroff <snaroff@apple.com>
Fri, 25 Sep 2009 21:45:39 +0000 (21:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82807 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang-c/Index.h
tools/CIndex/CIndex.cpp
tools/CIndex/CIndex.exports

index 2203e2872302fd1f877e3c144262c1962ca03ec0..3178017e45be85b0eebf9b2bab39e8bec6e492ad 100644 (file)
@@ -177,6 +177,7 @@ CXEntity clang_getEntityFromDecl(CXDecl);
 const char *clang_getDeclSpelling(CXDecl);
 unsigned clang_getDeclLine(CXDecl);
 unsigned clang_getDeclColumn(CXDecl);
+const char *clang_getDeclSource(CXDecl);
 
 /*
  * CXCursor Operations.
index 74b3cfd8af9748665569b1052ecaf3461fdf7e6b..ff0be0d9e2037c1e6156d4b5777c5d95237bf63d 100644 (file)
@@ -370,6 +370,14 @@ unsigned clang_getDeclColumn(CXDecl AnonDecl)
   return SourceMgr.getSpellingLineNumber(ND->getLocation());
 }
 
+const char *clang_getDeclSource(CXDecl AnonDecl) 
+{
+  assert(AnonDecl && "Passed null CXDecl");
+  NamedDecl *ND = static_cast<NamedDecl *>(AnonDecl);
+  SourceManager &SourceMgr = ND->getASTContext().getSourceManager();
+  return SourceMgr.getBufferName(ND->getLocation());
+}
+
 const char *clang_getCursorSpelling(CXCursor C)
 {
   assert(C.decl && "CXCursor has null decl");
index 8cfc1a9d7f1e85a84aea188c13af4828b9cd1c04..c1ca0c77351986f3ef7644b2127dd53e8389dd6c 100644 (file)
@@ -11,6 +11,7 @@ _clang_getDeclarationName
 _clang_getDeclSpelling
 _clang_getDeclLine
 _clang_getDeclColumn
+_clang_getDeclSource
 _clang_getEntity
 _clang_getEntityFromDecl
 _clang_getURI