diff options
author | Richard Trieu <rtrieu@google.com> | 2017-04-11 21:31:00 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2017-04-11 21:31:00 +0000 |
commit | fd1acbb9bb372b98e3dcb2be726098a1f7def7e9 (patch) | |
tree | 454491711bbbcd296617bbdcd711c2c0b790ebaa /clang/lib/Serialization/ASTWriter.cpp | |
parent | f720c036f4b1ac9178410b3d47c3543b9b529a65 (diff) | |
download | llvm-fd1acbb9bb372b98e3dcb2be726098a1f7def7e9.zip llvm-fd1acbb9bb372b98e3dcb2be726098a1f7def7e9.tar.gz llvm-fd1acbb9bb372b98e3dcb2be726098a1f7def7e9.tar.bz2 |
[ODRHash] Improve handling of hash values
Calculating the hash in Sema::ActOnTagFinishDefinition could happen before
all sub-Decls were parsed or processed, which would produce the wrong hash
value. Change to calculating the hash on the first use and storing the value
instead. Also, avoid using the macros that were only for Boolean fields and
use an explicit checker during the DefintionData merge. No functional change,
but was this blocking other ODRHash patches.
llvm-svn: 299989
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index ec59250..6f0d0ee 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -5769,7 +5769,10 @@ void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) { Record->push_back(Data.ImplicitCopyAssignmentHasConstParam); Record->push_back(Data.HasDeclaredCopyConstructorWithConstParam); Record->push_back(Data.HasDeclaredCopyAssignmentWithConstParam); - Record->push_back(Data.ODRHash); + + // getODRHash will compute the ODRHash if it has not been previously computed. + Record->push_back(D->getODRHash()); + bool ModularCodegen = Writer->Context->getLangOpts().ModularCodegen && Writer->WritingModule && !D->isDependentType(); Record->push_back(ModularCodegen); |