diff options
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_common.h')
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_common.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h index e2f33b27c66..a369c6f7014 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h @@ -224,6 +224,13 @@ bool WriteToFile(fd_t fd, const void *buff, uptr buff_size, bool RenameFile(const char *oldpath, const char *newpath, error_t *error_p = nullptr); +// Scoped file handle closer. +struct FileCloser { + explicit FileCloser(fd_t fd) : fd(fd) {} + ~FileCloser() { CloseFile(fd); } + fd_t fd; +}; + bool SupportsColoredOutput(fd_t fd); // Opens the file 'file_name" and reads up to 'max_len' bytes. |

