Tools for checking and visualizing C++ code architecture
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
bin64
code
dep
include
tests
.gitignore
Readme.md
premake5.lua

Readme.md

architect.cpp

Tools for checking and visualizing C++ code architecture, both as library and command-line.

Library

#include <iostream>
#include <architect.hpp>

int main(int argc, const char **argv)
{
	architect::Registry registry;
	if (!architect::clang::parse(registry, argc, argv))
		return EXIT_FAILURE;

    auto &symbols = registry.getSymbols();
    architect::dot::dumpSymbols(symbols, std::cout);

    return EXIT_SUCCESS;
}

The central class is architect::Registry and its main method is getSymbols. A registry holds information on code's symbols (logical abstractions like classes, enums, typedefs, global functions...) and their references to other symbols. From there, everything is possible.

A registry is not meant to be changed directly. Parsing files, which fills the registry, or dumping it, is done through format namespaces (see Input/output formats below).

Command-line

Simple interface on top of the library.

architect -h  # Show general help
architect dependencies -h  # Show help for the command "dependencies"
architect dependencies tests\cycles.cpp  # Extract dependencies from files

Commands:

  • cycles: shows all existing dependency cycles
  • dependencies: shows symbols and their references to other symbols
  • scc: shows the strongly connected components of the dependency graph

Build

The build system is Premake 5.

Edit premake5.lua if needed to accommodate your needs.

Input/output formats

Several formats are supported: they are in the corresponding sub-namespaces of architect. With the command-line, specify the input and output formats using respectively -input <format> and -output <format>.

  • clang: parses with clang
  • console: displays with a basic formatting for development purpose
  • dot: displays in DOT
  • json: parses and displays in JSON

Each of these formats can be opted out for building the library by editing premake5.lua. When using the library, you need to define the corresponding constants to access the namespace definitions.

Provided dependencies

License

Copyright (c) 2016 Jonathan Giroux

MIT License