diff options
author | Nico Weber <nicolasweber@gmx.de> | 2016-03-02 23:22:00 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2016-03-02 23:22:00 +0000 |
commit | 779355f96bd5e6bff40bae824f3f13ccbb30d018 (patch) | |
tree | f8303aa2cdd6b397592c67d67b5244ce181a9628 /clang/lib/Serialization/ASTWriter.cpp | |
parent | 8226fc482999342e899db0d046ad044ba2ada136 (diff) | |
download | bcm5719-llvm-779355f96bd5e6bff40bae824f3f13ccbb30d018.tar.gz bcm5719-llvm-779355f96bd5e6bff40bae824f3f13ccbb30d018.zip |
Serialize `pragma ms_struct` state.
pragma ms_struct has an effect on struct decls, and the effect is serialized
correctly already. But the "is ms_struct currently on" state wasn't before
this change.
This uses the same approach as `pragma clang optimize`: When writing a module,
the state isn't serialized, only when writing a pch file.
llvm-svn: 262539
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 98ed1488d50..bef7fc267eb 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -960,6 +960,7 @@ void ASTWriter::WriteBlockInfoBlock() { RECORD(UNDEFINED_BUT_USED); RECORD(LATE_PARSED_TEMPLATE); RECORD(OPTIMIZE_PRAGMA_OPTIONS); + RECORD(MSSTRUCT_PRAGMA_OPTIONS); RECORD(UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES); RECORD(CXX_CTOR_INITIALIZERS_OFFSETS); RECORD(DELETE_EXPRS_TO_ANALYZE); @@ -3928,6 +3929,13 @@ void ASTWriter::WriteOptimizePragmaOptions(Sema &SemaRef) { Stream.EmitRecord(OPTIMIZE_PRAGMA_OPTIONS, Record); } +/// \brief Write the state of 'pragma ms_struct' at the end of the module. +void ASTWriter::WriteMSStructPragmaOptions(Sema &SemaRef) { + RecordData Record; + Record.push_back(SemaRef.MSStructPragmaOn ? PMSST_ON : PMSST_OFF); + Stream.EmitRecord(MSSTRUCT_PRAGMA_OPTIONS, Record); +} + void ASTWriter::WriteModuleFileExtension(Sema &SemaRef, ModuleFileExtensionWriter &Writer) { // Enter the extension block. @@ -4605,8 +4613,10 @@ uint64_t ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot, WriteDeclReplacementsBlock(); WriteObjCCategories(); - if(!WritingModule) + if(!WritingModule) { WriteOptimizePragmaOptions(SemaRef); + WriteMSStructPragmaOptions(SemaRef); + } // Some simple statistics RecordData::value_type Record[] = { |