ΒΆCXTranslationUnit
clang_createTranslationUnitFromSourceFile(
CXIndex CIdx,
const char* source_filename,
int num_clang_command_line_args,
const char* const* clang_command_line_args,
unsigned int num_unsaved_files,
struct CXUnsavedFile* unsaved_files)
CXTranslationUnit
clang_createTranslationUnitFromSourceFile(
CXIndex CIdx,
const char* source_filename,
int num_clang_command_line_args,
const char* const* clang_command_line_args,
unsigned int num_unsaved_files,
struct CXUnsavedFile* unsaved_files)
Description
Return the CXTranslationUnit for a given source file and the provided command line arguments one would pass to the compiler. Note: The 'source_filename' argument is optional. If the caller provides a NULL pointer, the name of the source file is expected to reside in the specified command line arguments. Note: When encountered in 'clang_command_line_args', the following options are ignored: '-c' '-emit-ast' '-fsyntax-only' '-o < output file>' (both '-o' and ' < output file>' are ignored)
Declared at: clang/include/clang-c/Index.h:1166
Parameters
- CXIndex CIdx
- The index object with which the translation unit will be associated.
- const char* source_filename
- The name of the source file to load, or NULL if the source file is included in \p clang_command_line_args.
- int num_clang_command_line_args
- The number of command-line arguments in\p clang_command_line_args.
- const char* const* clang_command_line_args
- The command-line arguments that would be passed to the \c clang executable if it were being invoked out-of-process. These command-line options will be parsed and will affect how the translation unit is parsed. Note that the following options are ignored: '-c', '-emit-ast', '-fsyntax-only' (which is the default), and '-o < output file>'.
- unsigned int num_unsaved_files
- the number of unsaved file entries in \p unsaved_files.
- struct CXUnsavedFile* unsaved_files
- the files that have not yet been saved to disk but may be required for code completion, including the contents of those files. The contents and name of these files (as specified by CXUnsavedFile) are copied when necessary, so the client only needs to guarantee their validity until the call to this function returns.