[clang] [clang-repl] Handle mllvm args for clang-repl before calling executeAction (PR #197133)

Anutosh Bhat via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 6 07:34:39 PDT 2026


anutosh491 wrote:

Hey @mcbarton , my last commit should have everything passing on the emscripten tests. A couple tests needed to be skipped (which I've explain below)

You said that you weren't able to build it so i'll just share my configuration below if that helps !
```
// build native tblgen first

cmake -S llvm \
  -B /private/tmp/clang-repl-native-tools \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_ENABLE_PROJECTS="clang" \
  -DLLVM_TARGETS_TO_BUILD="WebAssembly"

cmake --build /private/tmp/clang-repl-native-tools \
  --target llvm-tblgen clang-tblgen llvm-min-tblgen \
  -j8
  
// cmake step

mkdir -p /private/tmp/clang-repl-emcache

EM_CACHE=/private/tmp/clang-repl-emcache \
emcmake cmake -S llvm \
  -B /private/tmp/clang-repl-wasm-tests \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX" \
  -DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
  -DLLVM_HOST_TRIPLE=wasm32-unknown-emscripten \
  -DLLVM_DEFAULT_TARGET_TRIPLE=wasm32-unknown-emscripten \
  -DLLVM_TARGETS_TO_BUILD="WebAssembly" \
  -DLLVM_ENABLE_PROJECTS="clang;lld" \
  -DLLVM_NATIVE_TOOL_DIR=/private/tmp/clang-repl-native-tools/bin \
  -DLLVM_INCLUDE_TESTS=ON \
  -DCLANG_INCLUDE_TESTS=ON \
  -DLLVM_INCLUDE_BENCHMARKS=OFF \
  -DLLVM_INCLUDE_EXAMPLES=OFF \
  -DLLVM_INCLUDE_DOCS=OFF \
  -DLLVM_ENABLE_THREADS=OFF \
  -DLLVM_ENABLE_PIC=OFF \
  -DLLVM_ENABLE_ZSTD=OFF \
  -DLLVM_ENABLE_LIBXML2=OFF \
  -DLLVM_ENABLE_LIBEDIT=OFF \
  -DCLANG_ENABLE_STATIC_ANALYZER=OFF \
  -DCLANG_ENABLE_OBJC_REWRITER=OFF \
  -DCLANG_ENABLE_BOOTSTRAP=OFF \
  -DCMAKE_C_FLAGS="-O2 -g0 -fPIC -sSUPPORT_LONGJMP=wasm -fwasm-exceptions -mtail-call" \
  -DCMAKE_CXX_FLAGS="-O2 -g0 -fPIC -sSUPPORT_LONGJMP=wasm -fwasm-exceptions -mtail-call -Dwait4=__syscall_wait4"
  
 // make step 
 
 EM_CACHE=/private/tmp/clang-repl-emcache \
emmake make \
  -C /private/tmp/clang-repl-wasm-tests \
  -j8 \
  ClangReplInterpreterTests
  
// run using node

cd /private/tmp/clang-repl-wasm-tests/tools/clang/unittests/Interpreter
node ./ClangReplInterpreterTests.js
```

I see this
```
anutosh491 at Anutoshs-MacBook-Air Interpreter % cd /private/tmp/clang-repl-wasm-test.7NOhv3/tools/clang/unittests/Interpreter

/Users/anutosh491/micromamba/envs/xeus-python-wasm-build/bin/node \
  ./ClangReplInterpreterTests.js
[==========] Running 32 tests from 5 test suites.
[----------] Global test environment set-up.
[----------] 2 tests from IncrementalCompilerBuilder
[ RUN      ] IncrementalCompilerBuilder.SetCompilerArgs
[       OK ] IncrementalCompilerBuilder.SetCompilerArgs (45 ms)
[ RUN      ] IncrementalCompilerBuilder.SetTargetTriple
/Users/anutosh491/work/llvm-project/clang/unittests/Interpreter/IncrementalCompilerBuilderTest.cpp:46: Skipped
Test fails for Emscipten builds

[  SKIPPED ] IncrementalCompilerBuilder.SetTargetTriple (0 ms)
[----------] 2 tests from IncrementalCompilerBuilder (46 ms total)

[----------] 1 test from IncrementalProcessingTest
[ RUN      ] IncrementalProcessingTest.EmitCXXGlobalInitFunc
[       OK ] IncrementalProcessingTest.EmitCXXGlobalInitFunc (235 ms)
[----------] 1 test from IncrementalProcessingTest (235 ms total)

[----------] 14 tests from InterpreterTest
[ RUN      ] InterpreterTest.Sanity
[       OK ] InterpreterTest.Sanity (16 ms)
[ RUN      ] InterpreterTest.IncrementalInputTopLevelDecls
[       OK ] InterpreterTest.IncrementalInputTopLevelDecls (29 ms)
[ RUN      ] InterpreterTest.Errors
[       OK ] InterpreterTest.Errors (24 ms)
[ RUN      ] InterpreterTest.DeclsAndStatements
[       OK ] InterpreterTest.DeclsAndStatements (32 ms)
[ RUN      ] InterpreterTest.TranslationUnitRedeclChainAcrossManyPTUs
[       OK ] InterpreterTest.TranslationUnitRedeclChainAcrossManyPTUs (33 ms)
[ RUN      ] InterpreterTest.UndoLeavesDeclsInTranslationUnitChain
/Users/anutosh491/work/llvm-project/clang/unittests/Interpreter/InterpreterTest.cpp:178: Skipped
Undo is not supported for Emscripten builds

[  SKIPPED ] InterpreterTest.UndoLeavesDeclsInTranslationUnitChain (0 ms)
[ RUN      ] InterpreterTest.UndoCommand
/Users/anutosh491/work/llvm-project/clang/unittests/Interpreter/InterpreterTest.cpp:207: Skipped
Test fails for Emscipten builds

[  SKIPPED ] InterpreterTest.UndoCommand (0 ms)
[ RUN      ] InterpreterTest.FindMangledNameSymbol
[       OK ] InterpreterTest.FindMangledNameSymbol (187 ms)
[ RUN      ] InterpreterTest.InstantiateTemplate
[       OK ] InterpreterTest.InstantiateTemplate (192 ms)
[ RUN      ] InterpreterTest.Value
dlsym failed for symbol: _ZN1SD2Ev
[       OK ] InterpreterTest.Value (433 ms)
[ RUN      ] InterpreterTest.ValueSetRawBitsCopiesByteCount
[       OK ] InterpreterTest.ValueSetRawBitsCopiesByteCount (51 ms)
[ RUN      ] InterpreterTest.ValueMoveSemantics
/Users/anutosh491/work/llvm-project/clang/unittests/Interpreter/InterpreterTest.cpp:514: Skipped
Unresolved destructor symbol: _ZN5MoveTD2Ev

[  SKIPPED ] InterpreterTest.ValueMoveSemantics (0 ms)
[ RUN      ] InterpreterTest.TranslationUnit_CanonicalDecl
[       OK ] InterpreterTest.TranslationUnit_CanonicalDecl (59 ms)
[ RUN      ] InterpreterTest.EmscriptenExceptionHandling
clang version 24.0.0git (git at github.com:anutosh491/llvm-project.git 533b2f98a223648a2c897342f4481fee4f745977)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: 
 "" -cc1 -triple wasm32-unknown-emscripten -emit-obj -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name "<<< inputs >>>" -mrelocation-model pic -pic-level 2 -mframe-pointer=none -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-feature +mutable-globals -target-feature +exception-handling -target-feature +multivalue -target-feature +reference-types -exception-model=wasm -mllvm -wasm-enable-eh -target-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/ -v -fcoverage-compilation-dir=/ -resource-dir lib/clang/24 -internal-isystem lib/clang/24/include -internal-isystem /include/wasm32-emscripten -internal-isystem /include -std=c++23 -fdeprecated-macro -ferror-limit 19 -fmessage-length=80 -fvisibility=default -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -exception-model=wasm -emit-llvm-only -fincremental-extensions -mllvm -wasm-enable-sjlj -o "<<< inputs >>>.o" -x c++ "<<< inputs >>>"
clang -cc1 version 24.0.0git based upon LLVM 24.0.0git default target wasm32-unknown-emscripten
ignoring nonexistent directory "lib/clang/24/include"
ignoring nonexistent directory "/include/wasm32-emscripten"
ignoring nonexistent directory "/include"
#include "..." search starts here:
End of search list.
[       OK ] InterpreterTest.EmscriptenExceptionHandling (62 ms)
[----------] 14 tests from InterpreterTest (1125 ms total)

[----------] 3 tests from InterpreterExtensionsTest
[ RUN      ] InterpreterExtensionsTest.DefaultCrossJIT
/Users/anutosh491/work/llvm-project/clang/unittests/Interpreter/InterpreterExtensionsTest.cpp:88: Skipped


[  SKIPPED ] InterpreterExtensionsTest.DefaultCrossJIT (0 ms)
[ RUN      ] InterpreterExtensionsTest.CustomCrossJIT
/Users/anutosh491/work/llvm-project/clang/unittests/Interpreter/InterpreterExtensionsTest.cpp:100: Skipped


[  SKIPPED ] InterpreterExtensionsTest.CustomCrossJIT (0 ms)
[ RUN      ] InterpreterExtensionsTest.CustomIncrementalExecutor
[       OK ] InterpreterExtensionsTest.CustomIncrementalExecutor (6 ms)
[----------] 3 tests from InterpreterExtensionsTest (8 ms total)

[----------] 12 tests from CodeCompletionTest
[ RUN      ] CodeCompletionTest.Sanity
[       OK ] CodeCompletionTest.Sanity (80 ms)
[ RUN      ] CodeCompletionTest.SanityNoneValid
[       OK ] CodeCompletionTest.SanityNoneValid (38 ms)
[ RUN      ] CodeCompletionTest.TwoDecls
[       OK ] CodeCompletionTest.TwoDecls (44 ms)
[ RUN      ] CodeCompletionTest.CompFunDeclsNoError
[       OK ] CodeCompletionTest.CompFunDeclsNoError (44 ms)
[ RUN      ] CodeCompletionTest.TypedDirected
[       OK ] CodeCompletionTest.TypedDirected (85 ms)
[ RUN      ] CodeCompletionTest.SanityClasses
[       OK ] CodeCompletionTest.SanityClasses (67 ms)
[ RUN      ] CodeCompletionTest.SubClassing
[       OK ] CodeCompletionTest.SubClassing (50 ms)
[ RUN      ] CodeCompletionTest.MultipleArguments
[       OK ] CodeCompletionTest.MultipleArguments (49 ms)
[ RUN      ] CodeCompletionTest.Methods
[       OK ] CodeCompletionTest.Methods (57 ms)
[ RUN      ] CodeCompletionTest.MethodsInvocations
[       OK ] CodeCompletionTest.MethodsInvocations (43 ms)
[ RUN      ] CodeCompletionTest.NestedInvocations
[       OK ] CodeCompletionTest.NestedInvocations (43 ms)
[ RUN      ] CodeCompletionTest.TemplateFunctions
[       OK ] CodeCompletionTest.TemplateFunctions (73 ms)
[----------] 12 tests from CodeCompletionTest (680 ms total)

[----------] Global test environment tear-down
[==========] 32 tests from 5 test suites ran. (2108 ms total)
[  PASSED  ] 26 tests.
[  SKIPPED ] 6 tests, listed below:
[  SKIPPED ] IncrementalCompilerBuilder.SetTargetTriple
[  SKIPPED ] InterpreterTest.UndoLeavesDeclsInTranslationUnitChain
[  SKIPPED ] InterpreterTest.UndoCommand
[  SKIPPED ] InterpreterTest.ValueMoveSemantics
[  SKIPPED ] InterpreterExtensionsTest.DefaultCrossJIT
[  SKIPPED ] InterpreterExtensionsTest.CustomCrossJIT

```

https://github.com/llvm/llvm-project/pull/197133


More information about the cfe-commits mailing list