diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2020-04-08 15:51:36 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2020-04-13 15:26:02 (GMT) |
commit | f2a33107be2d7d701708506c4c3054799d941bd6 (patch) | |
tree | 5fe7cc0705c425c368c293ff6dab6642ff1745ed /Source/cmake.cxx | |
parent | 4e9e7c713e01284d48fff8f3f18b3ffb08b6eaf9 (diff) | |
download | CMake-f2a33107be2d7d701708506c4c3054799d941bd6.zip CMake-f2a33107be2d7d701708506c4c3054799d941bd6.tar.gz CMake-f2a33107be2d7d701708506c4c3054799d941bd6.tar.bz2 |
clang-tidy: address bugprone-branch-clone lints
Arguably, many of these are bugs in `clang-tidy`. An if/else tree with
other conditionals between cloned blocks may be relying on the
intermediate logic to fall out of the case and inverting this logic may
be non-trivial.
See: https://bugs.llvm.org/show_bug.cgi?id=44165
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 2ec893f..ea1d8ca 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -642,6 +642,8 @@ void cmake::SetArgs(const std::vector<std::string>& args) path = cmSystemTools::CollapseFullPath(path); cmSystemTools::ConvertToUnixSlashes(path); this->SetHomeDirectory(path); + // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165 + // NOLINTNEXTLINE(bugprone-branch-clone) } else if (cmHasLiteralPrefix(arg, "-O")) { // There is no local generate anymore. Ignore -O option. } else if (cmHasLiteralPrefix(arg, "-B")) { @@ -681,27 +683,16 @@ void cmake::SetArgs(const std::vector<std::string>& args) this->VSSolutionFile = args[++i]; } #endif - else if (cmHasLiteralPrefix(arg, "-D")) { + else if (cmHasLiteralPrefix(arg, "-D") || cmHasLiteralPrefix(arg, "-U") || + cmHasLiteralPrefix(arg, "-C")) { // skip for now - // in case '-D var=val' is given, also skip the next - // in case '-Dvar=val' is given, don't skip the next - if (arg.size() == 2) { - ++i; - } - } else if (cmHasLiteralPrefix(arg, "-U")) { - // skip for now - // in case '-U var' is given, also skip the next - // in case '-Uvar' is given, don't skip the next - if (arg.size() == 2) { - ++i; - } - } else if (cmHasLiteralPrefix(arg, "-C")) { - // skip for now - // in case '-C path' is given, also skip the next - // in case '-Cpath' is given, don't skip the next + // in case '-[DUC] argval' var' is given, also skip the next + // in case '-[DUC]argval' is given, don't skip the next if (arg.size() == 2) { ++i; } + // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165 + // NOLINTNEXTLINE(bugprone-branch-clone) } else if (cmHasLiteralPrefix(arg, "-P")) { // skip for now i++; |