diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-11-05 22:10:18 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-11-05 22:10:18 +0000 |
commit | 452707c12542d6ec1a13e7611a86327ef8f8ab45 (patch) | |
tree | ee4ff6eca1d6b73623765b786505b689b1b33ecc /clang/lib/Serialization/ASTWriter.cpp | |
parent | d87ea457bb0af7366286f78ffa90b9b6c6650417 (diff) | |
download | bcm5719-llvm-452707c12542d6ec1a13e7611a86327ef8f8ab45.tar.gz bcm5719-llvm-452707c12542d6ec1a13e7611a86327ef8f8ab45.zip |
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.
llvm-svn: 118303
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 47ef72f7bd6..a5977f5cfe8 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/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. |