Skip to content

Conversation

@jeaye
Copy link
Contributor

@jeaye jeaye commented Sep 7, 2025

This is an updated version of @vgvassilev's PR from last year here: #94166

In short, it includes:

  1. The fix for a blocking issue where clang::Interpreter (and thus clang-repl) cannot resolve symbols defined in a PCH
  2. A test to prove this is working
  3. A new hidden flag for clang-repl so that llvm-lit can match the host JIT triple between the PCH and clang-repl; previously, they may differ in some cases
  4. Everything based on the latest LLVM main

Shout out to @kylc for finding a logic issue which had us stumped for a while (and securing the bounty).

@github-actions
Copy link

github-actions bot commented Sep 7, 2025

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:codegen IR generation bugs: mangling, exceptions, etc. labels Sep 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 7, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-codegen

Author: Jeaye Wilkerson (jeaye)

Changes

This is an updated version of @vgvassilev's PR from last year here: #94166

In short, it includes:

  1. The fix for a blocking issue where clang::Interpreter cannot resolve symbols defined in a PCH
  2. A test to prove this is working
  3. A new hidden flag for clang-repl so that llvm-lit can match the host JIT triple between the PCH and clang-repl; previously, they may differ in some cases
  4. Everything based on the latest LLVM main

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

10 Files Affected:

  • (modified) clang/include/clang/CodeGen/ModuleBuilder.h (+6)
  • (modified) clang/lib/CodeGen/BackendConsumer.h (-5)
  • (modified) clang/lib/CodeGen/CodeGenAction.cpp (+6-7)
  • (modified) clang/lib/CodeGen/ModuleBuilder.cpp (+9-1)
  • (modified) clang/lib/Interpreter/IncrementalAction.cpp (+2-1)
  • (modified) clang/lib/Interpreter/IncrementalParser.cpp (+4)
  • (modified) clang/lib/Interpreter/Interpreter.cpp (+4-3)
  • (added) clang/test/Interpreter/execute-pch.cpp (+23)
  • (modified) clang/test/lit.cfg.py (+4)
  • (modified) clang/tools/clang-repl/ClangRepl.cpp (+7)
diff --git a/clang/include/clang/CodeGen/ModuleBuilder.h b/clang/include/clang/CodeGen/ModuleBuilder.h
index 59b9840d02e08..f1b8229edd362 100644
--- a/clang/include/clang/CodeGen/ModuleBuilder.h
+++ b/clang/include/clang/CodeGen/ModuleBuilder.h
@@ -52,6 +52,12 @@ namespace CodeGen {
 class CodeGenerator : public ASTConsumer {
   virtual void anchor();
 
+protected:
+  /// True if we've finished generating IR. This prevents us from generating
+  /// additional LLVM IR after emitting output in HandleTranslationUnit. This
+  /// can happen when Clang plugins trigger additional AST deserialization.
+  bool IRGenFinished = false;
+
 public:
   /// Return an opaque reference to the CodeGenModule object, which can
   /// be used in various secondary APIs.  It is valid as long as the
diff --git a/clang/lib/CodeGen/BackendConsumer.h b/clang/lib/CodeGen/BackendConsumer.h
index ad3adfca36785..b7bbb81074836 100644
--- a/clang/lib/CodeGen/BackendConsumer.h
+++ b/clang/lib/CodeGen/BackendConsumer.h
@@ -40,11 +40,6 @@ class BackendConsumer : public ASTConsumer {
   llvm::Timer LLVMIRGeneration;
   unsigned LLVMIRGenerationRefCount = 0;
 
-  /// True if we've finished generating IR. This prevents us from generating
-  /// additional LLVM IR after emitting output in HandleTranslationUnit. This
-  /// can happen when Clang plugins trigger additional AST deserialization.
-  bool IRGenFinished = false;
-
   bool TimerIsEnabled = false;
 
   BackendAction Action;
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp
index dc54c97eeae8e..db38351118f26 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/lib/CodeGen/CodeGenAction.cpp
@@ -189,9 +189,7 @@ void BackendConsumer::HandleInlineFunctionDefinition(FunctionDecl *D) {
 }
 
 void BackendConsumer::HandleInterestingDecl(DeclGroupRef D) {
-  // Ignore interesting decls from the AST reader after IRGen is finished.
-  if (!IRGenFinished)
-    HandleTopLevelDecl(D);
+  HandleTopLevelDecl(D);
 }
 
 // Links each entry in LinkModules into our module. Returns true on error.
@@ -240,10 +238,11 @@ void BackendConsumer::HandleTranslationUnit(ASTContext &C) {
 
     Gen->HandleTranslationUnit(C);
 
-    if (TimerIsEnabled && !--LLVMIRGenerationRefCount)
-      LLVMIRGeneration.yieldTo(CI.getFrontendTimer());
-
-    IRGenFinished = true;
+    if (TimerIsEnabled) {
+      LLVMIRGenerationRefCount -= 1;
+      if (LLVMIRGenerationRefCount == 0)
+        LLVMIRGeneration.stopTimer();
+    }
   }
 
   // Silently ignore if we weren't initialized for some reason.
diff --git a/clang/lib/CodeGen/ModuleBuilder.cpp b/clang/lib/CodeGen/ModuleBuilder.cpp
index 8c1fee8c974f1..3eb0595864c6c 100644
--- a/clang/lib/CodeGen/ModuleBuilder.cpp
+++ b/clang/lib/CodeGen/ModuleBuilder.cpp
@@ -138,6 +138,8 @@ namespace {
       assert(!M && "Replacing existing Module?");
       M.reset(new llvm::Module(ExpandModuleName(ModuleName, CodeGenOpts), C));
 
+      IRGenFinished = false;
+
       std::unique_ptr<CodeGenModule> OldBuilder = std::move(Builder);
 
       Initialize(*Ctx);
@@ -179,6 +181,10 @@ namespace {
     }
 
     bool HandleTopLevelDecl(DeclGroupRef DG) override {
+      // Ignore interesting decls from the AST reader after IRGen is finished.
+      if (IRGenFinished)
+        return true; // We can't CodeGen more but pass to other consumers.
+
       // FIXME: Why not return false and abort parsing?
       if (Diags.hasUnrecoverableErrorOccurred())
         return true;
@@ -282,6 +288,7 @@ namespace {
     }
 
     void HandleTranslationUnit(ASTContext &Ctx) override {
+
       // Release the Builder when there is no error.
       if (!Diags.hasUnrecoverableErrorOccurred() && Builder)
         Builder->Release();
@@ -292,8 +299,9 @@ namespace {
         if (Builder)
           Builder->clear();
         M.reset();
-        return;
       }
+
+      IRGenFinished = true;
     }
 
     void AssignInheritanceModel(CXXRecordDecl *RD) override {
diff --git a/clang/lib/Interpreter/IncrementalAction.cpp b/clang/lib/Interpreter/IncrementalAction.cpp
index 4d1bc4c59e851..3d489fce54bc6 100644
--- a/clang/lib/Interpreter/IncrementalAction.cpp
+++ b/clang/lib/Interpreter/IncrementalAction.cpp
@@ -106,7 +106,8 @@ std::unique_ptr<llvm::Module> IncrementalAction::GenModule() {
     // around we created an empty module to make CodeGen happy. We should make
     // sure it always stays empty.
     assert(((!CachedInCodeGenModule ||
-             !CI.getPreprocessorOpts().Includes.empty()) ||
+             !CI.getPreprocessorOpts().Includes.empty() ||
+             !CI.getPreprocessorOpts().ImplicitPCHInclude.empty()) ||
             (CachedInCodeGenModule->empty() &&
              CachedInCodeGenModule->global_empty() &&
              CachedInCodeGenModule->alias_empty() &&
diff --git a/clang/lib/Interpreter/IncrementalParser.cpp b/clang/lib/Interpreter/IncrementalParser.cpp
index 32d1663fbe1a9..bf08911e23533 100644
--- a/clang/lib/Interpreter/IncrementalParser.cpp
+++ b/clang/lib/Interpreter/IncrementalParser.cpp
@@ -37,6 +37,10 @@ IncrementalParser::IncrementalParser(CompilerInstance &Instance,
   llvm::ErrorAsOutParameter EAO(&Err);
   Consumer = &S.getASTConsumer();
   P.reset(new Parser(S.getPreprocessor(), S, /*SkipBodies=*/false));
+
+  if (ExternalASTSource *External = S.getASTContext().getExternalSource())
+    External->StartTranslationUnit(Consumer);
+
   P->Initialize();
 }
 
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp
index 043e0c1e5754e..8944937f19115 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -276,9 +276,10 @@ Interpreter::Interpreter(std::unique_ptr<CompilerInstance> Instance,
 
   if (Act->getCodeGen()) {
     Act->CacheCodeGenModule();
-    // The initial PTU is filled by `-include` or by CUDA includes
-    // automatically.
-    if (!CI->getPreprocessorOpts().Includes.empty()) {
+    // The initial PTU is filled by `-include`/`-include-pch` or by CUDA
+    // includes automatically.
+    if (!CI->getPreprocessorOpts().Includes.empty() ||
+        !CI->getPreprocessorOpts().ImplicitPCHInclude.empty()) {
       // We can't really directly pass the CachedInCodeGenModule to the Jit
       // because it will steal it, causing dangling references as explained in
       // Interpreter::Execute
diff --git a/clang/test/Interpreter/execute-pch.cpp b/clang/test/Interpreter/execute-pch.cpp
new file mode 100644
index 0000000000000..1ee8221463977
--- /dev/null
+++ b/clang/test/Interpreter/execute-pch.cpp
@@ -0,0 +1,23 @@
+// REQUIRES: host-supports-jit
+// UNSUPPORTED: system-aix
+//
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+//
+// RUN: %clang -fmax-type-align=16 -Xclang -pic-level -Xclang 2 -Xclang -fdeprecated-macro -fno-stack-protector -Xclang -fwrapv -fPIC -Xclang -fblocks -Xclang -fskip-odr-check-in-gmf -fexceptions -fcxx-exceptions -fgnuc-version=0 -target %host-jit-triple -Xclang -fblocks -Xclang -fmax-type-align=8 -Xclang -fincremental-extensions -Xclang -emit-pch -x c++-header -o %t/include.pch %t/include.hpp
+//
+// RUN: cat %t/main.cpp \
+// RUN:     | clang-repl -Xcc -fgnuc-version=0 -Xcc -fno-stack-protector -Xcc -fwrapv -Xcc -fPIC -Xcc -fblocks -Xcc -fskip-odr-check-in-gmf -Xcc -fmax-type-align=8 -Xcc -include-pch -Xcc %t/include.pch \
+// RUN:     | FileCheck %s
+
+//--- include.hpp
+
+int f_pch() { return 5; }
+
+//--- main.cpp
+
+extern "C" int printf(const char *, ...);
+printf("f_pch = %d\n", f_pch());
+
+// CHECK: f_pch = 5
diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index d34319131ab6d..bec7f70517471 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -191,6 +191,10 @@ def have_host_clang_repl_cuda():
 
     if have_host_clang_repl_cuda():
         config.available_features.add('host-supports-cuda')
+    hosttriple = run_clang_repl("--host-jit-triple")
+    config.substitutions.append(
+        ("%host-jit-triple",  hosttriple.strip())
+    )
 
     if have_host_out_of_process_jit_feature_support():
         config.available_features.add("host-supports-out-of-process-jit")
diff --git a/clang/tools/clang-repl/ClangRepl.cpp b/clang/tools/clang-repl/ClangRepl.cpp
index 1d508816d7047..c7879422cd7df 100644
--- a/clang/tools/clang-repl/ClangRepl.cpp
+++ b/clang/tools/clang-repl/ClangRepl.cpp
@@ -85,6 +85,8 @@ static llvm::cl::list<std::string>
               llvm::cl::CommaSeparated);
 static llvm::cl::opt<bool> OptHostSupportsJit("host-supports-jit",
                                               llvm::cl::Hidden);
+static llvm::cl::opt<bool> OptHostJitTriple("host-jit-triple",
+                                            llvm::cl::Hidden);
 static llvm::cl::list<std::string> OptInputs(llvm::cl::Positional,
                                              llvm::cl::desc("[code to run]"));
 
@@ -279,6 +281,11 @@ int main(int argc, const char **argv) {
       llvm::outs() << "false\n";
     }
     return 0;
+  } else if (OptHostJitTriple) {
+    auto J = ExitOnErr(llvm::orc::LLJITBuilder().create());
+    auto T = J->getTargetTriple();
+    llvm::outs() << T.normalize() << '\n';
+    return 0;
   }
 
   clang::IncrementalCompilerBuilder CB;

@github-actions
Copy link

github-actions bot commented Sep 7, 2025

✅ With the latest revision this PR passed the Python code formatter.

@jeaye jeaye force-pushed the jeaye/fix-pch-pr branch 2 times, most recently from 7779512 to 42019e6 Compare September 7, 2025 19:44
@jeaye
Copy link
Contributor Author

jeaye commented Sep 7, 2025

Looks like the previous run of the Linux job failed in an unrelated area: https://productionresultssa6.blob.core.windows.net/actions-results/de1b4c8c-9dc9-4d5e-90f7-2ed4ede76dce/workflow-job-run-20b49bb8-304c-5069-9f6b-84a81382ac9a/logs/job/job-logs.txt?rsct=text%2Fplain&se=2025-09-07T20%3A05%3A27Z&sig=WPuhDVUUJD9i8lxrEkJACxl4ITjw1d7KGiI6QENb4Gg%3D&ske=2025-09-08T06%3A16%3A06Z&skoid=ca7593d4-ee42-46cd-af88-8b886a2f84eb&sks=b&skt=2025-09-07T18%3A16%3A06Z&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skv=2025-05-05&sp=r&spr=https&sr=b&st=2025-09-07T19%3A55%3A22Z&sv=2025-05-05

2025-09-07T19:51:57.6717663Z   File "/home/gha/actions-runner/_work/llvm-project/llvm-project/.ci/generate_test_report_github.py", line 24, in <module>
2025-09-07T19:51:57.6718439Z     report = generate_test_report_lib.generate_report_from_files(
2025-09-07T19:51:57.6718840Z              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-09-07T19:51:57.6719675Z   File "/home/gha/actions-runner/_work/llvm-project/llvm-project/.ci/generate_test_report_lib.py", line 274, in generate_report_from_files
2025-09-07T19:51:57.6720259Z     return generate_report(
2025-09-07T19:51:57.6720465Z            ^^^^^^^^^^^^^^^^
2025-09-07T19:51:57.6720933Z   File "/home/gha/actions-runner/_work/llvm-project/llvm-project/.ci/generate_test_report_lib.py", line 222, in generate_report
2025-09-07T19:51:57.6721465Z     ninja_failures = find_failure_in_ninja_logs(ninja_logs)
2025-09-07T19:51:57.6721756Z                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-09-07T19:51:57.6722278Z   File "/home/gha/actions-runner/_work/llvm-project/llvm-project/.ci/generate_test_report_lib.py", line 78, in find_failure_in_ninja_logs
2025-09-07T19:51:57.6723090Z     log_failures = _parse_ninja_log(ninja_log)
2025-09-07T19:51:57.6723341Z                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-09-07T19:51:57.6723822Z   File "/home/gha/actions-runner/_work/llvm-project/llvm-project/.ci/generate_test_report_lib.py", line 47, in _parse_ninja_log
2025-09-07T19:51:57.6724365Z     failing_action = ninja_log[index - 1].split("] ")[1]

However, the Windows failure was related to my changes and has been addressed. Locally (x64_64 Linux), the regression suite passes cleanly.

Testing Time: 127.99s

Total Discovered Tests: 68683
  Skipped          :   391 (0.57%)
  Unsupported      : 32272 (46.99%)
  Passed           : 35952 (52.34%)
  Expectedly Failed:    68 (0.10%)

@jeaye
Copy link
Contributor Author

jeaye commented Sep 8, 2025

I've scoured the latest Linux/Windows build+test logs and the failures in there have seemingly nothing to do with this PR. Based on comparing these results with other recently opened PRs, it's unclear to me if these are consistent. @vgvassilev do you know?

@vgvassilev
Copy link
Contributor

I've scoured the latest Linux/Windows build+test logs and the failures in there have seemingly nothing to do with this PR. Based on comparing these results with other recently opened PRs, it's unclear to me if these are consistent. @vgvassilev do you know?

Probably somebody break llvm. You can rebase probably tomorrow...

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

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

LGTM!

@AaronBallman, I'd appreciate if you take a look before we land this.

Copy link
Collaborator

@erichkeane erichkeane left a comment

Choose a reason for hiding this comment

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

1 nit, else lgtm.

@@ -282,6 +288,7 @@ namespace {
}

void HandleTranslationUnit(ASTContext &Ctx) override {

Copy link
Collaborator

Choose a reason for hiding this comment

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

Unrelated change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, removed now. Thanks for the review!

@vgvassilev vgvassilev merged commit 065cd64 into llvm:main Sep 30, 2025
9 checks passed
@github-actions
Copy link

@jeaye Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 30, 2025

LLVM Buildbot has detected a new failure on builder fuchsia-x86_64-linux running on fuchsia-debian-64-us-central1-b-1 while building clang at step 4 "annotate".

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

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/fuchsia-linux.py ...' (failure)
...
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using clang: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-nayi80te/bin/clang
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/TestingConfig.py:157: fatal: unable to parse config file '/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/clang/test/lit.cfg.py', traceback: Traceback (most recent call last):
  File "/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/TestingConfig.py", line 145, in load_from_path
    exec(compile(data, path, "exec"), cfg_globals, None)
  File "/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/clang/test/lit.cfg.py", line 194, in <module>
    if have_host_jit_feature_support('jit'):
  File "/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/clang/test/lit.cfg.py", line 165, in have_host_jit_feature_support
    return "true" in run_clang_repl("--host-supports-" + feature_name)
TypeError: argument of type 'bool' is not iterable

FAILED: tools/clang/test/CMakeFiles/check-clang /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-nayi80te/tools/clang/test/CMakeFiles/check-clang 
cd /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-nayi80te/tools/clang/test && /usr/bin/python3.10 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-nayi80te/./bin/llvm-lit -sv /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-nayi80te/tools/clang/test
[852/1434] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/STLExtrasTest.cpp.o
[853/1434] Building CXX object unittests/Analysis/CMakeFiles/AnalysisTests.dir/LazyCallGraphTest.cpp.o
[854/1434] Building CXX object unittests/DebugInfo/LogicalView/CMakeFiles/DebugInfoLogicalViewTests.dir/__/DWARF/DwarfUtils.cpp.o
[855/1434] Building CXX object unittests/DebugInfo/CodeView/CMakeFiles/DebugInfoCodeViewTests.dir/RandomAccessVisitorTest.cpp.o
[856/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/SelectionDAGAddressAnalysisTest.cpp.o
[857/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugArangeSetTest.cpp.o
[858/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/SchedBoundary.cpp.o
[859/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/GCMetadata.cpp.o
[860/1434] Building CXX object unittests/CodeGen/CGPluginTest/CMakeFiles/CGPluginTest.dir/PluginTest.cpp.o
[861/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/CCStateTest.cpp.o
[862/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugAbbrevTest.cpp.o
[863/1434] Building CXX object unittests/Analysis/CMakeFiles/AnalysisTests.dir/ValueTrackingTest.cpp.o
[864/1434] Building CXX object unittests/DebugInfo/CodeView/CMakeFiles/DebugInfoCodeViewTests.dir/TypeIndexDiscoveryTest.cpp.o
[865/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/DIETest.cpp.o
[866/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/SelectionDAGNodeConstructionTest.cpp.o
[867/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFAcceleratorTableTest.cpp.o
[868/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/MachineOperandTest.cpp.o
[869/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/MachineBasicBlockTest.cpp.o
[870/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFLocationExpressionTest.cpp.o
[871/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/LexicalScopesTest.cpp.o
[872/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFListTableTest.cpp.o
[873/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/RegAllocScoreTest.cpp.o
[874/1434] Building CXX object unittests/DebugInfo/BTF/CMakeFiles/DebugInfoBTFTests.dir/BTFParserTest.cpp.o
[875/1434] Building CXX object unittests/CodeGen/GlobalISel/CMakeFiles/GlobalISelTests.dir/GISelMITest.cpp.o
[876/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDataExtractorTest.cpp.o
[877/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/AsmPrinterDwarfTest.cpp.o
[878/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDieManualExtractTest.cpp.o
[879/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFExpressionCompactPrinterTest.cpp.o
[880/1434] Building CXX object unittests/CodeGen/GlobalISel/CMakeFiles/GlobalISelTests.dir/CSETest.cpp.o
[881/1434] Building CXX object unittests/CodeGen/GlobalISel/CMakeFiles/GlobalISelTests.dir/LegalizerTest.cpp.o
[882/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/MachineInstrTest.cpp.o
[883/1434] Building CXX object unittests/CodeGen/GlobalISel/CMakeFiles/GlobalISelTests.dir/ConstantFoldingTest.cpp.o
[884/1434] Building CXX object unittests/CodeGen/GlobalISel/CMakeFiles/GlobalISelTests.dir/MachineIRBuilderTest.cpp.o
[885/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/TestAsmPrinter.cpp.o
[886/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/MLRegAllocDevelopmentFeatures.cpp.o
[887/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DwarfGenerator.cpp.o
[888/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/X86MCInstLowerTest.cpp.o
Step 7 (check) failure: check (failure)
...
[850/1434] Running the Clang regression tests
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using clang: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-nayi80te/bin/clang
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/TestingConfig.py:157: fatal: unable to parse config file '/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/clang/test/lit.cfg.py', traceback: Traceback (most recent call last):
  File "/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/TestingConfig.py", line 145, in load_from_path
    exec(compile(data, path, "exec"), cfg_globals, None)
  File "/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/clang/test/lit.cfg.py", line 194, in <module>
    if have_host_jit_feature_support('jit'):
  File "/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/clang/test/lit.cfg.py", line 165, in have_host_jit_feature_support
    return "true" in run_clang_repl("--host-supports-" + feature_name)
TypeError: argument of type 'bool' is not iterable
FAILED: tools/clang/test/CMakeFiles/check-clang /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-nayi80te/tools/clang/test/CMakeFiles/check-clang 
cd /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-nayi80te/tools/clang/test && /usr/bin/python3.10 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-nayi80te/./bin/llvm-lit -sv /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-nayi80te/tools/clang/test
[852/1434] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/STLExtrasTest.cpp.o
[853/1434] Building CXX object unittests/Analysis/CMakeFiles/AnalysisTests.dir/LazyCallGraphTest.cpp.o
[854/1434] Building CXX object unittests/DebugInfo/LogicalView/CMakeFiles/DebugInfoLogicalViewTests.dir/__/DWARF/DwarfUtils.cpp.o
[855/1434] Building CXX object unittests/DebugInfo/CodeView/CMakeFiles/DebugInfoCodeViewTests.dir/RandomAccessVisitorTest.cpp.o
[856/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/SelectionDAGAddressAnalysisTest.cpp.o
[857/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugArangeSetTest.cpp.o
[858/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/SchedBoundary.cpp.o
[859/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/GCMetadata.cpp.o
[860/1434] Building CXX object unittests/CodeGen/CGPluginTest/CMakeFiles/CGPluginTest.dir/PluginTest.cpp.o
[861/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/CCStateTest.cpp.o
[862/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugAbbrevTest.cpp.o
[863/1434] Building CXX object unittests/Analysis/CMakeFiles/AnalysisTests.dir/ValueTrackingTest.cpp.o
[864/1434] Building CXX object unittests/DebugInfo/CodeView/CMakeFiles/DebugInfoCodeViewTests.dir/TypeIndexDiscoveryTest.cpp.o
[865/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/DIETest.cpp.o
[866/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/SelectionDAGNodeConstructionTest.cpp.o
[867/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFAcceleratorTableTest.cpp.o
[868/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/MachineOperandTest.cpp.o
[869/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/MachineBasicBlockTest.cpp.o
[870/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFLocationExpressionTest.cpp.o
[871/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/LexicalScopesTest.cpp.o
[872/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFListTableTest.cpp.o
[873/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/RegAllocScoreTest.cpp.o
[874/1434] Building CXX object unittests/DebugInfo/BTF/CMakeFiles/DebugInfoBTFTests.dir/BTFParserTest.cpp.o
[875/1434] Building CXX object unittests/CodeGen/GlobalISel/CMakeFiles/GlobalISelTests.dir/GISelMITest.cpp.o
[876/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDataExtractorTest.cpp.o
[877/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/AsmPrinterDwarfTest.cpp.o
[878/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDieManualExtractTest.cpp.o
[879/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFExpressionCompactPrinterTest.cpp.o
[880/1434] Building CXX object unittests/CodeGen/GlobalISel/CMakeFiles/GlobalISelTests.dir/CSETest.cpp.o
[881/1434] Building CXX object unittests/CodeGen/GlobalISel/CMakeFiles/GlobalISelTests.dir/LegalizerTest.cpp.o
[882/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/MachineInstrTest.cpp.o
[883/1434] Building CXX object unittests/CodeGen/GlobalISel/CMakeFiles/GlobalISelTests.dir/ConstantFoldingTest.cpp.o
[884/1434] Building CXX object unittests/CodeGen/GlobalISel/CMakeFiles/GlobalISelTests.dir/MachineIRBuilderTest.cpp.o
[885/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/TestAsmPrinter.cpp.o
[886/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/MLRegAllocDevelopmentFeatures.cpp.o
[887/1434] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DwarfGenerator.cpp.o
[888/1434] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/X86MCInstLowerTest.cpp.o

jeaye added a commit to jank-lang/llvm-project that referenced this pull request Sep 30, 2025
On the happy path, when `clang-repl` is present, we will invoke it in
order to determine if the host supports JIT features. That will return a
string containing "true". However, in cases where `clang-repl` is not
present or we fail to invoke it, we previously returned `False`, which
would then trigger a failure with our substring check. This PR updates
the function to return `""` instead, so the substring check is still
valid.

This is related to llvm#157359,
where the original change was introduced.
vgvassilev pushed a commit that referenced this pull request Sep 30, 2025
On the happy path, when `clang-repl` is present, we will invoke it in
order to determine if the host supports JIT features. That will return a
string containing "true". However, in cases where `clang-repl` is not
present or we fail to invoke it, we previously returned `False`, which
would then trigger a failure with our substring check. This PR updates
the function to return `""` instead, so the substring check is still
valid.

This is related to #157359,
where the original change was introduced.
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Sep 30, 2025
On the happy path, when `clang-repl` is present, we will invoke it in
order to determine if the host supports JIT features. That will return a
string containing "true". However, in cases where `clang-repl` is not
present or we fail to invoke it, we previously returned `False`, which
would then trigger a failure with our substring check. This PR updates
the function to return `""` instead, so the substring check is still
valid.

This is related to llvm/llvm-project#157359,
where the original change was introduced.
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
This is an updated version of @vgvassilev's PR from last year here:
llvm#94166

In short, it includes:

1. The fix for a blocking issue where `clang::Interpreter` (and thus
`clang-repl`) cannot resolve symbols defined in a PCH
2. A test to prove this is working
3. A new hidden flag for `clang-repl` so that `llvm-lit` can match the
host JIT triple between the PCH and `clang-repl`; previously, they may
differ in some cases
4. Everything based on the latest LLVM main

Shout out to @kylc for finding a logic issue which had us stumped for a
while (and securing the
[bounty](jank-lang/jank#446)).

---------

Co-authored-by: Vassil Vassilev <v.g.vassilev@gmail.com>
Co-authored-by: Kyle Cesare <kcesare@gmail.com>
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
On the happy path, when `clang-repl` is present, we will invoke it in
order to determine if the host supports JIT features. That will return a
string containing "true". However, in cases where `clang-repl` is not
present or we fail to invoke it, we previously returned `False`, which
would then trigger a failure with our substring check. This PR updates
the function to return `""` instead, so the substring check is still
valid.

This is related to llvm#157359,
where the original change was introduced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:codegen IR generation bugs: mangling, exceptions, etc. clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants