[all-commits] [llvm/llvm-project] 67a112: [Frontend] Don't output skipped includes from pred...

Shoaib Meenai via All-commits all-commits at lists.llvm.org
Wed Jun 21 15:50:08 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 67a11290df64fec44e671a1bdc3a225ed8a02962
      https://github.com/llvm/llvm-project/commit/67a11290df64fec44e671a1bdc3a225ed8a02962
  Author: Shoaib Meenai <smeenai at fb.com>
  Date:   2023-06-21 (Wed, 21 Jun 2023)

  Changed paths:
    M clang/lib/Frontend/HeaderIncludeGen.cpp
    M clang/test/Frontend/print-header-includes.c

  Log Message:
  -----------
  [Frontend] Don't output skipped includes from predefines

`-H` displays a tree of included header files, but that tree is supposed
to omit two categories of header files:
1. Any header files pulled in via `-include`, which the code refers to
   as the "predefines".
2. Any header files whose inclusion was skipped because they'd already
   been included (assuming header guards or `#pragma once`).

`-fshow-skipped-includes` was intended to make `-H` display the second
category of files. It wasn't checking for the first category, however,
so you could end up with only the middle of the `-include` hierarchy
displayed, e.g. the added test would previously output:

```
... /data/users/smeenai/llvm-project/clang/test/Frontend/Inputs/test2.h
. /data/users/smeenai/llvm-project/clang/test/Frontend/Inputs/test.h
```

This diff adds a check to prevent that and correctly omit headers from
`-include` even when `-fshow-skipped-includes` is passed. While I'm
here, add tests for the interaction between `-fshow-skipped-includes`
and `-sys-header-deps` as well.

Reviewed By: hans

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


  Commit: 1df10f15807f9b7deba3f714d27e21578a8b4748
      https://github.com/llvm/llvm-project/commit/1df10f15807f9b7deba3f714d27e21578a8b4748
  Author: Shoaib Meenai <smeenai at fb.com>
  Date:   2023-06-21 (Wed, 21 Jun 2023)

  Changed paths:
    M clang/include/clang/Frontend/DependencyOutputOptions.h
    M clang/lib/Frontend/HeaderIncludeGen.cpp

  Log Message:
  -----------
  [Frontend] Remove ShowIncludesPretendHeader

It hasn't been written to since https://reviews.llvm.org/D46652, so it
was always empty. I don't have enough context on that diff to know if
the removal of the write to ShowIncludesPretendHeader in that diff was
intentional, but no one's complained about it for five years, so I
assume we're okay to just get rid of it entirely.

Reviewed By: hans

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


Compare: https://github.com/llvm/llvm-project/compare/2bcbcbefcd0f...1df10f15807f


More information about the All-commits mailing list