[cfe-commits] r146207 - in /cfe/trunk: include/clang/Basic/CMakeLists.txt include/clang/Basic/Diagnostic.td include/clang/Basic/DiagnosticFrontendKinds.td include/clang/Basic/DiagnosticIDs.h include/clang/Basic/DiagnosticSerializationKinds.td include/clang/Serialization/SerializationDiagnostic.h lib/Basic/DiagnosticIDs.cpp lib/Serialization/ASTReader.cpp lib/Serialization/CMakeLists.txt

Chandler Carruth chandlerc at gmail.com
Thu Dec 8 16:02:23 PST 2011


Author: chandlerc
Date: Thu Dec  8 18:02:23 2011
New Revision: 146207

URL: http://llvm.org/viewvc/llvm-project?rev=146207&view=rev
Log:
Separate the serialization library's diagnostics from the frontend's
diagnostics. Conflating them was highly confusing and makes it harder to
establish a firm layering separation between these two libraries.

Added:
    cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
    cfe/trunk/include/clang/Serialization/SerializationDiagnostic.h
Modified:
    cfe/trunk/include/clang/Basic/CMakeLists.txt
    cfe/trunk/include/clang/Basic/Diagnostic.td
    cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
    cfe/trunk/include/clang/Basic/DiagnosticIDs.h
    cfe/trunk/lib/Basic/DiagnosticIDs.cpp
    cfe/trunk/lib/Serialization/ASTReader.cpp
    cfe/trunk/lib/Serialization/CMakeLists.txt

Modified: cfe/trunk/include/clang/Basic/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/CMakeLists.txt?rev=146207&r1=146206&r2=146207&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/CMakeLists.txt (original)
+++ cfe/trunk/include/clang/Basic/CMakeLists.txt Thu Dec  8 18:02:23 2011
@@ -13,6 +13,7 @@
 clang_diag_gen(Lex)
 clang_diag_gen(Parse)
 clang_diag_gen(Sema)
+clang_diag_gen(Serialization)
 clang_tablegen(DiagnosticGroups.inc -gen-clang-diag-groups
   SOURCE Diagnostic.td
   TARGET ClangDiagnosticGroups)

Modified: cfe/trunk/include/clang/Basic/Diagnostic.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.td?rev=146207&r1=146206&r2=146207&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.td (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.td Thu Dec  8 18:02:23 2011
@@ -102,4 +102,5 @@
 include "DiagnosticLexKinds.td"
 include "DiagnosticParseKinds.td"
 include "DiagnosticSemaKinds.td"
+include "DiagnosticSerializationKinds.td"
 

Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=146207&r1=146206&r2=146207&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Thu Dec  8 18:02:23 2011
@@ -56,19 +56,6 @@
     "unable to create target: '%0'">;
 def err_fe_unable_to_interface_with_target : Error<
     "unable to interface with target machine">;
-def err_fe_unable_to_read_pch_file : Error<
-    "unable to read PCH file: '%0'">;
-def err_fe_not_a_pch_file : Error<
-    "input is not a PCH file: '%0'">;
-def err_fe_pch_malformed : Error<
-    "malformed or corrupted PCH file: '%0'">, DefaultFatal;
-def err_fe_pch_malformed_block : Error<
-    "malformed block record in PCH file: '%0'">, DefaultFatal;
-def err_fe_pch_error_at_end_block : Error<
-    "error at end of module block in PCH file: '%0'">, DefaultFatal;
-def err_fe_pch_file_modified : Error<
-    "file '%0' has been modified since the precompiled header was built">,
-    DefaultFatal;
 def err_fe_unable_to_open_output : Error<
     "unable to open output file '%0': '%1'">;
 def err_fe_unable_to_rename_temp : Error<
@@ -115,38 +102,7 @@
 def err_relocatable_without_isysroot : Error<
     "must specify system root with -isysroot when building a relocatable "
     "PCH file">;
-def warn_pch_target_triple : Error<
-    "PCH file was compiled for the target '%0' but the current translation "
-    "unit is being compiled for target '%1'">;
-def err_pch_langopt_mismatch : Error<"%0 was %select{disabled|enabled}1 in "
-    "PCH file but is currently %select{disabled|enabled}2">;
-def err_pch_langopt_value_mismatch : Error<
-  "%0 differs in PCH file vs. current file">;
-  
-def warn_pch_version_too_old : Error<
-    "PCH file uses an older PCH format that is no longer supported">;
-def warn_pch_version_too_new : Error<
-    "PCH file uses a newer PCH format that cannot be read">;
-def warn_pch_different_branch : Error<
-    "PCH file built from a different branch (%0) than the compiler (%1)">;
-def warn_cmdline_conflicting_macro_def : Error<
-    "definition of the macro '%0' conflicts with the definition used to "
-    "build the precompiled header">;
-def note_pch_macro_defined_as : Note<
-    "definition of macro '%0' in the precompiled header">;
-def warn_cmdline_missing_macro_defs : Warning<
-    "macro definitions used to build the precompiled header are missing">;
-def note_using_macro_def_from_pch : Note<
-    "using this macro definition from precompiled header">;
-def warn_macro_name_used_in_pch : Error<
-    "definition of macro %0 conflicts with an identifier used in the "
-    "precompiled header">;
-def warn_pch_compiler_options_mismatch : Error<
-    "compiler options used when building the precompiled header differ from "
-    "the options used when using the precompiled header">;
 
-def err_not_a_pch_file : Error<
-    "'%0' does not appear to be a precompiled header file">, DefaultFatal;
 def warn_unknown_warning_option : Warning<
     "unknown warning option '%0'">,
     InGroup<DiagGroup<"unknown-warning-option"> >;

Modified: cfe/trunk/include/clang/Basic/DiagnosticIDs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticIDs.h?rev=146207&r1=146206&r2=146207&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticIDs.h (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticIDs.h Thu Dec  8 18:02:23 2011
@@ -31,14 +31,15 @@
   namespace diag {
     // Start position for diagnostics.
     enum {
-      DIAG_START_DRIVER   =                        300,
-      DIAG_START_FRONTEND = DIAG_START_DRIVER   +  100,
-      DIAG_START_LEX      = DIAG_START_FRONTEND +  120,
-      DIAG_START_PARSE    = DIAG_START_LEX      +  300,
-      DIAG_START_AST      = DIAG_START_PARSE    +  350,
-      DIAG_START_SEMA     = DIAG_START_AST      +  100,
-      DIAG_START_ANALYSIS = DIAG_START_SEMA     + 3000,
-      DIAG_UPPER_LIMIT    = DIAG_START_ANALYSIS +  100
+      DIAG_START_DRIVER        =                               300,
+      DIAG_START_FRONTEND      = DIAG_START_DRIVER          +  100,
+      DIAG_START_SERIALIZATION = DIAG_START_FRONTEND        +  100,
+      DIAG_START_LEX           = DIAG_START_SERIALIZATION   +  120,
+      DIAG_START_PARSE         = DIAG_START_LEX             +  300,
+      DIAG_START_AST           = DIAG_START_PARSE           +  350,
+      DIAG_START_SEMA          = DIAG_START_AST             +  100,
+      DIAG_START_ANALYSIS      = DIAG_START_SEMA            + 3000,
+      DIAG_UPPER_LIMIT         = DIAG_START_ANALYSIS        +  100
     };
 
     class CustomDiagInfo;

Added: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=146207&view=auto
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td (added)
+++ cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td Thu Dec  8 18:02:23 2011
@@ -0,0 +1,58 @@
+//==--- DiagnosticSerializationKinds.td - serialization diagnostics -------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+let Component = "Serialization" in {
+
+def err_fe_unable_to_read_pch_file : Error<
+    "unable to read PCH file: '%0'">;
+def err_fe_not_a_pch_file : Error<
+    "input is not a PCH file: '%0'">;
+def err_fe_pch_malformed : Error<
+    "malformed or corrupted PCH file: '%0'">, DefaultFatal;
+def err_fe_pch_malformed_block : Error<
+    "malformed block record in PCH file: '%0'">, DefaultFatal;
+def err_fe_pch_error_at_end_block : Error<
+    "error at end of module block in PCH file: '%0'">, DefaultFatal;
+def err_fe_pch_file_modified : Error<
+    "file '%0' has been modified since the precompiled header was built">,
+    DefaultFatal;
+
+def warn_pch_target_triple : Error<
+    "PCH file was compiled for the target '%0' but the current translation "
+    "unit is being compiled for target '%1'">;
+def err_pch_langopt_mismatch : Error<"%0 was %select{disabled|enabled}1 in "
+    "PCH file but is currently %select{disabled|enabled}2">;
+def err_pch_langopt_value_mismatch : Error<
+  "%0 differs in PCH file vs. current file">;
+  
+def warn_pch_version_too_old : Error<
+    "PCH file uses an older PCH format that is no longer supported">;
+def warn_pch_version_too_new : Error<
+    "PCH file uses a newer PCH format that cannot be read">;
+def warn_pch_different_branch : Error<
+    "PCH file built from a different branch (%0) than the compiler (%1)">;
+def warn_cmdline_conflicting_macro_def : Error<
+    "definition of the macro '%0' conflicts with the definition used to "
+    "build the precompiled header">;
+def note_pch_macro_defined_as : Note<
+    "definition of macro '%0' in the precompiled header">;
+def warn_cmdline_missing_macro_defs : Warning<
+    "macro definitions used to build the precompiled header are missing">;
+def note_using_macro_def_from_pch : Note<
+    "using this macro definition from precompiled header">;
+def warn_macro_name_used_in_pch : Error<
+    "definition of macro %0 conflicts with an identifier used in the "
+    "precompiled header">;
+def warn_pch_compiler_options_mismatch : Error<
+    "compiler options used when building the precompiled header differ from "
+    "the options used when using the precompiled header">;
+
+def err_not_a_pch_file : Error<
+    "'%0' does not appear to be a precompiled header file">, DefaultFatal;
+}

Added: cfe/trunk/include/clang/Serialization/SerializationDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/SerializationDiagnostic.h?rev=146207&view=auto
==============================================================================
--- cfe/trunk/include/clang/Serialization/SerializationDiagnostic.h (added)
+++ cfe/trunk/include/clang/Serialization/SerializationDiagnostic.h Thu Dec  8 18:02:23 2011
@@ -0,0 +1,28 @@
+//===--- SerializationDiagnostic.h - Serialization Diagnostics -*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_SERIALIZATIONDIAGNOSTIC_H
+#define LLVM_CLANG_SERIALIZATIONDIAGNOSTIC_H
+
+#include "clang/Basic/Diagnostic.h"
+
+namespace clang {
+  namespace diag {
+    enum {
+#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\
+             SFINAE,ACCESS,NOWERROR,SHOWINSYSHEADER,CATEGORY,BRIEF,FULL) ENUM,
+#define SERIALIZATIONSTART
+#include "clang/Basic/DiagnosticSerializationKinds.inc"
+#undef DIAG
+      NUM_BUILTIN_SERIALIZATION_DIAGNOSTICS
+    };
+  }  // end namespace diag
+}  // end namespace clang
+
+#endif

Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=146207&r1=146206&r2=146207&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original)
+++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Thu Dec  8 18:02:23 2011
@@ -21,6 +21,7 @@
 #include "clang/Lex/LexDiagnostic.h"
 #include "clang/Parse/ParseDiagnostic.h"
 #include "clang/Sema/SemaDiagnostic.h"
+#include "clang/Serialization/SerializationDiagnostic.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/ErrorHandling.h"
 
@@ -129,6 +130,7 @@
 #include "clang/Basic/DiagnosticCommonKinds.inc"
 #include "clang/Basic/DiagnosticDriverKinds.inc"
 #include "clang/Basic/DiagnosticFrontendKinds.inc"
+#include "clang/Basic/DiagnosticSerializationKinds.inc"
 #include "clang/Basic/DiagnosticLexKinds.inc"
 #include "clang/Basic/DiagnosticParseKinds.inc"
 #include "clang/Basic/DiagnosticASTKinds.inc"

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=146207&r1=146206&r2=146207&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Thu Dec  8 18:02:23 2011
@@ -14,9 +14,9 @@
 #include "clang/Serialization/ASTReader.h"
 #include "clang/Serialization/ASTDeserializationListener.h"
 #include "clang/Serialization/ModuleManager.h"
+#include "clang/Serialization/SerializationDiagnostic.h"
 #include "ASTCommon.h"
 #include "ASTReaderInternals.h"
-#include "clang/Frontend/FrontendDiagnostic.h"
 #include "clang/Frontend/Utils.h"
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/Scope.h"

Modified: cfe/trunk/lib/Serialization/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/CMakeLists.txt?rev=146207&r1=146206&r2=146207&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/CMakeLists.txt (original)
+++ cfe/trunk/lib/Serialization/CMakeLists.txt Thu Dec  8 18:02:23 2011
@@ -22,8 +22,8 @@
   ClangAttrList
   ClangAttrPCHRead
   ClangAttrPCHWrite
-  ClangDiagnosticFrontend
   ClangDiagnosticLex
   ClangDiagnosticSema
+  ClangDiagnosticSerialization
   ClangDeclNodes
   ClangStmtNodes)





More information about the cfe-commits mailing list