Skip to content

fix check clang info#7345

Merged
waruqi merged 2 commits intodevfrom
llvm
Feb 26, 2026
Merged

fix check clang info#7345
waruqi merged 2 commits intodevfrom
llvm

Conversation

@waruqi
Copy link
Member

@waruqi waruqi commented Feb 24, 2026

@waruqi waruqi added this to the v3.0.8 milestone Feb 24, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @waruqi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where LLVM/Clang driver information, such as the resource directory and target triple, was not consistently cached or efficiently retrieved. By introducing a dedicated function to query and store this information during the initial toolchain check, the changes aim to improve the performance and reliability of toolchain detection and configuration within Xmake, avoiding repeated calls to the compiler for the same data.

Highlights

  • Refactored LLVM/Clang Information Retrieval: Centralized the process of querying LLVM/Clang for resource directory and target triple into a new check_llvm_info function.
  • Improved Caching Mechanism: Ensured that LLVM/Clang driver information is collected and cached during the toolchain check phase, preventing redundant calls to the compiler.
  • Standardized Internal Function Names: Renamed existing helper functions for retrieving LLVM details with a leading underscore (_) to signify their internal usage.
  • Integrated Info Collection Across Toolchains: Applied the new check_llvm_info function to clang-cl, clang, and llvm toolchain checks to ensure consistent data collection.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • xmake/modules/private/utils/toolchain.lua
    • Added check_llvm_info function to query and cache LLVM/Clang resource directory and target triple.
    • Renamed get_llvm_resourcedir to _get_llvm_resourcedir and updated its implementation to retrieve cached data.
    • Renamed get_llvm_rootdir to _get_llvm_rootdir and updated its implementation to use _get_llvm_resourcedir.
    • Renamed get_llvm_compiler_rtinfo to _get_llvm_compiler_rtinfo and updated its implementation to use _get_llvm_resourcedir and _get_llvm_target_triple.
    • Renamed get_llvm_target_triple to _get_llvm_target_triple and updated its implementation to retrieve cached data.
    • Updated calls to get_llvm_resourcedir, get_llvm_rootdir, get_llvm_compiler_rtinfo, and get_llvm_target_triple to use their new prefixed names.
    • Modified get_llvm_dirs to use _get_llvm_rootdir, _get_llvm_target_triple, _get_llvm_resourcedir, and _get_llvm_compiler_rtinfo.
  • xmake/toolchains/clang-cl/check.lua
    • Invoked toolchain_utils.check_llvm_info after successfully finding the clang-cl executable.
    • Removed a trailing blank line.
  • xmake/toolchains/clang/check.lua
    • Invoked toolchain_utils.check_llvm_info after successfully finding the clang executable in both general and Windows-specific checks.
    • Removed a trailing blank line.
  • xmake/toolchains/llvm/check.lua
    • Invoked toolchain_utils.check_llvm_info when configuring the llvm toolchain.
  • xmake/toolchains/llvm/xmake.lua
    • Updated the import path for xcode.load from ".xcode.load_" .. toolchain:plat() to ".xcode.load".
  • xmake/toolchains/swift/xmake.lua
    • Updated the import path for xcode.load from ".xcode.load_" .. toolchain:plat() to ".xcode.load".
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors how LLVM/Clang information, such as the resource directory and target triple, is retrieved and cached. It introduces a new function, check_llvm_info, to proactively gather this information during the toolchain check phase and store it in the toolchain configuration. This approach avoids redundant executions of clang to fetch this data. The existing helper functions have been updated to read from this new cache, and their names have been changed to reflect their internal usage. This is a solid improvement for performance and code clarity. The changes are applied consistently across the clang, clang-cl, and llvm toolchains. I have one minor suggestion to improve robustness.

@waruqi waruqi merged commit ac25635 into dev Feb 26, 2026
73 of 74 checks passed
@waruqi waruqi deleted the llvm branch February 26, 2026 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant