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

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 26 13:15:19 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Andrew V. Teylu (aytey)

<details>
<summary>Changes</summary>

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.teylu@<!-- -->vector.com>

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


1 Files Affected:

- (modified) clang/tools/clang-repl/ClangRepl.cpp (+1) 


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

``````````

</details>


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


More information about the cfe-commits mailing list