Skip to content

Commit

Permalink
fix(verifier): provide reasonable default corpus/path values (#5943)
Browse files Browse the repository at this point in the history
Tests that don't generate file nodes can still expect anchors to
have path/corpus values set.
  • Loading branch information
zrlk committed Nov 20, 2023
1 parent 9cf45f8 commit f358c2e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions kythe/cxx/verifier/verifier.cc
Expand Up @@ -779,9 +779,15 @@ bool Verifier::LoadInlineRuleFile(const std::string& filename) {
return false;
}
}
kythe::proto::VName empty;
auto* vname = ConvertVName(yy::location{}, empty);
return LoadInMemoryRuleFile(filename, vname, content_sym);
AstNode** values = (AstNode**)arena_.New(sizeof(AstNode*) * 5);
values[0] = empty_string_id_;
values[1] = default_file_corpus_;
values[2] = empty_string_id_;
values[3] = IdentifierFor(yy::location{}, filename);
values[4] = empty_string_id_;
AstNode* default_vname_tuple = new (&arena_) Tuple(yy::location{}, 5, values);
AstNode* default_vname = new (&arena_) App(vname_id_, default_vname_tuple);
return LoadInMemoryRuleFile(filename, default_vname, content_sym);
}

bool Verifier::LoadInMemoryRuleFile(const std::string& filename, AstNode* vname,
Expand Down

0 comments on commit f358c2e

Please sign in to comment.