.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "CASTXML" "1" "Sep 14, 2024" "0.6.8" "CastXML" .SH NAME castxml \- C-family Abstract Syntax Tree XML Output .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .EX castxml ( | | )... .EE .UNINDENT .UNINDENT .SH DESCRIPTION .sp Parse C\-family source files and optionally write a subset of the Abstract Syntax Tree (AST) to a representation in XML. .sp Source files are parsed as complete translation units using an internal \X'tty: link https://clang.llvm.org/'\fI\%Clang\fP\X'tty: link' compiler. XML output is enabled by the \fB\-\-castxml\-output=\fP or \fB\-\-castxml\-gccxml\fP option. .SH OPTIONS .sp The following command\-line options are interpreted by \fBcastxml\fP\&. Remaining options are given to the internal Clang compiler. .INDENT 0.0 .TP .B \fB\-\-castxml\-cc\- \fP, \fB\-\-castxml\-cc\- \(dq(\(dq ... \(dq)\(dq\fP Configure the internal Clang preprocessor and target platform to match that of the given compiler command. The \fB\fP names a reference compiler with which the given command is compatible. It must be one of: .INDENT 7.0 .IP \(bu 2 \fBgnu\fP: GNU Compiler Collection C++ (g++) .IP \(bu 2 \fBgnu\-c\fP: GNU Compiler Collection C (gcc) .IP \(bu 2 \fBmsvc\fP: Microsoft Visual C++ (cl) .IP \(bu 2 \fBmsvc\-c\fP: Microsoft Visual C (cl) .UNINDENT .sp \fB\fP names a compiler (e.g. \fB/usr/bin/gcc\fP or \fBcl\fP) and \fB...\fP specifies options that may affect its target (e.g. \fB\-m32\fP). The target platform detected from the given compiler may be overridden by a separate Clang \fB\-target\fP option. The language standard level detected from the given compiler may be overridden by a separate Clang \fB\-std=\fP option. .TP .B \fB\-\-castxml\-output=\fP Write XML output to to \fB.xml\fP or file named by \fB\-o\fP\&. The \fB\fP specifies the “epic” format version number to generate, and must be \fB1\fP\&. .TP .B \fB\-\-castxml\-gccxml\fP Generate XML output in a format close to that of \X'tty: link http://gccxml.org'\fI\%gccxml\fP\X'tty: link'\&. Write output to \fB.xml\fP or file named by \fB\-o\fP\&. The gccxml format does not support Clang language modes other than \fB\-std=c++98\fP or \fB\-std=c89\fP\&. This output format may be used with language modes \fB\-std=c++11\fP, \fB\-std=c++14\fP, \fB\-std=c99\fP, and \fB\-std=c11\fP but the output will not contain implicit move constructors or move assignment operators, and may contain \fB\fP elements on non\-c++98 constructs. .TP .B \fB\-\-castxml\-start [,]...\fP Start AST traversal at declaration(s) with the given qualified name(s). Multiple names may be specified as a comma\-separated list or by repeating the option. .TP .B \fB\-help\fP, \fB\-\-help\fP Print \fBcastxml\fP and internal Clang compiler usage information. .TP .B \fB\-o \fP If output is generated (e.g. via \fB\-\-castxml\-output=\fP), write the output to \fB\fP\&. At most one \fB\fP file may be specified as input. .TP .B \fB\-\-version\fP Print \fBcastxml\fP and internal Clang compiler version information. .sp Release versions of CastXML use the format: .INDENT 7.0 .INDENT 3.5 .sp .EX ..[\-rc][\-] .EE .UNINDENT .UNINDENT .sp where the \fB\fP component is less than \fB20000000\fP, \fB\fP is an optional release candidate number, and \fB\fP may contain arbitrary text (in case of development between patch versions). .sp Development versions of CastXML use the format: .INDENT 7.0 .INDENT 3.5 .sp .EX ..[\-] .EE .UNINDENT .UNINDENT .sp where the \fB\fP component is of format \fBCCYYMMDD\fP and \fB\fP may contain arbitrary text. This represents development as of a particular date following the \fB.\fP feature release. .UNINDENT .SH OUTPUT FORMAT VERSIONS .SS With \fB\-\-castxml\-output=\fP .sp The XML root element tag will be of the form: .INDENT 0.0 .INDENT 3.5 .sp .EX .EE .UNINDENT .UNINDENT .INDENT 0.0 .IP \(bu 2 The first component is the \fBepic\fP format version number given to the \fB\-\-castxml\-output=\fP flag, and currently must always be \fB1\fP\&. .IP \(bu 2 The second component is the \fBmajor\fP format version number and increments when a new XML element is added or for other major changes. Clients will need updating. .IP \(bu 2 The third component is the \fBminor\fP format version number and increments whenever a new XML attribute is added to an existing element or a minor bug is fixed in the XML output of an existing element or attribute (clients should work unchanged unless they want the new info). .UNINDENT .SS With \fB\-\-castxml\-gccxml\fP .sp The XML root element tag will be of the form: .INDENT 0.0 .INDENT 3.5 .sp .EX .EE .UNINDENT .UNINDENT .sp The \fBversion\fP number corresponds to the last \X'tty: link http://gccxml.org'\fI\%gccxml\fP\X'tty: link' version that was ever released (for backward compatibility). The \fBcvs_revision\fP number is a running number that is incremented for each minor change in the xml format. .SH SCHEMA .sp XML Schema that describes both output formats is available: \fBcastxml.xsd\fP\&. .SH PREPROCESSING .sp CastXML preprocesses source files using an internal Clang compiler using its own predefined macros for the target platform by default. The \fB\-\-castxml\-cc\-\fP option switches the predefined macros to match those detected from the given compiler command. In either case, CastXML always adds the following predefined macros: .INDENT 0.0 .TP .B \fB__castxml_major__\fP Defined to the CastXML major version number in decimal. .TP .B \fB__castxml_minor__\fP Defined to the CastXML minor version number in decimal. .TP .B \fB__castxml_patch__\fP Defined to the CastXML patch version number in decimal. .TP .B \fB__castxml_check(major,minor,patch)\fP Defined to a constant expression encoding the three version components for comparison with \fB__castxml__\fP\&. The actual encoding is unspecified. .TP .B \fB__castxml__\fP Defined to a constant expression encoding the CastXML version components: .INDENT 7.0 .INDENT 3.5 .sp .EX __castxml_check(__castxml_major__,__castxml_minor__,__castxml_patch__) .EE .UNINDENT .UNINDENT .TP .B \fB__castxml_clang_major__\fP Defined to the value of \fB__clang_major__\fP from the internal Clang. .TP .B \fB__castxml_clang_minor__\fP Defined to the value of \fB__clang_minor__\fP from the internal Clang. .TP .B \fB__castxml_clang_patchlevel__\fP Defined to the value of \fB__clang_patchlevel__\fP from the internal Clang. .UNINDENT .sp Source files may use these to identify the tool that is actually doing the preprocessing even when \fB\-\-castxml\-cc\-\fP changes the predefined macros. .SH FAQ .SS Why are C++ function bodies not dumped in XML? .sp This feature has not been implemented because the driving project for which CastXML was written had no need for function bodies. .SS Why don’t I see templates in the output? .sp This feature has not been implemented because the driving project for which CastXML was written had no need for uninstantiated templates. Template instantiations will still be dumped, though. For example: .INDENT 0.0 .INDENT 3.5 .sp .EX template struct foo {}; typedef foo::foo foo_int; .EE .UNINDENT .UNINDENT .sp will instantiate \fBfoo\fP, which will be included in the output. However, there will be no place that explicitly lists the set of types used for the instantiation other than in the name. This is because the proper way to do it is to dump the templates too and reference them from the instantiations with the template arguments listed. Since the features will be linked they should be implemented together. .SH COPYRIGHT 2013-2024 Kitware, Inc. .\" Generated by docutils manpage writer. .