In this post I will describe the process of visualizing the Chromium include graph with the help of one of my side projects - clang-include-graph. The main motivation for this work was to test the new release of clang-include-graph against a large code base. In the next sections I will describe all steps needed to reproduce the final graph, including building Chromium to obtain the compile_commands.json and generating a GraphML include graph representation using clang-include-graph, which will then be used to visualize the graph using Gephi, but if you’re in a hurry: TL;DR -> The full graph Table of contents Open Table of contents clang-include-graph overview clang-include-graph is a simple Clang-based command line tool for analyzing C/C++ project include graphs. As of version 0.2.0 it provides the following features: Generating include graph in several formats: Topologically ordered include list Include tree and reverse include tree Include graph cycles detection Listing of all dependents of a specified header file Parallel processing of translation units In this post we will focus on the GraphML output feature of clang-include-graph and how it can be used to visualize and analyze the include graph of the Chromium source code using existing open-source software. Generating the include graph Building Chromium Since clang-include-graph is a Clang-based tool, before we can generate the GraphML file include graph, we need to generate the compile_commands.json file for the Chromium source. For reproducibility, I created a Docker image with some helper scripts to fetch and build Chromium as well as generate the GraphML files - it is available here. Below I will however present how these steps can be performed manually. We’ll assume that we’ll be working in /build directory, which corresponds to the volume mount in the Docker container. Fetching Chromium sources git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git mkdir -p chromium cd chromium export...
First seen: 2025-05-21 18:21
Last seen: 2025-05-22 00:22