diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-02-15 19:46:30 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-02-15 19:46:30 +0000 |
commit | 84bccea1ad9fd8bc1f4ec3d1fc5dd8d15dabffbc (patch) | |
tree | d650504629ed58dedf2e653bfb86926d94bb62ff /lib/Serialization/ASTWriter.cpp | |
parent | 39d3e7a26c1969fcb76bceb4ee0a410c60ea5954 (diff) |
Serialization/deserialization support for floating point #pragma
options, enabled OpenCL extensions and default FP_CONTRACT setting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125589 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index cb29973105..d46ddf8f2f 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -740,7 +740,10 @@ void ASTWriter::WriteBlockInfoBlock() { RECORD(DECL_UPDATES); RECORD(CXX_BASE_SPECIFIER_OFFSETS); RECORD(DIAG_PRAGMA_MAPPINGS); + RECORD(CUDA_SPECIAL_DECL_REFS); RECORD(HEADER_SEARCH_TABLE); + RECORD(FP_PRAGMA_OPTIONS); + RECORD(OPENCL_EXTENSIONS); // SourceManager Block. BLOCK(SOURCE_MANAGER_BLOCK); @@ -1056,6 +1059,7 @@ void ASTWriter::WriteLanguageOptions(const LangOptions &LangOpts) { Record.push_back(LangOpts.OpenCL); Record.push_back(LangOpts.CUDA); Record.push_back(LangOpts.CatchUndefined); + Record.push_back(LangOpts.DefaultFPContract); Record.push_back(LangOpts.ElideConstructors); Record.push_back(LangOpts.SpellChecking); Stream.EmitRecord(LANGUAGE_OPTIONS, Record); @@ -2528,6 +2532,25 @@ void ASTWriter::WriteDeclContextVisibleUpdate(const DeclContext *DC) { Stream.EmitRecordWithBlob(UpdateVisibleAbbrev, Record, LookupTable.str()); } +/// \brief Write an FP_PRAGMA_OPTIONS block for the given FPOptions. +void ASTWriter::WriteFPPragmaOptions(const FPOptions &Opts) { + RecordData Record; + Record.push_back(Opts.fp_contract); + Stream.EmitRecord(FP_PRAGMA_OPTIONS, Record); +} + +/// \brief Write an OPENCL_EXTENSIONS block for the given OpenCLOptions. +void ASTWriter::WriteOpenCLExtensions(Sema &SemaRef) { + if (!SemaRef.Context.getLangOptions().OpenCL) + return; + + const OpenCLOptions &Opts = SemaRef.getOpenCLOptions(); + RecordData Record; +#define OPENCLEXT(nm) Record.push_back(Opts.nm); +#include "clang/Basic/OpenCLExtensions.def" + Stream.EmitRecord(OPENCL_EXTENSIONS, Record); +} + //===----------------------------------------------------------------------===// // General Serialization Routines //===----------------------------------------------------------------------===// @@ -2758,6 +2781,8 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls, WriteSelectors(SemaRef); WriteReferencedSelectorsPool(SemaRef); WriteIdentifierTable(PP); + WriteFPPragmaOptions(SemaRef.getFPOptions()); + WriteOpenCLExtensions(SemaRef); WriteTypeDeclOffsets(); WritePragmaDiagnosticMappings(Context.getDiagnostics()); @@ -2997,6 +3022,9 @@ void ASTWriter::WriteASTChain(Sema &SemaRef, MemorizeStatCalls *StatCalls, WriteSelectors(SemaRef); WriteReferencedSelectorsPool(SemaRef); WriteIdentifierTable(PP); + WriteFPPragmaOptions(SemaRef.getFPOptions()); + WriteOpenCLExtensions(SemaRef); + WriteTypeDeclOffsets(); // FIXME: For chained PCH only write the new mappings (we currently // write all of them again). |