diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-11-13 18:32:08 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-13 18:32:08 +0000 |
commit | f482d59386dbc70716f7a5f65adb37ff86b501e6 (patch) | |
tree | c4b9754f2d3f893b61e263634d5b53785d38626b /include/clang/Frontend/CompilerInstance.h | |
parent | a0fdd916bbaede20b4ef257af0f61487cb6ed85a (diff) |
Add CompilerInstance utility functions for creating output files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88667 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend/CompilerInstance.h')
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 0623b2de1a..b7b3e8c998 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -20,6 +20,7 @@ namespace llvm { class LLVMContext; class raw_ostream; +class raw_fd_ostream; } namespace clang { @@ -432,6 +433,39 @@ public: bool UseDebugPrinter, bool ShowMacros, llvm::raw_ostream &OS); + /// Create the default output file (from the invocation's options) and add it + /// to the list of tracked output files. + llvm::raw_fd_ostream * + createDefaultOutputFile(bool Binary = true, llvm::StringRef BaseInput = "", + llvm::StringRef Extension = ""); + + /// Create a new output file and add it to the list of tracked output files, + /// optionally deriving the output path name. + llvm::raw_fd_ostream * + createOutputFile(llvm::StringRef OutputPath, bool Binary = true, + llvm::StringRef BaseInput = "", + llvm::StringRef Extension = ""); + + /// Create a new output file, optionally deriving the output path name. + /// + /// If \arg OutputPath is empty, then createOutputFile will derive an output + /// path location as \arg BaseInput, with any suffix removed, and \arg + /// Extension appended. + /// + /// \param OutputPath - If given, the path to the output file. + /// \param Error [out] - On failure, the error message. + /// \param BaseInput - If \arg OutputPath is empty, the input path name to use + /// for deriving the output path. + /// \param Extension - The extension to use for derived output names. + /// \param Binary - The mode to open the file in. + /// \param ResultPathName [out] - If given, the result path name will be + /// stored here on success. + static llvm::raw_fd_ostream * + createOutputFile(llvm::StringRef OutputPath, std::string &Error, + bool Binary = true, llvm::StringRef BaseInput = "", + llvm::StringRef Extension = "", + std::string *ResultPathName = 0); + /// } }; |