Re: r348685 - Move diagnostic enums into Basic.

2018-12-10 Thread David Blaikie via cfe-commits
Hey Richard,

Thanks for cleaning up some of the layering here!

I /think/ I vaguely recall having a conversation with Richard Smith about a
different direction to fix the layering of the diagnostics system - but it
was/is more involved. Ah, here, apparently I sent out a WIP patch & must've
got engaged in other things: https://reviews.llvm.org/D41357 - not sure if
this is a better/workable/useful way forward, or whether we should go with
sinking the specific diagnostics into the Diagnostics library as you've
done/started doing here (I don't have much context in my head right now, so
I forget exactly what's involved in fully pushing them all down into
Diagnostics).

Just some thoughts/directions/ideas,
- Dave

On Fri, Dec 7, 2018 at 9:07 PM Richard Trieu via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rtrieu
> Date: Fri Dec  7 21:05:03 2018
> New Revision: 348685
>
> URL: http://llvm.org/viewvc/llvm-project?rev=348685=rev
> Log:
> Move diagnostic enums into Basic.
>
> Move enums from */*Diagnostic.h to Basic/Diagnostic*.h.
> Basic/AllDiagnostics.h
> needs all the enums and moving the sources to Basic prevents a
> Basic->*->Basic
> dependency loop.  This also allows each Basic/Diagnostics*Kinds.td to have
> a
> header at Basic/Diagnostic*.h (except for Common).  The old headers are
> kept in place since other packages are still using them.
>
> Added:
> cfe/trunk/include/clang/Basic/DiagnosticAST.h
>   - copied, changed from r348541,
> cfe/trunk/include/clang/AST/ASTDiagnostic.h
> cfe/trunk/include/clang/Basic/DiagnosticAnalysis.h
>   - copied, changed from r348541,
> cfe/trunk/include/clang/Analysis/AnalysisDiagnostic.h
> cfe/trunk/include/clang/Basic/DiagnosticComment.h
>   - copied, changed from r348541,
> cfe/trunk/include/clang/AST/CommentDiagnostic.h
> cfe/trunk/include/clang/Basic/DiagnosticCrossTU.h
>   - copied, changed from r348541,
> cfe/trunk/include/clang/CrossTU/CrossTUDiagnostic.h
> cfe/trunk/include/clang/Basic/DiagnosticDriver.h
>   - copied, changed from r348541,
> cfe/trunk/include/clang/Driver/DriverDiagnostic.h
> cfe/trunk/include/clang/Basic/DiagnosticFrontend.h
>   - copied, changed from r348541,
> cfe/trunk/include/clang/Frontend/FrontendDiagnostic.h
> cfe/trunk/include/clang/Basic/DiagnosticLex.h
>   - copied, changed from r348541,
> cfe/trunk/include/clang/Lex/LexDiagnostic.h
> cfe/trunk/include/clang/Basic/DiagnosticParse.h
>   - copied, changed from r348541,
> cfe/trunk/include/clang/Parse/ParseDiagnostic.h
> cfe/trunk/include/clang/Basic/DiagnosticRefactoring.h
>   - copied, changed from r348541,
> cfe/trunk/include/clang/Tooling/Refactoring/RefactoringDiagnostic.h
> cfe/trunk/include/clang/Basic/DiagnosticSema.h
>   - copied, changed from r348541,
> cfe/trunk/include/clang/Sema/SemaDiagnostic.h
> cfe/trunk/include/clang/Basic/DiagnosticSerialization.h
>   - copied, changed from r348541,
> cfe/trunk/include/clang/Serialization/SerializationDiagnostic.h
> Modified:
> cfe/trunk/include/clang/AST/ASTDiagnostic.h
> cfe/trunk/include/clang/AST/CommentDiagnostic.h
> cfe/trunk/include/clang/Analysis/AnalysisDiagnostic.h
> cfe/trunk/include/clang/Basic/AllDiagnostics.h
> cfe/trunk/include/clang/CrossTU/CrossTUDiagnostic.h
> cfe/trunk/include/clang/Driver/DriverDiagnostic.h
> cfe/trunk/include/clang/Frontend/FrontendDiagnostic.h
> cfe/trunk/include/clang/Lex/LexDiagnostic.h
> cfe/trunk/include/clang/Parse/ParseDiagnostic.h
> cfe/trunk/include/clang/Sema/SemaDiagnostic.h
> cfe/trunk/include/clang/Serialization/SerializationDiagnostic.h
> cfe/trunk/include/clang/Tooling/Refactoring/RefactoringDiagnostic.h
>
> Modified: cfe/trunk/include/clang/AST/ASTDiagnostic.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTDiagnostic.h?rev=348685=348684=348685=diff
>
> ==
> --- cfe/trunk/include/clang/AST/ASTDiagnostic.h (original)
> +++ cfe/trunk/include/clang/AST/ASTDiagnostic.h Fri Dec  7 21:05:03 2018
> @@ -11,19 +11,9 @@
>  #define LLVM_CLANG_AST_ASTDIAGNOSTIC_H
>
>  #include "clang/Basic/Diagnostic.h"
> +#include "clang/Basic/DiagnosticAST.h"
>
>  namespace clang {
> -  namespace diag {
> -enum {
> -#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\
> - SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM,
> -#define ASTSTART
> -#include "clang/Basic/DiagnosticASTKinds.inc"
> -#undef DIAG
> -  NUM_BUILTIN_AST_DIAGNOSTICS
> -};
> -  }  // end namespace diag
> -
>/// DiagnosticsEngine argument formatting function for diagnostics that
>/// involve AST nodes.
>///
>
> Modified: cfe/trunk/include/clang/AST/CommentDiagnostic.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentDiagnostic.h?rev=348685=348684=348685=diff
>
> 

r348685 - Move diagnostic enums into Basic.

2018-12-07 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Fri Dec  7 21:05:03 2018
New Revision: 348685

URL: http://llvm.org/viewvc/llvm-project?rev=348685=rev
Log:
Move diagnostic enums into Basic.

Move enums from */*Diagnostic.h to Basic/Diagnostic*.h.  Basic/AllDiagnostics.h
needs all the enums and moving the sources to Basic prevents a Basic->*->Basic
dependency loop.  This also allows each Basic/Diagnostics*Kinds.td to have a
header at Basic/Diagnostic*.h (except for Common).  The old headers are kept in 
place since other packages are still using them.

Added:
cfe/trunk/include/clang/Basic/DiagnosticAST.h
  - copied, changed from r348541, 
cfe/trunk/include/clang/AST/ASTDiagnostic.h
cfe/trunk/include/clang/Basic/DiagnosticAnalysis.h
  - copied, changed from r348541, 
cfe/trunk/include/clang/Analysis/AnalysisDiagnostic.h
cfe/trunk/include/clang/Basic/DiagnosticComment.h
  - copied, changed from r348541, 
cfe/trunk/include/clang/AST/CommentDiagnostic.h
cfe/trunk/include/clang/Basic/DiagnosticCrossTU.h
  - copied, changed from r348541, 
cfe/trunk/include/clang/CrossTU/CrossTUDiagnostic.h
cfe/trunk/include/clang/Basic/DiagnosticDriver.h
  - copied, changed from r348541, 
cfe/trunk/include/clang/Driver/DriverDiagnostic.h
cfe/trunk/include/clang/Basic/DiagnosticFrontend.h
  - copied, changed from r348541, 
cfe/trunk/include/clang/Frontend/FrontendDiagnostic.h
cfe/trunk/include/clang/Basic/DiagnosticLex.h
  - copied, changed from r348541, 
cfe/trunk/include/clang/Lex/LexDiagnostic.h
cfe/trunk/include/clang/Basic/DiagnosticParse.h
  - copied, changed from r348541, 
cfe/trunk/include/clang/Parse/ParseDiagnostic.h
cfe/trunk/include/clang/Basic/DiagnosticRefactoring.h
  - copied, changed from r348541, 
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringDiagnostic.h
cfe/trunk/include/clang/Basic/DiagnosticSema.h
  - copied, changed from r348541, 
cfe/trunk/include/clang/Sema/SemaDiagnostic.h
cfe/trunk/include/clang/Basic/DiagnosticSerialization.h
  - copied, changed from r348541, 
cfe/trunk/include/clang/Serialization/SerializationDiagnostic.h
Modified:
cfe/trunk/include/clang/AST/ASTDiagnostic.h
cfe/trunk/include/clang/AST/CommentDiagnostic.h
cfe/trunk/include/clang/Analysis/AnalysisDiagnostic.h
cfe/trunk/include/clang/Basic/AllDiagnostics.h
cfe/trunk/include/clang/CrossTU/CrossTUDiagnostic.h
cfe/trunk/include/clang/Driver/DriverDiagnostic.h
cfe/trunk/include/clang/Frontend/FrontendDiagnostic.h
cfe/trunk/include/clang/Lex/LexDiagnostic.h
cfe/trunk/include/clang/Parse/ParseDiagnostic.h
cfe/trunk/include/clang/Sema/SemaDiagnostic.h
cfe/trunk/include/clang/Serialization/SerializationDiagnostic.h
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringDiagnostic.h

Modified: cfe/trunk/include/clang/AST/ASTDiagnostic.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTDiagnostic.h?rev=348685=348684=348685=diff
==
--- cfe/trunk/include/clang/AST/ASTDiagnostic.h (original)
+++ cfe/trunk/include/clang/AST/ASTDiagnostic.h Fri Dec  7 21:05:03 2018
@@ -11,19 +11,9 @@
 #define LLVM_CLANG_AST_ASTDIAGNOSTIC_H
 
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Basic/DiagnosticAST.h"
 
 namespace clang {
-  namespace diag {
-enum {
-#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\
- SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM,
-#define ASTSTART
-#include "clang/Basic/DiagnosticASTKinds.inc"
-#undef DIAG
-  NUM_BUILTIN_AST_DIAGNOSTICS
-};
-  }  // end namespace diag
-
   /// DiagnosticsEngine argument formatting function for diagnostics that
   /// involve AST nodes.
   ///

Modified: cfe/trunk/include/clang/AST/CommentDiagnostic.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentDiagnostic.h?rev=348685=348684=348685=diff
==
--- cfe/trunk/include/clang/AST/CommentDiagnostic.h (original)
+++ cfe/trunk/include/clang/AST/CommentDiagnostic.h Fri Dec  7 21:05:03 2018
@@ -10,20 +10,7 @@
 #ifndef LLVM_CLANG_AST_COMMENTDIAGNOSTIC_H
 #define LLVM_CLANG_AST_COMMENTDIAGNOSTIC_H
 
-#include "clang/Basic/Diagnostic.h"
-
-namespace clang {
-  namespace diag {
-enum {
-#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\
- SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM,
-#define COMMENTSTART
-#include "clang/Basic/DiagnosticCommentKinds.inc"
-#undef DIAG
-  NUM_BUILTIN_COMMENT_DIAGNOSTICS
-};
-  }  // end namespace diag
-}  // end namespace clang
+#include "clang/Basic/DiagnosticComment.h"
 
 #endif
 

Modified: cfe/trunk/include/clang/Analysis/AnalysisDiagnostic.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/AnalysisDiagnostic.h?rev=348685=348684=348685=diff
==
---