aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-01-14 20:54:07 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-01-14 20:54:07 +0000
commit3efd52cf8f4e57c5571bd8cc3168264c3bc46a1e (patch)
treee01032cae49e0af5c073d902fc347cddfef7c904 /lib/Serialization/ASTWriter.cpp
parentdb0594bfc013131f88429add4eb653c285fa94fb (diff)
Properly propagate #pragma diagnostic mappings from PCH but not command-line warning flags.
Addresses rdar://8435969&8852495 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123462 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r--lib/Serialization/ASTWriter.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index 7582d1a450..00d46bc660 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -1507,18 +1507,30 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) {
}
}
-void ASTWriter::WriteUserDiagnosticMappings(const Diagnostic &Diag) {
+void ASTWriter::WritePragmaDiagnosticMappings(const Diagnostic &Diag) {
RecordData Record;
- for (unsigned i = 0; i != diag::DIAG_UPPER_LIMIT; ++i) {
- diag::Mapping Map = Diag.getDiagnosticMappingInfo(i,Diag.GetCurDiagState());
- if (Map & 0x8) { // user mapping.
- Record.push_back(i);
- Record.push_back(Map & 0x7);
+ for (Diagnostic::DiagStatePointsTy::const_iterator
+ I = Diag.DiagStatePoints.begin(), E = Diag.DiagStatePoints.end();
+ I != E; ++I) {
+ const Diagnostic::DiagStatePoint &point = *I;
+ if (point.Loc.isInvalid())
+ continue;
+
+ Record.push_back(point.Loc.getRawEncoding());
+ for (Diagnostic::DiagState::iterator
+ I = point.State->begin(), E = point.State->end(); I != E; ++I) {
+ unsigned diag = I->first, map = I->second;
+ if (map & 0x10) { // mapping from a diagnostic pragma.
+ Record.push_back(diag);
+ Record.push_back(map & 0x7);
+ }
}
+ Record.push_back(-1); // mark the end of the diag/map pairs for this
+ // location.
}
if (!Record.empty())
- Stream.EmitRecord(DIAG_USER_MAPPINGS, Record);
+ Stream.EmitRecord(DIAG_PRAGMA_MAPPINGS, Record);
}
//===----------------------------------------------------------------------===//
@@ -2483,7 +2495,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls,
WriteIdentifierTable(PP);
WriteTypeDeclOffsets();
- WriteUserDiagnosticMappings(Context.getDiagnostics());
+ WritePragmaDiagnosticMappings(Context.getDiagnostics());
// Write the C++ base-specifier set offsets.
if (!CXXBaseSpecifiersOffsets.empty()) {
@@ -2719,7 +2731,7 @@ void ASTWriter::WriteASTChain(Sema &SemaRef, MemorizeStatCalls *StatCalls,
WriteTypeDeclOffsets();
// FIXME: For chained PCH only write the new mappings (we currently
// write all of them again).
- WriteUserDiagnosticMappings(Context.getDiagnostics());
+ WritePragmaDiagnosticMappings(Context.getDiagnostics());
/// Build a record containing first declarations from a chained PCH and the
/// most recent declarations in this AST that they point to.