Lot's of little changes to get the C-based indexing API going...

Work in progress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80367 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index 52ffb93..b96cb6c 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -33,13 +33,13 @@
    Naming Conventions: To avoid namespace pollution, data types are prefixed 
    with "CX" and functions are prefixed with "clang_".
 */
-typedef void *CXIndex;            // An indexing instance.
+typedef void *CXIndex;            /* An indexing instance. */
 
-typedef void *CXTranslationUnit;  // A translation unit instance.
+typedef void *CXTranslationUnit;  /* A translation unit instance. */
 
-typedef void *CXCursor;  // An opaque cursor into the CXTranslationUnit.
+typedef void *CXCursor;  /* An opaque cursor into the CXTranslationUnit. */
 
-// Cursors represent declarations and references (provides line/column info).
+/* Cursors represent declarations and references (provides line/column info). */
 enum CXCursorKind {  
  CXCursor_Declaration,
  CXCursor_Reference,
@@ -49,9 +49,9 @@
  CXCursor_ObjC_SelectorRef
 };
 
-typedef void *CXDecl;    // A specific declaration within a translation unit.
+typedef void *CXDecl;    /* A specific declaration within a translation unit. */
 
-enum CXDeclKind {  // The various kinds of declarations.
+enum CXDeclKind {  /* The various kinds of declarations. */
  CXDecl_any,
  CXDecl_typedef,
  CXDecl_enum,
@@ -73,12 +73,12 @@
  CXDecl_ObjC_property_implementation
 };
 
-// A unique token for looking up "visible" CXDecls from a CXTranslationUnit.
+/* A unique token for looking up "visible" CXDecls from a CXTranslationUnit. */
 typedef void *CXEntity;     
 
 CXIndex clang_createIndex();
 
-CXTranslationUnit clang_loadTranslationUnitFromASTFile(
+CXTranslationUnit clang_createTranslationUnit(
   CXIndex, const char *ast_filename
 );
 
@@ -130,33 +130,35 @@
 */
 void clang_loadDeclaration(CXDecl, void (*callback)(CXDecl, CXCursor));
 
-//
-// CXEntity Operations.
-//
+/*
+ * CXEntity Operations.
+ */
 const char *clang_getDeclarationName(CXEntity);
 const char *clang_getURI(CXEntity);
 CXEntity clang_getEntity(const char *URI);
-//
-// CXDecl Operations.
-//
+/*
+ * CXDecl Operations.
+ */
 CXCursor clang_getCursorFromDecl(CXDecl);
 CXEntity clang_getEntityFromDecl(CXDecl);
 enum CXDeclKind clang_getDeclKind(CXDecl);
 const char *clang_getDeclSpelling(CXDecl);
-//
-// CXCursor Operations.
-//
+/*
+ * CXCursor Operations.
+ */
 CXCursor clang_getCursor(CXTranslationUnit, const char *source_name, 
                          unsigned line, unsigned column);
 
-CXCursorKind clang_getCursorKind(CXCursor);
+enum CXCursorKind clang_getCursorKind(CXCursor);
 
 unsigned clang_getCursorLine(CXCursor);
 unsigned clang_getCursorColumn(CXCursor);
 const char *clang_getCursorSource(CXCursor);
 
-// If CXCursorKind == Cursor_Reference, then this will return the referenced declaration.
-// If CXCursorKind == Cursor_Declaration, then this will return the declaration.
+/*
+ * 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);
 
 #ifdef __cplusplus
diff --git a/include/clang/Index/Indexer.h b/include/clang/Index/Indexer.h
index 98cce9e..0fcf31c 100644
--- a/include/clang/Index/Indexer.h
+++ b/include/clang/Index/Indexer.h
@@ -19,6 +19,7 @@
 #include "clang/Index/GlobalSelector.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/DenseMap.h"
+#include "clang/Basic/FileManager.h"
 #include <map>
 
 namespace clang {
@@ -36,10 +37,13 @@
   typedef std::map<Entity, TUSetTy> MapTy;
   typedef std::map<GlobalSelector, TUSetTy> SelMapTy;
 
-  explicit Indexer(Program &prog) : Prog(prog) { }
+  explicit Indexer(Program &prog, FileManager &FM) : 
+    Prog(prog), FileMgr(FM) { }
 
   Program &getProgram() const { return Prog; }
 
+  FileManager &getFileManager() const { return FileMgr; }
+  
   /// \brief Find all Entities and map them to the given translation unit.
   void IndexAST(TranslationUnit *TU);
 
@@ -50,6 +54,8 @@
 
 private:
   Program &Prog;
+  FileManager &FileMgr;
+  
   MapTy Map;
   CtxTUMapTy CtxTUMap;
   SelMapTy SelMap;