summaryrefslogtreecommitdiffstats
path: root/clang/tools/CIndex/CIndex.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Enhance 'clang_createTranslationUnitFromSourceFile()' in two ways:Ted Kremenek2009-10-221-11/+32
| | | | | | | | | (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
* Extend clang_getCursor() to take a 'relativeDecl' argument (so speed up ↵Steve Naroff2009-10-211-2/+4
| | | | | | | | | | | | | | 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-20/+39
| | | | | | | | | | | | 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
* Fix inverted preprocessor guard, and fix the resulting compiler error that ↵Ted Kremenek2009-10-191-5/+5
| | | | | | was unmasked. llvm-svn: 84555
* Really fix <rdar://problem/7312058> by adding a 'displayDiagnostics' option toTed Kremenek2009-10-191-6/+17
| | | | | | | | | | | 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
* The constructor for ASTUnit now takes a DiagnosticClient*, allowing uses of ↵Ted Kremenek2009-10-191-1/+11
| | | | | | | | | | | | | | ASTUnit to specify alternate DiagnosticClients. To match this API, ASTUnit::LoadFromPCHFile() now takes a corresponding DiagnosticClient* argument as well. The DiagnosticClient object is destroyed when the ASTUnit object is destroyed. The CIndex library now uses this API to create a 'IgnoreDiagnosticsClient' that simply silences diagnostics when using the clang_createTranslationUnitFromSourceFile() function. This fixes <rdar://problem/7312058>. This API can change in the future as we add more flexibility for clients. llvm-svn: 84539
* Re-order includes so that the logic involving '#ifdef LLVM_ON_WIN32' appears ↵Ted Kremenek2009-10-191-1/+2
| | | | | | after the main #includes. The ultimate solution is to just use LLVM-portable methods in llvm/System. llvm-svn: 84534
* Move Diagnostic/DiagClient/FileManager from Indexer => ASTUnit.Steve Naroff2009-10-191-2/+1
| | | | | | Removing this shared data should enable clang_createTranslationUnit/clang_createTranslationUnitFromSourceFile to be run from multiple threads (related to <rdar://problem/7303432>). llvm-svn: 84499
* Change indenting for case/compound statements to conform to the rest of clang.Steve Naroff2009-10-191-39/+26
| | | | llvm-svn: 84498
* CIndex: make variable non-static to avoid potential race conditions, perBenjamin Kramer2009-10-191-4/+2
| | | | | | Daniel's comment. llvm-svn: 84484
* Move clients to use IdentifierInfo::getNameStart() instead of getName()Daniel Dunbar2009-10-181-6/+6
| | | | llvm-svn: 84436
* CIndex: fix typo.Benjamin Kramer2009-10-181-1/+1
| | | | llvm-svn: 84422
* Missed a paren.Benjamin Kramer2009-10-181-1/+1
| | | | llvm-svn: 84421
* CIndex: add a (untested) WIN32 codepath to get ClangPath.Benjamin Kramer2009-10-181-10/+14
| | | | llvm-svn: 84420
* CIndex: compute ClangPath lazily.Benjamin Kramer2009-10-181-17/+31
| | | | llvm-svn: 84419
* CIndex: replace fork/exec with our portable ExecuteAndWait wrapper.Benjamin Kramer2009-10-181-17/+3
| | | | llvm-svn: 84414
* CIndex: avoid a dangling pointer issue.Benjamin Kramer2009-10-181-8/+7
| | | | llvm-svn: 84413
* Attempt to unbreak the MSVC build.Daniel Dunbar2009-10-171-0/+12
| | | | llvm-svn: 84381
* Resolve FIXME: delete the 'Program' object in the destructor of CIndexer.Ted Kremenek2009-10-171-4/+4
| | | | llvm-svn: 84313
* Add 'UseBumpPtrAllocator' flag to ASTUnit::LoadFromPCHFile() to cause the ↵Ted Kremenek2009-10-171-1/+2
| | | | | | | | | | | created ASTContext to use its own BumpPtrAllocator to allocate ASTs. Change clang_createTranslationUnit (CIndex) to pass 'UseBumpPtrAllocator = true' to ASTUnit::LoadFromPCHFile(). llvm-svn: 84296
* Make CIndex and c-index-test a little bit more robust. The onlyDouglas Gregor2009-10-161-2/+14
| | | | | | | | substantive change is that clang_getCursorSource() now returns the file in which a macro was instantiated when the cursor points into a macro instantiation, rather than crashing. llvm-svn: 84275
* Keep track of whether declararions were loaded from a precompiledDouglas Gregor2009-10-161-10/+52
| | | | | | | | | | 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
* Use an std::vector<> instead of an array of ARG_MAX size, as ARG_MAX may not ↵Ted Kremenek2009-10-151-12/+12
| | | | | | be defined everywhere. llvm-svn: 84220
* Make sure temporary files get unlinked.Steve Naroff2009-10-151-1/+4
| | | | llvm-svn: 84208
* Add missing #include for wait().Ted Kremenek2009-10-151-0/+1
| | | | llvm-svn: 84207
* Minor improvement to format...no functionality change.Steve Naroff2009-10-151-14/+13
| | | | llvm-svn: 84203
* Implement <rdar://problem/7303432> [Clang/Index] In-memory-style AST ↵Steve Naroff2009-10-151-0/+62
| | | | | | | | | generation API (initial API implementation). Added clang_createTranslationUnitFromSourceFile(). Changed clang_createIndex() to lookup the location of clang (using dladdr). llvm-svn: 84198
* - Fix assert in clang_getCursorDecl (having to do with recently added ↵Steve Naroff2009-10-051-1/+2
| | | | | | | | ObjC_ProtocolRef). - Make sure CHECK: lines in test case match the expected output. llvm-svn: 83316
* Add support for class and protocol references.Steve Naroff2009-10-011-5/+33
| | | | llvm-svn: 83186
* When pointing at a type decl reference, ASTLocation is a NamedDeclRef.Argyrios Kyrtzidis2009-09-291-0/+2
| | | | llvm-svn: 83099
* Modify ASTLocation and apart from being a Decl or Stmt, allow it to also be:Argyrios Kyrtzidis2009-09-291-2/+2
| | | | | | | -A NamedDecl reference -A TypeLoc llvm-svn: 83095
* Fix cut/paste error resulting in bad column info.Steve Naroff2009-09-251-1/+1
| | | | llvm-svn: 82810
* Add clang_getDeclSource().Steve Naroff2009-09-251-0/+8
| | | | llvm-svn: 82807
* Add clang_getDeclLine and clang_getDeclColumnSteve Naroff2009-09-251-1/+44
| | | | | | | 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
* More work to enable more exhaustive testing of the indexing API.Steve Naroff2009-09-231-10/+57
| | | | | | Next step: Add actual some test cases:-) llvm-svn: 82636
* - Implement support for various types of "refs" (initially to help test ↵Steve Naroff2009-09-221-6/+90
| | | | | | | | clang_getCursor()). - Add missing prototypes for dispose functions. llvm-svn: 82564
* Change ASTUnit to take the Diagnostic as an argument, the client should have ↵Daniel Dunbar2009-09-211-1/+2
| | | | | | control of this. llvm-svn: 82430
* Add Diagnostic to Indexer, and have it keep its own FileManager instead of ↵Daniel Dunbar2009-09-211-1/+2
| | | | | | taking an external reference (which was leaked in the case of the CIndex library). llvm-svn: 82429
* Add clang_disposeTranslationUnit() and clang_disposeIndex().Steve Naroff2009-09-171-0/+13
| | | | llvm-svn: 82154
* - clang_getCursor(): Replace asserts with error codes (CXCursor_InvalidFile, ↵Steve Naroff2009-09-151-10/+27
| | | | | | | | | CXCursor_NoDeclFound). - Add predicate clang_isInvalid(). - Implement clang_getCursorFromDecl(). llvm-svn: 81908
* Implement accessors clang_getCursorKind(), clang_getCursorDecl().Steve Naroff2009-09-041-17/+94
| | | | | | | Implement clang_getCursor() - wired up to Argiris's work. Implement callbacks for CXCursor_ObjCProtocolRef. llvm-svn: 81004
* Add ASTUnit::getOriginalSourceFileName() and use in ↵Steve Naroff2009-09-031-3/+2
| | | | | | clang_getTranslationUnitSpelling(). llvm-svn: 80932
* - Add back some harmless code that part of a reverted commit (r80859). I'll ↵Steve Naroff2009-09-031-2/+40
| | | | | | | | 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
* Revert "Visit function/method bodies and issue callback for parameters and localDaniel Dunbar2009-09-031-24/+1
| | | | | | variables.", this is breaking x86_64-apple-darwin10 and Linux tests. llvm-svn: 80896
* Visit function/method bodies and issue callback for parameters and local ↵Steve Naroff2009-09-031-1/+24
| | | | | | | | variables. Add clang_getTranslationUnitSpelling(). llvm-svn: 80859
* Fix some newly added bugs uncovered by the RELEASE build.Steve Naroff2009-09-021-8/+9
| | | | llvm-svn: 80813
* Start issuing callback for references (add some predicates, refactor some code).Steve Naroff2009-09-021-13/+65
| | | | llvm-svn: 80810
* Flesh out CXCursorKind...Steve Naroff2009-09-021-11/+88
| | | | | | | | | - 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
* Add explicit "blind" client data to callback function (since we aren't using ↵Steve Naroff2009-09-011-17/+19
| | | | | | blocks). llvm-svn: 80673
* Implement source/line/column hooks.Steve Naroff2009-08-311-11/+34
| | | | llvm-svn: 80585
OpenPOWER on IntegriCloud