ToolOutputFile.h (276479) | ToolOutputFile.h (280031) |
---|---|
1//===- ToolOutputFile.h - Output files for compiler-like tools -----------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 15 unchanged lines hidden (view full) --- 24/// - The file is automatically deleted when the tool_output_file 25/// object is destroyed unless the client calls keep(). 26class tool_output_file { 27 /// Installer - This class is declared before the raw_fd_ostream so that 28 /// it is constructed before the raw_fd_ostream is constructed and 29 /// destructed after the raw_fd_ostream is destructed. It installs 30 /// cleanups in its constructor and uninstalls them in its destructor. 31 class CleanupInstaller { | 1//===- ToolOutputFile.h - Output files for compiler-like tools -----------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 15 unchanged lines hidden (view full) --- 24/// - The file is automatically deleted when the tool_output_file 25/// object is destroyed unless the client calls keep(). 26class tool_output_file { 27 /// Installer - This class is declared before the raw_fd_ostream so that 28 /// it is constructed before the raw_fd_ostream is constructed and 29 /// destructed after the raw_fd_ostream is destructed. It installs 30 /// cleanups in its constructor and uninstalls them in its destructor. 31 class CleanupInstaller { |
32 /// Filename - The name of the file. | 32 /// The name of the file. |
33 std::string Filename; 34 public: | 33 std::string Filename; 34 public: |
35 /// Keep - The flag which indicates whether we should not delete the file. | 35 /// The flag which indicates whether we should not delete the file. |
36 bool Keep; 37 | 36 bool Keep; 37 |
38 explicit CleanupInstaller(const char *filename); | 38 explicit CleanupInstaller(StringRef ilename); |
39 ~CleanupInstaller(); 40 } Installer; 41 42 /// OS - The contained stream. This is intentionally declared after 43 /// Installer. 44 raw_fd_ostream OS; 45 46public: | 39 ~CleanupInstaller(); 40 } Installer; 41 42 /// OS - The contained stream. This is intentionally declared after 43 /// Installer. 44 raw_fd_ostream OS; 45 46public: |
47 /// tool_output_file - This constructor's arguments are passed to 48 /// to raw_fd_ostream's constructor. 49 tool_output_file(const char *filename, std::string &ErrorInfo, | 47 /// This constructor's arguments are passed to to raw_fd_ostream's 48 /// constructor. 49 tool_output_file(StringRef Filename, std::error_code &EC, |
50 sys::fs::OpenFlags Flags); 51 | 50 sys::fs::OpenFlags Flags); 51 |
52 tool_output_file(const char *Filename, int FD); | 52 tool_output_file(StringRef Filename, int FD); |
53 54 /// os - Return the contained raw_fd_ostream. 55 raw_fd_ostream &os() { return OS; } 56 57 /// keep - Indicate that the tool's job wrt this output file has been 58 /// successful and the file should not be deleted. 59 void keep() { Installer.Keep = true; } 60}; 61 62} // end llvm namespace 63 64#endif | 53 54 /// os - Return the contained raw_fd_ostream. 55 raw_fd_ostream &os() { return OS; } 56 57 /// keep - Indicate that the tool's job wrt this output file has been 58 /// successful and the file should not be deleted. 59 void keep() { Installer.Keep = true; } 60}; 61 62} // end llvm namespace 63 64#endif |