summaryrefslogtreecommitdiffstats
path: root/clang/tools/CIndex/CIndex.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Teach ASTUnit to keep track of temporary files, then delete them whenDouglas Gregor2010-02-181-9/+16
| | | | | | the ASTUnit itself is destroyed. Fixes <rdar://problem/7649385>. llvm-svn: 96628
* Re-apply my diagnostics-capture patch for CIndex, with some tweaks toDouglas Gregor2010-02-181-6/+41
| | | | | | try to address the msvc failures. llvm-svn: 96624
* Revert "Sort visitor methods so we can easily tell what's implemented."Ted Kremenek2010-02-181-14/+14
| | | | | | This reverts commit 4383e04c75731f8695b8355783f9966ac56b0926. llvm-svn: 96622
* Revert "Tidy up order of switch statement. No functionality change."Ted Kremenek2010-02-181-20/+24
| | | | | | This reverts commit 95575005fc6409df98e6e079caf324308f62171b. llvm-svn: 96620
* Revert my CIndex diagnostic changes (r96603, 96606, 96607), which wereDouglas Gregor2010-02-181-41/+6
| | | | | | breaking the msvc9 builder for unknown reasons. llvm-svn: 96618
* Introduce debugging/testing hook clang_enableStackTraces() intoDouglas Gregor2010-02-181-0/+5
| | | | | | | 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/+36
| | | | | | | display captured diagnostics when we can't return an invalid CXTranslationUnit. llvm-svn: 96606
* Tidy up order of switch statement. No functionality change.Ted Kremenek2010-02-181-24/+20
| | | | llvm-svn: 96602
* Sort visitor methods so we can easily tell what's implemented.Ted Kremenek2010-02-181-14/+14
| | | | llvm-svn: 96600
* Change cursor behavior for attributes to have them visited as part of recursingTed Kremenek2010-02-181-7/+1
| | | | | | to the children of a Decl. llvm-svn: 96599
* Rework how CIndex handles diagnostics. Rather than using a callback,Douglas Gregor2010-02-181-20/+15
| | | | | | | | | | | | | | | | | | 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
* Add basic cursor traversal for attributes. We currently don't have sourceTed Kremenek2010-02-181-0/+16
| | | | | | ranges for Attr objects, so lookup by cursor location currently doesn't work. llvm-svn: 96571
* Start adding cursor kinds for attributes, with first exposingTed Kremenek2010-02-181-0/+6
| | | | | | IBActionAttr and IBOutletAttr respectively. llvm-svn: 96563
* Don't make the inclusion of crashtracer information depend on NDEBUG.Ted Kremenek2010-02-171-3/+1
| | | | llvm-svn: 96515
* Remove trailing spaces.Ted Kremenek2010-02-171-212/+212
| | | | llvm-svn: 96427
* Change clang_getCursorKindSpelling() to return a CXStringTed Kremenek2010-02-171-45/+79
| | | | | | instead of a 'const char *'. llvm-svn: 96425
* Change clang_getFileName() to return a 'CXString' instead of 'const char *'.Ted Kremenek2010-02-171-3/+3
| | | | llvm-svn: 96424
* Move createCXString() functions out of CIndexer and into the clang::cxstring ↵Ted Kremenek2010-02-171-55/+52
| | | | | | | | | | | | namespace. We can much more succinctly refer to these functions this way. Also change the default behavior of createCXString(StringRef&) to duplicate the string. This is almost always what we want. The other case is where we pass a constant c-string, which uses the other version of createCXString(). llvm-svn: 96423
* ASTUnit: Constant fold UseBumpAllocator to true, we don't care to support ↵Daniel Dunbar2010-02-161-4/+1
| | | | | | this as an argument. llvm-svn: 96316
* CIndex: Switch CXSourceRange to proper half-open intervals.Daniel Dunbar2010-02-141-21/+16
| | | | | | - Doug, please review. llvm-svn: 96162
* CIndex: Avoid an unnecessary getLocForEndOfToken call, the region of interestDaniel Dunbar2010-02-141-2/+1
| | | | | | | doesn't need to be a full token. - Doug, please review. llvm-svn: 96161
* CIndex: Simplify (remove provably dead code).Daniel Dunbar2010-02-141-4/+0
| | | | llvm-svn: 96157
* CIndex: Inline CompareRegionOfInterest(CXSourceRange) into sole caller.Daniel Dunbar2010-02-141-13/+3
| | | | llvm-svn: 96156
* Rename translateSourceRange(CXSourceRange) translateCXSourceRange, instead ofDaniel Dunbar2010-02-141-3/+3
| | | | | | having overloaded functions with inverse semantics. llvm-svn: 96155
* CIndex: Kill off CXSourceLocationPtr, and AtEnd arguments.Daniel Dunbar2010-02-141-9/+5
| | | | llvm-svn: 96145
* CIndex: Stop hiding magic end bit in CXSourceRange locations where clients can'tDaniel Dunbar2010-02-141-27/+45
| | | | | | | | | see it. Instead, translate the locations up-front when we create a CXSourceRange. - This is part of a move to make CXSourceRange a pure half-open range, which is a more natural API for clients to deal with. More cleanups to follow. llvm-svn: 96144
* Make the following functions thread-safe but having them return an ↵Ted Kremenek2010-02-121-2/+2
| | | | | | | | | | | | std::string that is reconstructed every time they are called: getClangRevision() getClangFullRepositoryVersion() getClangFullVersion() llvm-svn: 96033
* Eliminate the ASTContext parameter from RecordDecl::getDefinition()Douglas Gregor2010-02-111-2/+2
| | | | | | | and CXXRecordDecl::getDefinition(); it's totally unnecessary. No functionality change. llvm-svn: 95836
* CIndex: Fix a crash in clang_createTranslationUnitFromSourceFile when usingDaniel Dunbar2010-02-021-15/+17
| | | | | | | | external ASTs, and the ASTUnit fails to load. Also, move getLocationFromExpr outside extern "C" block. llvm-svn: 95065
* In C++, an initializer on a variable doesn't necessarily mean it's the ↵Sebastian Redl2010-02-011-17/+4
| | | | | | definition. With that in mind, rename getDefinition to getAnyInitializer (to distinguish it from getInit) and reimplement it in terms of isThisDeclarationADefinition. Update all code to use this new function. llvm-svn: 94999
* CIndex: Fix clang_equalLocations for change to ptr_data field.Daniel Dunbar2010-01-301-1/+3
| | | | llvm-svn: 94930
* CIndex: Fix ReportSerializedDiagnostics to honor the DiagnosticClient contractDaniel Dunbar2010-01-301-1/+2
| | | | | | | | | | that diagnostics with a source location should occur inside {Begin,End}SourceFile. Note that code completion is currently passing in an invalid LangOptions object due to its implementation, I need to sort this out with Doug. llvm-svn: 94927
* Harden the CIndex implementation a bit, so that it does not assertDouglas Gregor2010-01-291-14/+21
| | | | | | when given bad inputs. llvm-svn: 94769
* Introduce serialization and deserialization of diagnostic informationDouglas Gregor2010-01-281-1/+12
| | | | | | | | | | | | | | | | | so that CIndex can report diagnostics through the normal mechanisms even when executing Clang in a separate process. This applies both when performing code completion and when using ASTs as an intermediary for clang_createTranslationUnitFromSourceFile(). The serialized format is not perfect at the moment, because it does not encapsulate macro-instantiation information. Instead, it maps all source locations back to the instantiation location. However, it does maintain source-range and fix-it information. To get perfect fidelity from the serialized format would require serializing a large chunk of the source manager; at present, it isn't clear if this code will live long enough for that to matter. llvm-svn: 94740
* Switch the remaining diagnostic printing in CIndex over to theDouglas Gregor2010-01-281-11/+13
| | | | | | | | | 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-34/+52
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Eliminate clang_getInstantiationLocationOffset(), and instead add anDouglas Gregor2010-01-261-41/+18
| | | | | | offset parameter to clang_getInstantiationLocation(). llvm-svn: 94573
* Implement clang_annotateTokens(), which associates cursors with eachDouglas Gregor2010-01-261-3/+70
| | | | | | | of the tokens within a raw token stream. This does not even attempt to handle macros yet. llvm-svn: 94561
* Introduce a CIndex API for lexing the raw tokens within a given sourceDouglas Gregor2010-01-261-0/+192
| | | | | | range. The token-annotation function does nothing, yet. llvm-svn: 94551
* Introduce clang_getInstantiationLocationOffset(), which decomposes aDouglas Gregor2010-01-261-14/+42
| | | | | | source location in file + offset. llvm-svn: 94497
* Pull functions that translate from CXSourceLocation to SourceLocation (and ↵Ted Kremenek2010-01-251-47/+20
| | | | | | back) to a separate header file. llvm-svn: 94462
* Loosen preconditions for clang_getCursorSpelling(), returning an emptyDouglas Gregor2010-01-251-1/+4
| | | | | | | string when given a cursor that does not have a name. Also, don't give silly names for statements and non-reference expressions. llvm-svn: 94426
* Expect the impossibleDouglas Gregor2010-01-251-1/+1
| | | | llvm-svn: 94425
* Visit the condition variables of while and for loops; also, visit theDouglas Gregor2010-01-251-5/+40
| | | | | | | condition even when we've visited the condition variable, so that we'll see implicit conversions there. llvm-svn: 94423
* CIndex: Don't crash when visitor passes null child statements, and sprinkle someDaniel Dunbar2010-01-251-1/+1
| | | | | | | | | | | | | asserts in cursor construction functions to make this more obvious. Doug, please check. c-index-test would previously crash on this code: -- for(;;) {} -- Do we need a custom visit of the for statement to cover the variable declarations? llvm-svn: 94391
* Rename getClangFullVendorVersion() to getClangFullVersion().Ted Kremenek2010-01-231-1/+1
| | | | llvm-svn: 94273
* Teach the cursor visitor to recurse into the type information ofDouglas Gregor2010-01-231-0/+32
| | | | | | explicit casts, sizeof, alignof, and compound literals. llvm-svn: 94265
* Extend clang_createTranslationUnitFromSourceFile() to support creatingDouglas Gregor2010-01-231-5/+36
| | | | | | translation units that include unsaved files. llvm-svn: 94258
* Add 'clang_getClangVersion()' function to CIndex. This exposes the full ↵Ted Kremenek2010-01-221-0/+15
| | | | | | Clang version string through the CIndex API. llvm-svn: 94242
* Yet more CIndex API cleanup:Douglas Gregor2010-01-221-12/+59
| | | | | | | | - 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
OpenPOWER on IntegriCloud