如果使用-x
标志指定语言,Clang可以通过管道接受源文件。
cat hello_world.c | clang -x c -o hello_world
Clang还可以编译LLVM IR和位码到目标文件
clang hello_world.c -S -emit-llvm && clang -o hello_world hello_world.ll
我想编译通过管道传递的LLVM IR或位码。但是,我找不到关于-x
选项接受什么参数的任何文档。我可以使用c
, c++
,但clang不识别llvm
或bitcode
。
我可以给-x
什么,以便Clang接受IR或位码?
您要查找的语言标志是ir
。例如:
clang hello_world.c -S -emit-llvm -o - | clang -x ir -o hello_world -
for me (clang version 3.5, trunk 200156)