clang 20.0.0git
|
These routines provide the ability to determine references within and across translation units, by providing the names of the entities referenced by cursors, follow reference cursors to the declarations they reference, and associate declarations with their definitions. More...
Typedefs | |
typedef void * | CXPrintingPolicy |
Opaque pointer representing a policy that controls pretty printing for clang_getCursorPrettyPrinted . | |
Functions | |
CINDEX_LINKAGE CXString | clang_getCursorUSR (CXCursor) |
Retrieve a Unified Symbol Resolution (USR) for the entity referenced by the given cursor. | |
CINDEX_LINKAGE CXString | clang_constructUSR_ObjCClass (const char *class_name) |
Construct a USR for a specified Objective-C class. | |
CINDEX_LINKAGE CXString | clang_constructUSR_ObjCCategory (const char *class_name, const char *category_name) |
Construct a USR for a specified Objective-C category. | |
CINDEX_LINKAGE CXString | clang_constructUSR_ObjCProtocol (const char *protocol_name) |
Construct a USR for a specified Objective-C protocol. | |
CINDEX_LINKAGE CXString | clang_constructUSR_ObjCIvar (const char *name, CXString classUSR) |
Construct a USR for a specified Objective-C instance variable and the USR for its containing class. | |
CINDEX_LINKAGE CXString | clang_constructUSR_ObjCMethod (const char *name, unsigned isInstanceMethod, CXString classUSR) |
Construct a USR for a specified Objective-C method and the USR for its containing class. | |
CINDEX_LINKAGE CXString | clang_constructUSR_ObjCProperty (const char *property, CXString classUSR) |
Construct a USR for a specified Objective-C property and the USR for its containing class. | |
CINDEX_LINKAGE CXString | clang_getCursorSpelling (CXCursor) |
Retrieve a name for the entity referenced by this cursor. | |
CINDEX_LINKAGE CXSourceRange | clang_Cursor_getSpellingNameRange (CXCursor, unsigned pieceIndex, unsigned options) |
Retrieve a range for a piece that forms the cursors spelling name. | |
CINDEX_LINKAGE unsigned | clang_PrintingPolicy_getProperty (CXPrintingPolicy Policy, enum CXPrintingPolicyProperty Property) |
Get a property value for the given printing policy. | |
CINDEX_LINKAGE void | clang_PrintingPolicy_setProperty (CXPrintingPolicy Policy, enum CXPrintingPolicyProperty Property, unsigned Value) |
Set a property value for the given printing policy. | |
CINDEX_LINKAGE CXPrintingPolicy | clang_getCursorPrintingPolicy (CXCursor) |
Retrieve the default policy for the cursor. | |
CINDEX_LINKAGE void | clang_PrintingPolicy_dispose (CXPrintingPolicy Policy) |
Release a printing policy. | |
CINDEX_LINKAGE CXString | clang_getCursorPrettyPrinted (CXCursor Cursor, CXPrintingPolicy Policy) |
Pretty print declarations. | |
CINDEX_LINKAGE CXString | clang_getCursorDisplayName (CXCursor) |
Retrieve the display name for the entity referenced by this cursor. | |
CINDEX_LINKAGE CXCursor | clang_getCursorReferenced (CXCursor) |
For a cursor that is a reference, retrieve a cursor representing the entity that it references. | |
CINDEX_LINKAGE CXCursor | clang_getCursorDefinition (CXCursor) |
For a cursor that is either a reference to or a declaration of some entity, retrieve a cursor that describes the definition of that entity. | |
CINDEX_LINKAGE unsigned | clang_isCursorDefinition (CXCursor) |
Determine whether the declaration pointed to by this cursor is also a definition of that entity. | |
CINDEX_LINKAGE CXCursor | clang_getCanonicalCursor (CXCursor) |
Retrieve the canonical cursor corresponding to the given cursor. | |
CINDEX_LINKAGE int | clang_Cursor_getObjCSelectorIndex (CXCursor) |
If the cursor points to a selector identifier in an Objective-C method or message expression, this returns the selector index. | |
CINDEX_LINKAGE int | clang_Cursor_isDynamicCall (CXCursor C) |
Given a cursor pointing to a C++ method call or an Objective-C message, returns non-zero if the method/message is "dynamic", meaning: | |
CINDEX_LINKAGE CXType | clang_Cursor_getReceiverType (CXCursor C) |
Given a cursor pointing to an Objective-C message or property reference, or C++ method call, returns the CXType of the receiver. | |
CINDEX_LINKAGE unsigned | clang_Cursor_getObjCPropertyAttributes (CXCursor C, unsigned reserved) |
Given a cursor that represents a property declaration, return the associated property attributes. | |
CINDEX_LINKAGE CXString | clang_Cursor_getObjCPropertyGetterName (CXCursor C) |
Given a cursor that represents a property declaration, return the name of the method that implements the getter. | |
CINDEX_LINKAGE CXString | clang_Cursor_getObjCPropertySetterName (CXCursor C) |
Given a cursor that represents a property declaration, return the name of the method that implements the setter, if any. | |
CINDEX_LINKAGE unsigned | clang_Cursor_getObjCDeclQualifiers (CXCursor C) |
Given a cursor that represents an Objective-C method or parameter declaration, return the associated Objective-C qualifiers for the return type or the parameter respectively. | |
CINDEX_LINKAGE unsigned | clang_Cursor_isObjCOptional (CXCursor C) |
Given a cursor that represents an Objective-C method or property declaration, return non-zero if the declaration was affected by "\@optional". | |
CINDEX_LINKAGE unsigned | clang_Cursor_isVariadic (CXCursor C) |
Returns non-zero if the given cursor is a variadic function or method. | |
CINDEX_LINKAGE unsigned | clang_Cursor_isExternalSymbol (CXCursor C, CXString *language, CXString *definedIn, unsigned *isGenerated) |
Returns non-zero if the given cursor points to a symbol marked with external_source_symbol attribute. | |
CINDEX_LINKAGE CXSourceRange | clang_Cursor_getCommentRange (CXCursor C) |
Given a cursor that represents a declaration, return the associated comment's source range. | |
CINDEX_LINKAGE CXString | clang_Cursor_getRawCommentText (CXCursor C) |
Given a cursor that represents a declaration, return the associated comment text, including comment markers. | |
CINDEX_LINKAGE CXString | clang_Cursor_getBriefCommentText (CXCursor C) |
Given a cursor that represents a documentable entity (e.g., declaration), return the associated. | |
These routines provide the ability to determine references within and across translation units, by providing the names of the entities referenced by cursors, follow reference cursors to the declarations they reference, and associate declarations with their definitions.
typedef void* CXPrintingPolicy |
Property attributes for a CXCursor_ObjCPropertyDecl
.
Properties for the printing policy.
See clang::PrintingPolicy
for more information.
CINDEX_LINKAGE CXString clang_constructUSR_ObjCCategory | ( | const char * | class_name, |
const char * | category_name | ||
) |
Construct a USR for a specified Objective-C category.
CINDEX_LINKAGE CXString clang_constructUSR_ObjCClass | ( | const char * | class_name | ) |
Construct a USR for a specified Objective-C class.
CINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar | ( | const char * | name, |
CXString | classUSR | ||
) |
Construct a USR for a specified Objective-C instance variable and the USR for its containing class.
CINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod | ( | const char * | name, |
unsigned | isInstanceMethod, | ||
CXString | classUSR | ||
) |
Construct a USR for a specified Objective-C method and the USR for its containing class.
CINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty | ( | const char * | property, |
CXString | classUSR | ||
) |
Construct a USR for a specified Objective-C property and the USR for its containing class.
CINDEX_LINKAGE CXString clang_constructUSR_ObjCProtocol | ( | const char * | protocol_name | ) |
Construct a USR for a specified Objective-C protocol.
CINDEX_LINKAGE CXString clang_Cursor_getBriefCommentText | ( | CXCursor | C | ) |
Given a cursor that represents a documentable entity (e.g., declaration), return the associated.
CINDEX_LINKAGE CXSourceRange clang_Cursor_getCommentRange | ( | CXCursor | C | ) |
Given a cursor that represents a declaration, return the associated comment's source range.
The range may include multiple consecutive comments with whitespace in between.
CINDEX_LINKAGE unsigned clang_Cursor_getObjCDeclQualifiers | ( | CXCursor | C | ) |
Given a cursor that represents an Objective-C method or parameter declaration, return the associated Objective-C qualifiers for the return type or the parameter respectively.
The bits are formed from CXObjCDeclQualifierKind.
CINDEX_LINKAGE unsigned clang_Cursor_getObjCPropertyAttributes | ( | CXCursor | C, |
unsigned | reserved | ||
) |
Given a cursor that represents a property declaration, return the associated property attributes.
The bits are formed from CXObjCPropertyAttrKind
.
reserved | Reserved for future use, pass 0. |
CINDEX_LINKAGE CXString clang_Cursor_getObjCPropertyGetterName | ( | CXCursor | C | ) |
Given a cursor that represents a property declaration, return the name of the method that implements the getter.
CINDEX_LINKAGE CXString clang_Cursor_getObjCPropertySetterName | ( | CXCursor | C | ) |
Given a cursor that represents a property declaration, return the name of the method that implements the setter, if any.
CINDEX_LINKAGE int clang_Cursor_getObjCSelectorIndex | ( | CXCursor | ) |
If the cursor points to a selector identifier in an Objective-C method or message expression, this returns the selector index.
After getting a cursor with clang_getCursor, this can be called to determine if the location points to a selector identifier.
CINDEX_LINKAGE CXString clang_Cursor_getRawCommentText | ( | CXCursor | C | ) |
Given a cursor that represents a declaration, return the associated comment text, including comment markers.
CINDEX_LINKAGE CXType clang_Cursor_getReceiverType | ( | CXCursor | C | ) |
Given a cursor pointing to an Objective-C message or property reference, or C++ method call, returns the CXType of the receiver.
CINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange | ( | CXCursor | , |
unsigned | pieceIndex, | ||
unsigned | options | ||
) |
Retrieve a range for a piece that forms the cursors spelling name.
Most of the times there is only one range for the complete spelling but for Objective-C methods and Objective-C message expressions, there are multiple pieces for each selector identifier.
pieceIndex | the index of the spelling name piece. If this is greater than the actual number of pieces, it will return a NULL (invalid) range. |
options | Reserved. |
CINDEX_LINKAGE int clang_Cursor_isDynamicCall | ( | CXCursor | C | ) |
Given a cursor pointing to a C++ method call or an Objective-C message, returns non-zero if the method/message is "dynamic", meaning:
For a C++ method: the call is virtual. For an Objective-C message: the receiver is an object instance, not 'super' or a specific class.
If the method/message is "static" or the cursor does not point to a method/message, it will return zero.
CINDEX_LINKAGE unsigned clang_Cursor_isExternalSymbol | ( | CXCursor | C, |
CXString * | language, | ||
CXString * | definedIn, | ||
unsigned * | isGenerated | ||
) |
Returns non-zero if the given cursor points to a symbol marked with external_source_symbol attribute.
language | If non-NULL, and the attribute is present, will be set to the 'language' string from the attribute. |
definedIn | If non-NULL, and the attribute is present, will be set to the 'definedIn' string from the attribute. |
isGenerated | If non-NULL, and the attribute is present, will be set to non-zero if the 'generated_declaration' is set in the attribute. |
CINDEX_LINKAGE unsigned clang_Cursor_isObjCOptional | ( | CXCursor | C | ) |
Given a cursor that represents an Objective-C method or property declaration, return non-zero if the declaration was affected by "\@optional".
Returns zero if the cursor is not such a declaration or it is "\@required".
CINDEX_LINKAGE unsigned clang_Cursor_isVariadic | ( | CXCursor | C | ) |
Returns non-zero if the given cursor is a variadic function or method.
CINDEX_LINKAGE CXCursor clang_getCanonicalCursor | ( | CXCursor | ) |
Retrieve the canonical cursor corresponding to the given cursor.
In the C family of languages, many kinds of entities can be declared several times within a single translation unit. For example, a structure type can be forward-declared (possibly multiple times) and later defined:
The declarations and the definition of X
are represented by three different cursors, all of which are declarations of the same underlying entity. One of these cursor is considered the "canonical" cursor, which is effectively the representative for the underlying entity. One can determine if two cursors are declarations of the same underlying entity by comparing their canonical cursors.
CINDEX_LINKAGE CXCursor clang_getCursorDefinition | ( | CXCursor | ) |
For a cursor that is either a reference to or a declaration of some entity, retrieve a cursor that describes the definition of that entity.
Some entities can be declared multiple times within a translation unit, but only one of those declarations can also be a definition. For example, given:
there are three declarations of the function "f", but only the second one is a definition. The clang_getCursorDefinition() function will take any cursor pointing to a declaration of "f" (the first or fourth lines of the example) or a cursor referenced that uses "f" (the call to "f' inside "g") and will return a declaration cursor pointing to the definition (the second "f" declaration).
If given a cursor for which there is no corresponding definition, e.g., because there is no definition of that entity within this translation unit, returns a NULL cursor.
CINDEX_LINKAGE CXString clang_getCursorDisplayName | ( | CXCursor | ) |
Retrieve the display name for the entity referenced by this cursor.
The display name contains extra information that helps identify the cursor, such as the parameters of a function or template or the arguments of a class template specialization.
CINDEX_LINKAGE CXString clang_getCursorPrettyPrinted | ( | CXCursor | Cursor, |
CXPrintingPolicy | Policy | ||
) |
Pretty print declarations.
Cursor | The cursor representing a declaration. |
Policy | The policy to control the entities being printed. If NULL, a default policy is used. |
CINDEX_LINKAGE CXPrintingPolicy clang_getCursorPrintingPolicy | ( | CXCursor | ) |
Retrieve the default policy for the cursor.
The policy should be released after use with clang_PrintingPolicy_dispose
.
CINDEX_LINKAGE CXCursor clang_getCursorReferenced | ( | CXCursor | ) |
For a cursor that is a reference, retrieve a cursor representing the entity that it references.
Reference cursors refer to other entities in the AST. For example, an Objective-C superclass reference cursor refers to an Objective-C class. This function produces the cursor for the Objective-C class from the cursor for the superclass reference. If the input cursor is a declaration or definition, it returns that declaration or definition unchanged. Otherwise, returns the NULL cursor.
CINDEX_LINKAGE CXString clang_getCursorSpelling | ( | CXCursor | ) |
Retrieve a name for the entity referenced by this cursor.
CINDEX_LINKAGE CXString clang_getCursorUSR | ( | CXCursor | ) |
Retrieve a Unified Symbol Resolution (USR) for the entity referenced by the given cursor.
A Unified Symbol Resolution (USR) is a string that identifies a particular entity (function, class, variable, etc.) within a program. USRs can be compared across translation units to determine, e.g., when references in one translation refer to an entity defined in another translation unit.
CINDEX_LINKAGE unsigned clang_isCursorDefinition | ( | CXCursor | ) |
Determine whether the declaration pointed to by this cursor is also a definition of that entity.
CINDEX_LINKAGE void clang_PrintingPolicy_dispose | ( | CXPrintingPolicy | Policy | ) |
Release a printing policy.
CINDEX_LINKAGE unsigned clang_PrintingPolicy_getProperty | ( | CXPrintingPolicy | Policy, |
enum CXPrintingPolicyProperty | Property | ||
) |
Get a property value for the given printing policy.
CINDEX_LINKAGE void clang_PrintingPolicy_setProperty | ( | CXPrintingPolicy | Policy, |
enum CXPrintingPolicyProperty | Property, | ||
unsigned | Value | ||
) |
Set a property value for the given printing policy.