[PATCH] D136895: [WIP][llvm-driver] Accept -cc1 and friends as tools meaning clang

Alex Brachet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 19:41:01 PDT 2022


abrachet marked an inline comment as done.
abrachet added inline comments.


================
Comment at: llvm/tools/llvm-driver/llvm-driver.cpp:65-71
+  if constexpr (isClangDefined()) {
+    if (Argc > 1) {
+      StringRef Argv1 = Argv[1];
+      if (Argv1 == "-cc1" || Argv1 == "-cc1as" || Argv1 == "-cc1gen-reproducer")
+        return clang_main(Argc, Argv);
+    }
+  }
----------------
phosek wrote:
> Could you instead include `-cc1`, `-cc1as` and `-cc1gen-reproducer` as an alias for `clang` by appending them to `LLVM_DRIVER_TOOL_ALIASES_clang`?
Unfortunately not because these are the 1st argument and not the executable name so we would end up invoking clang with argv[0] as "-cc1" and that arg would get skipped.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136895/new/

https://reviews.llvm.org/D136895



More information about the llvm-commits mailing list