Author: Andrew V. Teylu Date: 2024-04-04T18:10:23+08:00 New Revision: cbdc86e46c3824dda152db2bd0b9fdb3872ddf87
URL: https://github.com/llvm/llvm-project/commit/cbdc86e46c3824dda152db2bd0b9fdb3872ddf87 DIFF: https://github.com/llvm/llvm-project/commit/cbdc86e46c3824dda152db2bd0b9fdb3872ddf87.diff LOG: [clang-repl] Add call to 'InitializeAllAsmParsers' (#86727) This PR fixes the following issue when working with `clang-repl`: ``` fatal error: error in backend: Inline asm not supported by this streamer because we don't have an asm parser for this target ``` When working with the following input (named "unit.cpp"): ```cpp __asm(".globl _ZSt21ios_base_library_initv"); int x; ``` and then in `clang-repl`: ``` #include "unit.cpp" x = 10; ``` Signed-off-by: Andrew V. Teylu <andrew.te...@vector.com> Added: clang/test/Interpreter/inline-asm.cpp Modified: clang/tools/clang-repl/ClangRepl.cpp Removed: ################################################################################ diff --git a/clang/test/Interpreter/inline-asm.cpp b/clang/test/Interpreter/inline-asm.cpp new file mode 100644 index 00000000000000..f94f14df72f80e --- /dev/null +++ b/clang/test/Interpreter/inline-asm.cpp @@ -0,0 +1,17 @@ +// REQUIRES: host-supports-jit, x86_64-linux +// UNSUPPORTED: system-aix +// +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// +// RUN: cat %t/inline-asm.txt | clang-repl -Xcc="-I%t" + +//--- inline-asm.cpp +__asm(".globl _ZSt21ios_base_library_initv"); +int x; + +//--- inline-asm.txt +#include "inline-asm.cpp" +x = 10; +%quit diff --git a/clang/tools/clang-repl/ClangRepl.cpp b/clang/tools/clang-repl/ClangRepl.cpp index 5bad8145324d06..aecf61b97fc719 100644 --- a/clang/tools/clang-repl/ClangRepl.cpp +++ b/clang/tools/clang-repl/ClangRepl.cpp @@ -152,6 +152,7 @@ int main(int argc, const char **argv) { llvm::InitializeAllTargets(); llvm::InitializeAllTargetMCs(); llvm::InitializeAllAsmPrinters(); + llvm::InitializeAllAsmParsers(); if (OptHostSupportsJit) { auto J = llvm::orc::LLJITBuilder().create(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits