-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[clangd] fails to compile the module with transitive module dependency #139189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-clangd Author: Sidney Cogdill (SidneyCogdill)
The reproduction step doesn't fit into an issue description. I've created a tiny project to showcase the bug: https://github.com/SidneyCogdill/clangd_modules_bug_showcase
Audit the code before opening it in your editor because it's good security practice, it's a tiny project and shouldn't be hard. Basically:
// unique_fd.cpp
module;
#include <print>
export module unique_fd;
import unique_wrapper;
export struct UniqueFd { ... }; // unique_wrapper.cpp
module;
#include <functional>
#include <stdexcept>
#include <type_traits>
export module unique_wrapper;
export template <typename Handle> requires(...)
struct UniqueWrapper { ... };
module;
#include <print>
export module my_app;
import unique_wrapper; // <- This is required to make clangd successfully compile `unique_fd`.
import unique_fd; clang can compile the program successfully, but clangd will complain "Module XXX not found`. more importantly it will point at whatever the first import statement is at rather than the problematic module. One can only obtain useful information from the log output. clangd version:
arguments:
|
@llvm/issue-subscribers-clang-modules Author: Sidney Cogdill (SidneyCogdill)
The reproduction step doesn't fit into an issue description. I've created a tiny project to showcase the bug: https://github.com/SidneyCogdill/clangd_modules_bug_showcase
Audit the code before opening it in your editor because it's good security practice, it's a tiny project and shouldn't be hard. Basically:
// unique_fd.cpp
module;
#include <print>
export module unique_fd;
import unique_wrapper;
export struct UniqueFd { ... }; // unique_wrapper.cpp
module;
#include <functional>
#include <stdexcept>
#include <type_traits>
export module unique_wrapper;
export template <typename Handle> requires(...)
struct UniqueWrapper { ... };
module;
#include <print>
export module my_app;
import unique_wrapper; // <- This is required to make clangd successfully compile `unique_fd`.
import unique_fd; clang can compile the program successfully, but clangd will complain "Module XXX not found`. more importantly it will point at whatever the first import statement is at rather than the problematic module. One can only obtain useful information from the log output. clangd version:
arguments:
|
The reproduction step doesn't fit into an issue description. I've created a tiny project to showcase the bug: https://github.com/SidneyCogdill/clangd_modules_bug_showcase
Audit the code before opening it in your editor because it's good security practice, it's a tiny project and shouldn't be hard.
Basically:
unique_fd
requiresunique_wrapper
as an dependency:unique_fd
is used inmy_app
,unique_wrapper
has to be explicitly imported beforeunique_fd
, otherwise clangd will fail to compileunique_fd
:clang can compile the program successfully, but clangd will complain "Module XXX not found`. more importantly it will point at whatever the first import statement is at rather than the problematic module. One can only obtain useful information from the log output.
clangd version:
arguments:
The text was updated successfully, but these errors were encountered: