Skip to content
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

Fix libc++.modules.json finding #4695

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function get_stdmodules(target)
-- @see https://github.com/llvm/llvm-project/pull/76451 (has been revert, so we need to wait)
local clang_path = path.directory(get_clang_path(target))
local clang_lib_path = path.join(clang_path, "..", "lib")
local modules_json_path = find_file("libc++.modules.json", clang_lib_path)
local modules_json_path = find_file("**.modules.json", clang_lib_path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use -print-library-module-manifest-path?

def print_std_module_manifest_path : Flag<["-", "--"], "print-library-module-manifest-path">,
  HelpText<"Print the path for the C++ Standard library module manifest">,
  Visibility<[ClangOption, CLOption]>;

https://github.com/llvm/llvm-project/pull/76451/files

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it might also be modules-asan.json

    // For example
    //  StringRef modules = [&] {
    //    const SanitizerArgs &Sanitize = TC.getSanitizerArgs(C.getArgs());
    //    if (Sanitize.needsAsanRt())
    //      return "modules-asan.json";
    //    return "modules.json";
    //  }();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use -print-library-module-manifest-path?

def print_std_module_manifest_path : Flag<["-", "--"], "print-library-module-manifest-path">,
  HelpText<"Print the path for the C++ Standard library module manifest">,
  Visibility<[ClangOption, CLOption]>;

https://github.com/llvm/llvm-project/pull/76451/files

it has been reverted, i plan to support it when it's re-merged
llvm/llvm-project@82f424f

if modules_json_path then
local modules_json = json.decode(io.readfile(modules_json_path))
local std_module_directory = path.directory(modules_json.modules[1]["source-path"])
Expand Down
Loading