From 120f725932ce0d5c4e1ad4a14610f2c898c41346 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sat, 14 Nov 2015 19:31:56 +0000 Subject: [PATCH] Move diagnostics from Parse to Sema to remove Sema's dependency on ParserDiagnostic.h diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253143 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticParseKinds.td | 52 ------------------ include/clang/Basic/DiagnosticSemaKinds.td | 59 +++++++++++++++++++++ lib/Parse/ParseDecl.cpp | 1 + lib/Sema/DeclSpec.cpp | 1 - lib/Sema/SemaDecl.cpp | 1 - lib/Sema/SemaType.cpp | 1 - 6 files changed, 60 insertions(+), 55 deletions(-) diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 13d254316c..8a06031254 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -51,14 +51,6 @@ def warn_extra_semi_after_mem_fn_def : Warning< "extra ';' after member function definition">, InGroup, DefaultIgnore; -def ext_duplicate_declspec : ExtWarn<"duplicate '%0' declaration specifier">, - InGroup; -def warn_duplicate_declspec : Warning<"duplicate '%0' declaration specifier">, - InGroup; -def ext_plain_complex : ExtWarn< - "plain '_Complex' requires a type specifier; assuming '_Complex double'">; -def ext_integer_complex : Extension< - "complex integer types are a GNU extension">, InGroup; def ext_thread_before : Extension<"'__thread' before '%0'">; def ext_keyword_as_ident : ExtWarn< "keyword '%0' will be made available as an identifier " @@ -70,11 +62,6 @@ def ext_nullability : Extension< InGroup>; def error_empty_enum : Error<"use of empty enum">; -def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">; -def err_invalid_width_spec : Error< - "'%select{|short|long|long long}0 %1' is invalid">; -def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">; -def err_friend_decl_spec : Error<"'%0' is invalid in friend declarations">; def ext_ident_list_in_param : Extension< "type-less parameter names in function declaration">; @@ -285,11 +272,6 @@ def err_init_list_bin_op : Error<"initializer list cannot be used on the " def warn_cxx98_compat_trailing_return_type : Warning< "trailing return types are incompatible with C++98">, InGroup, DefaultIgnore; -def ext_auto_type_specifier : ExtWarn< - "'auto' type specifier is a C++11 extension">, InGroup; -def warn_auto_storage_class : Warning< - "'auto' storage class specifier is redundant and incompatible with C++11">, - InGroup, DefaultIgnore; def ext_auto_storage_class : ExtWarn< "'auto' storage class specifier is not permitted in C++11, and will not " "be supported in future releases">, InGroup>; @@ -329,9 +311,6 @@ def err_unspecified_vla_size_with_static : Error< "'static' may not be used with an unspecified variable length array size">; def err_unspecified_size_with_static : Error< "'static' may not be used without an array size">; -def warn_deprecated_register : Warning< - "'register' storage class specifier is deprecated">, - InGroup; def err_expected_parentheses_around_typename : Error< "expected parentheses around type name in %0 expression">; @@ -350,35 +329,8 @@ def err_typename_invalid_constexpr : Error< def err_typename_identifiers_only : Error< "typename is allowed for identifiers only">; -def err_invalid_decl_spec_combination : Error< - "cannot combine with previous '%0' declaration specifier">; -def err_invalid_vector_decl_spec_combination : Error< - "cannot combine with previous '%0' declaration specifier. " - "'__vector' must be first">; -def err_invalid_pixel_decl_spec_combination : Error< - "'__pixel' must be preceded by '__vector'. " - "'%0' declaration specifier not allowed here">; -def err_invalid_vector_bool_decl_spec : Error< - "cannot use '%0' with '__vector bool'">; -def err_invalid_vector_long_decl_spec : Error< - "cannot use 'long' with '__vector'">; -def err_invalid_vector_float_decl_spec : Error< - "cannot use 'float' with '__vector'">; -def err_invalid_vector_double_decl_spec : Error < - "use of 'double' with '__vector' requires VSX support to be enabled " - "(available on POWER7 or later)">; -def err_invalid_vector_long_long_decl_spec : Error < - "use of 'long long' with '__vector bool' requires VSX support (available on " - "POWER7 or later) or extended Altivec support (available on POWER8 or later) " - "to be enabled">; -def err_invalid_vector_long_double_decl_spec : Error< - "cannot use 'long double' with '__vector'">; -def warn_vector_long_decl_spec_combination : Warning< - "Use of 'long' with '__vector' is deprecated">, InGroup; def err_friend_invalid_in_context : Error< "'friend' used outside of class">; -def err_use_of_tag_name_without_tag : Error< - "must use '%1' tag to refer to type %0%select{| in this scope}2">; def err_templated_using_directive_declaration : Error< "cannot template a using %select{directive|declaration}0">; def err_unexpected_colon_in_nested_name_spec : Error< @@ -950,10 +902,6 @@ def err_pragma_optimize_invalid_argument : Error< def err_pragma_optimize_extra_argument : Error< "unexpected extra argument '%0' to '#pragma clang optimize'">; -// OpenCL Section 6.8.g -def err_opencl_unknown_type_specifier : Error< - "OpenCL does not support the '%0' %select{type qualifier|storage class specifier}1">; - // OpenCL EXTENSION pragma (OpenCL 1.1 [9.1]) def warn_pragma_expected_colon : Warning< "missing ':' after %0 - ignoring">, InGroup; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index c3b501a8b5..bf1101f0f4 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -188,6 +188,60 @@ def ext_flexible_array_init : Extension< "flexible array initialization is a GNU extension">, InGroup; // Declarations. +def ext_duplicate_declspec : ExtWarn<"duplicate '%0' declaration specifier">, + InGroup; +def warn_duplicate_declspec : Warning<"duplicate '%0' declaration specifier">, + InGroup; +def ext_plain_complex : ExtWarn< + "plain '_Complex' requires a type specifier; assuming '_Complex double'">; +def ext_integer_complex : Extension< + "complex integer types are a GNU extension">, InGroup; + +def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">; +def err_invalid_width_spec : Error< + "'%select{|short|long|long long}0 %1' is invalid">; +def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">; +def err_friend_decl_spec : Error<"'%0' is invalid in friend declarations">; + +def ext_auto_type_specifier : ExtWarn< + "'auto' type specifier is a C++11 extension">, InGroup; +def warn_auto_storage_class : Warning< + "'auto' storage class specifier is redundant and incompatible with C++11">, + InGroup, DefaultIgnore; + +def warn_deprecated_register : Warning< + "'register' storage class specifier is deprecated">, + InGroup; + +def err_invalid_decl_spec_combination : Error< + "cannot combine with previous '%0' declaration specifier">; +def err_invalid_vector_decl_spec_combination : Error< + "cannot combine with previous '%0' declaration specifier. " + "'__vector' must be first">; +def err_invalid_pixel_decl_spec_combination : Error< + "'__pixel' must be preceded by '__vector'. " + "'%0' declaration specifier not allowed here">; +def err_invalid_vector_bool_decl_spec : Error< + "cannot use '%0' with '__vector bool'">; +def err_invalid_vector_long_decl_spec : Error< + "cannot use 'long' with '__vector'">; +def err_invalid_vector_float_decl_spec : Error< + "cannot use 'float' with '__vector'">; +def err_invalid_vector_double_decl_spec : Error < + "use of 'double' with '__vector' requires VSX support to be enabled " + "(available on POWER7 or later)">; +def err_invalid_vector_long_long_decl_spec : Error < + "use of 'long long' with '__vector bool' requires VSX support (available on " + "POWER7 or later) or extended Altivec support (available on POWER8 or later) " + "to be enabled">; +def err_invalid_vector_long_double_decl_spec : Error< + "cannot use 'long double' with '__vector'">; +def warn_vector_long_decl_spec_combination : Warning< + "Use of 'long' with '__vector' is deprecated">, InGroup; + +def err_use_of_tag_name_without_tag : Error< + "must use '%1' tag to refer to type %0%select{| in this scope}2">; + def err_redeclaration_different_type : Error< "redeclaration of %0 with a different type%diff{: $ vs $|}1,2">; def err_bad_variable_name : Error< @@ -7565,6 +7619,11 @@ def err_atomic_init_constant : Error< " in the declaration statement in the program scope">; def err_opencl_implicit_vector_conversion : Error< "implicit conversions between vector types (%0 and %1) are not permitted">; + +// OpenCL Section 6.8.g +def err_opencl_unknown_type_specifier : Error< + "OpenCL does not support the '%0' %select{type qualifier|storage class specifier}1">; + } // end of sema category let CategoryName = "OpenMP Issue" in { diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 4f713b70a5..d26f99560f 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -24,6 +24,7 @@ #include "clang/Sema/ParsedTemplate.h" #include "clang/Sema/PrettyDeclStackTrace.h" #include "clang/Sema/Scope.h" +#include "clang/Sema/SemaDiagnostic.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringSwitch.h" diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index fe420bdcd6..a503962876 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -20,7 +20,6 @@ #include "clang/Basic/LangOptions.h" #include "clang/Basic/TargetInfo.h" #include "clang/Lex/Preprocessor.h" -#include "clang/Parse/ParseDiagnostic.h" // FIXME: remove this back-dependency! #include "clang/Sema/LocInfoType.h" #include "clang/Sema/ParsedTemplate.h" #include "clang/Sema/Sema.h" diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index d051c4318d..5123601d8a 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -33,7 +33,6 @@ #include "clang/Lex/Lexer.h" // TODO: Extract static functions to fix layering. #include "clang/Lex/ModuleLoader.h" // TODO: Sema shouldn't depend on Lex #include "clang/Lex/Preprocessor.h" // Included for isCodeCompletionEnabled() -#include "clang/Parse/ParseDiagnostic.h" #include "clang/Sema/CXXFieldCollector.h" #include "clang/Sema/DeclSpec.h" #include "clang/Sema/DelayedDiagnostic.h" diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index b6bc159428..59006227ab 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -26,7 +26,6 @@ #include "clang/Basic/PartialDiagnostic.h" #include "clang/Basic/TargetInfo.h" #include "clang/Lex/Preprocessor.h" -#include "clang/Parse/ParseDiagnostic.h" #include "clang/Sema/DeclSpec.h" #include "clang/Sema/DelayedDiagnostic.h" #include "clang/Sema/Lookup.h" -- 2.40.0