Commit Graph

328 Commits

Author SHA1 Message Date
John Thompson de258b5ab9 Changes for building as a Windows DLL
llvm-svn: 85234
2009-10-27 13:42:56 +00:00
Ted Kremenek a96b72a4ca Split clang_getCursor() into clang_getCursor() and clang_getCursorWithHint().
llvm-svn: 84873
2009-10-22 17:22:53 +00:00
Ted Kremenek 649bf5c04b Enhance 'clang_createTranslationUnitFromSourceFile()' in two ways:
(1) Allow the source file to be specified in the actual command line arguments by allowing the
    caller to set 'source_filename' to NULL.

(2) Automatically strip off the arguments '-emit-ast', '-fsyntax-only', and '-c'.

llvm-svn: 84802
2009-10-22 00:03:57 +00:00
Steve Naroff 20bad0b7c6 Extend clang_getCursor() to take a 'relativeDecl' argument (so speed up searching). Without a 'relativeDecl', the algorithm is n-squared. For example, running the following command on 'Large.m' takes hours without a 'relatvieDecl'.
snaroff% time ../../Debug/bin/c-index-test Large.ast all > Large.out
snaroff% cat Large.m
#import <Cocoa/Cocoa.h>
#import <QuickTime/QuickTime.h>
#import <OpenGL/OpenGL.h>

With a 'relativeDecl', it takes <30 seconds:-)

llvm-svn: 84760
2009-10-21 13:56:23 +00:00
Steve Naroff bb4568a37d Add an example to help claify the process/assumptions...
llvm-svn: 84642
2009-10-20 16:36:34 +00:00
Steve Naroff 531e284064 - Extend clang_createIndex() to support PCH and diagnostic 'filtering'. This seems cleaner to me without sacrificing much flexibility.
- Remove clang_wantOnlyLocalDeclarations().

- Remove 'displayDiagnostics' arguments to clang_createTranslationUnitFromSourceFile() and clang_createTranslationUnit().

- Have clang_createTranslationUnitFromSourceFile() strip the '-o <outfile>' command line arguments if they exist. Document this semantic in the header. Also verify we have a valid ASTUnit before telling it to 'unlinkTemporaryFile()'.

llvm-svn: 84634
2009-10-20 14:46:24 +00:00
Ted Kremenek 02b319ce18 Really fix <rdar://problem/7312058> by adding a 'displayDiagnostics' option to
clang_createTranslationUnit() and clang_createTranslationUnitFromSourceFile(). The user can now
specify if the diagnostics from Clang are printed to stderr or are silenced completely. We can
obviously evolve this API to be more general in the future.

Note: Added a FIXME since I wasn't certain what was the best way to redirect to something analogous
to '/dev/null' on Windows.

llvm-svn: 84548
2009-10-19 22:15:09 +00:00
Douglas Gregor 16bef857d9 Keep track of whether declararions were loaded from a precompiled
header or not via a new "PCHLevel" field in Decl. We currently use
this information to help CIndex filter out declarations that came from
a precompiled header (rather than from an AST file). Further down the
road, it can be used to help implement multi-level precompiled
headers.

llvm-svn: 84267
2009-10-16 20:01:17 +00:00
Steve Naroff 7781daa4e0 Implement <rdar://problem/7303432> [Clang/Index] In-memory-style AST generation API (initial API implementation).
Added clang_createTranslationUnitFromSourceFile().
Changed clang_createIndex() to lookup the location of clang (using dladdr).

llvm-svn: 84198
2009-10-15 20:04:39 +00:00
Steve Naroff 2676089407 Add clang_getDeclSource().
llvm-svn: 82807
2009-09-25 21:45:39 +00:00
Steve Naroff 63f475a212 Add clang_getDeclLine and clang_getDeclColumn
Fix clang_getCursorDecl to do the right thing for expr refs
Fixup test file to accommodate new output (which includes the line/column for the referenced decl)

llvm-svn: 82798
2009-09-25 21:32:34 +00:00
Steve Naroff 76b8f13fcb More work to enable more exhaustive testing of the indexing API.
Next step: Add actual some test cases:-)

llvm-svn: 82636
2009-09-23 17:52:52 +00:00
Steve Naroff 66af1aecdb - Implement support for various types of "refs" (initially to help test clang_getCursor()).
- Add missing prototypes for dispose functions.

llvm-svn: 82564
2009-09-22 19:25:29 +00:00
Chris Lattner dd890b2b2e fit in 80 cols
llvm-svn: 82073
2009-09-16 20:18:54 +00:00
Steve Naroff 54f22fb1de - clang_getCursor(): Replace asserts with error codes (CXCursor_InvalidFile, CXCursor_NoDeclFound).
- Add predicate clang_isInvalid().
- Implement clang_getCursorFromDecl().

llvm-svn: 81908
2009-09-15 20:25:34 +00:00
Steve Naroff 38c1a7ba12 - Add back some harmless code that part of a reverted commit (r80859). I'll investigate the lifetime snafu (with ASTUnit) separately.
- Traverse category methods, add a "class ref" and make the little test harness a bit more flexible.

llvm-svn: 80921
2009-09-03 15:49:00 +00:00
Daniel Dunbar 3a0637b06b Revert "Visit function/method bodies and issue callback for parameters and local
variables.", this is breaking x86_64-apple-darwin10 and Linux tests.

llvm-svn: 80896
2009-09-03 05:59:50 +00:00
Steve Naroff ef3cf2a576 Visit function/method bodies and issue callback for parameters and local variables.
Add clang_getTranslationUnitSpelling().

llvm-svn: 80859
2009-09-03 00:32:06 +00:00
Steve Naroff 80a766bf50 Start issuing callback for references (add some predicates, refactor some code).
llvm-svn: 80810
2009-09-02 18:26:48 +00:00
Steve Naroff 3645f5a99b Flesh out CXCursorKind...
- More declaration types (distinguish between struct/union/class, instance/class methods).
- Add definition types (class, category, function, instance/class method, etc.).

Add client data to clang_loadDeclaration() and implement.

llvm-svn: 80787
2009-09-02 13:28:54 +00:00
Steve Naroff 95908b373a Tweak comment based on Daniel's recently added '-emit-ast' option.
llvm-svn: 80684
2009-09-01 17:13:31 +00:00
Steve Naroff 69b10fd2c5 Add explicit "blind" client data to callback function (since we aren't using blocks).
llvm-svn: 80673
2009-09-01 15:55:40 +00:00
Steve Naroff 772c1a4574 Implement source/line/column hooks.
llvm-svn: 80585
2009-08-31 14:26:51 +00:00
Steve Naroff 1054e60334 More fleshing out the C-based indexing API (under construction).
llvm-svn: 80529
2009-08-31 00:59:03 +00:00
Steve Naroff a1c728438c Lot's of little changes to get the C-based indexing API going...
Work in progress.

llvm-svn: 80367
2009-08-28 15:28:48 +00:00
Steve Naroff 8721959642 Add CX prefix to Cursor and move a comment.
llvm-svn: 80359
2009-08-28 12:07:44 +00:00
Steve Naroff d5e8e862bb Fill in Index.h header file and add stubs to implementation file.
llvm-svn: 80279
2009-08-27 19:51:58 +00:00
Ted Kremenek b60d87c517 Add initial boilerplate for CIndex, a shared library that will vend high-level
source symbol information (harvested by Clang) through a C API.

llvm-svn: 80166
2009-08-26 22:36:44 +00:00