diff options
author | Adrian Prantl <aprantl@apple.com> | 2015-09-22 23:26:31 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2015-09-22 23:26:31 +0000 |
commit | adbd2b1f32ddc3fc9ee1726fe4f5c6fd3b51014d (patch) | |
tree | b3f0b4158cf059ad3a92dd23bef3b0355cb0ac37 /clang/lib | |
parent | 040975472c140b6ab451541e7ba5b94b6bb9fed4 (diff) | |
download | bcm5719-llvm-adbd2b1f32ddc3fc9ee1726fe4f5c6fd3b51014d.tar.gz bcm5719-llvm-adbd2b1f32ddc3fc9ee1726fe4f5c6fd3b51014d.zip |
Serialization: Let ASTWriter return the signature of the written module.
NFC
llvm-svn: 248344
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index b582c3239d0..95c1620fcbb 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -1166,9 +1166,12 @@ static ASTFileSignature getSignature() { } /// \brief Write the control block. -void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context, - StringRef isysroot, - const std::string &OutputFile) { +uint64_t ASTWriter::WriteControlBlock(Preprocessor &PP, + ASTContext &Context, + StringRef isysroot, + const std::string &OutputFile) { + ASTFileSignature Signature = 0; + using namespace llvm; Stream.EnterSubblock(CONTROL_BLOCK_ID, 5); RecordData Record; @@ -1201,7 +1204,8 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context, // is non-deterministic. // FIXME: Remove this when output is deterministic. if (Context.getLangOpts().ImplicitModules) { - RecordData::value_type Record[] = {getSignature()}; + Signature = getSignature(); + RecordData::value_type Record[] = {Signature}; Stream.EmitRecord(SIGNATURE, Record); } @@ -1468,6 +1472,7 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context, PP.getHeaderSearchInfo().getHeaderSearchOpts(), PP.getLangOpts().Modules); Stream.ExitBlock(); + return Signature; } namespace { @@ -4012,12 +4017,11 @@ time_t ASTWriter::getTimestampForOutput(const FileEntry *E) const { return IncludeTimestamps ? E->getModificationTime() : 0; } -void ASTWriter::WriteAST(Sema &SemaRef, - const std::string &OutputFile, - Module *WritingModule, StringRef isysroot, - bool hasErrors) { +uint64_t ASTWriter::WriteAST(Sema &SemaRef, const std::string &OutputFile, + Module *WritingModule, StringRef isysroot, + bool hasErrors) { WritingAST = true; - + ASTHasCompilerErrors = hasErrors; // Emit the file header. @@ -4031,13 +4035,15 @@ void ASTWriter::WriteAST(Sema &SemaRef, Context = &SemaRef.Context; PP = &SemaRef.PP; this->WritingModule = WritingModule; - WriteASTCore(SemaRef, isysroot, OutputFile, WritingModule); + ASTFileSignature Signature = + WriteASTCore(SemaRef, isysroot, OutputFile, WritingModule); Context = nullptr; PP = nullptr; this->WritingModule = nullptr; this->BaseDirectory.clear(); WritingAST = false; + return Signature; } template<typename Vector> @@ -4049,10 +4055,9 @@ static void AddLazyVectorDecls(ASTWriter &Writer, Vector &Vec, } } -void ASTWriter::WriteASTCore(Sema &SemaRef, - StringRef isysroot, - const std::string &OutputFile, - Module *WritingModule) { +uint64_t ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot, + const std::string &OutputFile, + Module *WritingModule) { using namespace llvm; bool isModule = WritingModule != nullptr; @@ -4197,7 +4202,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, } // Write the control block - WriteControlBlock(PP, Context, isysroot, OutputFile); + uint64_t Signature = WriteControlBlock(PP, Context, isysroot, OutputFile); // Write the remaining AST contents. Stream.EnterSubblock(AST_BLOCK_ID, 5); @@ -4527,6 +4532,8 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, NumStatements, NumMacros, NumLexicalDeclContexts, NumVisibleDeclContexts}; Stream.EmitRecord(STATISTICS, Record); Stream.ExitBlock(); + + return Signature; } void ASTWriter::WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord) { |