Evict selftest tempfiles from the diagnostics file cache
commita476cb62c6b7b7b3f66b6aa678e68fe5e15e563d
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 18 Aug 2016 13:07:53 +0000 (18 13:07 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 18 Aug 2016 13:07:53 +0000 (18 13:07 +0000)
tree16edeb7bb8574ddbbe228f6cc852ec20e0ca6e1e
parentb35a87b17607d81ae83ee6a7e0a5d91044b7b00a
Evict selftest tempfiles from the diagnostics file cache

Selftests can use class selftest::temp_source_file to write out files
for testing input-handling, and the files are unlinked in the dtor.

This leads to stale entries in input.c's cache of file content, which
could lead to errors if a temporary filename gets reused during a run
of the selftests.

We don't normally expect files to be "deleted from under us", so
special-case this by adding a special way for temp_source_file's
dtor to purge any cache entries referring to it.

gcc/ChangeLog:
* input.c (diagnostics_file_cache_forcibly_evict_file): New
function.
* input.h (diagnostics_file_cache_forcibly_evict_file): New
declaration.
* selftest.c (selftest::temp_source_file::~temp_source_file):
Evict m_filename from the diagnostic file cache.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239570 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/input.c
gcc/input.h
gcc/selftest.c