[clang-tools-extra] [clangd] [C++ Modules] Fix handling of relative paths in prebuilt mod… (PR #187654)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 20 00:49:04 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- clang-tools-extra/clangd/ModulesBuilder.cpp clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp b/clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp
index 179190619..d676371d5 100644
--- a/clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp
+++ b/clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp
@@ -676,7 +676,8 @@ import M;
// Test that prebuilt module files with relative paths are correctly resolved.
// This tests the fix for the issue where clangd couldn't find BMI files when
-// the compilation database contained relative paths in -fmodule-file= arguments.
+// the compilation database contained relative paths in -fmodule-file=
+// arguments.
TEST_F(PrerequisiteModulesTests, PrebuiltModuleFileWithRelativePath) {
MockDirectoryCompilationDatabase CDB(TestDir, FS);
@@ -737,8 +738,8 @@ int use() { return m_value; }
)cpp");
// Use relative path in -fmodule-file= argument
- CDBWithRelativePath.ExtraClangFlags.push_back(
- "-fmodule-file=M=" + RelativeBMPath);
+ CDBWithRelativePath.ExtraClangFlags.push_back("-fmodule-file=M=" +
+ RelativeBMPath);
// Step 5: Verify that clangd can find and reuse the prebuilt module file
ModulesBuilder BuilderWithRelativePath(CDBWithRelativePath);
``````````
</details>
https://github.com/llvm/llvm-project/pull/187654
More information about the cfe-commits
mailing list