llvm-project/clang/lib/Frontend
Hans Wennborg f29dcbdde1 Add flag for showing skipped headers in -H / --show-includes output
Consider the following set of files:

  a.cc:
  #include "a.h"

  a.h:
  #ifndef A_H
  #define A_H

  #include "b.h"
  #include "c.h"  // This gets "skipped".

  #endif

  b.h:
  #ifndef B_H
  #define B_H

  #include "c.h"

  #endif

  c.h:
  #ifndef C_H
  #define C_H

  void c();

  #endif

And the output of the -H option:

  $ clang -c -H a.cc
  . ./a.h
  .. ./b.h
  ... ./c.h

Note that the include of c.h in a.h is not shown in the output (GCC does the
same). This is because of the include guard optimization: clang knows c.h is
covered by an include guard which is already defined, so when it sees the
include in a.h, it skips it. The same would have happened if #pragma once were
used instead of include guards.

However, a.h *does* include c.h, and it may be useful to show that in the -H
output. This patch adds a flag for doing that.

Differential revision: https://reviews.llvm.org/D100480
2021-04-14 17:01:51 +02:00
..
Rewrite [Windows] Turn off text mode correctly in Rewriter to stop CRLF translation 2021-04-06 10:49:09 -04:00
ASTConsumers.cpp [clang][NFC] Store a pointer to the ASTContext in ASTDumper and TextNodeDumper 2020-07-03 13:59:22 +01:00
ASTMerge.cpp [ASTImporter] Mark erroneous nodes in shared st 2019-07-01 15:37:07 +00:00
ASTUnit.cpp [clang][clangd] Avoid inconsistent target creation 2021-04-06 23:23:34 +08:00
CMakeLists.txt Revert "[Clang] Move assembler into a separate file" 2021-01-23 15:04:27 +01:00
ChainedDiagnosticConsumer.cpp
ChainedIncludesSource.cpp [ASTReader] Allow controlling separately whether validation should be disabled for a PCH vs a module file 2021-01-21 20:45:54 -08:00
CompilerInstance.cpp [clang] Check AuxTarget exists when creating target in CompilerInstance 2021-04-07 20:58:48 +08:00
CompilerInvocation.cpp [clang] Fix copy constructor of CompilerInvocation 2021-04-14 09:13:35 +02:00
CreateInvocationFromCommandLine.cpp [flang][driver] Add the new flang compiler and frontend drivers 2020-09-11 10:55:54 +01:00
DependencyFile.cpp [SystemZ][z/OS][Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text 2021-04-06 07:23:31 -04:00
DependencyGraph.cpp [SystemZ][z/OS][Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text 2021-04-06 07:23:31 -04:00
DiagnosticRenderer.cpp [clang][Frontend] Fix a crash in DiagnosticRenderer. 2021-02-17 09:02:49 +01:00
FrontendAction.cpp [ASTReader] Allow controlling separately whether validation should be disabled for a PCH vs a module file 2021-01-21 20:45:54 -08:00
FrontendActions.cpp [SystemZ][z/OS][Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text 2021-04-06 07:23:31 -04:00
FrontendOptions.cpp [OpenCL] Added distinct file extension for C++ for OpenCL. 2021-03-24 13:07:04 +00:00
HeaderIncludeGen.cpp Add flag for showing skipped headers in -H / --show-includes output 2021-04-14 17:01:51 +02:00
InitHeaderSearch.cpp [clang][Driver] Implement AddClangSystemIncludeArgs and HasNativeLLVMSupport for the OpenBSD clang driver. 2020-08-23 20:08:40 -04:00
InitPreprocessor.cpp String Literal and Wide String Literal Encoding from the Preprocessor 2021-04-13 14:18:07 -04:00
InterfaceStubFunctionsConsumer.cpp Revert "[NFC, Refactor] Modernize StorageClass from Specifiers.h to a scoped enum (II)" 2021-01-04 23:17:45 +01:00
LayoutOverrideSource.cpp
LogDiagnosticPrinter.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
ModuleDependencyCollector.cpp [SystemZ][z/OS][Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text 2021-04-06 07:23:31 -04:00
MultiplexConsumer.cpp [AST] Add missing MultiplexConsumer::CompleteExternalDeclaration 2019-12-22 19:00:48 -08:00
PrecompiledPreamble.cpp [clang][clangd] Avoid inconsistent target creation 2021-04-06 23:23:34 +08:00
PrintPreprocessedOutput.cpp [Clang] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:04:18 +00:00
SerializedDiagnosticPrinter.cpp CrashTracer: clang at clang: llvm::BitstreamWriter::ExitBlock 2020-07-09 20:27:33 -07:00
SerializedDiagnosticReader.cpp Bitstream reader: Fix undefined behavior seen after rL364464 2019-07-05 20:22:40 +00:00
TestModuleFileExtension.cpp [clang][modules] Use extensible RTTI for ModuleFileExtension 2021-03-05 11:11:05 +01:00
TestModuleFileExtension.h [clang][modules] Use extensible RTTI for ModuleFileExtension 2021-03-05 11:11:05 +01:00
TextDiagnostic.cpp [clang-cl] Remove the /fallback option 2021-02-04 10:33:16 +01:00
TextDiagnosticBuffer.cpp Fix more implicit conversions. Getting closer to having clang working with gcc 5 again 2020-01-29 02:57:59 +01:00
TextDiagnosticPrinter.cpp [clang-cl] Remove the /fallback option 2021-02-04 10:33:16 +01:00
VerifyDiagnosticConsumer.cpp Frontend: Migrate to FileEntryRef in VerifyDiagnosticConsumer.cpp, NFC 2020-12-09 11:51:43 -08:00