C++ (with Clang)#
This module for C/C++ is based on Clang (http://clang.llvm.org/). Clang is part of the LLVM framework and is designed to support the C family of languages including C, C++ and Objective C. Clang is part of Apple’s development platform for iPhone, Macs and other devices. Clang has proven itself for its complete support for the C language family.
Getting Started#
C/C++ analysis is sensitive to the compile and link options. There are 3 ways to provide source, compile and link information to Lattix:
Providing a build specification file (manually written or created with Lattix tool LXBuild)
Using the Project Configurer to specify files, directories and compiler options (not suitable for complex projects where there are many different compiler options)
The above pages will talk you through how to create your first Lattix project. Once you have completed those steps, continue reading about Lattix C/C++ Clang details and capabilities below.
Atom and Dependency Kinds#
Atom Kinds#
The clang module creates atoms of these kinds:
Header File
Source File
Macro
Enum
Class - class, struct, template or union
Field - data member of a class
Method - class function or method
Global Variable
Static Variable - variable scoped to a file
Global Function
Static Function - function scoped to a file
Template Class
Template Function
Dependency Kinds#
The clang module creates these types of dependencies between atoms:
Override - a method overrides a method in a base class
Invoke - a method calls another
Inherit - a class has target class as a base class
Type Reference - general reference to a type
Macro - use of a macro
Address of Global - reference to the address of a global variable
Multiply Defined - symbol is multiply defined
Include - file include
Read Field - read access a data member of a class
Read Global - read access a global variable
Modify Field - modify a data member of a class
Modify Global - modify a global variable
Compiled With - Source files have a “Compiled With” dependency on the header files included in source’s compilation. Dependencies of this kind are only generated when the “Compute Visible Declaration Dependency Property” option is enabled. This dependency is filtered out by default.
Clang Reports#
There are a number of reports for the Clang Module. These reports include diagnostics (including errors) that were generated when the source code was compiled. It also includes a number of reports related to include file analysis. Please note that for some of these reports to work properly, the Compute Declaration Information property must be enabled at project creation. This property is needed because declarations are bypassed when dependencies are generated. As a result, the Externs report will generate an error if this property is not set. Furthermore, in the absence of this property, reports related to header files will not take declarations into account.
Diagnostics by File This report produces two sub-reports:
Files with Errors
Files with Warnings
Header Analysis This report produces 4 sub reports:
Headers not Included
Headers without dependencies
Headers included only for declarations
Headers included only to include other headers
Externs Analysis This report produces the following two sub reports:
Non-local Declarations in Source Files
Dependencies using non-local Declarations
Dependencies on Indirect Includes This report produces a 5 column report with the following fields: - Header File - Target/Provider atom in the header file (such as class, field, global data reference etc) - Source Location of the dependency in the source file for the target/provider atom - The type of dependency - The path(s) for the indirect dependency
Undefined Macros Produces a list of macros that weren’t defined and where those macros were referenced.
Missing Include Files Produces a list of include files that were missing, the name of the file that included them and a suggestion of the file that could be considered for inclusion (in case there was an error in the include path).
Cloned Files Lists files that are duplicates. Sometimes, files are copied by build systems. Occasionally, files are duplicated by developers. This report gives you a list of all the files which are identical.