Skip to content

Conversation

@MythreyaK
Copy link
Contributor

@MythreyaK MythreyaK commented Aug 1, 2025

Fix for clangd/clangd#2450.

Ensures that headers are inserted after module; declaration by updating minimum offset. I haven't updated the max offset, which would be either with module <name>; or export module <name> as that didn't seem necessary, not sure? If anything else is missing, please let me know!

I was wondering if we could use the AST instead to more "smartly" insert these headers.

@MythreyaK MythreyaK force-pushed the mythreyak/module-header-insertion branch from 1c1f7cc to 51db593 Compare August 1, 2025 02:32
@github-actions
Copy link

github-actions bot commented Aug 1, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@MythreyaK MythreyaK force-pushed the mythreyak/module-header-insertion branch from 51db593 to b4c0f29 Compare August 1, 2025 08:21
@MythreyaK MythreyaK marked this pull request as ready for review August 1, 2025 08:57
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Aug 1, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 1, 2025

@llvm/pr-subscribers-clang

Author: Mythreya Kuricheti (MythreyaK)

Changes

Currently a draft PR. Fix for clangd/clangd#2450.

Ensures that headers are inserted after module; declaration by updating minimum offset. I haven't updated the max offset, which would be either with module &lt;name&gt;; or export module &lt;name&gt; as that didn't seem necessary, not sure?

I was wondering if we could use the AST instead to more "smartly" insert these headers.


Full diff: https://github.com/llvm/llvm-project/pull/151624.diff

2 Files Affected:

  • (modified) clang/lib/Tooling/Inclusions/HeaderIncludes.cpp (+21-1)
  • (modified) clang/unittests/Tooling/HeaderIncludesTest.cpp (+81)
diff --git a/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp b/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp
index 2b5a293b35841..2ad0c8b1ff135 100644
--- a/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp
+++ b/clang/lib/Tooling/Inclusions/HeaderIncludes.cpp
@@ -74,6 +74,15 @@ void skipComments(Lexer &Lex, Token &Tok) {
       return;
 }
 
+bool checkAndConsumeModuleDecl(const SourceManager &SM, Lexer &Lex,
+                               Token &Tok) {
+  bool Matched = Tok.is(tok::raw_identifier) &&
+                 Tok.getRawIdentifier() == "module" &&
+                 !Lex.LexFromRawLexer(Tok) && Tok.is(tok::semi) &&
+                 !Lex.LexFromRawLexer(Tok);
+  return Matched;
+}
+
 // Returns the offset after header guard directives and any comments
 // before/after header guards (e.g. #ifndef/#define pair, #pragma once). If no
 // header guard is present in the code, this will return the offset after
@@ -95,7 +104,17 @@ unsigned getOffsetAfterHeaderGuardsAndComments(StringRef FileName,
               return std::max(InitialOffset, Consume(SM, Lex, Tok));
             });
       };
-  return std::max(
+
+  auto ModuleDecl = ConsumeHeaderGuardAndComment(
+      [](const SourceManager &SM, Lexer &Lex, Token Tok) -> unsigned {
+        if (checkAndConsumeModuleDecl(SM, Lex, Tok)) {
+          skipComments(Lex, Tok);
+          return SM.getFileOffset(Tok.getLocation());
+        }
+        return 0;
+      });
+
+  auto HeaderAndPPOffset = std::max(
       // #ifndef/#define
       ConsumeHeaderGuardAndComment(
           [](const SourceManager &SM, Lexer &Lex, Token Tok) -> unsigned {
@@ -115,6 +134,7 @@ unsigned getOffsetAfterHeaderGuardsAndComments(StringRef FileName,
               return SM.getFileOffset(Tok.getLocation());
             return 0;
           }));
+  return std::max(HeaderAndPPOffset, ModuleDecl);
 }
 
 // Check if a sequence of tokens is like
diff --git a/clang/unittests/Tooling/HeaderIncludesTest.cpp b/clang/unittests/Tooling/HeaderIncludesTest.cpp
index 929156a11d0d9..9308513225d9a 100644
--- a/clang/unittests/Tooling/HeaderIncludesTest.cpp
+++ b/clang/unittests/Tooling/HeaderIncludesTest.cpp
@@ -594,6 +594,87 @@ TEST_F(HeaderIncludesTest, CanDeleteAfterCode) {
   EXPECT_EQ(Expected, remove(Code, "\"b.h\""));
 }
 
+TEST_F(HeaderIncludesTest, InsertInGlobalModuleFragment) {
+  // Ensure header insertions go only in the global module fragment
+  std::string Code = R"cpp(// comments
+
+// more comments
+
+module;
+export module foo;
+
+int main() {
+    std::vector<int> ints {};
+})cpp";
+  std::string Expected = R"cpp(// comments
+
+// more comments
+
+module;
+#include <vector>
+export module foo;
+
+int main() {
+    std::vector<int> ints {};
+})cpp";
+
+  auto InsertedCode = insert(Code, "<vector>");
+  EXPECT_EQ(Expected, insert(Code, "<vector>"));
+}
+
+TEST_F(HeaderIncludesTest, InsertInGlobalModuleFragmentWithPP) {
+  // Ensure header insertions go only in the global module fragment
+  std::string Code = R"cpp(// comments
+
+// more comments
+
+// some more comments
+
+module;
+
+#ifndef MACRO_NAME
+#define MACRO_NAME
+#endif
+
+// comment
+
+#ifndef MACRO_NAME
+#define MACRO_NAME
+#endif
+
+// more comment
+
+int main() {
+    std::vector<int> ints {};
+})cpp";
+  std::string Expected = R"cpp(// comments
+
+// more comments
+
+// some more comments
+
+module;
+
+#include <vector>
+#ifndef MACRO_NAME
+#define MACRO_NAME
+#endif
+
+// comment
+
+#ifndef MACRO_NAME
+#define MACRO_NAME
+#endif
+
+// more comment
+
+int main() {
+    std::vector<int> ints {};
+})cpp";
+
+  EXPECT_EQ(Expected, insert(Code, "<vector>"));
+}
+
 } // namespace
 } // namespace tooling
 } // namespace clang

@HighCommander4
Copy link
Collaborator

@MythreyaK thanks for the patch!

@JVApen I'll let you take a first crack at reviewing this :) Feel free to flag me if you think it needs an additional pair of eyes.

@MythreyaK MythreyaK force-pushed the mythreyak/module-header-insertion branch from b4c0f29 to f7e79ed Compare August 2, 2025 04:34
@JVApen
Copy link

JVApen commented Aug 2, 2025

Checking the example of https://clang.llvm.org/docs/StandardCPlusPlusModules.html#abi-breaking-style, there is not really and end where to put the include.

It might be advised to put the headers all together after the global module fragment, though restricting the range to that might be to strict. Especially if there are includes after than, it might be advised to group with those.

We also know that the algorithm tries to put the headers as early as possible, so I believe it's safe to not change the max.

If we learn more about modules, we can always add some rule for the max later on.

Copy link

@JVApen JVApen left a comment

Choose a reason for hiding this comment

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

Looks good, can you extend the testing as indicated in a comment?

Copy link

Choose a reason for hiding this comment

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

I like the test cases you wrote. I do think we should add at least one extra where we already had some includes in the source code. Such that we know this works in such case as well. (I don't expect failure based on your code)

Copy link
Contributor Author

@MythreyaK MythreyaK Aug 2, 2025

Choose a reason for hiding this comment

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

Thanks for the explanation here!

Should I combine all into the same test case, or are 3 separate ones okay?

I just realized the other tests seem to combine multiple checks into one gtest test.

Edit: Ah, it seems I was mistaken, kept them as 3 separate tests. Let me know if the naming looks okay!

Copy link

@JVApen JVApen left a comment

Choose a reason for hiding this comment

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

LGTM

@JVApen
Copy link

JVApen commented Aug 2, 2025

@HighCommander4 I don't have the power to complete on LLVM repository, can you do that?

Copy link
Collaborator

@HighCommander4 HighCommander4 left a comment

Choose a reason for hiding this comment

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

I couldn't resist making one comment :)

return SM.getFileOffset(Tok.getLocation());
return 0;
}));
return std::max(HeaderAndPPOffset, ModuleDecl);
Copy link
Collaborator

@HighCommander4 HighCommander4 Aug 3, 2025

Choose a reason for hiding this comment

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

Technically, this function is no longer doing what its name says, getOffsetAfterHeaderGuardsAndComments.

Can we rename it to getMinHeaderInsertionOffset, and adjust the comment above it to talk about the module declaration as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, done!

Does the comment look okay?

Copy link

Choose a reason for hiding this comment

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

If rather say something like:

Determines the area where we want to insert header includes. This will be put (when available):
 - after `#pragma once`
 - in-between header guards (`#ifdef/#define` & `#endif`)
 - after opening global module (`module;`)

Feel free to rephrase or ignore

Copy link
Contributor Author

@MythreyaK MythreyaK Aug 3, 2025

Choose a reason for hiding this comment

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

This does read better, yeah. Will push after current CI run to prevent a restart.

Edit: done

// includes. This will be put (when available):
// - after `#pragma once`
// - after header guards (`#ifdef` and `#define`)
// - after opening global module (`module;`)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add "after any comments at the start of the file or immediately following one of the above constructs"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator

@HighCommander4 HighCommander4 left a comment

Choose a reason for hiding this comment

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

Thanks!

@HighCommander4
Copy link
Collaborator

(The merge interface has been tweaked to make me click past a scary-looking "you probably shouldn't be checking this" warning to merge before CI checks complete... so I'll just wait for the checks 😆 )

@HighCommander4 HighCommander4 merged commit c76a9af into llvm:main Aug 3, 2025
9 checks passed
@MythreyaK MythreyaK deleted the mythreyak/module-header-insertion branch August 3, 2025 07:25
@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 3, 2025

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux-bootstrap-asan running on sanitizer-buildbot2 while building clang at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/52/builds/10153

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/main.py:73: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 88486 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.
FAIL: lld :: COFF/import_weak_alias.test (85642 of 88486)
******************** TEST 'lld :: COFF/import_weak_alias.test' FAILED ********************
Exit Code: 139

Command Output (stderr):
--
split-file /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/COFF/import_weak_alias.test /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dir # RUN: at line 3
+ split-file /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/COFF/import_weak_alias.test /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dir
/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/llvm-mc --filetype=obj -triple=x86_64-windows-msvc /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dir/foo.s -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.foo.obj # RUN: at line 4
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/llvm-mc --filetype=obj -triple=x86_64-windows-msvc /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dir/foo.s -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.foo.obj
/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/llvm-mc --filetype=obj -triple=x86_64-windows-msvc /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dir/qux.s -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.qux.obj # RUN: at line 5
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/llvm-mc --filetype=obj -triple=x86_64-windows-msvc /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dir/qux.s -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.qux.obj
/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/lld-link /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.qux.obj /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.foo.obj -out:/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dll -dll # RUN: at line 6
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/lld-link /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.qux.obj /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.foo.obj -out:/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dll -dll
/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.script: line 4: 3920474 Segmentation fault      (core dumped) /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/lld-link /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.qux.obj /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.foo.obj -out:/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dll -dll

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
24.65s: LLVM :: CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll
23.38s: LLVM :: tools/llvm-reduce/parallel-workitem-kill.ll
13.90s: Clang :: Driver/fsanitize.c
13.47s: Clang :: CodeGen/AArch64/sve-intrinsics/acle_sve_reinterpret.c
12.81s: LLVM :: CodeGen/AMDGPU/memintrinsic-unroll.ll
12.04s: LLVM :: CodeGen/AMDGPU/sched-group-barrier-pipeline-solver.mir
10.46s: LLVM :: CodeGen/AMDGPU/amdgcn.bitcast.512bit.ll
10.01s: LLVM-Unit :: Support/./SupportTests/ProgramEnvTest/TestExecuteNoWaitDetached
9.53s: Clang :: Analysis/runtime-regression.c
9.46s: Clang :: Preprocessor/riscv-target-features.c
8.98s: Clang :: OpenMP/target_update_codegen.cpp
8.84s: Clang :: OpenMP/target_defaultmap_codegen_01.cpp
8.47s: LLVM :: MC/Mips/mips-jump-pc-region.s
8.31s: LLVM :: CodeGen/Hexagon/isel/isel-tfrrp.ll
8.09s: LLVM :: CodeGen/AMDGPU/amdgcn.bitcast.960bit.ll
7.57s: Clang :: OpenMP/target_teams_distribute_parallel_for_simd_codegen_registration.cpp
7.50s: LLVM :: CodeGen/RISCV/attributes.ll
Step 14 (stage3/asan check) failure: stage3/asan check (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/main.py:73: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 88486 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.
FAIL: lld :: COFF/import_weak_alias.test (85642 of 88486)
******************** TEST 'lld :: COFF/import_weak_alias.test' FAILED ********************
Exit Code: 139

Command Output (stderr):
--
split-file /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/COFF/import_weak_alias.test /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dir # RUN: at line 3
+ split-file /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/COFF/import_weak_alias.test /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dir
/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/llvm-mc --filetype=obj -triple=x86_64-windows-msvc /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dir/foo.s -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.foo.obj # RUN: at line 4
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/llvm-mc --filetype=obj -triple=x86_64-windows-msvc /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dir/foo.s -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.foo.obj
/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/llvm-mc --filetype=obj -triple=x86_64-windows-msvc /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dir/qux.s -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.qux.obj # RUN: at line 5
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/llvm-mc --filetype=obj -triple=x86_64-windows-msvc /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dir/qux.s -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.qux.obj
/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/lld-link /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.qux.obj /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.foo.obj -out:/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dll -dll # RUN: at line 6
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/lld-link /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.qux.obj /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.foo.obj -out:/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dll -dll
/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.script: line 4: 3920474 Segmentation fault      (core dumped) /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/bin/lld-link /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.qux.obj /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.foo.obj -out:/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/tools/lld/test/COFF/Output/import_weak_alias.test.tmp.dll -dll

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
24.65s: LLVM :: CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll
23.38s: LLVM :: tools/llvm-reduce/parallel-workitem-kill.ll
13.90s: Clang :: Driver/fsanitize.c
13.47s: Clang :: CodeGen/AArch64/sve-intrinsics/acle_sve_reinterpret.c
12.81s: LLVM :: CodeGen/AMDGPU/memintrinsic-unroll.ll
12.04s: LLVM :: CodeGen/AMDGPU/sched-group-barrier-pipeline-solver.mir
10.46s: LLVM :: CodeGen/AMDGPU/amdgcn.bitcast.512bit.ll
10.01s: LLVM-Unit :: Support/./SupportTests/ProgramEnvTest/TestExecuteNoWaitDetached
9.53s: Clang :: Analysis/runtime-regression.c
9.46s: Clang :: Preprocessor/riscv-target-features.c
8.98s: Clang :: OpenMP/target_update_codegen.cpp
8.84s: Clang :: OpenMP/target_defaultmap_codegen_01.cpp
8.47s: LLVM :: MC/Mips/mips-jump-pc-region.s
8.31s: LLVM :: CodeGen/Hexagon/isel/isel-tfrrp.ll
8.09s: LLVM :: CodeGen/AMDGPU/amdgcn.bitcast.960bit.ll
7.57s: Clang :: OpenMP/target_teams_distribute_parallel_for_simd_codegen_registration.cpp
7.50s: LLVM :: CodeGen/RISCV/attributes.ll

@MythreyaK
Copy link
Contributor Author

@HighCommander4 @JVApen, I wasn't sure if the failures reported by the buildbot are relevant or related to this PR. Thoughts?

@JVApen
Copy link

JVApen commented Aug 3, 2025

From what I can see, the failures are linked to lld, so can't be caused by your changes

@MythreyaK
Copy link
Contributor Author

Thank you for checking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants