| 140 | } |
| 141 | |
| 142 | void BfDeferredLocalAssignData::SetIntersection(const BfDeferredLocalAssignData& otherLocalAssignData) |
| 143 | { |
| 144 | BreakExtendChain(); |
| 145 | |
| 146 | if (otherLocalAssignData.mLeftBlockUncond) |
| 147 | { |
| 148 | // Intersection of self and infinity is self |
| 149 | } |
| 150 | else if (mLeftBlockUncond) |
| 151 | { |
| 152 | // Intersection of infinity and other is other |
| 153 | mAssignedLocals = otherLocalAssignData.mAssignedLocals; |
| 154 | } |
| 155 | else |
| 156 | { |
| 157 | for (int i = 0; i < (int)mAssignedLocals.size(); ) |
| 158 | { |
| 159 | auto& local = mAssignedLocals[i]; |
| 160 | |
| 161 | bool wantRemove = true; |
| 162 | bool foundOtherFields = false; |
| 163 | for (auto& otherLocalAssignData : otherLocalAssignData.mAssignedLocals) |
| 164 | { |
| 165 | if (otherLocalAssignData.mLocalVar == local.mLocalVar) |
| 166 | { |
| 167 | if ((otherLocalAssignData.mLocalVarField == local.mLocalVarField) || (otherLocalAssignData.mLocalVarField == -1)) |
| 168 | { |
| 169 | if (otherLocalAssignData.mAssignKind == BfLocalVarAssignKind_Conditional) |
| 170 | local.mAssignKind = BfLocalVarAssignKind_Conditional; |
| 171 | wantRemove = false; |
| 172 | } |
| 173 | else |
| 174 | foundOtherFields = true; |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | if ((wantRemove) && (foundOtherFields)) |
| 179 | { |
| 180 | for (auto& otherLocalAssignData : otherLocalAssignData.mAssignedLocals) |
| 181 | { |
| 182 | if (otherLocalAssignData.mLocalVar == local.mLocalVar) |
| 183 | { |
| 184 | mAssignedLocals.Add(otherLocalAssignData); |
| 185 | } |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | if (wantRemove) |
| 190 | { |
| 191 | mAssignedLocals.RemoveAt(i); |
| 192 | } |
| 193 | else |
| 194 | i++; |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | mHadFallthrough = mHadFallthrough && otherLocalAssignData.mHadFallthrough; |
| 199 | mLeftBlockUncond = mLeftBlockUncond && otherLocalAssignData.mLeftBlockUncond; |
no test coverage detected