summaryrefslogtreecommitdiffstats
path: root/clang/tools/CIndex/CIndex.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Eliminate CIndex's dependency on the Clang Index library, since weDouglas Gregor2010-01-221-1/+1
| | | | | | weren't actually using any of its facilities. llvm-svn: 94210
* Teach CIndex's cursor visitor to restrict its traversal to a specificDouglas Gregor2010-01-221-35/+146
| | | | | | | | | | | | | | region of interest (if provided). Implement clang_getCursor() in terms of this traversal rather than using the Index library; the unified cursor visitor is more complete, and will be The Way Forward. Minor other tweaks needed to make this work: - Extend Preprocessor::getLocForEndOfToken() to accept an offset from the end, making it easy to move to the last character in the token (rather than just past the end of the token). - In Lexer::MeasureTokenLength(), the length of whitespace is zero. llvm-svn: 94200
* Visit if, switch statements properlyDouglas Gregor2010-01-221-0/+32
| | | | llvm-svn: 94126
* Teach the cursor visitor to walk all of the C and Objective-CDouglas Gregor2010-01-221-28/+118
| | | | | | | | declarations that have enough source information to make such a walk useful. This includes walking into variable initializers and enum constants, the types behind typedefs, etc. llvm-svn: 94124
* Teach the cursor visitor to walk statements and expressions, includingDouglas Gregor2010-01-211-23/+62
| | | | | | a few important subkinds. Now we're cookin' with gas! llvm-svn: 94116
* Teach the cursor visitor to walk into typeof types (both kinds). ThisDouglas Gregor2010-01-211-0/+16
| | | | | | | is hard to test now; tests will come when we can walk stataements and expressions properly. llvm-svn: 94099
* Teach the cursor visitor to walk into a variety of different TypeLocDouglas Gregor2010-01-211-7/+170
| | | | | | kinds, so that we see referenced types, protocols, classes, etc. llvm-svn: 94085
* Introduce type references into the C API, capturing references toDouglas Gregor2010-01-211-2/+45
| | | | | | typedefs only (for now). llvm-svn: 94078
* Stash a CXXUnit pointer into each cursor. This allows us to simplifyDouglas Gregor2010-01-201-41/+57
| | | | | | | the interface to clang_visitChildren() by eliminating the CXTranslationUnit pointer. llvm-svn: 94051
* Eliminate the MakeCXCursor routines that require their callers to know too ↵Douglas Gregor2010-01-201-2/+2
| | | | | | much about the cursor's storage llvm-svn: 94049
* Kill some CXDecl-related APIs that have been superceded byDouglas Gregor2010-01-201-54/+23
| | | | | | CXCursor-based APIs. llvm-svn: 94037
* Kill clang_loadDeclaration() and clang_loadTranslationUnit().Douglas Gregor2010-01-201-61/+0
| | | | llvm-svn: 94034
* Switch the internals of clang_loadTranslationUnit() over to the newDouglas Gregor2010-01-201-69/+33
| | | | | | | cursor-based traversal, and eliminate TUVisitor. We're now down to one visitor for traversing the AST. Yay! llvm-svn: 94025
* Introduce a new, cursor-based traversal function that visits theDouglas Gregor2010-01-201-100/+186
| | | | | | | | | | | | children of a given cursor, regardless of what kind of cursor it is. This is a generalization of clang_loadDeclaration and clang_loadTranslationUnit that will also extent to statements, expressions, etc. As proof-of-concept, switched clang_loadDeclaration() from its own visitor over to an instance of this traversal function internally. llvm-svn: 94022
* Remove some #if 0'd code that's never going to get used.Douglas Gregor2010-01-201-61/+0
| | | | llvm-svn: 93957
* Kill off clang_getDeclColumn, clang_getDeclExtent, clang_getDeclLine,Douglas Gregor2010-01-201-42/+0
| | | | | | | clang_getDeclSource, and clang_getDeclSourceFile; the cursor equivalents are the way of the future. llvm-svn: 93955
* Introduce a special cursor kind for the translation unit, to serve asDouglas Gregor2010-01-201-0/+13
| | | | | | | | | the root of the conceptual cursor hierarchy (just like we do with declarations). This will be used when we get to unify clang_loadTranslationUnit() and clang_loadDeclaration() into something more generally useful. llvm-svn: 93954
* Kill CXCursor_ObjCSelectorRef, CXCursor_VarRef, CXCursor_FunctionRef,Douglas Gregor2010-01-191-42/+0
| | | | | | | and CXCursor_EnumConstantRef; they've been subsumed by expression references, which do a much nicer job. llvm-svn: 93947
* Extend the CIndex API with direct support for expressions andDouglas Gregor2010-01-191-39/+61
| | | | | | | | | | statements, moving some of the more unnatural kinds of references (VarRef, EnumConstantRef, etc.) over to the expressions. We can now poke at arbitrary expressions and statements with, e.g., clang_getCursor() and get back useful information (e.g., source ranges). llvm-svn: 93946
* Kill the unused and unnecessary CXCursor_MemberRef, twin to theDouglas Gregor2010-01-191-6/+2
| | | | | | now-dead CXCursor_ObjCIvarRef. llvm-svn: 93928
* Kill CXCursor_ObjCIvarRef. Such cursors could never be created, andDouglas Gregor2010-01-191-4/+0
| | | | | | have been marked for death for a while. llvm-svn: 93927
* Introduce the notion of an "unexposed" declaration into the CIndexDouglas Gregor2010-01-191-2/+6
| | | | | | | | API. This is a catch-all for any declaration known to Clang but not specifically part of the CIndex API. We'll use the same approach with expressions, statements, references, etc., as needed. llvm-svn: 93924
* Rework the CXSourceLocation and CXSourceRange APIs. They are nowDouglas Gregor2010-01-191-20/+105
| | | | | | | | | | 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-17/+240
| | | | | | | | | | | | 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-0/+39
| | | | | | entity that a particular cursor references. llvm-svn: 93830
* Implement clang_getCursorExtent, which provides a source range for theDouglas Gregor2010-01-191-51/+96
| | | | | | | | | | | | | 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
* Teach clang_getCursorLocation() to return the locations of referencesDouglas Gregor2010-01-181-63/+58
| | | | | | rather than the locations that refer to. llvm-svn: 93812
* Now that a reasonable deprecation cycle has passed, killDouglas Gregor2010-01-181-16/+0
| | | | | | | clang_getCursorLine(), clang_getCursorColumn(), clang_getCursorSource(), and clang_getCursorSourceFile() outright. llvm-svn: 93801
* Introduce clang_getCursorLocation(), which supercedesDouglas Gregor2010-01-181-43/+48
| | | | | | | | 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-4/+5
| | | | | | | | | | | 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
* Fix -Asserts warning.Daniel Dunbar2010-01-181-2/+1
| | | | llvm-svn: 93731
* Give ObjCClassRef cursors a sane representation, which is encapsulatedDouglas Gregor2010-01-161-28/+13
| | | | | | | | | in CXCursor.cpp. With this sane representation, fix the class reference that is part of Objective-C category declarations so that the cursor's location matches up with the reference, not the class being referred to. llvm-svn: 93640
* Use a sane encoding for CXCursor_ObjCProtocolRef, using the actualDouglas Gregor2010-01-161-19/+17
| | | | | | | source locations where the protocols were referenced rather than the location of some random enclosing declaration. llvm-svn: 93637
* Give CXCursor_ObjCSuperClassRef a sane encoding, which is only knownDouglas Gregor2010-01-161-10/+10
| | | | | | to CXCursor.cpp. llvm-svn: 93634
* Remove 'default' case in switch statement in clang_getCursorKindSpelling(). ↵Ted Kremenek2010-01-161-5/+7
| | | | | | This identified a missing case (warned by the compiler) and identified that CXCursor_FirstDecl didn't actually correspond to the first decl. llvm-svn: 93622
* Remove TranslateKind and centralize Decl -> CXCursorKind in GetCursorKind(). ↵Ted Kremenek2010-01-161-30/+6
| | | | | | This revealed a bunch of inconsistencies in how CXCursorKinds were being computed. llvm-svn: 93618
* Migrate Decl* -> cursorkind logic into CXCursor.cpp, and drastically tighten ↵Ted Kremenek2010-01-161-69/+20
| | | | | | TUVisitor. llvm-svn: 93599
* Remove unused code.Ted Kremenek2010-01-151-36/+0
| | | | llvm-svn: 93586
* Make CXCursor's data opaque.Douglas Gregor2010-01-151-36/+29
| | | | llvm-svn: 93561
* Add CXCursor.[h,cpp]. These files will centralize the logic for ↵Ted Kremenek2010-01-151-12/+2
| | | | | | creating/probing CXCursors. llvm-svn: 93547
* getLocationFromCursor: If a cursor is a reference and has a referringDecl, ↵Ted Kremenek2010-01-151-0/+4
| | | | | | using the referringDecl for the location. llvm-svn: 93520
* Switch return site to use clang_getNullCursor().Ted Kremenek2010-01-141-5/+5
| | | | llvm-svn: 93405
* Reorganize CIndex.cpp into clearer sections of functions, and add a utility ↵Ted Kremenek2010-01-131-98/+117
| | | | | | function 'MakeCXCursor' to centralize the logic for creating CXCursor objects. llvm-svn: 93359
* Add 'referringDecl' field to CXCursor to prepare the way to better model ↵Ted Kremenek2010-01-131-10/+10
| | | | | | declaration references from other delcarations. llvm-svn: 93343
* Add extra null check in clang_disposeString().Ted Kremenek2010-01-131-1/+1
| | | | llvm-svn: 93328
* Move definitions for visitor methods in CDeclVisitor out-of-line.Ted Kremenek2010-01-131-73/+103
| | | | llvm-svn: 93276
* Make method definitions in TUVisitor out-of-line, making it easy to tell ↵Ted Kremenek2010-01-131-44/+67
| | | | | | | | what visitor methods are defined. Generalize TUVisitor to take a general "root" and "iterator" callback; this is prep. work to merging TUVisitor and CDeclVisitor. llvm-svn: 93275
* Remove duplicate class name, MSVC doesn't like this.Daniel Dunbar2010-01-121-1/+1
| | | | llvm-svn: 93225
* Make createCXString() a static member function of class CIndex.Ted Kremenek2010-01-121-16/+21
| | | | llvm-svn: 93212
* CIndex:Ted Kremenek2010-01-111-4/+0
| | | | | | | | | - Remove unused (and unimplemented) clang_getDeclarationName(). - Remove unused (and unimplemented) clang_getEntity(). - Add clang_getEntityFromDecl(): maps from a CXDecl to a CXEntity) - Add clang_getDeclaration(): maps from a (CXEntity, CXTranslationUnit) to a CXDecl). llvm-svn: 93209
OpenPOWER on IntegriCloud