From 1155efccce690a1f098a6c65f1d3cc4a3b1c395a Mon Sep 17 00:00:00 2001 From: Pawel Sagan Date: Fri, 9 Apr 2021 10:54:37 +0200 Subject: [PATCH] chnaging std::optional to absl::optional, adding exceptions, formating code --- verilog/analysis/checkers/BUILD | 10 ++++++++++ verilog/analysis/checkers/constraint_name_style_rule.h | 4 ++-- verilog/analysis/checkers/enum_name_style_rule.h | 4 ++-- verilog/analysis/checkers/interface_name_style_rule.h | 8 ++++---- .../analysis/checkers/parameter_type_name_style_rule.h | 4 ++-- .../analysis/checkers/struct_union_name_style_rule.h | 6 +++--- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/verilog/analysis/checkers/BUILD b/verilog/analysis/checkers/BUILD index 7777b5ff7a..29677f8ed6 100644 --- a/verilog/analysis/checkers/BUILD +++ b/verilog/analysis/checkers/BUILD @@ -651,6 +651,7 @@ cc_library( name = "enum_name_style_rule", srcs = ["enum_name_style_rule.cc"], hdrs = ["enum_name_style_rule.h"], + copts = ["-fexceptions"], deps = [ "//common/analysis:citation", "//common/analysis:lint_rule_status", @@ -666,6 +667,7 @@ cc_library( "//verilog/analysis:descriptions", "//verilog/analysis:lint_rule_registry", "@com_google_absl//absl/strings", + "@com_google_absl//absl/types:optional", ], alwayslink = 1, ) @@ -1413,6 +1415,7 @@ cc_library( name = "constraint_name_style_rule", srcs = ["constraint_name_style_rule.cc"], hdrs = ["constraint_name_style_rule.h"], + copts = ["-fexceptions"], deps = [ "//common/analysis:citation", "//common/analysis:lint_rule_status", @@ -1430,6 +1433,7 @@ cc_library( "//verilog/analysis:lint_rule_registry", "//verilog/parser:verilog_token_enum", "@com_google_absl//absl/strings", + "@com_google_absl//absl/types:optional", ], alwayslink = 1, ) @@ -1601,6 +1605,7 @@ cc_library( name = "parameter_type_name_style_rule", srcs = ["parameter_type_name_style_rule.cc"], hdrs = ["parameter_type_name_style_rule.h"], + copts = ["-fexceptions"], deps = [ "//common/analysis:citation", "//common/analysis:lint_rule_status", @@ -1618,6 +1623,7 @@ cc_library( "//verilog/analysis:lint_rule_registry", "//verilog/parser:verilog_token_enum", "@com_google_absl//absl/strings", + "@com_google_absl//absl/types:optional", ], alwayslink = 1, ) @@ -1844,6 +1850,7 @@ cc_library( name = "struct_union_name_style_rule", srcs = ["struct_union_name_style_rule.cc"], hdrs = ["struct_union_name_style_rule.h"], + copts = ["-fexceptions"], deps = [ "//common/analysis:citation", "//common/analysis:lint_rule_status", @@ -1859,6 +1866,7 @@ cc_library( "//verilog/analysis:descriptions", "//verilog/analysis:lint_rule_registry", "@com_google_absl//absl/strings", + "@com_google_absl//absl/types:optional", ], alwayslink = 1, ) @@ -1882,6 +1890,7 @@ cc_library( name = "interface_name_style_rule", srcs = ["interface_name_style_rule.cc"], hdrs = ["interface_name_style_rule.h"], + copts = ["-fexceptions"], deps = [ "//common/analysis:citation", "//common/analysis:lint_rule_status", @@ -1898,6 +1907,7 @@ cc_library( "//verilog/analysis:descriptions", "//verilog/analysis:lint_rule_registry", "@com_google_absl//absl/strings", + "@com_google_absl//absl/types:optional", ], alwayslink = 1, ) diff --git a/verilog/analysis/checkers/constraint_name_style_rule.h b/verilog/analysis/checkers/constraint_name_style_rule.h index 5e58019890..b80fb430c2 100644 --- a/verilog/analysis/checkers/constraint_name_style_rule.h +++ b/verilog/analysis/checkers/constraint_name_style_rule.h @@ -15,11 +15,11 @@ #ifndef VERIBLE_VERILOG_ANALYSIS_CHECKERS_CONSTRAINT_NAME_STYLE_RULE_H_ #define VERIBLE_VERILOG_ANALYSIS_CHECKERS_CONSTRAINT_NAME_STYLE_RULE_H_ -#include #include #include #include +#include "absl/types/optional.h" #include "common/analysis/lint_rule_status.h" #include "common/analysis/syntax_tree_lint_rule.h" #include "common/text/symbol.h" @@ -55,7 +55,7 @@ class ConstraintNameStyleRule : public verible::SyntaxTreeLintRule { // Diagnostic message for constraint name violations. static const char kMessage[]; - std::optional name_regex_; + absl::optional name_regex_; std::set violations_; }; diff --git a/verilog/analysis/checkers/enum_name_style_rule.h b/verilog/analysis/checkers/enum_name_style_rule.h index bff924d98d..859b656517 100644 --- a/verilog/analysis/checkers/enum_name_style_rule.h +++ b/verilog/analysis/checkers/enum_name_style_rule.h @@ -15,11 +15,11 @@ #ifndef VERIBLE_VERILOG_ANALYSIS_CHECKERS_ENUM_NAME_STYLE_RULE_H_ #define VERIBLE_VERILOG_ANALYSIS_CHECKERS_ENUM_NAME_STYLE_RULE_H_ -#include #include #include #include +#include "absl/types/optional.h" #include "common/analysis/lint_rule_status.h" #include "common/analysis/syntax_tree_lint_rule.h" #include "common/text/symbol.h" @@ -54,7 +54,7 @@ class EnumNameStyleRule : public verible::SyntaxTreeLintRule { // Diagnostic message. static const char kMessage[]; - std::optional name_regex_; + absl::optional name_regex_; std::set violations_; }; diff --git a/verilog/analysis/checkers/interface_name_style_rule.h b/verilog/analysis/checkers/interface_name_style_rule.h index 814a79bce5..ef8511960b 100644 --- a/verilog/analysis/checkers/interface_name_style_rule.h +++ b/verilog/analysis/checkers/interface_name_style_rule.h @@ -15,11 +15,11 @@ #ifndef VERIBLE_VERILOG_ANALYSIS_CHECKERS_INTERFACE_NAME_STYLE_RULE_H_ #define VERIBLE_VERILOG_ANALYSIS_CHECKERS_INTERFACE_NAME_STYLE_RULE_H_ +#include #include #include -#include -#include +#include "absl/types/optional.h" #include "common/analysis/lint_rule_status.h" #include "common/analysis/syntax_tree_lint_rule.h" #include "common/text/symbol.h" @@ -42,7 +42,7 @@ class InterfaceNameStyleRule : public verible::SyntaxTreeLintRule { void HandleSymbol(const verible::Symbol& symbol, const verible::SyntaxTreeContext& context) override; - + absl::Status Configure(absl::string_view configuration) override; verible::LintRuleStatus Report() const override; @@ -54,7 +54,7 @@ class InterfaceNameStyleRule : public verible::SyntaxTreeLintRule { // Diagnostic message. static const char kMessage[]; - std::optional name_regex_; + absl::optional name_regex_; std::set violations_; }; diff --git a/verilog/analysis/checkers/parameter_type_name_style_rule.h b/verilog/analysis/checkers/parameter_type_name_style_rule.h index 0561e4950d..354ee5fce3 100644 --- a/verilog/analysis/checkers/parameter_type_name_style_rule.h +++ b/verilog/analysis/checkers/parameter_type_name_style_rule.h @@ -15,11 +15,11 @@ #ifndef VERIBLE_VERILOG_ANALYSIS_CHECKERS_PARAMETER_TYPE_NAME_STYLE_RULE_H_ #define VERIBLE_VERILOG_ANALYSIS_CHECKERS_PARAMETER_TYPE_NAME_STYLE_RULE_H_ -#include #include #include #include +#include "absl/types/optional.h" #include "common/analysis/lint_rule_status.h" #include "common/analysis/syntax_tree_lint_rule.h" #include "common/text/symbol.h" @@ -54,7 +54,7 @@ class ParameterTypeNameStyleRule : public verible::SyntaxTreeLintRule { // Diagnostic message for type name violations. static const char kMessage[]; - std::optional name_regex_; + absl::optional name_regex_; std::set violations_; }; diff --git a/verilog/analysis/checkers/struct_union_name_style_rule.h b/verilog/analysis/checkers/struct_union_name_style_rule.h index ffac3c8c33..e54b503dd8 100644 --- a/verilog/analysis/checkers/struct_union_name_style_rule.h +++ b/verilog/analysis/checkers/struct_union_name_style_rule.h @@ -15,12 +15,12 @@ #ifndef VERIBLE_VERILOG_ANALYSIS_CHECKERS_STRUCT_UNION_NAME_STYLE_RULE_H_ #define VERIBLE_VERILOG_ANALYSIS_CHECKERS_STRUCT_UNION_NAME_STYLE_RULE_H_ +#include #include #include -#include -#include #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "common/analysis/lint_rule_status.h" #include "common/analysis/syntax_tree_lint_rule.h" #include "common/text/symbol.h" @@ -57,7 +57,7 @@ class StructUnionNameStyleRule : public verible::SyntaxTreeLintRule { static const char kMessageUnion[]; std::set exceptions_; - std::optional name_regex_; + absl::optional name_regex_; std::set violations_; };