-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang][deps] Skip writing DIAG_PRAGMA_MAPPINGS
record
#70874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jansvoboda11
merged 1 commit into
llvm:main
from
jansvoboda11:skip-pragma-diag-mappings
Nov 10, 2023
Merged
[clang][deps] Skip writing DIAG_PRAGMA_MAPPINGS
record
#70874
jansvoboda11
merged 1 commit into
llvm:main
from
jansvoboda11:skip-pragma-diag-mappings
Nov 10, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c3602bc
to
450c5ad
Compare
@llvm/pr-subscribers-clang-modules @llvm/pr-subscribers-clang Author: Jan Svoboda (jansvoboda11) ChangesFull diff: https://github.com/llvm/llvm-project/pull/70874.diff 3 Files Affected:
diff --git a/clang/include/clang/Lex/HeaderSearchOptions.h b/clang/include/clang/Lex/HeaderSearchOptions.h
index 114af14dec7f5a8..fa2d0b502d72c19 100644
--- a/clang/include/clang/Lex/HeaderSearchOptions.h
+++ b/clang/include/clang/Lex/HeaderSearchOptions.h
@@ -247,6 +247,11 @@ class HeaderSearchOptions {
LLVM_PREFERRED_TYPE(bool)
unsigned ModulesSkipHeaderSearchPaths : 1;
+ /// Whether to entirely skip writing pragma diagnostic mappings.
+ /// Primarily used to speed up deserialization during dependency scanning.
+ LLVM_PREFERRED_TYPE(bool)
+ unsigned ModulesSkipPragmaDiagnosticMappings : 1;
+
LLVM_PREFERRED_TYPE(bool)
unsigned ModulesHashContent : 1;
@@ -270,7 +275,8 @@ class HeaderSearchOptions {
ForceCheckCXX20ModulesInputFiles(false), UseDebugInfo(false),
ModulesValidateDiagnosticOptions(true),
ModulesSkipDiagnosticOptions(false),
- ModulesSkipHeaderSearchPaths(false), ModulesHashContent(false),
+ ModulesSkipHeaderSearchPaths(false),
+ ModulesSkipPragmaDiagnosticMappings(false), ModulesHashContent(false),
ModulesStrictContextHash(false) {}
/// AddPath - Add the \p Path path to the specified \p Group list.
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 1e86566d81fbc02..0161ad10f3f2381 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -1261,8 +1261,8 @@ void ASTWriter::writeUnhashedControlBlock(Preprocessor &PP,
Stream.EmitRecord(HEADER_SEARCH_PATHS, Record);
}
- // Write out the diagnostic/pragma mappings.
- WritePragmaDiagnosticMappings(Diags, /* isModule = */ WritingModule);
+ if (!HSOpts.ModulesSkipPragmaDiagnosticMappings)
+ WritePragmaDiagnosticMappings(Diags, /* isModule = */ WritingModule);
// Header search entry usage.
auto HSEntryUsage = PP.getHeaderSearchInfo().computeUserEntryUsage();
diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
index d1d3cc50cb25b83..c54e6d523800b6b 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -255,6 +255,8 @@ class DependencyScanningAction : public tooling::ToolAction {
ScanInstance.getHeaderSearchOpts().ModulesStrictContextHash = true;
ScanInstance.getHeaderSearchOpts().ModulesSkipDiagnosticOptions = true;
ScanInstance.getHeaderSearchOpts().ModulesSkipHeaderSearchPaths = true;
+ ScanInstance.getHeaderSearchOpts().ModulesSkipPragmaDiagnosticMappings =
+ true;
// Avoid some checks and module map parsing when loading PCM files.
ScanInstance.getPreprocessorOpts().ModulesCheckRelocated = false;
|
benlangmuir
approved these changes
Nov 10, 2023
jansvoboda11
added a commit
to swiftlang/llvm-project
that referenced
this pull request
Nov 10, 2023
Following up on llvm#69975, this patch skips writing `DIAG_PRAGMA_MAPPINGS` as well. Deserialization of this PCM record is still showing up in profiles, since it needs to be VBR-decoded for every transitively loaded PCM file. The scanner doesn't make any guarantees about diagnostic accuracy (and it even disables all warnings), so skipping this record should be safe. (cherry picked from commit 22c6851)
zahiraam
pushed a commit
to zahiraam/llvm-project
that referenced
this pull request
Nov 20, 2023
Following up on llvm#69975, this patch skips writing `DIAG_PRAGMA_MAPPINGS` as well. Deserialization of this PCM record is still showing up in profiles, since it needs to be VBR-decoded for every transitively loaded PCM file. The scanner doesn't make any guarantees about diagnostic accuracy (and it even disables all warnings), so skipping this record should be safe.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
clang:modules
C++20 modules and Clang Header Modules
clang
Clang issues not falling into any other category
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following up on #69975, this patch skips writing
DIAG_PRAGMA_MAPPINGS
as well. Deserialization of this PCM record is still showing up in profiles, since it needs to be VBR-decoded for every transitively loaded PCM file.The scanner doesn't make any guarantees about diagnostic accuracy (and it even disables all warnings), so skipping this record should be safe.