如果使用该-x标志指定了语言,Clang可以通过管道接受源文件.
cat hello_world.c | clang -x c -o hello_world
Run Code Online (Sandbox Code Playgroud)
Clang还可以将LLVM IR和bitcode编译为目标文件
clang hello_world.c -S -emit-llvm && clang -o hello_world hello_world.ll
Run Code Online (Sandbox Code Playgroud)
我想编译通过管道传递的LLVM IR或bitcode.但是,我找不到任何关于该-x选项接受的参数的文档.我可以使用c,c++但是clang不承认llvm或bitcode.
我能给予什么-x,Clang会接受IR还是bitcode?
你正在寻找的语言标志是ir.例如:
clang hello_world.c -S -emit-llvm -o - | clang -x ir -o hello_world -
Run Code Online (Sandbox Code Playgroud)
适合我(clang版本3.5,主干200156).