Skip to content

Commit

Permalink
linter: forbid-implicit-declartions: Comment-out old implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Lukasz Dalek <[email protected]>
  • Loading branch information
Lukasz Dalek committed Feb 2, 2021
1 parent c994e37 commit 9d37e4f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion verilog/analysis/checkers/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ cc_library(
"//verilog/CST:verilog_matchers",
"//verilog/analysis:descriptions",
"//verilog/analysis:lint_rule_registry",
"//verilog/analysis:scope_tree_visitor",
#"//verilog/analysis:scope_tree_visitor",
"@com_google_absl//absl/strings",
],
alwayslink = 1,
Expand Down
42 changes: 21 additions & 21 deletions verilog/analysis/checkers/forbid_implicit_declarations_rule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,33 +56,33 @@ void ForbidImplicitDeclarationsRule::Lint(const verible::TextStructureView& text
absl::string_view filename) {
const verible::ConcreteSyntaxTree& syntax_tree = text_structure.SyntaxTree();
CHECK_NOTNULL(syntax_tree);
syntax_tree->Accept(this);
//syntax_tree->Accept(this);
}

LintRuleStatus ForbidImplicitDeclarationsRule::Report() const {
return LintRuleStatus(violations_, Name(), GetStyleGuideCitation(kTopic));
}

void ForbidImplicitDeclarationsRule::HandleNetReference(
const verible::Symbol& symbol, const verible::SyntaxTreeContext& context,
const ScopeTreeContext& scope) {
const auto& leaf = *ABSL_DIE_IF_NULL(
dynamic_cast<const verible::SyntaxTreeLeaf*>(&symbol));
const auto identifier = leaf.get().text;

// Search upward stack and for declared nets.
for (auto itr = scope.rbegin() ; itr != scope.rend() ; ++itr) {
const auto& declared_nets = (*itr)->declared_nets_;
const auto& net = declared_nets.find(identifier);
if (net != declared_nets.end()) {
// Found net declaration
return ;
}
}

// No one net declaration was found. Report violation
violations_.insert(LintViolation(leaf, kMessage, context));
}
//void ForbidImplicitDeclarationsRule::HandleNetReference(
// const verible::Symbol& symbol, const verible::SyntaxTreeContext& context,
// const ScopeTreeContext& scope) {
// const auto& leaf = *ABSL_DIE_IF_NULL(
// dynamic_cast<const verible::SyntaxTreeLeaf*>(&symbol));
// const auto identifier = leaf.get().text;
//
// // Search upward stack and for declared nets.
// for (auto itr = scope.rbegin() ; itr != scope.rend() ; ++itr) {
// const auto& declared_nets = (*itr)->declared_nets_;
// const auto& net = declared_nets.find(identifier);
// if (net != declared_nets.end()) {
// // Found net declaration
// return ;
// }
// }
//
// // No one net declaration was found. Report violation
// violations_.insert(LintViolation(leaf, kMessage, context));
//}

} // namespace analysis
} // namespace verilog
14 changes: 7 additions & 7 deletions verilog/analysis/checkers/forbid_implicit_declarations_rule.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
#include "common/util/auto_pop_stack.h"
#include "verilog/CST/verilog_matchers.h" // IWYU pragma: keep
#include "verilog/analysis/descriptions.h"
#include "verilog/analysis/scope_tree_visitor.h"
//#include "verilog/analysis/scope_tree_visitor.h"

namespace verilog {
namespace analysis {

// ForbidImplicitDeclarationsRule detect implicitly declared nets
class ForbidImplicitDeclarationsRule : public verible::TextStructureLintRule,
public ScopeTreeVisitor {
class ForbidImplicitDeclarationsRule : public verible::TextStructureLintRule {
//public ScopeTreeVisitor {
public:
using rule_type = verible::TextStructureLintRule;
static absl::string_view Name();
Expand All @@ -51,9 +51,9 @@ class ForbidImplicitDeclarationsRule : public verible::TextStructureLintRule,

verible::LintRuleStatus Report() const override;

void HandleNetReference(const verible::Symbol& symbol,
const verible::SyntaxTreeContext& context,
const ScopeTreeContext& scope) override;
//void HandleNetReference(const verible::Symbol& symbol,
// const verible::SyntaxTreeContext& context,
// const ScopeTreeContext& scope) override;

private:
// Link to style guide rule.
Expand All @@ -64,7 +64,7 @@ class ForbidImplicitDeclarationsRule : public verible::TextStructureLintRule,

std::set<verible::LintViolation> violations_;

ScopeTreeVisitor visitor_;
//ScopeTreeVisitor visitor_;
};

} // namespace analysis
Expand Down

0 comments on commit 9d37e4f

Please sign in to comment.