Skip to content

Commit

Permalink
chnaging std::optional to absl::optional, adding exceptions, formatin…
Browse files Browse the repository at this point in the history
…g code
  • Loading branch information
Pawel Sagan committed Apr 9, 2021
1 parent d9192e9 commit 1155efc
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
10 changes: 10 additions & 0 deletions verilog/analysis/checkers/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
)
Expand Down Expand Up @@ -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",
Expand All @@ -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,
)
Expand Down Expand Up @@ -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",
Expand All @@ -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,
)
Expand Down Expand Up @@ -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",
Expand All @@ -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,
)
Expand All @@ -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",
Expand All @@ -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,
)
Expand Down
4 changes: 2 additions & 2 deletions verilog/analysis/checkers/constraint_name_style_rule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <optional>
#include <regex>
#include <set>
#include <string>

#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"
Expand Down Expand Up @@ -55,7 +55,7 @@ class ConstraintNameStyleRule : public verible::SyntaxTreeLintRule {
// Diagnostic message for constraint name violations.
static const char kMessage[];

std::optional<std::regex> name_regex_;
absl::optional<std::regex> name_regex_;

std::set<verible::LintViolation> violations_;
};
Expand Down
4 changes: 2 additions & 2 deletions verilog/analysis/checkers/enum_name_style_rule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <optional>
#include <regex>
#include <set>
#include <string>

#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"
Expand Down Expand Up @@ -54,7 +54,7 @@ class EnumNameStyleRule : public verible::SyntaxTreeLintRule {
// Diagnostic message.
static const char kMessage[];

std::optional<std::regex> name_regex_;
absl::optional<std::regex> name_regex_;

std::set<verible::LintViolation> violations_;
};
Expand Down
8 changes: 4 additions & 4 deletions verilog/analysis/checkers/interface_name_style_rule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <regex>
#include <set>
#include <string>
#include <regex>
#include <optional>

#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"
Expand All @@ -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;
Expand All @@ -54,7 +54,7 @@ class InterfaceNameStyleRule : public verible::SyntaxTreeLintRule {
// Diagnostic message.
static const char kMessage[];

std::optional<std::regex> name_regex_;
absl::optional<std::regex> name_regex_;

std::set<verible::LintViolation> violations_;
};
Expand Down
4 changes: 2 additions & 2 deletions verilog/analysis/checkers/parameter_type_name_style_rule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <optional>
#include <regex>
#include <set>
#include <string>

#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"
Expand Down Expand Up @@ -54,7 +54,7 @@ class ParameterTypeNameStyleRule : public verible::SyntaxTreeLintRule {
// Diagnostic message for type name violations.
static const char kMessage[];

std::optional<std::regex> name_regex_;
absl::optional<std::regex> name_regex_;

std::set<verible::LintViolation> violations_;
};
Expand Down
6 changes: 3 additions & 3 deletions verilog/analysis/checkers/struct_union_name_style_rule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <regex>
#include <set>
#include <string>
#include <regex>
#include <optional>

#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"
Expand Down Expand Up @@ -57,7 +57,7 @@ class StructUnionNameStyleRule : public verible::SyntaxTreeLintRule {
static const char kMessageUnion[];

std::set<std::string> exceptions_;
std::optional<std::regex> name_regex_;
absl::optional<std::regex> name_regex_;

std::set<verible::LintViolation> violations_;
};
Expand Down

0 comments on commit 1155efc

Please sign in to comment.