diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2024-07-22 17:39:19 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-07-23 14:11:27 (GMT) |
commit | e947e7b6e23fe740d85b1843fb459d2eab6820aa (patch) | |
tree | b14c2a95a4bb10ab629c1ffe7a409495435913e8 | |
parent | 55a4a585fa7bb1985d21b1c792cc1506a44758df (diff) | |
download | CMake-e947e7b6e23fe740d85b1843fb459d2eab6820aa.zip CMake-e947e7b6e23fe740d85b1843fb459d2eab6820aa.tar.gz CMake-e947e7b6e23fe740d85b1843fb459d2eab6820aa.tar.bz2 |
cmListFileCache: use cmStrCat instead of string stream
-rw-r--r-- | Source/cmListFileCache.cxx | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 4425845..cf869c8 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -4,7 +4,7 @@ #include "cmListFileCache.h" #include <memory> -#include <sstream> +#include <ostream> #include <utility> #ifdef _WIN32 @@ -15,6 +15,7 @@ #include "cmListFileLexer.h" #include "cmMessageType.h" #include "cmMessenger.h" +#include "cmStringAlgorithms.h" #include "cmSystemTools.h" namespace { @@ -177,20 +178,19 @@ bool cmListFileParser::Parse() return false; } } else { - std::ostringstream error; - error << "Parse error. Expected a newline, got " - << cmListFileLexer_GetTypeAsString(this->Lexer.get(), - token->type) - << " with text \"" << token->text << "\"."; - this->IssueError(error.str()); + auto error = cmStrCat( + "Parse error. Expected a newline, got ", + cmListFileLexer_GetTypeAsString(this->Lexer.get(), token->type), + " with text \"", token->text, "\"."); + this->IssueError(error); return false; } } else { - std::ostringstream error; - error << "Parse error. Expected a command name, got " - << cmListFileLexer_GetTypeAsString(this->Lexer.get(), token->type) - << " with text \"" << token->text << "\"."; - this->IssueError(error.str()); + auto error = cmStrCat( + "Parse error. Expected a command name, got ", + cmListFileLexer_GetTypeAsString(this->Lexer.get(), token->type), + " with text \"", token->text, "\"."); + this->IssueError(error); return false; } } @@ -225,11 +225,11 @@ bool cmListFileParser::ParseFunction(const char* name, long line) return false; } if (token->type != cmListFileLexer_Token_ParenLeft) { - std::ostringstream error; - error << "Parse error. Expected \"(\", got " - << cmListFileLexer_GetTypeAsString(this->Lexer.get(), token->type) - << " with text \"" << token->text << "\"."; - this->IssueError(error.str()); + auto error = + cmStrCat("Parse error. Expected \"(\", got ", + cmListFileLexer_GetTypeAsString(this->Lexer.get(), token->type), + " with text \"", token->text, "\"."); + this->IssueError(error); return false; } @@ -279,12 +279,12 @@ bool cmListFileParser::ParseFunction(const char* name, long line) this->Separation = SeparationError; } else { // Error. - std::ostringstream error; - error << "Parse error. Function missing ending \")\". " - "Instead found " - << cmListFileLexer_GetTypeAsString(this->Lexer.get(), token->type) - << " with text \"" << token->text << "\"."; - this->IssueError(error.str()); + auto error = cmStrCat( + "Parse error. Function missing ending \")\". " + "Instead found ", + cmListFileLexer_GetTypeAsString(this->Lexer.get(), token->type), + " with text \"", token->text, "\"."); + this->IssueError(error); return false; } } @@ -311,21 +311,21 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, } bool isError = (this->Separation == SeparationError || delim == cmListFileArgument::Bracket); - std::ostringstream m; cmListFileContext lfc; lfc.FilePath = this->FileName; lfc.Line = token->line; cmListFileBacktrace lfbt = this->Backtrace; lfbt = lfbt.Push(lfc); - m << "Syntax " << (isError ? "Error" : "Warning") - << " in cmake code at column " << token->column - << "\n" - "Argument not separated from preceding token by whitespace."; + auto msg = + cmStrCat("Syntax ", (isError ? "Error" : "Warning"), + " in cmake code at column ", token->column, + "\n" + "Argument not separated from preceding token by whitespace."); if (isError) { - this->Messenger->IssueMessage(MessageType::FATAL_ERROR, m.str(), lfbt); + this->Messenger->IssueMessage(MessageType::FATAL_ERROR, msg, lfbt); return false; } - this->Messenger->IssueMessage(MessageType::AUTHOR_WARNING, m.str(), lfbt); + this->Messenger->IssueMessage(MessageType::AUTHOR_WARNING, msg, lfbt); return true; } |