[clang] [clang-repl] Add call to 'InitializeAllAsmParsers' (PR #86727)

Andrew V. Teylu via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 2 04:41:46 PDT 2024


https://github.com/aytey updated https://github.com/llvm/llvm-project/pull/86727

>From 480d77eb88df2abc589c4be90ceab200cb3fac98 Mon Sep 17 00:00:00 2001
From: "Andrew V. Teylu" <andrew.teylu at vector.com>
Date: Tue, 26 Mar 2024 20:10:24 +0000
Subject: [PATCH 1/2] [clang-repl] Add call to 'InitializeAllAsmParsers'

Signed-off-by: Andrew V. Teylu <andrew.teylu at vector.com>
---
 clang/tools/clang-repl/ClangRepl.cpp | 1 +
 1 file changed, 1 insertion(+)

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();

>From d1e104977e22c4d641459714c4e45acdb87576b1 Mon Sep 17 00:00:00 2001
From: "Andrew V. Teylu" <andrew.teylu at vector.com>
Date: Tue, 26 Mar 2024 20:49:53 +0000
Subject: [PATCH 2/2] [clang-repl] add test for inline asm

Signed-off-by: Andrew V. Teylu <andrew.teylu at vector.com>
---
 clang/test/Interpreter/inline-asm.cpp | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 clang/test/Interpreter/inline-asm.cpp

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



More information about the cfe-commits mailing list