DoxyPress  1.4.2
Parsing with clang

DoxyPress offers an alternative from the traditional lex only parsing of source files for a few computer languages. Lex uses hand written rules which need to be updated as new syntax is added to the languages.

Some documenting programs which say they use clang, only invoke the clang front end under a very limited set of conditions. A small portion of the documented source code is passed to clang and most of the clang parsing is never used. This approach is not really using the full capabilities of clang and should not be thought of as actually parsing with clang.

DoxyPress provides a mechanism for parsing your source code using the clang front end exclusively. When the clang parsing option in your DoxyPress project file is enabled all C, C++, and Objective-C source code will be processed using clang. This approach may be slower however it relies on the properties of clang for parsing so it may be more accurate. DoxyPress is one of the very programs to use the clang front end for generating source documentation.

DoxyPress currently uses clang 10 for the clang front end. This version of clang provides full support through C++20. Support for various features can be enabled or disabled using the language dialect tag.

## Project File

There are several tags which must be set in your project file to enable and use clang for parsing. These tags are located on the Build Settings tab under Clang Parsing.

Clang Parsing
If this tag is set DoxyPress will use the clang parser for parsing C, C++, and Objective-C source code. Using clang might be slightly slower, however it will be more accurate.
Compilation Path
This tag is used to set the path to a JSON file previously created by a build tool like CMake or Visual Studio. If this tag is used then the compiler options do not need to be specified in the clang flags tag.
Language Dialect
This tag specifies which C++ standard should be used when parsing source code with clang and a compilation database is not provided.
At run time DoxyPress will need access to the clang header files. Checking this tag will use the clang headers located in the 'doxypress/include' folder. To use a different set of clang headers ensure this tag is not set. Then specify the location of the clang headers using '-I pathToClang' under the clang flags tag.
Clang Flags

Values for this tag are entered using the same syntax supported by the clang command line. If you are using a compilation database these flags should not be required.

On some platforms it may be necessary to indicate the path where your C++ standard library headers are located if clang fails to find the system headers.

Windows

• Lines 2 and 3 show the required path for parsing when running the 32-bit versions of MinGW and DoxyPress
• Lines 7 and 8 show the required path for parsing when running the 64-bit versions of MinGW and DoxyPress

OS X

• Lines 12 and 13 show the required path on for Mac OS X

1 // windows 32 bit
2 -Ic:/MinGW_32_7.3/lib/gcc/i686-w64-mingw32/7.3.0/include/c++/
3 -Ic:/MinGW_32_7.3/lib/gcc/i686-w64-mingw32/7.3.0/include/c++/i686-w64-mingw32
4
5
6 // windows 64 bit
7 -Ic:/MinGW_64_7.3/lib/gcc/x86_64-w64-mingw32/7.3.0/include//c++/x86_64-w64-mingw32/
8 -Ic:/MinGW_64_7.3/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++/
9
10
11 // os x
12 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1/
13 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include