analyzer: log the stashing of named constants [PR107711]
PR analyzer/107711 seems to be a bug in how named constants are looked up
by the analyzer in the C frontend.
To help debug this, this patch extends -fdump-analyzer and
-fdump-analyzer-stderr so that they dump this part of the analyzer's
startup.
gcc/analyzer/ChangeLog:
PR analyzer/107711
* analyzer-language.cc: Include "diagnostic.h".
(maybe_stash_named_constant): Add logger param and use it to log
the name being looked up, and the result.
(stash_named_constants): New, splitting out from...
(on_finish_translation_unit): ...this function. Call
get_or_create_logfile and use the result to create a logger
instance, passing it to stash_named_constants.
* analyzer.h (get_or_create_any_logfile): New decl.
* engine.cc (dump_fout, owns_dump_fout): New globals, split out
from run_checkers.
(get_or_create_any_logfile): New function, split out from...
(run_checkers): ...here, so that the logfile can be opened by
on_finish_translation_unit. Clear the globals when closing the
dump file.
gcc/testsuite/ChangeLog:
PR analyzer/107711
* gcc.dg/analyzer/fdump-analyzer-1.c: New test.
Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
Showing
- gcc/analyzer/analyzer-language.cc 35 additions, 7 deletionsgcc/analyzer/analyzer-language.cc
- gcc/analyzer/analyzer.h 2 additions, 0 deletionsgcc/analyzer/analyzer.h
- gcc/analyzer/engine.cc 34 additions, 16 deletionsgcc/analyzer/engine.cc
- gcc/testsuite/gcc.dg/analyzer/fdump-analyzer-1.c 14 additions, 0 deletionsgcc/testsuite/gcc.dg/analyzer/fdump-analyzer-1.c
Loading
Please register or sign in to comment