summaryrefslogtreecommitdiff
path: root/Source/cmInstallExportGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-05-06 14:19:04 -0400
committerBrad King <brad.king@kitware.com>2016-05-06 14:25:55 -0400
commit64b5520346c75ec479042a114390a0bf71909723 (patch)
treebea1373e84594ba036fe50eea3eab86375d63aa6 /Source/cmInstallExportGenerator.cxx
parent73601ff831faa80a188e5997ee048b6986b00a5c (diff)
downloadcmake-64b5520346c75ec479042a114390a0bf71909723.tar.gz
Isolate formatted streaming blocks with clang-format off/on
The clang-format tool can do a good job formatting most code, but well-organized streaming blocks are best left manually formatted. Find blocks of the form os << "...\n" "...\n" ; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}' Find blocks of the form os << "...\n" << "...\n" << "...\n"; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}' Surround such blocks with the pair /* clang-format off */ ... /* clang-format on */ in order to protect them from update by clang-format. Use the C-style `/*...*/` comments instead of C++-style `//...` comments in order to prevent them from ever being swallowed by re-formatting of surrounding comments.
Diffstat (limited to 'Source/cmInstallExportGenerator.cxx')
-rw-r--r--Source/cmInstallExportGenerator.cxx2
1 files changed, 2 insertions, 0 deletions
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index a31c0c979d..0b623c6820 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -216,6 +216,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
Indent indentN = indent.Next();
Indent indentNN = indentN.Next();
Indent indentNNN = indentNN.Next();
+ /* clang-format off */
os << indentN << "file(DIFFERENT EXPORT_FILE_CHANGED FILES\n"
<< indentN << " \"" << installedFile << "\"\n"
<< indentN << " \"" << this->MainImportFile << "\")\n";
@@ -229,6 +230,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
os << indentNN << "endif()\n";
os << indentN << "endif()\n";
os << indent << "endif()\n";
+ /* clang-format on */
// Install the main export file.
std::vector<std::string> files;