[all-commits] [llvm/llvm-project] 3738ce: Add support for a backdoor driver option that enab...

Akira Hatanaka via All-commits all-commits at lists.llvm.org
Wed Dec 7 15:31:53 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3738ce05a70cf97fc73a07b158a1726f61aed28b
      https://github.com/llvm/llvm-project/commit/3738ce05a70cf97fc73a07b158a1726f61aed28b
  Author: Akira Hatanaka <ahatanaka at apple.com>
  Date:   2022-12-07 (Wed, 07 Dec 2022)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    A clang/include/clang/Basic/HeaderInclude.h
    M clang/include/clang/Driver/Driver.h
    M clang/include/clang/Driver/Options.td
    M clang/include/clang/Frontend/DependencyOutputOptions.h
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/lib/Frontend/HeaderIncludeGen.cpp
    A clang/test/Preprocessor/Inputs/print-header-json/header0.h
    A clang/test/Preprocessor/Inputs/print-header-json/header1.h
    A clang/test/Preprocessor/Inputs/print-header-json/header2.h
    A clang/test/Preprocessor/Inputs/print-header-json/system/system0.h
    A clang/test/Preprocessor/Inputs/print-header-json/system/system1.h
    A clang/test/Preprocessor/Inputs/print-header-json/system/system2.h
    A clang/test/Preprocessor/Inputs/print-header-json/system/system3.h
    A clang/test/Preprocessor/print-header-json.c
    M clang/tools/driver/driver.cpp

  Log Message:
  -----------
  Add support for a backdoor driver option that enables emitting header
usage information in JSON to a file

Each line in the file is a JSON object that has the name of the main
source file followed by the list of system header files included
directly or indirectly from that file.

For example:

{"source":"/tmp/foo.c",
 "includes":["/usr/include/stdio.h", "/usr/include/stdlib.h"]}

To reduce the amount of data written to the file, only the system
headers that are directly included from a non-system header file are
recorded.

In order to emit the header information in JSON, it is necessary to set
the following environment variables:

CC_PRINT_HEADERS_FORMAT=json CC_PRINT_HEADERS_FILTERING=only-direct-system

The following combination is equivalent to setting CC_PRINT_HEADERS=1:

CC_PRINT_HEADERS_FORMAT=textual CC_PRINT_HEADERS_FILTERING=none

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




More information about the All-commits mailing list