home.social

#cppmodules — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #cppmodules, aggregated by home.social.

  1. is has issues when module import is in a header file, and not the cpp file. This is not a problem for clang, its all in the same translation unit. AFAICT this is legal and fine C++20 module code, clangd shouldn't have this issue.

    github.com/llvm/llvm-project/i

  2. [EDIT: this is wrong, read thread]

    Interesting issue.
    When using its possible to have a fixit applies multiple times causing incorrect code.

    I believe what is happening is the cppm is the source text, but its analysed in other translation unit by the module import which uses its pcm. In parallel they both read and apply their fixit and you get situations like NULL becoming nullptrptr.

    I'll try and make a minimal example at some point.

  3. [EDIT: this is wrong, read thread]

    Interesting #clangtidy issue.
    When using #cppmodules its possible to have a fixit applies multiple times causing incorrect code.

    I believe what is happening is the cppm is the source text, but its analysed in other translation unit by the module import which uses its pcm. In parallel they both read and apply their fixit and you get situations like NULL becoming nullptrptr.

    I'll try and make a minimal example at some point.

    #cpp #cplusplus

  4. [EDIT: this is wrong, read thread]

    Interesting #clangtidy issue.
    When using #cppmodules its possible to have a fixit applies multiple times causing incorrect code.

    I believe what is happening is the cppm is the source text, but its analysed in other translation unit by the module import which uses its pcm. In parallel they both read and apply their fixit and you get situations like NULL becoming nullptrptr.

    I'll try and make a minimal example at some point.

    #cpp #cplusplus

  5. [EDIT: this is wrong, read thread]

    Interesting #clangtidy issue.
    When using #cppmodules its possible to have a fixit applies multiple times causing incorrect code.

    I believe what is happening is the cppm is the source text, but its analysed in other translation unit by the module import which uses its pcm. In parallel they both read and apply their fixit and you get situations like NULL becoming nullptrptr.

    I'll try and make a minimal example at some point.

    #cpp #cplusplus

  6. [EDIT: this is wrong, read thread]

    Interesting #clangtidy issue.
    When using #cppmodules its possible to have a fixit applies multiple times causing incorrect code.

    I believe what is happening is the cppm is the source text, but its analysed in other translation unit by the module import which uses its pcm. In parallel they both read and apply their fixit and you get situations like NULL becoming nullptrptr.

    I'll try and make a minimal example at some point.

    #cpp #cplusplus

  7. Any diagnostic to find cyclic dependencies?

    set(CMAKE_CXX_SCAN_FOR_MODULES ON)
    add_library(A STATIC)
    target_sources(A PUBLIC
    FILE_SET CXX_MODULES FILES mod.cppm # export module x;
    )
    target_link_libraries(A PRIVATE B)
    add_library(B STATIC use.cpp) # import x;
    target_link_libraries(B PRIVATE A)

    All you get ATM is failure at compile time `fatal error: module 'x' not found`

    But it would be nice to know that the real issue is that A and B make a cycle

  8. What is the reasonable way to test internal parts of a module?

    For a complex module I want unit tests for parts that I do not want to export. Do I make an internals module that can be tested. Then have the actual module which only re-export what I intend to be the library's interface?

  9. Working with with and

    How can I run just the scan/dynamic based bits so that I can run clang-tidy without a full build?

    ATM I have this hack
    ```
    # cmake config
    cmake --preset thing

    # select what I need made
    ninja -C build -t inputs | grep -E '\.cppm\.o$|\.o\.modmap$' | xargs -r ninja -C build

    # then I can run clang-tidy
    ```

    There must be a better way

  10. Struggled all morning to build the #CMake 3.30 `import std;` #cppmodules demo on #NixOS. I might try again after a break, but it seems very difficult to get working.

  11. Why are private module fragments `module : private;` only allowed in the primary module interface unit? Why can't they exist in the module partition units?

    I was going to use a partition unit to hold a complex internal subsystem that the main unit needs. Everything with internal or module linkage, no exports/external linkage.
    But I can't `import :subsystem;` after `module : private;` in the main unit.
    And I can't `module : private;` at all in the partition unit.

  12. Working with #cpp20 #cppmodules with #ninjabuild and #cmake

    How can I run just the scan/dynamic based bits so that I can run clang-tidy without a full build?

    ATM I have this hack
    ```
    # cmake config
    cmake --preset thing

    # select what I need made
    ninja -C build -t inputs | grep -E '\.cppm\.o$|\.o\.modmap$' | xargs -r ninja -C build

    # then I can run clang-tidy
    ```

    There must be a better way

    #cpp #cplusplus #programming

  13. Working with #cpp20 #cppmodules with #ninjabuild and #cmake

    How can I run just the scan/dynamic based bits so that I can run clang-tidy without a full build?

    ATM I have this hack
    ```
    # cmake config
    cmake --preset thing

    # select what I need made
    ninja -C build -t inputs | grep -E '\.cppm\.o$|\.o\.modmap$' | xargs -r ninja -C build

    # then I can run clang-tidy
    ```

    There must be a better way

    #cpp #cplusplus #programming

  14. Working with #cpp20 #cppmodules with #ninjabuild and #cmake

    How can I run just the scan/dynamic based bits so that I can run clang-tidy without a full build?

    ATM I have this hack
    ```
    # cmake config
    cmake --preset thing

    # select what I need made
    ninja -C build -t inputs | grep -E '\.cppm\.o$|\.o\.modmap$' | xargs -r ninja -C build

    # then I can run clang-tidy
    ```

    There must be a better way

    #cpp #cplusplus #programming

  15. Working with #cpp20 #cppmodules with #ninjabuild and #cmake

    How can I run just the scan/dynamic based bits so that I can run clang-tidy without a full build?

    ATM I have this hack
    ```
    # cmake config
    cmake --preset thing

    # select what I need made
    ninja -C build -t inputs | grep -E '\.cppm\.o$|\.o\.modmap$' | xargs -r ninja -C build

    # then I can run clang-tidy
    ```

    There must be a better way

    #cpp #cplusplus #programming