Skip to content

Commit

Permalink
SymbolTable: Gracefully handle current CHECK-fail
Browse files Browse the repository at this point in the history
This situation seems to arise if we have possibly multiple parent references
when fed a bunch of possibly unrelated files with naming overlap. Don't
crash in this case.
  • Loading branch information
hzeller committed Oct 19, 2023
1 parent 520ca4b commit 3681b01
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion verilog/analysis/symbol_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2017,7 +2017,12 @@ static void ResolveReferenceComponentNode(
switch (component.ref_type) {
case ReferenceType::kUnqualified: {
// root node: lookup this symbol from its context upward
CHECK(node->Parent() == nullptr);
if (node->Parent() != nullptr) {
// TODO(hzeller): Is this a situation that should never happen thus
// be dealt with further up-stream ? (changed from a CHECK()).
LOG(WARNING) << *node << ": Parent exists " << *node->Parent() << "\n";
return;
}
ResolveUnqualifiedName(&component, context, diagnostics);
break;
}
Expand Down

0 comments on commit 3681b01

Please sign in to comment.