diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2020-03-22 13:54:31 (GMT) |
---|---|---|
committer | Alex Turbov <i.zaufi@gmail.com> | 2020-03-26 03:36:57 (GMT) |
commit | 3fdd8db3aaf4c804dd24a59913650ad024c8343e (patch) | |
tree | 1b2b9ef7f9b724b802b4cecdc2554f5abaf41a43 /Source/cmGlobalUnixMakefileGenerator3.cxx | |
parent | ea54f8d44199502d6d02369ea0a2de4e9ef8c1ca (diff) | |
download | CMake-3fdd8db3aaf4c804dd24a59913650ad024c8343e.zip CMake-3fdd8db3aaf4c804dd24a59913650ad024c8343e.tar.gz CMake-3fdd8db3aaf4c804dd24a59913650ad024c8343e.tar.bz2 |
Refactor: Avoid `std::endl` where it's not necessary (part 1)
The `std::endl` manupulator, except inserting `\n` character, also
performs `os.flush()`, which may leads to undesired effects (like
disk I/O in the middle of forming data strings). For the
`std::stringstream` it also has no meaning.
Diffstat (limited to 'Source/cmGlobalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 7daca74..bebd4e0 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -159,7 +159,7 @@ void cmGlobalUnixMakefileGenerator3::Generate() this->WriteMainCMakefile(); if (this->CommandDatabase) { - *this->CommandDatabase << std::endl << "]"; + *this->CommandDatabase << "\n]"; this->CommandDatabase.reset(); } } @@ -174,21 +174,20 @@ void cmGlobalUnixMakefileGenerator3::AddCXXCompileCommand( "/compile_commands.json"; this->CommandDatabase = cm::make_unique<cmGeneratedFileStream>(commandDatabaseName); - *this->CommandDatabase << "[" << std::endl; + *this->CommandDatabase << "[\n"; } else { - *this->CommandDatabase << "," << std::endl; + *this->CommandDatabase << ",\n"; } - *this->CommandDatabase << "{" << std::endl + *this->CommandDatabase << "{\n" << R"( "directory": ")" << cmGlobalGenerator::EscapeJSON(workingDirectory) - << "\"," << std::endl + << "\",\n" << R"( "command": ")" << cmGlobalGenerator::EscapeJSON(compileCommand) - << "\"," << std::endl + << "\",\n" << R"( "file": ")" - << cmGlobalGenerator::EscapeJSON(sourceFile) << "\"" - << std::endl - << "}"; + << cmGlobalGenerator::EscapeJSON(sourceFile) + << "\"\n}"; } void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2() |