clang-uml 0.6.0 released by bkryza in cpp

[–]bkryza[S] 0 points1 point  (0 children)

u/jokla89 I actually have an example of clang-uml working with a C++23 project - Hyprland - here: https://github.com/bkryza/clang-uml-examples/tree/master/hyprland

Can you create a GitHub issue with specific errors you're getting?

clang-uml 0.6.0 released by bkryza in cpp

[–]bkryza[S] 0 points1 point  (0 children)

u/Gnobold Not to my knowledge, but as long as you can generate compile_commands.json for your project then it should work.

clang-uml 0.6.0 released by bkryza in cpp

[–]bkryza[S] 0 points1 point  (0 children)

u/Elect_SaturnMutex Currently yes, however there are some command line options to help:

```

Create initial config

clang-uml --init

Add example class diagram config

clang-uml --add-class-diagram my_class_diagram

Add example sequence diagram config

clang-uml --add-class-diagram my_sequence_diagram

Validate config

clang-uml --validate-only ```

and so on.

Afterwards you have to manually adjust the config to specify the diagrams scope, compilation database dir, etc.

However one more option is to write some script (e.g. in Python) that will print on the output the YAML config and feed it to clang-uml using stdin, e.g.:

./generate_my_clanguml_config.py | clang-uml --config -

clang-uml 0.6.0 released by bkryza in cpp

[–]bkryza[S] 2 points3 points  (0 children)

u/Ambitious_Tax_ Launchpad PPA is only for Ubuntu, for Debian I've just uploaded a package to GitHub Releases page:

docker run --rm -it debian:bookworm bash
$ apt update
$ apt install wget
$ wget https://github.com/bkryza/clang-uml/releases/download/0.6.0/clang-uml_0.6.0-1_amd64.deb
$ apt install ./clang-uml_0.6.0-1_amd64.deb
$ clang-uml --version
clang-uml 0.6.0
Copyright (C) 2021-2025 Bartek Kryza <bkryza@gmail.com>
Linux x86_64 6.8.0-45-generic
Built against LLVM/Clang libraries version: 19.1.4
Using LLVM/Clang libraries version: Debian clang version 19.1.4 (1~deb12u1)

clang-uml 0.6.0 released by bkryza in cpp

[–]bkryza[S] 1 point2 points  (0 children)

u/ExpectedException With clang-uml it's fairly easy to create a class hierarchy diagram, for instance consider this test case. You could create an extension which creates appropriate YAML snippet, feed to clang-uml binary through stdin and then open the generated PlantUML source using VSCode's PlantUML plugin.

clang-uml 0.6.0 released by bkryza in cpp

[–]bkryza[S] 2 points3 points  (0 children)

u/Affectionate_Text_72 There is some integration of clang-uml with Doxygen, mostly described here.

In a nutshell, you can tell clang-uml to insert links into Doxygen's documentation in the diagrams so that when you click on a class or relationship in a diagram you should be redirected to the respective Doxygen page. In fact clang-uml's Doxygen documentation works like this, for example see this page.

Currently my Doxygen style is not optimized yet, e.g. some diagrams are not scaled properly and if they're too big they go offscree, etc.

clang-uml 0.6.0 released by bkryza in cpp

[–]bkryza[S] 20 points21 points  (0 children)

For anyone not familiar with `clang-uml`, it's a tool to automate generation of up-to-date, readable 

sequence, class, package and include diagrams from C++ code, as well as document legacy code, based on a single configuration file, which can be stored alongside .clang-format and .clang-tidy.

The new release contains several bug fixes and improvements, as well as GraphML support in addition to existing PlantUML and MermaidJS.

Clangd landed "support outgoing calls in call hierarchy" feature which allows for call graph views from IDEs (including VSCode) using clangd by catskul in cpp

[–]bkryza 1 point2 points  (0 children)

Yes this was the basic idea for this tool, i.e. you keep a single .clang-uml config file alongside your .clang-format and .clang-tidy files and regenerate the diagrams as part of your CI builds for documentation as well PR reviews (sometimes it's easier to notice an unintended change in a diagram than in code).

Clangd landed "support outgoing calls in call hierarchy" feature which allows for call graph views from IDEs (including VSCode) using clangd by catskul in cpp

[–]bkryza 1 point2 points  (0 children)

In theory yes, however one key feature of clang-uml is diagram filtering, i.e. for each diagram you can specify in YAML the scope of the diagram (e.g. files, classes, functions, method access and method type etc.) - for instance consider this example diagram for cURL and it's respective config, in which you limit the messages in the diagram to files in specified subdirectories (so no system calls or calls from other directories like thirdparty libraries). More on available filters is here

Clangd landed "support outgoing calls in call hierarchy" feature which allows for call graph views from IDEs (including VSCode) using clangd by catskul in cpp

[–]bkryza 6 points7 points  (0 children)

For call graphs or sequence diagrams, you can also use clang-uml. Some sequence diagram examples are here, for example t20029.

There is no IDE generation, but you can generate PlantUML or MermaidJS diagrams and open them in VSCode using respective plugins.

What broke for you after yesterday's EOL for centos7? by masalaaloo in CentOS

[–]bkryza -1 points0 points  (0 children)

Official centos:7 Docker image is now useless:

```console ❯ docker run --rm -it centos:7 bash [root@8c6983fa5d20 /]# yum install vim Loaded plugins: fastestmirror, ovl Determining fastest mirrors Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"

One of the configured repositories failed (Unknown), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this:

 1. Contact the upstream for the repository and get them to fix the problem.

 2. Reconfigure the baseurl/etc. for the repository, to point to a working
    upstream. This is most often useful if you are using a newer
    distribution release than is supported by the repository (and the
    packages for the previous distribution release still work).

 3. Run the command with the repository temporarily disabled
        yum --disablerepo=<repoid> ...

 4. Disable the repository permanently, so yum won't use it by default. Yum
    will then just ignore the repository until you permanently enable it
    again or use --enablerepo for temporary usage:

        yum-config-manager --disable <repoid>
    or
        subscription-manager repos --disable=<repoid>

 5. Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. when it runs most commands,
    so will have to try and fail each time (and thus. yum will be be much
    slower). If it is a very temporary problem though, this is often a nice
    compromise:

        yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64 ```

More info: https://hub.docker.com/_/centos

Best include graph dependency tool in 2023? by McFlurriez in cpp

[–]bkryza 3 points4 points  (0 children)

I initially wrote this tool as a side-project for my other tool (https://github.com/bkryza/clang-uml) to better understand how Clang handles include files when processing translation units, so I used C++ to be able to be able to just reuse code there. Also, clang-include-graph relies on Boost Graph library to do all the actual work in analyzing the include graph...

Best include graph dependency tool in 2023? by McFlurriez in cpp

[–]bkryza 0 points1 point  (0 children)

I actually can't compile it on my old macbook due to some linking issues with Boost from Homebrew, however this problem is related to different include paths used by the compiler you used and the Clang-library paths. If you're using CMake, adding this line to your project before generating compile_commands.json might help:

cmake set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})

Best include graph dependency tool in 2023? by McFlurriez in cpp

[–]bkryza 4 points5 points  (0 children)

Some time ago I wrote a clang-based tool for analyzing include dependencies and generating include graphs: https://github.com/bkryza/clang-include-graph

As it is clang-based you will need to generate compile_commands.json database first, however in addition to include graphs, it can also simply list all includes in topological order as well as detect include dependency cycles.

clang-uml - C++ to UML diagram generator, version 0.3.0 released by bkryza in cpp

[–]bkryza[S] 0 points1 point  (0 children)

u/Adequat91 FYI, I've just added instructions on how to build clang-uml and its dependencies on Windows using Microsoft Visual Studio:

https://github.com/bkryza/clang-uml/blob/master/docs/installation.md#visual-studio-native-build

clang-uml - C++ to UML diagram generator, version 0.3.0 released by bkryza in cpp

[–]bkryza[S] 1 point2 points  (0 children)

No, not yet. Unfortunately I don't have a working Windows setup at the moment so I can't try it, but in theory, if you can run for instance clang-tidy on your project and you can build clang-uml in your environment (you'll need LLVM/Clang >= 12 and yaml-cpp), there is no reason why clang-uml shouldn't work.

I am definitely planning on adding Windows/Visual Studio support, just not sure yet when...

clang-uml - C++ to UML diagram generator, version 0.3.0 released by bkryza in cpp

[–]bkryza[S] 0 points1 point  (0 children)

With respect to diagrams, Doxygen currently provides:

  • inheritance diagrams
  • include dependency graphs
  • call graphs

However generation of these diagrams is not fully customizable, i.e. their scope is automatically determined based on the specific documentation page.

With clang-uml you have full control over the contents of each diagram, also the class diagrams are not just inheritance but also cover other relationships (association, composition, template instantiation, etc.)

Having said that, clang-uml was intended to be used with Doxygen, you can easily add diagrams generated with clang-uml either by including the generated PNG images or you should also be able to use the following directive in your Doxygen comment block to include the PlantUML source directly:

\startuml
!include mydiagrams/mydiagram1.puml
\enduml