clang 20.0.0git
Typedefs | Enumerations | Functions
Miscellaneous utility functions
Collaboration diagram for Miscellaneous utility functions:

Typedefs

typedef void(* CXInclusionVisitor) (CXFile included_file, CXSourceLocation *inclusion_stack, unsigned include_len, CXClientData client_data)
 Visitor invoked for each file in a translation unit (used with clang_getInclusions()).
 
typedef void * CXEvalResult
 Evaluation result of a cursor.
 

Enumerations

enum  CXEvalResultKind {
  CXEval_Int = 1 , CXEval_Float = 2 , CXEval_ObjCStrLiteral = 3 , CXEval_StrLiteral = 4 ,
  CXEval_CFStr = 5 , CXEval_Other = 6 , CXEval_UnExposed = 0
}
 

Functions

CINDEX_LINKAGE CXString clang_getClangVersion (void)
 Return a version string, suitable for showing to a user, but not intended to be parsed (the format is not guaranteed to be stable).
 
CINDEX_LINKAGE void clang_toggleCrashRecovery (unsigned isEnabled)
 Enable/disable crash recovery.
 
CINDEX_LINKAGE void clang_getInclusions (CXTranslationUnit tu, CXInclusionVisitor visitor, CXClientData client_data)
 Visit the set of preprocessor inclusions in a translation unit.
 
CINDEX_LINKAGE CXEvalResult clang_Cursor_Evaluate (CXCursor C)
 If cursor is a statement declaration tries to evaluate the statement and if its variable, tries to evaluate its initializer, into its corresponding type.
 
CINDEX_LINKAGE CXEvalResultKind clang_EvalResult_getKind (CXEvalResult E)
 Returns the kind of the evaluated result.
 
CINDEX_LINKAGE int clang_EvalResult_getAsInt (CXEvalResult E)
 Returns the evaluation result as integer if the kind is Int.
 
CINDEX_LINKAGE long long clang_EvalResult_getAsLongLong (CXEvalResult E)
 Returns the evaluation result as a long long integer if the kind is Int.
 
CINDEX_LINKAGE unsigned clang_EvalResult_isUnsignedInt (CXEvalResult E)
 Returns a non-zero value if the kind is Int and the evaluation result resulted in an unsigned integer.
 
CINDEX_LINKAGE unsigned long long clang_EvalResult_getAsUnsigned (CXEvalResult E)
 Returns the evaluation result as an unsigned integer if the kind is Int and clang_EvalResult_isUnsignedInt is non-zero.
 
CINDEX_LINKAGE double clang_EvalResult_getAsDouble (CXEvalResult E)
 Returns the evaluation result as double if the kind is double.
 
CINDEX_LINKAGE const char * clang_EvalResult_getAsStr (CXEvalResult E)
 Returns the evaluation result as a constant string if the kind is other than Int or float.
 
CINDEX_LINKAGE void clang_EvalResult_dispose (CXEvalResult E)
 Disposes the created Eval memory.
 

Detailed Description

Typedef Documentation

◆ CXEvalResult

typedef void* CXEvalResult

Evaluation result of a cursor.

Definition at line 5824 of file Index.h.

◆ CXInclusionVisitor

typedef void(* CXInclusionVisitor) (CXFile included_file, CXSourceLocation *inclusion_stack, unsigned include_len, CXClientData client_data)

Visitor invoked for each file in a translation unit (used with clang_getInclusions()).

This visitor function will be invoked by clang_getInclusions() for each file included (either at the top-level or by #include directives) within a translation unit. The first argument is the file being included, and the second and third arguments provide the inclusion stack. The array is sorted in order of immediate inclusion. For example, the first element refers to the location that included 'included_file'.

Definition at line 5794 of file Index.h.

Enumeration Type Documentation

◆ CXEvalResultKind

Enumerator
CXEval_Int 
CXEval_Float 
CXEval_ObjCStrLiteral 
CXEval_StrLiteral 
CXEval_CFStr 
CXEval_Other 
CXEval_UnExposed 

Definition at line 5809 of file Index.h.

Function Documentation

◆ clang_Cursor_Evaluate()

CINDEX_LINKAGE CXEvalResult clang_Cursor_Evaluate ( CXCursor  C)

If cursor is a statement declaration tries to evaluate the statement and if its variable, tries to evaluate its initializer, into its corresponding type.

If it's an expression, tries to evaluate the expression.

◆ clang_EvalResult_dispose()

CINDEX_LINKAGE void clang_EvalResult_dispose ( CXEvalResult  E)

Disposes the created Eval memory.

◆ clang_EvalResult_getAsDouble()

CINDEX_LINKAGE double clang_EvalResult_getAsDouble ( CXEvalResult  E)

Returns the evaluation result as double if the kind is double.

◆ clang_EvalResult_getAsInt()

CINDEX_LINKAGE int clang_EvalResult_getAsInt ( CXEvalResult  E)

Returns the evaluation result as integer if the kind is Int.

◆ clang_EvalResult_getAsLongLong()

CINDEX_LINKAGE long long clang_EvalResult_getAsLongLong ( CXEvalResult  E)

Returns the evaluation result as a long long integer if the kind is Int.

This prevents overflows that may happen if the result is returned with clang_EvalResult_getAsInt.

◆ clang_EvalResult_getAsStr()

CINDEX_LINKAGE const char * clang_EvalResult_getAsStr ( CXEvalResult  E)

Returns the evaluation result as a constant string if the kind is other than Int or float.

User must not free this pointer, instead call clang_EvalResult_dispose on the CXEvalResult returned by clang_Cursor_Evaluate.

◆ clang_EvalResult_getAsUnsigned()

CINDEX_LINKAGE unsigned long long clang_EvalResult_getAsUnsigned ( CXEvalResult  E)

Returns the evaluation result as an unsigned integer if the kind is Int and clang_EvalResult_isUnsignedInt is non-zero.

◆ clang_EvalResult_getKind()

CINDEX_LINKAGE CXEvalResultKind clang_EvalResult_getKind ( CXEvalResult  E)

Returns the kind of the evaluated result.

◆ clang_EvalResult_isUnsignedInt()

CINDEX_LINKAGE unsigned clang_EvalResult_isUnsignedInt ( CXEvalResult  E)

Returns a non-zero value if the kind is Int and the evaluation result resulted in an unsigned integer.

◆ clang_getClangVersion()

CINDEX_LINKAGE CXString clang_getClangVersion ( void  )

Return a version string, suitable for showing to a user, but not intended to be parsed (the format is not guaranteed to be stable).

◆ clang_getInclusions()

CINDEX_LINKAGE void clang_getInclusions ( CXTranslationUnit  tu,
CXInclusionVisitor  visitor,
CXClientData  client_data 
)

Visit the set of preprocessor inclusions in a translation unit.

The visitor function is called with the provided data for every included file. This does not include headers included by the PCH file (unless one is inspecting the inclusions in the PCH file itself).

◆ clang_toggleCrashRecovery()

CINDEX_LINKAGE void clang_toggleCrashRecovery ( unsigned  isEnabled)

Enable/disable crash recovery.

Parameters
isEnabledFlag to indicate if crash recovery is enabled. A non-zero value enables crash recovery, while 0 disables it.