Warning and error fix.
(cherry picked from commit 9eb5a29d7c6d6430fb70a76f19b9a0e6d259da62)
This commit is contained in:
parent
b2997ee67a
commit
1465ec4d8a
@ -174,12 +174,18 @@ namespace cling {
|
||||
|
||||
///\brief Set the stdout and stderr stream to the appropriate file.
|
||||
///
|
||||
///\param [in] file - The file for teh redirection
|
||||
///\param [in] file - The file for the redirection.
|
||||
///\param [in] stream - Which stream to redirect: stdout, stderr or both.
|
||||
///\param [in] append - Write in append mode.
|
||||
///
|
||||
void setStdStream(llvm::StringRef file, RedirectionScope stream,
|
||||
bool append);
|
||||
private:
|
||||
///\brief Set a stream to a file
|
||||
///
|
||||
///\param [in] file - The file for the redirection.
|
||||
void setFileStream(std::string& fileStorage, llvm::StringRef file,
|
||||
bool append);
|
||||
};
|
||||
} // end namespace cling
|
||||
|
||||
|
@ -319,20 +319,25 @@ namespace cling {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void MetaProcessor::setFileStream(std::string& fileStorage,
|
||||
llvm::StringRef file, bool append) {
|
||||
fileStorage = file;
|
||||
if (!append && !fileStorage.empty()) {
|
||||
if (fopen(fileStorage.c_str(), "w")) {
|
||||
llvm::errs() << "cling::MetaProcessor Error: The file path is not"
|
||||
<< " valid.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MetaProcessor::setStdStream(llvm::StringRef file,
|
||||
RedirectionScope stream, bool append) {
|
||||
|
||||
if (stream & kSTDOUT) {
|
||||
m_FileOut = file;
|
||||
if (!append && !m_FileOut.empty()) {
|
||||
fopen(m_FileOut.c_str(), "w");
|
||||
}
|
||||
setFileStream(m_FileOut, file, append);
|
||||
}
|
||||
if (stream & kSTDERR) {
|
||||
m_FileErr = file;
|
||||
if (!append && !m_FileErr.empty()) {
|
||||
fopen(m_FileErr.c_str(), "w");
|
||||
}
|
||||
setFileStream(m_FileErr, file, append);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user