Skip to content

Commit

Permalink
[clang][serialization] Reduce `ASTWriter::writeUnhashedControlBlock()…
Browse files Browse the repository at this point in the history
…` scope
  • Loading branch information
jansvoboda11 committed Nov 6, 2024
1 parent 4a6d13b commit 304c412
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion clang/include/clang/Serialization/ASTWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ class ASTWriter : public ASTDeserializationListener,
void WriteControlBlock(Preprocessor &PP, StringRef isysroot);

/// Write out the signature and diagnostic options, and return the signature.
void writeUnhashedControlBlock(Preprocessor &PP, ASTContext &Context);
void writeUnhashedControlBlock(Preprocessor &PP);
ASTFileSignature backpatchSignature();

/// Calculate hash of the pcm content.
Expand Down
7 changes: 3 additions & 4 deletions clang/lib/Serialization/ASTWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,8 +1269,7 @@ ASTFileSignature ASTWriter::backpatchSignature() {
return Signature;
}

void ASTWriter::writeUnhashedControlBlock(Preprocessor &PP,
ASTContext &Context) {
void ASTWriter::writeUnhashedControlBlock(Preprocessor &PP) {
using namespace llvm;

// Flush first to prepare the PCM hash (signature).
Expand Down Expand Up @@ -1323,7 +1322,7 @@ void ASTWriter::writeUnhashedControlBlock(Preprocessor &PP,
const auto &HSOpts = PP.getHeaderSearchInfo().getHeaderSearchOpts();

// Diagnostic options.
const auto &Diags = Context.getDiagnostics();
const auto &Diags = PP.getDiagnostics();
const DiagnosticOptions &DiagOpts = Diags.getDiagnosticOptions();
if (!HSOpts.ModulesSkipDiagnosticOptions) {
#define DIAGOPT(Name, Bits, Default) Record.push_back(DiagOpts.Name);
Expand Down Expand Up @@ -5368,7 +5367,7 @@ ASTFileSignature ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot,
// SourceLocations or FileIDs depends on it.
computeNonAffectingInputFiles();

writeUnhashedControlBlock(PP, Context);
writeUnhashedControlBlock(PP);

// Don't reuse type ID and Identifier ID from readers for C++ standard named
// modules since we want to support no-transitive-change model for named
Expand Down

0 comments on commit 304c412

Please sign in to comment.