summaryrefslogtreecommitdiffstats
path: root/clang/tools/c-index-test/c-index-test.c
Commit message (Collapse)AuthorAgeFilesLines
* Add 'PostVisitTU' callback hook to 'perform_test_load()' to allow a special ↵Ted Kremenek2010-01-261-9/+21
| | | | | | callback after the translation unit has been loaded (and streamed). llvm-svn: 94557
* Allow the 'visitor' argument to 'perform_test_load()' to be NULL. TheTed Kremenek2010-01-261-18/+22
| | | | | | | utility of this change will be made clearer in a subsequent patch when perform_test_load()' does more than stream the AST. llvm-svn: 94556
* Introduce a CIndex API for lexing the raw tokens within a given sourceDouglas Gregor2010-01-261-30/+151
| | | | | | range. The token-annotation function does nothing, yet. llvm-svn: 94551
* Extend clang_createTranslationUnitFromSourceFile() to support creatingDouglas Gregor2010-01-231-102/+112
| | | | | | translation units that include unsaved files. llvm-svn: 94258
* Yet more CIndex API cleanup:Douglas Gregor2010-01-221-4/+13
| | | | | | | | - Added more routines to manipulate/compare source locations and ranges - Switched clang_getCursor() over to take a CXSourceLocation rather than file/line/column. llvm-svn: 94226
* Stash a CXXUnit pointer into each cursor. This allows us to simplifyDouglas Gregor2010-01-201-1/+1
| | | | | | | the interface to clang_visitChildren() by eliminating the CXTranslationUnit pointer. llvm-svn: 94051
* Switch c-index-test from clang_loadDeclaration() andDouglas Gregor2010-01-201-55/+44
| | | | | | clang_loadTranslationUnit() over to clang_visitChildren(). llvm-svn: 94031
* Rework the CXSourceLocation and CXSourceRange APIs. They are nowDouglas Gregor2010-01-191-10/+31
| | | | | | | | | | opaque data structures accessed through the new functions clang_getInstantiationLocation(), clang_getRangeStart(), and clang_getRangeEnd(). The new API permits later extensions to introduce new functions to allow CIndex clients to walk macro instantiations, if we ever care. llvm-svn: 93915
* Eliminate cursor kinds used to express definitions. Instead, provideDouglas Gregor2010-01-191-1/+5
| | | | | | | | | | | | CIndex functions that (1) map from a reference or declaration to the corresponding definition, if available, and (2) determine whether a given declaration cursor is also a definition. This eliminates a lot of duplication in the cursor kinds, and maps more closely to the Clang ASTs. This is another API + ABI breaker with no deprecation. Yay, progress. llvm-svn: 93893
* Introduce clang_getCursorReferenced, to get a cursor pointing at theDouglas Gregor2010-01-191-5/+7
| | | | | | entity that a particular cursor references. llvm-svn: 93830
* Implement clang_getCursorExtent, which provides a source range for theDouglas Gregor2010-01-191-8/+8
| | | | | | | | | | | | | cursor itself. In particular, for references this returns the source range of the reference rather than the source range of the thing it refers to. Switch c-index-test from clang_getDeclExtent (which will eventually be deprecated and removed) over to clang_getCursorExtent. The source ranges we print for references now make sense; fix up the tests appropriately. llvm-svn: 93823
* Introduce clang_getCursorLocation(), which supercedesDouglas Gregor2010-01-181-16/+23
| | | | | | | | clang_getCursorLine(), clang_getCursorColumn(), clang_getCursorSource(), and clang_getCursorSourceFile(). Mark those 4 functions as deprecated and stop using them ourselves. llvm-svn: 93800
* Clean up the CIndex API slightly.Douglas Gregor2010-01-181-1/+1
| | | | | | | | | | | Renamed CXSourceFileLine to CXSourceLocation and added a CXFile, to better match Clang's SourceLocation. Teach clang_getDeclExtent to fill in the CXFile properly. Renamed CXSourceExtent to CXSourceRange, to better match Clang's SourceLocation. llvm-svn: 93783
* Replace clang_getDeclUSR() with clang_getCursorUSR(). Also remove printing ↵Ted Kremenek2010-01-181-18/+4
| | | | | | 'contexts' from c-index-test output; it wasn't helpful and was extremely brittle. llvm-svn: 93760
* Remove TranslateKind and centralize Decl -> CXCursorKind in GetCursorKind(). ↵Ted Kremenek2010-01-161-8/+17
| | | | | | This revealed a bunch of inconsistencies in how CXCursorKinds were being computed. llvm-svn: 93618
* Make CXCursor's data opaque.Douglas Gregor2010-01-151-7/+7
| | | | llvm-svn: 93561
* Add -cursor-at=file:line:column command line option to c-index-test,Douglas Gregor2010-01-151-1/+71
| | | | | | | | to directly check the results of clang_getCursor(). Also, start migrating some index-test tests over to c-index test [*] and some grep-using tests over to FileCheck. llvm-svn: 93537
* Add USR printing modes to c-index-test.Ted Kremenek2010-01-121-10/+54
| | | | llvm-svn: 93269
* Make 'CXTranslationUnitIterator' an argument to perform_test_load(),Ted Kremenek2010-01-121-8/+12
| | | | | | perform_test_load_tu(), and perform_test_load_source(). llvm-svn: 93248
* Improve code completion by introducing patterns for the various C andDouglas Gregor2010-01-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | C++ grammatical constructs that show up in top-level (namespace-level) declarations, member declarations, template declarations, statements, expressions, conditions, etc. For example, we now provide a pattern for static_cast<type>(expr) when we can have an expression, or using namespace identifier; when we can have a using directive. Also, improves the results of code completion at the beginning of a top-level declaration. Previously, we would see value names (function names, global variables, etc.); now we see types, namespace names, etc., but no values. llvm-svn: 93134
* Add FileCheck prefix to another location in the output of c-index-test.Ted Kremenek2010-01-071-1/+1
| | | | llvm-svn: 92890
* Remove unused variables.Ted Kremenek2010-01-051-2/+0
| | | | llvm-svn: 92804
* Add C API hook 'clang_getDeclExtent()', which returns the source extent of a ↵Ted Kremenek2010-01-051-16/+42
| | | | | | declaration. This implements <rdar://problem/7280072>. llvm-svn: 92802
* Extend code-completion results with the type of each resultDouglas Gregor2009-12-181-0/+1
| | | | llvm-svn: 91702
* Change clang_codeComplete API to return the results in a structure onDouglas Gregor2009-12-181-4/+13
| | | | | | | | the heap, so that clients are not forced to copy the results during the initial iteration. A separate clang_disposeCodeCompleteResults function frees the returned results. llvm-svn: 91690
* Test for errors during fread() inside c-index-test and handle themChandler Carruth2009-12-171-1/+9
| | | | | | appropriately. This also silences some pedantic GCC warnings. llvm-svn: 91596
* Switch clang_createTranslationUnitFromSourceFile to use ↵Daniel Dunbar2009-12-031-0/+5
| | | | | | | | | | | | | | | | | | | ASTUnit::LoadFromCommandLine. - This is much faster, as it avoids the overhead of dumping an AST file to disk and reloading it. - For debugging purposes, there is a clang_setUseExternalASTGeneration hook which can be used to disable this. On the Sketch Cocoa app, the speedup is pretty nice, especially when using a PCH file while scanning the source: Wall time to c-index-test all files (no PCH): Old: 23.4221 New: 12.3884 Wall time to c-index-test all files (with a PCH, and "local" mode): Old: 10.9233 New: 1.9038 llvm-svn: 90385
* Extend the CIndex code-completion API to perform code completionDouglas Gregor2009-12-021-1/+95
| | | | | | | involving unsaved files, using the -remap-file= functionality recently added to clang-cc. llvm-svn: 90314
* c-index-test: Split "function scanning" behavior into its own "filter" -- itsDaniel Dunbar2009-12-011-68/+63
| | | | | | | | quite slow and doesn't really stress the APIs people should really use. - I'm not even sure if this mode is still useful given the other scanning mode; Steve? llvm-svn: 90193
* Add c-index-test -test-load-source, which loads the translation unit from a ↵Daniel Dunbar2009-12-011-1/+36
| | | | | | source file (and other command line arguments). llvm-svn: 90187
* Add special clang_getCursor() support for @class. Handles ↵Ted Kremenek2009-11-181-9/+16
| | | | | | <rdar://problem/7383421>. llvm-svn: 89183
* fgetln is a BSDism; replace it with more portable code.Benjamin Kramer2009-11-171-6/+9
| | | | llvm-svn: 89140
* Add c-index-test mode "-test-file-scan", which scans a source file and calls ↵Ted Kremenek2009-11-171-6/+100
| | | | | | clang_getCursor() on every character. llvm-svn: 89136
* Organize c-index-test into logic sections, and add section headers.Ted Kremenek2009-11-171-42/+62
| | | | llvm-svn: 89117
* Clean up c-index-test command line usage a bit by requiring a ↵Ted Kremenek2009-11-171-36/+49
| | | | | | "-test-load-tu" option when testing clang_loadTranslationUnit(). Running c-index-test without the correct arguments now also prints a useful summary of its correct usage. llvm-svn: 89115
* Have clang_getCursorSource() return NULL when the source location is invalid ↵Ted Kremenek2009-11-171-4/+11
| | | | | | or refers to a built-in buffer. Implements <rdar://problem/7296243>. llvm-svn: 89044
* Improve c-index-test's parsing of the -code-completion-at=file:line:column ↵Douglas Gregor2009-11-091-21/+24
| | | | | | argument llvm-svn: 86566
* Introduce CXString type and associated functions clang_getCString() and ↵Steve Naroff2009-11-091-4/+17
| | | | | | | | | | clang_disposeString(). This abstraction will help us manage string memory for complex names that cross the C++/C boundary (e.g. ObjC methods, selectors). This patch also uses it in clang_getTranslationUnitSpelling (which I'm not sure is necessary). Will investigate later...since the extra malloc() can't hurt (for now). Patch by John Thompson. llvm-svn: 86562
* C doesn't allow mixing declarations and statements, sillyDouglas Gregor2009-11-091-2/+2
| | | | llvm-svn: 86556
* Minor cleanup for CIndex-based code-completion:Douglas Gregor2009-11-091-11/+24
| | | | | | | | - Provide an actual test for code-completion via CIndex. - Actually print optional strings in c-index-test - Export clang_getCompletionChunkCompletionString from CIndex llvm-svn: 86550
* Revert unintentional change to this file.Daniel Dunbar2009-11-081-2/+1
| | | | llvm-svn: 86455
* CIndex: Add temporary hack to leak memory instead of returning invalid pointers.Daniel Dunbar2009-11-081-1/+2
| | | | llvm-svn: 86438
* Fix some build warnings.Daniel Dunbar2009-11-071-2/+5
| | | | llvm-svn: 86393
* Various improvements to Clang's code-completion infrastructure:Douglas Gregor2009-11-071-0/+106
| | | | | | | | | | | | | | - Introduce more code-completion string "chunk" kinds that describe symbols, the actual text that the user is expected to type, etc. - Make the generation of macro results optional, since it can be slow - Make code-completion accessible through the C API, marshalling the code-completion results through a temporary file (ick) to maintain process separation. The last doesn't have tests yet. llvm-svn: 86306
* Remove _clang_initCXLookupHint() and _clang_getCursorWithHint(). Related to ↵Steve Naroff2009-10-281-6/+2
| | | | | | | | | | <rdar://problem/7310688>. Localize the optimization to ResolveLocationInAST(). The last valid AST location is now stored with ASTUnit. There still isn't optimal, however it's an improvement (with a much cleaner API). Having the client manage an "hint" is error prone and complex. I wanted to land the major changes before finishing up the optimizations. llvm-svn: 85425
* Changes for building as a Windows DLLJohn Thompson2009-10-271-0/+16
| | | | llvm-svn: 85234
* Fixes a warning.Fariborz Jahanian2009-10-221-1/+1
| | | | llvm-svn: 84909
* Split clang_getCursor() into clang_getCursor() and clang_getCursorWithHint().Ted Kremenek2009-10-221-2/+6
| | | | llvm-svn: 84873
* Extend clang_getCursor() to take a 'relativeDecl' argument (so speed up ↵Steve Naroff2009-10-211-2/+2
| | | | | | | | | | | | | | 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
* - Extend clang_createIndex() to support PCH and diagnostic 'filtering'. This ↵Steve Naroff2009-10-201-5/+3
| | | | | | | | | | | | 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
OpenPOWER on IntegriCloud