aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-05 22:10:18 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-05 22:10:18 +0000
commitf41d3be39980d40849850d3fb90403623cc8459e (patch)
tree8ddc2c3ae4bad968ffe991f594f7f26e278c678e /lib/Serialization/ASTWriter.cpp
parent2e57494445747c911f48b853015b784e292fefe4 (diff)
Read/write from/to PCH the diagnostic mappings that the user set so that e.g. #pragma clang diagnostic can be used in a PCH.
Fixes rdar://8435969. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118303 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r--lib/Serialization/ASTWriter.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index 47ef72f7bd..a5977f5cfe 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -1441,6 +1441,19 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) {
}
}
+void ASTWriter::WriteUserDiagnosticMappings(const Diagnostic &Diag) {
+ RecordData Record;
+ for (unsigned i = 0; i != diag::DIAG_UPPER_LIMIT; ++i) {
+ diag::Mapping Map = Diag.getDiagnosticMappingInfo(i);
+ if (Map & 0x8) { // user mapping.
+ Record.push_back(i);
+ Record.push_back(Map & 0x7);
+ }
+ }
+
+ Stream.EmitRecord(DIAG_USER_MAPPINGS, Record);
+}
+
//===----------------------------------------------------------------------===//
// Type Serialization
//===----------------------------------------------------------------------===//
@@ -2402,6 +2415,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls,
WriteIdentifierTable(PP);
WriteTypeDeclOffsets();
+ WriteUserDiagnosticMappings(Context.getDiagnostics());
// Write the C++ base-specifier set offsets.
if (!CXXBaseSpecifiersOffsets.empty()) {
@@ -2635,6 +2649,9 @@ void ASTWriter::WriteASTChain(Sema &SemaRef, MemorizeStatCalls *StatCalls,
WriteReferencedSelectorsPool(SemaRef);
WriteIdentifierTable(PP);
WriteTypeDeclOffsets();
+ // FIXME: For chained PCH only write the new mappings (we currently
+ // write all of them again).
+ WriteUserDiagnosticMappings(Context.getDiagnostics());
/// Build a record containing first declarations from a chained PCH and the
/// most recent declarations in this AST that they point to.