Introduction

The Clang module analyzes C/C++ code for a particular build specification. A build specification specifies each source file and how it is compiled. A build specification also specifies which of those files are linked together LXBuild is a Lattix Architect utility that monitors the build process and generates such a build specification.

Generate a Build Specification File

Run LXBuild and specify the command to build as an argument. For example

lxbuild make

You will see a new file called buildspec.xml when the build completes. This file contains the specification of the build. It consists of units, corresponding to each link unit. Each unit contains the files and the options for compiling them.

You can read more about this utility in LXBuild help files.

Create your Project

LXBuild New Project Dialog

  1. Click on New Project on the home page to bring up the Create New Project dialog
  2. Select C/C++(Clang) for Module Type
  3. Choose the option Build Specification File for Datasources
  4. Navigate to the build specification file that was generated using LXBuild
  5. Click on Create Project

Here is a video on the process: Creating a C/C++ Project in Lattix Architect (8 min)

Check for Errors

Check for errors by bringing up the Clang Reports using Reports->Clang Reports…->Diagnostics By File. The errors that cause analysis inaccuracies are typically from missing include files. Fix the errors and re-create (or update) the project. Note that you can specify additional include directories in the Options tab in the Create New Project dialog.

Hint 1: To minimize the time, remember that you can test by compiling just a single source file. The Options tab on the Create New Project dialog has an option called Include files matching these names. Simply enter the full path name of the file and then only that file will be compiled.

Hint 2: You can specify any additional include directories in the Options tab on the Create New Project dialog using the option Include Directories. You can also specify any additional compiler options using the option Compiler Options.

Analyze

You are now ready for further analysis using Lattix Architect. If you have not created a Dependency Structure Matrix view, you can create that now. Here are a couple of videos that can help:

Additional Resources

A well understood modular architecture may be the most effective technique for improving the quality and maintainability of complex code bases. At Lattix, we have helped some of the leading companies in the world improve the quality of their software and we can help you achieve the same results.

The Lattix Customer Portal contains additional whitepapers, customer case studies and articles. If you have questions on comments, you can contact us at support@lattix.com. To try Lattix on your code, email sales@lattix.com or call 978-664-5050