diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-10-24 15:17:15 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-10-24 15:17:15 +0000 |
commit | 5f3d8224af99ad0d9107601c0c31b74693371cc1 (patch) | |
tree | ccb78103e62bda6da4e2fbce57145eb303f4f068 /lib/Serialization/ASTWriter.cpp | |
parent | 6e347bccd1f132a41f9b72adbd25dc6be1dabe90 (diff) |
Serialize DiagnosticOptions to the AST file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166572 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 801615280f..650d1aa3c5 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -776,6 +776,7 @@ void ASTWriter::WriteBlockInfoBlock() { RECORD(ORIGINAL_FILE); RECORD(ORIGINAL_PCH_DIR); RECORD(INPUT_FILE_OFFSETS); + RECORD(DIAGNOSTIC_OPTIONS); BLOCK(INPUT_FILES_BLOCK); RECORD(INPUT_FILE); @@ -1068,6 +1069,21 @@ void ASTWriter::WriteControlBlock(ASTContext &Context, StringRef isysroot, } Stream.EmitRecord(TARGET_OPTIONS, Record); + // Diagnostic options. + Record.clear(); + const DiagnosticOptions &DiagOpts + = Context.getDiagnostics().getDiagnosticOptions(); +#define DIAGOPT(Name, Bits, Default) Record.push_back(DiagOpts.Name); +#define ENUM_DIAGOPT(Name, Type, Bits, Default) \ + Record.push_back(static_cast<unsigned>(DiagOpts.get##Name())); +#include "clang/Basic/DiagnosticOptions.def" + Record.push_back(DiagOpts.Warnings.size()); + for (unsigned I = 0, N = DiagOpts.Warnings.size(); I != N; ++I) + AddString(DiagOpts.Warnings[I], Record); + // Note: we don't serialize the log or serialization file names, because they + // are generally transient files and will almost always be overridden. + Stream.EmitRecord(DIAGNOSTIC_OPTIONS, Record); + // Original file name and file ID SourceManager &SM = Context.getSourceManager(); if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) { |