diff options
Diffstat (limited to 'gcc/selftest.h')
-rw-r--r-- | gcc/selftest.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/selftest.h b/gcc/selftest.h index b0a4142..3bb4885 100644 --- a/gcc/selftest.h +++ b/gcc/selftest.h @@ -25,6 +25,8 @@ along with GCC; see the file COPYING3. If not see #if CHECKING_P +class file_cache; + namespace selftest { /* A struct describing the source-location of a selftest, to make it @@ -91,17 +93,20 @@ extern void assert_str_startswith (const location &loc, /* A named temporary file for use in selftests. Usable for writing out files, and as the base class for temp_source_file. - The file is unlinked in the destructor. */ + The file is unlinked in the destructor. + If the file_cache is non-null, the filename is evicted from + the file_cache when the named_temp_file is destroyed. */ class named_temp_file { public: - named_temp_file (const char *suffix); + named_temp_file (const char *suffix, file_cache *fc = nullptr); ~named_temp_file (); const char *get_filename () const { return m_filename; } private: char *m_filename; + file_cache *m_file_cache; }; /* A class for writing out a temporary sourcefile for use in selftests @@ -111,7 +116,7 @@ class temp_source_file : public named_temp_file { public: temp_source_file (const location &loc, const char *suffix, - const char *content); + const char *content, file_cache *fc = nullptr); temp_source_file (const location &loc, const char *suffix, const char *content, size_t sz); }; |