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/ASTReader.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/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 4eef6cfbff4..57dc611c7e0 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -3217,6 +3217,14 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { OptimizeOffPragmaLocation = ReadSourceLocation(F, Record[0]); break; + case MSSTRUCT_PRAGMA_OPTIONS: + if (Record.size() != 1) { + Error("invalid pragma ms_struct record"); + return Failure; + } + PragmaMSStructState = Record[0]; + break; + case UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES: for (unsigned I = 0, N = Record.size(); I != N; ++I) UnusedLocalTypedefNameCandidates.push_back( @@ -6998,10 +7006,12 @@ void ASTReader::UpdateSema() { SemaDeclRefs.clear(); } - // Update the state of 'pragma clang optimize'. Use the same API as if we had - // encountered the pragma in the source. + // Update the state of pragmas. Use the same API as if we had encountered the + // pragma in the source. if(OptimizeOffPragmaLocation.isValid()) SemaObj->ActOnPragmaOptimize(/* IsOn = */ false, OptimizeOffPragmaLocation); + if (PragmaMSStructState != -1) + SemaObj->ActOnPragmaMSStruct((PragmaMSStructKind)PragmaMSStructState); } IdentifierInfo *ASTReader::get(StringRef Name) { @@ -8696,6 +8706,7 @@ ASTReader::ASTReader( Diags(PP.getDiagnostics()), SemaObj(nullptr), PP(PP), Context(Context), Consumer(nullptr), ModuleMgr(PP.getFileManager(), PCHContainerRdr), ReadTimer(std::move(ReadTimer)), + PragmaMSStructState(-1), isysroot(isysroot), DisableValidation(DisableValidation), AllowASTWithCompilerErrors(AllowASTWithCompilerErrors), AllowConfigurationMismatch(AllowConfigurationMismatch), |