Skip to content

Commit cbdc86e

Browse files
authored
[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 <[email protected]>
1 parent d799be8 commit cbdc86e

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

clang/test/Interpreter/inline-asm.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// REQUIRES: host-supports-jit, x86_64-linux
2+
// UNSUPPORTED: system-aix
3+
//
4+
// RUN: rm -rf %t
5+
// RUN: mkdir -p %t
6+
// RUN: split-file %s %t
7+
//
8+
// RUN: cat %t/inline-asm.txt | clang-repl -Xcc="-I%t"
9+
10+
//--- inline-asm.cpp
11+
__asm(".globl _ZSt21ios_base_library_initv");
12+
int x;
13+
14+
//--- inline-asm.txt
15+
#include "inline-asm.cpp"
16+
x = 10;
17+
%quit

clang/tools/clang-repl/ClangRepl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ int main(int argc, const char **argv) {
152152
llvm::InitializeAllTargets();
153153
llvm::InitializeAllTargetMCs();
154154
llvm::InitializeAllAsmPrinters();
155+
llvm::InitializeAllAsmParsers();
155156

156157
if (OptHostSupportsJit) {
157158
auto J = llvm::orc::LLJITBuilder().create();

0 commit comments

Comments
 (0)