Ted Kremenek | d2fa566 | 2009-08-26 22:36:44 +0000 | [diff] [blame] | 1 | //===- CIndex.cpp - Clang-C Source Indexing Library -----------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements the Clang-C Source Indexing library. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "clang-c/Index.h" |
| 15 | |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 16 | extern "C" { |
Ted Kremenek | d2fa566 | 2009-08-26 22:36:44 +0000 | [diff] [blame] | 17 | |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 18 | CXIndex clang_createIndex() |
| 19 | { |
| 20 | return 0; |
| 21 | } |
| 22 | |
| 23 | CXTranslationUnit clang_loadTranslationUnitFromASTFile( |
| 24 | CXIndex, const char *ast_filename) |
| 25 | { |
| 26 | return 0; |
| 27 | } |
| 28 | |
| 29 | void clang_loadTranslationUnit( |
| 30 | CXTranslationUnit, void (*callback)(CXTranslationUnit, CXCursor) |
| 31 | ) |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | void clang_loadDeclaration(CXDecl, void (*callback)(CXDecl, CXCursor)) |
| 36 | { |
| 37 | } |
| 38 | |
Steve Naroff | 7e8f818 | 2009-08-28 12:07:44 +0000 | [diff] [blame] | 39 | // Some notes on CXEntity: |
| 40 | // |
| 41 | // - Since the 'ordinary' namespace includes functions, data, typedefs, |
| 42 | // ObjC interfaces, thecurrent algorithm is a bit naive (resulting in one |
| 43 | // entity for 2 different types). For example: |
| 44 | // |
| 45 | // module1.m: @interface Foo @end Foo *x; |
| 46 | // module2.m: void Foo(int); |
| 47 | // |
| 48 | // - Since the unique name spans translation units, static data/functions |
| 49 | // within a CXTranslationUnit are *not* currently represented by entities. |
| 50 | // As a result, there will be no entity for the following: |
| 51 | // |
| 52 | // module.m: static void Foo() { } |
| 53 | // |
| 54 | |
| 55 | |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 56 | const char *clang_getDeclarationName(CXEntity) |
| 57 | { |
| 58 | return ""; |
| 59 | } |
| 60 | const char *clang_getURI(CXEntity) |
| 61 | { |
| 62 | return ""; |
| 63 | } |
| 64 | |
| 65 | CXEntity clang_getEntity(const char *URI) |
| 66 | { |
| 67 | return 0; |
| 68 | } |
| 69 | |
| 70 | // |
| 71 | // CXDecl Operations. |
| 72 | // |
| 73 | CXCursor clang_getCursorFromDecl(CXDecl) |
| 74 | { |
| 75 | return 0; |
| 76 | } |
| 77 | CXEntity clang_getEntityFromDecl(CXDecl) |
| 78 | { |
| 79 | return 0; |
| 80 | } |
| 81 | enum CXDeclKind clang_getDeclKind(CXDecl) |
| 82 | { |
| 83 | return CXDecl_any; |
| 84 | } |
| 85 | const char *clang_getDeclSpelling(CXDecl) |
| 86 | { |
| 87 | return ""; |
| 88 | } |
| 89 | // |
| 90 | // CXCursor Operations. |
| 91 | // |
| 92 | CXCursor clang_getCursor(CXTranslationUnit, const char *source_name, |
| 93 | unsigned line, unsigned column) |
| 94 | { |
| 95 | return 0; |
| 96 | } |
| 97 | |
| 98 | CXCursorKind clang_getCursorKind(CXCursor) |
| 99 | { |
Steve Naroff | 7e8f818 | 2009-08-28 12:07:44 +0000 | [diff] [blame] | 100 | return CXCursor_Declaration; |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | unsigned clang_getCursorLine(CXCursor) |
| 104 | { |
| 105 | return 0; |
| 106 | } |
| 107 | unsigned clang_getCursorColumn(CXCursor) |
| 108 | { |
| 109 | return 0; |
| 110 | } |
| 111 | const char *clang_getCursorSource(CXCursor) |
| 112 | { |
| 113 | return ""; |
| 114 | } |
| 115 | |
| 116 | // If CXCursorKind == Cursor_Reference, then this will return the referenced declaration. |
| 117 | // If CXCursorKind == Cursor_Declaration, then this will return the declaration. |
| 118 | CXDecl clang_getCursorDecl(CXCursor) |
| 119 | { |
| 120 | return 0; |
| 121 | } |
| 122 | |
| 123 | } // end extern "C" |