[PATCH] D137996: Add support for a backdoor driver option that enables emitting header usage information in JSON to a file

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 14 17:22:13 PST 2022


ahatanak created this revision.
ahatanak added reviewers: jansvoboda11, akyrtzi.
ahatanak added a project: clang.
Herald added a project: All.
ahatanak requested review of this revision.
Herald added a subscriber: MaskRay.

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 file that isn't in the system directory are recorded.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137996

Files:
  clang/include/clang/Driver/Driver.h
  clang/include/clang/Driver/Options.td
  clang/include/clang/Frontend/DependencyOutputOptions.h
  clang/include/clang/Frontend/Utils.h
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Frontend/HeaderIncludeGen.cpp
  clang/test/Preprocessor/Inputs/print-header-json/header0.h
  clang/test/Preprocessor/Inputs/print-header-json/header1.h
  clang/test/Preprocessor/Inputs/print-header-json/header2.h
  clang/test/Preprocessor/Inputs/print-header-json/system/system0.h
  clang/test/Preprocessor/Inputs/print-header-json/system/system1.h
  clang/test/Preprocessor/Inputs/print-header-json/system/system2.h
  clang/test/Preprocessor/Inputs/print-header-json/system/system3.h
  clang/test/Preprocessor/print-header-json.c
  clang/tools/driver/driver.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137996.475312.patch
Type: text/x-patch
Size: 13040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221115/1ba39306/attachment.bin>


More information about the cfe-commits mailing list