[all-commits] [llvm/llvm-project] c12577: [clang][driver] Introduce new -fdriver-only flag

Jan Svoboda via All-commits all-commits at lists.llvm.org
Mon Jun 13 04:31:12 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c12577c61dbf37b1b6ae25ed422a900ac71f18fe
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2022-06-13 (Mon, 13 Jun 2022)

  Changed paths:
    M clang/include/clang/Driver/Compilation.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/Compilation.cpp
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
    M clang/test/Driver/cc-print-options.c
    A clang/test/Driver/driver-only.c

  Log Message:
  [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

  Commit: a85670001ba2487988839656299771915ebc7633
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2022-06-13 (Mon, 13 Jun 2022)

  Changed paths:
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/test/Driver/compilation_database.c
    A clang/test/Driver/compilation_database_multiarch.c

  Log Message:
  [clang][driver] Fix compilation database dump with multiple architectures

Command lines with multiple `-arch` arguments expand into multiple entries in the compilation database. However, the file writes are not appending, meaning subsequent writes end up overwriting the previous ones, resulting in garbled output.

This patch fixes that by always appending to the file.


Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D121997

Compare: https://github.com/llvm/llvm-project/compare/84b9ae662419...a85670001ba2

More information about the All-commits mailing list