[cfe-commits] r82807 - in /cfe/trunk: include/clang-c/Index.h tools/CIndex/CIndex.cpp tools/CIndex/CIndex.exports

Steve Naroff snaroff at apple.com
Fri Sep 25 14:45:39 PDT 2009


Author: snaroff
Date: Fri Sep 25 16:45:39 2009
New Revision: 82807

URL: http://llvm.org/viewvc/llvm-project?rev=82807&view=rev
Log:
Add clang_getDeclSource().

Modified:
    cfe/trunk/include/clang-c/Index.h
    cfe/trunk/tools/CIndex/CIndex.cpp
    cfe/trunk/tools/CIndex/CIndex.exports

Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=82807&r1=82806&r2=82807&view=diff

==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Fri Sep 25 16:45:39 2009
@@ -177,6 +177,7 @@
 const char *clang_getDeclSpelling(CXDecl);
 unsigned clang_getDeclLine(CXDecl);
 unsigned clang_getDeclColumn(CXDecl);
+const char *clang_getDeclSource(CXDecl);
 
 /*
  * CXCursor Operations.

Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=82807&r1=82806&r2=82807&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Fri Sep 25 16:45:39 2009
@@ -370,6 +370,14 @@
   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");

Modified: cfe/trunk/tools/CIndex/CIndex.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.exports?rev=82807&r1=82806&r2=82807&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.exports (original)
+++ cfe/trunk/tools/CIndex/CIndex.exports Fri Sep 25 16:45:39 2009
@@ -11,6 +11,7 @@
 _clang_getDeclSpelling
 _clang_getDeclLine
 _clang_getDeclColumn
+_clang_getDeclSource
 _clang_getEntity
 _clang_getEntityFromDecl
 _clang_getURI





More information about the cfe-commits mailing list