0

我正在做一些 Clang 源到源的转换。我是从 Clang 源代码做的:clang/tools/extra. 我所做的是printf("Hello World\n");在 main 方法的开头添加一个。它工作得很好,我运行我的工具bin/add-code ../../test/hello.c,它变成了:

#include <stdio.h>

int main(){
  printf("This is from main ....\n");

  return 0;
}

对此:

#include <stdio.h>

int main(){
  printf("Hello World\n");
  printf("This is from main ....\n");

  return 0;
}

add-code是我写的 clang libtool。
但是这个重写器只将更改写入终端;而我想用修改编译 hello.c 并想用 clang 命令来做,clang -c hello.c不像我在这里做的那样。
我怎么能那样做?

4

0 回答 0