Add AST_SIGNATURE record to unhashed control block of PCM files
authorDaniel Grumberg <dany.grumberg@gmail.com>
Wed, 13 May 2020 16:07:47 +0000 (17:07 +0100)
committerDaniel Grumberg <dany.grumberg@gmail.com>
Thu, 11 Jun 2020 13:09:07 +0000 (14:09 +0100)
commitbb8c7e756c51bb3dc05b30671fa4c64f48e41c39
tree0807ac70b3ea111d553b52315b9ef2a9b14288f9
parentfb80e67f10eea7177b0ff9c618c8231363b6f2fc
Add AST_SIGNATURE record to unhashed control block of PCM files

Summary:
This record is constructed by hashing the bytes of the AST block in a similiar
fashion to the SIGNATURE record. This new signature only means anything if the
AST block is fully relocatable, i.e. it does not embed absolute offsets within
the PCM file. This change ensure this does not happen by replacing these offsets
with offsets relative to the nearest relevant subblock of the AST block.

Reviewers: Bigcheese, dexonsmith

Subscribers: dexonsmith, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80383
12 files changed:
clang/include/clang/Serialization/ASTBitCodes.h
clang/include/clang/Serialization/ASTReader.h
clang/include/clang/Serialization/ASTWriter.h
clang/include/clang/Serialization/ModuleFile.h
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/lib/Serialization/ASTWriterDecl.cpp
clang/test/Modules/ASTSignature.c [new file with mode: 0644]
clang/test/Modules/Inputs/ASTHash/module.modulemap [new file with mode: 0644]
clang/test/Modules/Inputs/ASTHash/my_header_1.h [new file with mode: 0644]
clang/test/Modules/Inputs/ASTHash/my_header_2.h [new file with mode: 0644]