From c12577c61dbf37b1b6ae25ed422a900ac71f18fe Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Thu, 9 Jun 2022 16:58:09 +0200 Subject: [clang][driver] Introduce new -fdriver-only flag This patch introduces the new -fdriver-only flag which instructs Clang to only execute the driver logic without running individual jobs. In a way, this is very similar to -###, with the following differences: * it doesn't automatically print all jobs, * it doesn't avoid side effects (e.g. it will generate compilation database when -MJ is specified). This flag will be useful in testing D121997. Reviewed By: dexonsmith, egorzhdan Differential Revision: https://reviews.llvm.org/D127408 --- clang/lib/Frontend/CreateInvocationFromCommandLine.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/Frontend/CreateInvocationFromCommandLine.cpp') diff --git a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp index 49e814b..35b5e21 100644 --- a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -54,6 +54,9 @@ clang::createInvocation(ArrayRef ArgList, if (!C) return nullptr; + if (C->getArgs().hasArg(driver::options::OPT_fdriver_only)) + return nullptr; + // Just print the cc1 options if -### was present. if (C->getArgs().hasArg(driver::options::OPT__HASH_HASH_HASH)) { C->getJobs().Print(llvm::errs(), "\n", true); -- cgit v1.1