Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Differential D146104 Diff 505515 clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
Changeset View
Changeset View
Standalone View
Standalone View
clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
Show First 20 Lines • Show All 1,575 Lines • ▼ Show 20 Lines | |||||
bool lazyMapOfSetsIntersectionExists(const MapTy &Map, const ElemTy &E1, | bool lazyMapOfSetsIntersectionExists(const MapTy &Map, const ElemTy &E1, | ||||
const ElemTy &E2) { | const ElemTy &E2) { | ||||
auto E1Iterator = Map.find(E1); | auto E1Iterator = Map.find(E1); | ||||
auto E2Iterator = Map.find(E2); | auto E2Iterator = Map.find(E2); | ||||
if (E1Iterator == Map.end() || E2Iterator == Map.end()) | if (E1Iterator == Map.end() || E2Iterator == Map.end()) | ||||
return false; | return false; | ||||
for (const auto &E1SetElem : E1Iterator->second) | for (const auto &E1SetElem : E1Iterator->second) | ||||
if (llvm::is_contained(E2Iterator->second, E1SetElem)) | if (E2Iterator->second.contains(E1SetElem)) | ||||
return true; | return true; | ||||
return false; | return false; | ||||
} | } | ||||
/// Implements the heuristic that marks two parameters related if there is | /// Implements the heuristic that marks two parameters related if there is | ||||
/// a usage for both in the same strict expression subtree. A strict | /// a usage for both in the same strict expression subtree. A strict | ||||
/// expression subtree is a tree which only includes Expr nodes, i.e. no | /// expression subtree is a tree which only includes Expr nodes, i.e. no | ||||
▲ Show 20 Lines • Show All 720 Lines • Show Last 20 Lines |