From f358c2e2a3a38acf50ac0286a176300e5b126fe6 Mon Sep 17 00:00:00 2001 From: zrlk Date: Mon, 20 Nov 2023 18:23:15 -0500 Subject: [PATCH] fix(verifier): provide reasonable default corpus/path values (#5943) Tests that don't generate file nodes can still expect anchors to have path/corpus values set. --- kythe/cxx/verifier/verifier.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/kythe/cxx/verifier/verifier.cc b/kythe/cxx/verifier/verifier.cc index 7460b67c93..ff49c94c78 100644 --- a/kythe/cxx/verifier/verifier.cc +++ b/kythe/cxx/verifier/verifier.cc @@ -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,