summaryrefslogtreecommitdiffstats
path: root/clang/tools/c-index-test/c-index-test.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Re-apply my diagnostics-capture patch for CIndex, with some tweaks toDouglas Gregor2010-02-181-109/+66
| | | | | | try to address the msvc failures. llvm-svn: 96624
* Revert my CIndex diagnostic changes (r96603, 96606, 96607), which wereDouglas Gregor2010-02-181-66/+109
| | | | | | breaking the msvc9 builder for unknown reasons. llvm-svn: 96618
* Introduce debugging/testing hook clang_enableStackTraces() intoDouglas Gregor2010-02-181-0/+1
| | | | | | | CIndex, so that c-index-test to use it to call lvm::sys::PrintStackTraceOnErrorSignal(). llvm-svn: 96607
* Resurrect the displayDiagnostics parameter to clang_createIndex(), andDouglas Gregor2010-02-181-6/+9
| | | | | | | display captured diagnostics when we can't return an invalid CXTranslationUnit. llvm-svn: 96606
* Introduce CIndex API functions for displaying a diagnostic, with someDouglas Gregor2010-02-181-103/+56
| | | | | | | | | | | knobs to control formatting. Eventually, I'd like to merge the implementation of this code with the TextDiagnosticPrinter, so that it's easy for CIndex clients to produce beautiful diagnostics like the clang compiler does. Use this new function to display diagnostics within c-index-test. llvm-svn: 96603
* Rework how CIndex handles diagnostics. Rather than using a callback,Douglas Gregor2010-02-181-19/+25
| | | | | | | | | | | | | | | | | | we attach diagnostics to translation units and code-completion results, so they can be queried at any time. To facilitate this, the new StoredDiagnostic class stores a diagnostic in a serializable/deserializable form, and ASTUnit knows how to capture diagnostics in this stored form. CIndex's CXDiagnostic is a thin wrapper around StoredDiagnostic, providing a C interface to stored or de-serialized diagnostics. I've XFAIL'd one test case temporarily, because currently we end up storing diagnostics in an ASTUnit that's never returned to the user (because it contains errors). I'll introduce a temporary fix for this soon; the real fix will be to allow us to return and query invalid ASTs. llvm-svn: 96592
* Convert clang_getCompletionChunkText() to return a CXString.Ted Kremenek2010-02-171-2/+6
| | | | llvm-svn: 96439
* Change clang_getCursorKindSpelling() to return a CXStringTed Kremenek2010-02-171-112/+122
| | | | | | instead of a 'const char *'. llvm-svn: 96425
* Change clang_getFileName() to return a 'CXString' instead of 'const char *'.Ted Kremenek2010-02-171-9/+27
| | | | llvm-svn: 96424
* c-index-test: Pass appropriate client data.Daniel Dunbar2010-02-161-1/+1
| | | | llvm-svn: 96317
* CIndex: Switch CXSourceRange to proper half-open intervals.Daniel Dunbar2010-02-141-3/+2
| | | | | | - Doug, please review. llvm-svn: 96162
* c-index-test: Unify and always print half-open extents.Daniel Dunbar2010-02-141-8/+7
| | | | llvm-svn: 96160
* c-index-test: Simplify file scanning code.Daniel Dunbar2010-02-141-46/+28
| | | | llvm-svn: 96159
* c-index-test: Unify syntax for printing extents. Yes, there were 4.Daniel Dunbar2010-02-141-16/+25
| | | | llvm-svn: 96158
* Attempt to always dispose of the CXIndex object in c-index-test.Ted Kremenek2010-02-111-3/+12
| | | | llvm-svn: 95864
* c-index-test: Add "none" filter, useful for performance testing.Daniel Dunbar2010-02-101-0/+1
| | | | llvm-svn: 95800
* Clean up the CIndex interface to diagnostic ranges. Thanks, Daniel!Douglas Gregor2010-02-081-8/+7
| | | | llvm-svn: 95602
* When printing diagnostics in c-index-test, also print source rangesDouglas Gregor2010-01-291-2/+85
| | | | | | | | and fix-it information, so we can see everything in one place. Along the way, fix a few bugs with deserialization and query of diagnostics in CIndex. llvm-svn: 94768
* Switch the remaining diagnostic printing in CIndex over to theDouglas Gregor2010-01-281-10/+9
| | | | | | | | | diagnostic callback mechanism, so all diagnostics now go through that callback. Also, eliminate the displayDiagnostics flag to clang_createIndex(), since it is no longer necessary: the client determines whether to display diagnostics or not. llvm-svn: 94714
* Implement a diagnostics callback for the C interface to Clang, so thatDouglas Gregor2010-01-281-4/+48
| | | | | | | | | | | | | | | | | | | | | | | | | clients can format diagnostics as they wish rather than having to parse standard error. All of the important parts of the front end's diagnostics are exposed: text, severity, location, source ranges, and fix-its. The diagnostics callback is now available with clang_createTranslationUnitFromSource() and clang_createTranslationUnit(). As part of this change, CXSourceLocation and CXSourceRange got one pointer larger, since we need to hold on to the SourceManager and LangOptions structures in the source location. This is the minimum amount of information needed for the functions that operate on source locations and ranges (as implemented now). Previously we held on to the ASTContext, but the diagnostics callback can end up with source locations when there is no ASTContext (or preprocessor). Still to do: - Code completion needs to support the diagnostics callback, once we have the ability to (de-)serialize diagnostics. - Eliminate the "displayDiagnostics" argument to createIndex; we'll always pass diagnostics to the callback and let it deal with display. llvm-svn: 94709
* Implement 'clang_getInclusions()' in CIndex. This API allows clients to ↵Ted Kremenek2010-01-261-1/+33
| | | | | | walk the set of files included in a translation unit via the C API. llvm-svn: 94575
* Eliminate clang_getInstantiationLocationOffset(), and instead add anDouglas Gregor2010-01-261-8/+8
| | | | | | offset parameter to clang_getInstantiationLocation(). llvm-svn: 94573
* Implement clang_annotateTokens(), which associates cursors with eachDouglas Gregor2010-01-261-1/+6
| | | | | | | of the tokens within a raw token stream. This does not even attempt to handle macros yet. llvm-svn: 94561
* 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
OpenPOWER on IntegriCloud