diff options
author | Cody Schroeder <schroederc@google.com> | 2024-03-21 13:12:59 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-21 12:12:59 -0700 |
commit | e899872a597da291ce2e033636c40177650f1786 (patch) | |
tree | 01a12c697c442c9d975e698211b4f05d69c3795f | |
parent | d899851f8a5bb5d5edd007d0aab9ac22e0625c91 (diff) | |
download | kythe-e899872a597da291ce2e033636c40177650f1786.tar.gz |
style: hide verbose verifier logging, by default (#6078)
-rw-r--r-- | kythe/cxx/verifier/verifier.cc | 12 | ||||
-rw-r--r-- | kythe/cxx/verifier/verifier.h | 6 | ||||
-rw-r--r-- | kythe/cxx/verifier/verifier_main.cc | 6 |
3 files changed, 20 insertions, 4 deletions
diff --git a/kythe/cxx/verifier/verifier.cc b/kythe/cxx/verifier/verifier.cc index a6514a672..525719e34 100644 --- a/kythe/cxx/verifier/verifier.cc +++ b/kythe/cxx/verifier/verifier.cc @@ -825,6 +825,8 @@ void Verifier::SaveEVarAssignments() { parser_.InspectAllEVars(); } +void Verifier::Verbose() { verbose_ = true; } + void Verifier::ShowGoals() { FileHandlePrettyPrinter printer(stdout); for (auto& group : parser_.groups()) { @@ -1150,10 +1152,12 @@ AstNode* Verifier::FixFileVName(AstNode* node) { if (auto* tuple = app->rhs()->AsTuple(); tuple->size() == 5) { if (auto* corpus_id = tuple->element(1)->AsIdentifier()) { if (corpus_id->symbol() == empty_string_sym_) { - if (auto* path_id = tuple->element(3)->AsIdentifier()) { - fprintf(stderr, - "Warning: file '%s' is missing a corpus in its VName.\n", - symbol_table_.text(path_id->symbol()).c_str()); + if (verbose_) { + if (auto* path_id = tuple->element(3)->AsIdentifier()) { + fprintf(stderr, + "Warning: file '%s' is missing a corpus in its VName.\n", + symbol_table_.text(path_id->symbol()).c_str()); + } } AstNode** values = (AstNode**)arena_.New(sizeof(AstNode*) * 5); values[0] = tuple->element(0); diff --git a/kythe/cxx/verifier/verifier.h b/kythe/cxx/verifier/verifier.h index 85ffb043b..6efb4f02b 100644 --- a/kythe/cxx/verifier/verifier.h +++ b/kythe/cxx/verifier/verifier.h @@ -76,6 +76,9 @@ class Verifier { /// \brief Save results of verification keyed by inspection label. void SaveEVarAssignments(); + /// \brief Emit verbose logging. + void Verbose(); + /// \brief Dump all goals to standard out. void ShowGoals(); @@ -301,6 +304,9 @@ class Verifier { /// Has the database been prepared? bool database_prepared_ = false; + /// Emit verbose logging? + bool verbose_ = false; + /// Ignore duplicate facts during verification? bool ignore_dups_ = false; diff --git a/kythe/cxx/verifier/verifier_main.cc b/kythe/cxx/verifier/verifier_main.cc index 9012744d4..90b277448 100644 --- a/kythe/cxx/verifier/verifier_main.cc +++ b/kythe/cxx/verifier/verifier_main.cc @@ -66,6 +66,8 @@ ABSL_FLAG(bool, file_vnames, true, "Find file vnames by matching file content."); ABSL_FLAG(bool, allow_missing_file_vnames, false, "If file_vnames is set, treat missing file vnames as non-fatal."); +ABSL_FLAG(bool, verbose, false, + "If verbose is set, more logging will be emitted."); ABSL_FLAG(bool, use_fast_solver, true, "Use the fast solver."); ABSL_FLAG(bool, print_timing_information, false, "Print timing information for profiling."); @@ -151,6 +153,10 @@ Example: v.AllowMissingFileVNames(); } + if (absl::GetFlag(FLAGS_verbose)) { + v.Verbose(); + } + if (absl::GetFlag(FLAGS_show_fact_prefix)) { v.ShowFactPrefix(); } |