llvm-project/clang/lib/Frontend
Argyrios Kyrtzidis b4c83a13f6 [Tooling/DependencyScanning & Preprocessor] Refactor dependency scanning to produce pre-lexed preprocessor directive tokens, instead of minimized sources
This is a commit with the following changes:

* Remove `ExcludedPreprocessorDirectiveSkipMapping` and related functionality

Removes `ExcludedPreprocessorDirectiveSkipMapping`; its intended benefit for fast skipping of excluded directived blocks
will be superseded by a follow-up patch in the series that will use dependency scanning lexing for the same purpose.

* Refactor dependency scanning to produce pre-lexed preprocessor directive tokens, instead of minimized sources

Replaces the "source minimization" mechanism with a mechanism that produces lexed dependency directives tokens.

* Make the special lexing for dependency scanning a first-class feature of the `Preprocessor` and `Lexer`

This is bringing the following benefits:

    * Full access to the preprocessor state during dependency scanning. E.g. a component can see what includes were taken and where they were located in the actual sources.
    * Improved performance for dependency scanning. Measurements with a release+thin-LTO build shows ~ -11% reduction in wall time.
    * Opportunity to use dependency scanning lexing to speed-up skipping of excluded conditional blocks during normal preprocessing (as follow-up, not part of this patch).

For normal preprocessing measurements show differences are below the noise level.

Since, after this change, we don't minimize sources and pass them in place of the real sources, `DependencyScanningFilesystem` is not technically necessary, but it has valuable performance benefits for caching file `stat`s along with the results of scanning the sources. So the setup of using the `DependencyScanningFilesystem` during a dependency scan remains.

Differential Revision: https://reviews.llvm.org/D125486
Differential Revision: https://reviews.llvm.org/D125487
Differential Revision: https://reviews.llvm.org/D125488
2022-05-26 12:50:06 -07:00
..
Rewrite Revert "Revert "Revert "[clang][pp] adds '#pragma include_instead'""" 2022-04-22 16:37:20 +00:00
ASTConsumers.cpp [clang] Fix JSON AST output when a filter is used 2021-10-10 07:46:17 +05:30
ASTMerge.cpp
ASTUnit.cpp [Frontend] Flip default of CreateInvocationOptions::ProbePrecompiled to false 2022-05-10 16:58:13 +02:00
CMakeLists.txt [clang][extract-api] Add global record support 2022-03-16 15:13:55 -07: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] NFCI: Use DirectoryEntryRef in collectIncludePCH 2022-04-15 15:16:17 +02:00
CompilerInvocation.cpp Move GCC-compatible pod-packing change to v15/old behavior available at v14 and below 2022-05-25 03:03:27 +00:00
CreateInvocationFromCommandLine.cpp [clang] createInvocationFromCommandLine -> createInvocation, delete former. NFC 2022-05-06 16:21:48 +02:00
DependencyFile.cpp [clang][lex] NFCI: Use FileEntryRef in PPCallbacks::InclusionDirective() 2022-04-14 10:46:12 +02:00
DependencyGraph.cpp [clang][lex] NFCI: Use FileEntryRef in PPCallbacks::InclusionDirective() 2022-04-14 10:46:12 +02:00
DiagnosticRenderer.cpp [clang][Frontend] Fix a crash in DiagnosticRenderer. 2021-02-17 09:02:49 +01:00
FrontendAction.cpp [clang] NFCI: Use DirectoryEntryRef in FrontendAction::BeginSourceFile() 2022-04-20 18:54:39 +02:00
FrontendActions.cpp [Tooling/DependencyScanning & Preprocessor] Refactor dependency scanning to produce pre-lexed preprocessor directive tokens, instead of minimized sources 2022-05-26 12:50:06 -07:00
FrontendOptions.cpp [C++20][Modules][Driver][HU 1/N] Initial handling for -xc++-{system,user}-header. 2022-04-22 09:24:29 +01:00
HeaderIncludeGen.cpp [clang] Inclusive language: change instances of blacklist/whitelist to allowlist/ignorelist 2021-11-12 15:46:16 +00:00
InitPreprocessor.cpp [Frontend] Move, don't copy the predefines buffer into PP. NFC. 2022-05-08 01:04:46 +02:00
InterfaceStubFunctionsConsumer.cpp [ifs] Prepare llvm-ifs for elfabi/ifs merging. 2021-07-19 11:23:00 -07:00
LayoutOverrideSource.cpp [Driver, Frontend] Use StringRef::contains (NFC) 2021-10-19 08:54:02 -07:00
LogDiagnosticPrinter.cpp Remove a few effectively-unused FileEntry APIs. NFC 2022-04-07 16:45:47 +02:00
ModuleDependencyCollector.cpp [clang][lex] NFCI: Use FileEntryRef in PPCallbacks::InclusionDirective() 2022-04-14 10:46:12 +02:00
MultiplexConsumer.cpp [Clang] Override method ModuleImportRead in MultiplexASTDeserializationListener 2022-04-11 08:38:37 -04:00
PrecompiledPreamble.cpp [Frontend] when attaching a preamble, don't generate the long predefines buffer. 2022-05-09 15:55:32 +02:00
PrintPreprocessedOutput.cpp [clang][lex] NFCI: Use FileEntryRef in PPCallbacks::InclusionDirective() 2022-04-14 10:46:12 +02:00
SerializedDiagnosticPrinter.cpp [clang] Remove redundant member initialization (NFC) 2022-01-02 10:20:23 -08:00
SerializedDiagnosticReader.cpp
TestModuleFileExtension.cpp [NFC][clang] Return underlying strings directly instead of OS.str() 2021-12-09 16:05:46 -08:00
TestModuleFileExtension.h [modules] Use `HashBuilder` and `MD5` for the module hash. 2021-09-03 11:13:36 -07:00
TextDiagnostic.cpp Remove a few effectively-unused FileEntry APIs. NFC 2022-04-07 16:45:47 +02:00
TextDiagnosticBuffer.cpp
TextDiagnosticPrinter.cpp [clang-cl] Remove the /fallback option 2021-02-04 10:33:16 +01:00
VerifyDiagnosticConsumer.cpp [clang][lex] NFC: Simplify calls to `LookupFile` 2022-01-18 16:02:18 +01:00