[llvm-branch-commits] [cfe-branch] r123625 - in /cfe/branches/Apple/whitney: include/clang/Basic/Diagnostic.h include/clang/Serialization/ASTBitCodes.h include/clang/Serialization/ASTReader.h include/clang/Serialization/ASTWriter.h lib/Serialization/ASTReader.cpp lib/Serialization/ASTWriter.cpp test/PCH/pragma-diag.c

Daniel Dunbar daniel at zuster.org
Mon Jan 17 07:32:59 PST 2011


Author: ddunbar
Date: Mon Jan 17 09:32:59 2011
New Revision: 123625

URL: http://llvm.org/viewvc/llvm-project?rev=123625&view=rev
Log:
Reverse merge r118303, which caused other breakage.
--
Author: Argyrios Kyrtzidis <akyrtzi at gmail.com>
Date:   Fri Nov 5 22:10:18 2010 +0000

    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.

*** MANUAL MERGE ***

Removed:
    cfe/branches/Apple/whitney/test/PCH/pragma-diag.c
Modified:
    cfe/branches/Apple/whitney/include/clang/Basic/Diagnostic.h
    cfe/branches/Apple/whitney/include/clang/Serialization/ASTBitCodes.h
    cfe/branches/Apple/whitney/include/clang/Serialization/ASTReader.h
    cfe/branches/Apple/whitney/include/clang/Serialization/ASTWriter.h
    cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp
    cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp

Modified: cfe/branches/Apple/whitney/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/Basic/Diagnostic.h?rev=123625&r1=123624&r2=123625&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/Basic/Diagnostic.h (original)
+++ cfe/branches/Apple/whitney/include/clang/Basic/Diagnostic.h Mon Jan 17 09:32:59 2011
@@ -642,9 +642,6 @@
   /// \returns true if the diagnostic was emitted, false if it was
   /// suppressed.
   bool ProcessDiag();
-
-  friend class ASTReader;
-  friend class ASTWriter;
 };
 
 //===----------------------------------------------------------------------===//

Modified: cfe/branches/Apple/whitney/include/clang/Serialization/ASTBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/Serialization/ASTBitCodes.h?rev=123625&r1=123624&r2=123625&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/Serialization/ASTBitCodes.h (original)
+++ cfe/branches/Apple/whitney/include/clang/Serialization/ASTBitCodes.h Mon Jan 17 09:32:59 2011
@@ -341,10 +341,7 @@
       
       /// \brief Record code for the table of offsets to CXXBaseSpecifier
       /// sets.
-      CXX_BASE_SPECIFIER_OFFSETS = 37,
-
-      /// \brief Record code for diagnostic mappings specified by the user.
-      DIAG_USER_MAPPINGS = 38
+      CXX_BASE_SPECIFIER_OFFSETS = 37
     };
 
     /// \brief Record types used within a source manager block.

Modified: cfe/branches/Apple/whitney/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/Serialization/ASTReader.h?rev=123625&r1=123624&r2=123625&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/Serialization/ASTReader.h (original)
+++ cfe/branches/Apple/whitney/include/clang/Serialization/ASTReader.h Mon Jan 17 09:32:59 2011
@@ -570,9 +570,6 @@
 
   //@}
 
-  /// \brief Diagnostic IDs and their mappings that the user changed.
-  llvm::SmallVector<uint64_t, 8> UserDiagMappings;
-
   /// \brief The original file name that was used to build the primary AST file,
   /// which may have been modified for relocatable-pch support.
   std::string OriginalFileName;
@@ -855,8 +852,6 @@
   /// \brief Read the preprocessed entity at the given offset.
   virtual PreprocessedEntity *ReadPreprocessedEntity(uint64_t Offset);
 
-  void ReadUserDiagnosticMappings(Diagnostic &Diag);
-
   /// \brief Returns the number of source locations found in the chain.
   unsigned getTotalNumSLocs() const {
     return TotalNumSLocEntries;

Modified: cfe/branches/Apple/whitney/include/clang/Serialization/ASTWriter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/Serialization/ASTWriter.h?rev=123625&r1=123624&r2=123625&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/Serialization/ASTWriter.h (original)
+++ cfe/branches/Apple/whitney/include/clang/Serialization/ASTWriter.h Mon Jan 17 09:32:59 2011
@@ -311,7 +311,6 @@
                                const Preprocessor &PP,
                                const char* isysroot);
   void WritePreprocessor(const Preprocessor &PP);
-  void WriteUserDiagnosticMappings(const Diagnostic &Diag);
   void WriteType(QualType T);
   uint64_t WriteDeclContextLexicalBlock(ASTContext &Context, DeclContext *DC);
   uint64_t WriteDeclContextVisibleBlock(ASTContext &Context, DeclContext *DC);

Modified: cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp?rev=123625&r1=123624&r2=123625&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp Mon Jan 17 09:32:59 2011
@@ -2134,18 +2134,6 @@
       F.CXXBaseSpecifiersOffsets = (const uint32_t *)BlobStart;
       break;
     }
-
-    case DIAG_USER_MAPPINGS:
-      if (Record.size() % 2 != 0) {
-        Error("invalid DIAG_USER_MAPPINGS block in AST file");
-        return Failure;
-      }
-      if (UserDiagMappings.empty())
-        UserDiagMappings.swap(Record);
-      else
-        UserDiagMappings.insert(UserDiagMappings.end(),
-                                Record.begin(), Record.end());
-      break;
     }
     First = false;
   }
@@ -2486,8 +2474,6 @@
 
   if (SpecialTypes[SPECIAL_TYPE_INT128_INSTALLED])
     Context->setInt128Installed();
-
-  ReadUserDiagnosticMappings(Context->getDiagnostics());
 }
 
 /// \brief Retrieve the name of the original source file name
@@ -2674,15 +2660,6 @@
   return ReadMacroRecord(*F, Offset);
 }
 
-void ASTReader::ReadUserDiagnosticMappings(Diagnostic &Diag) {
-  unsigned Idx = 0;
-  while (Idx < UserDiagMappings.size()) {
-    unsigned DiagID = UserDiagMappings[Idx++];
-    unsigned Map = UserDiagMappings[Idx++];
-    Diag.setDiagnosticMappingInternal(DiagID, Map, /*isUser=*/true);
-  }
-}
-
 /// \brief Get the correct cursor and offset for loading a type.
 ASTReader::RecordLocation ASTReader::TypeCursorForIndex(unsigned Index) {
   PerFileData *F = 0;

Modified: cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp?rev=123625&r1=123624&r2=123625&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp Mon Jan 17 09:32:59 2011
@@ -1456,19 +1456,6 @@
   }
 }
 
-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
 //===----------------------------------------------------------------------===//
@@ -2431,7 +2418,6 @@
   WriteIdentifierTable(PP);
 
   WriteTypeDeclOffsets();
-  WriteUserDiagnosticMappings(Context.getDiagnostics());
 
   // Write the C++ base-specifier set offsets.
   if (!CXXBaseSpecifiersOffsets.empty()) {
@@ -2665,9 +2651,6 @@
   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.

Removed: cfe/branches/Apple/whitney/test/PCH/pragma-diag.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/PCH/pragma-diag.c?rev=123624&view=auto
==============================================================================
--- cfe/branches/Apple/whitney/test/PCH/pragma-diag.c (original)
+++ cfe/branches/Apple/whitney/test/PCH/pragma-diag.c (removed)
@@ -1,19 +0,0 @@
-// Test this without pch.
-// RUN: %clang_cc1 %s -include %s -verify -fsyntax-only
-
-// Test with pch.
-// RUN: %clang_cc1 %s -emit-pch -o %t
-// RUN: %clang_cc1 %s -include-pch %t -verify -fsyntax-only
-
-#ifndef HEADER
-#define HEADER
-
-#pragma clang diagnostic ignored "-Wtautological-compare"
-
-#else
-
-void f() {
-  int b = b==b;
-}
-
-#endif





More information about the llvm-branch-commits mailing list