A C/C++ program architecture generator https://faraphel.github.io/clang-architecture-viewer/
  • C++ 75.3%
  • CMake 17.4%
  • Dockerfile 7.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-14 08:53:53 +02:00
docs improved the README page 2026-08-07 23:23:37 +02:00
external changed how Catch2 is included, added code scanning 2026-08-06 13:05:08 +02:00
source made the output file logic stronger 2026-08-07 18:38:55 +02:00
tests use Catch2 through submodule instead of package to avoid distribution issues 2026-08-06 13:05:07 +02:00
.clang-tidy added Clang tidy and Clang Static Analysis support 2026-08-06 13:05:08 +02:00
.dockerignore added support for docker 2026-08-07 13:25:21 +02:00
.gitattributes Added gitattributes to normalize formatting 2026-08-06 13:05:07 +02:00
.gitignore updated documentation to have its own directory 2026-08-06 13:05:08 +02:00
.gitmodules made the application not handle system files by default, added --keep-system argument for this usage 2026-08-06 13:05:08 +02:00
CMakeLists.txt make the package named generator, similarly to the git repository 2026-08-13 23:24:35 +02:00
CMakePresets.json changed how Catch2 is included, added code scanning 2026-08-06 13:05:08 +02:00
Dockerfile added support for docker 2026-08-07 13:25:21 +02:00
Jenkinsfile improved Jenkinsfile to make it automatically publish artifacts on the git server 2026-08-14 08:53:53 +02:00
LICENSE.md initial commit 2026-08-06 13:05:07 +02:00
README.md improved the README page 2026-08-07 23:23:37 +02:00

Clang Architecture Generator

clang-architecture is a small utilitary based on Clang/LLVM that aim to extract and visualize the dependencies in a C/C++ program at the symbol level.

Example

This project generate JSON reports that store where symbols are declared and how they are used.

Those reports can be combined with the viewer in order to have a dynamic web visualization of the project analyzed.

Self-Architecture

Requirements

Project

Your project must match the following conditions:

  1. Your project can compile with the clang compiler.
  2. Your project should have a compilation database (compile_commands.json)
    • Using CMake, it can be generated by using CMAKE_EXPORT_COMPILE_COMMANDS=ON
    • Using another build system, bear can wrap it to generate the file.

Build

Docker / Podman

You can use the OCI image in the packages tab directly to use this project, or you can build the image yourself using the Dockerfile.

docker build -t clang-architecture .

Manual

Requirements

In order to build this project, your environment must match the following conditions:

  1. The required packages should be installed:
# Debian
sudo apt install clang libclang-dev llvm llvm-dev

To build this project, you only need to run cmake on it:

# configure the project
cmake --preset release
# build the project
cmake --build --preset release --parallel

Usage

You can generate an architecture report for your project by adapting this command:

clang-architecture 
  -o=./architecture.json
  -p=./build/ 
  --extra-arg=-resource-dir=$(clang -print-resource-dir) 
  ./source/*

Arguments

Name Description Type Required Default
-o / --output The output path for the report file string - (stdout)
-p The build path where the compile database is stored string True
-k / --keep-system Should the symbols system be included in the report bool false
--extra-arg Extra arguments appended to the parser any False
--extra-arg-before Extra arguments prepended to the parser any False
[...] sources The sources files of the project string True

Tips

The internal parser used by this tool may require to know the location additional resources such as the system headers of your compiler. It is recommended to pass them using the --extra-arg argument.

For clang, you can use --extra-arg=-resource-dir=$(clang -print-resource-dir) to include them.