[PATCH] D53329: Generate DIFile with main program if source is not available

Yonghong Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 16 10:18:32 PDT 2018


yonghong-song added a comment.

We already have `-main-file-name` in cc1.
`clang -cc1 -triple x86_64-unknown-linux-gnu ... -main-file-name main.c ... -o main.bc -x c /virtual/main.c -faddrsig`
Is this expected?

BTW, we just pass the normal C flags to the driver like

  vector<const char *> flags_cstr({"-O0", "-O2", "-emit-llvm", "-I", dstack.cwd(),
                                   "-D", "__BPF_TRACING__",
                                   "-Wno-deprecated-declarations",
                                   "-Wno-gnu-variable-sized-type-not-at-end",
                                   "-Wno-pragma-once-outside-header",
                                   "-Wno-address-of-packed-member",
                                   "-Wno-unknown-warning-option",
                                   "-fno-color-diagnostics",
                                   "-fno-unwind-tables",
                                   "-fno-asynchronous-unwind-tables",
                                   "-x", "c", "-c", abs_file.c_str()});
  flags_cstr.push_back("-g");
  flags_cstr.push_back("-gdwarf-5");
  flags_cstr.push_back("-gembed-source");
  // A few other flags

We call drv.BuildCompilation to get the cc1 flags.


Repository:
  rC Clang

https://reviews.llvm.org/D53329





More information about the cfe-commits mailing list