Clang can accept source files through a pipe if a language is specified with the -x
flag.
cat hello_world.c | clang -x c -o hello_world
Clang can also compile LLVM IR and bitcode to object files
clang hello_world.c -S -emit-llvm && clang -o hello_world hello_world.ll
I want to compile LLVM IR or bitcode passed via a pipe. However, I can't find any documentation on exactly what parameters the -x
option accepts. I can use c
, c++
, but clang doesn't recognize llvm
or bitcode
.
What can I give to -x
so Clang will accept IR or bitcode?