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/cmLocalGenerator.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/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f5ca5f4..e6083d3 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2070,11 +2070,9 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, case cmStateEnums::OBJECT_LIBRARY: // An object library has no single file on which to depend. // This was listed to get the target-level dependency. - return false; case cmStateEnums::INTERFACE_LIBRARY: // An interface library has no file on which to depend. // This was listed to get the target-level dependency. - return false; case cmStateEnums::UTILITY: case cmStateEnums::GLOBAL_TARGET: // A utility target has no file on which to depend. This was listed @@ -3389,11 +3387,12 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget( // Select a nice-looking reference to the source file to construct // the object file name. std::string objectName; + // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165 + // NOLINTNEXTLINE(bugprone-branch-clone) if ((relSource && !relBinary) || (subSource && !subBinary)) { objectName = relFromSource; - } else if ((relBinary && !relSource) || (subBinary && !subSource)) { - objectName = relFromBinary; - } else if (relFromBinary.length() < relFromSource.length()) { + } else if ((relBinary && !relSource) || (subBinary && !subSource) || + relFromBinary.length() < relFromSource.length()) { objectName = relFromBinary; } else { objectName = relFromSource; @@ -3552,7 +3551,6 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4() break; case cmPolicies::NEW: // New behavior is to ignore the variable. - return false; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: // This will never be the case because the only way to require |