| 155 | } |
| 156 | |
| 157 | bool TempVariable::IsInUse() const |
| 158 | { |
| 159 | const auto currentGen = |
| 160 | tempVarInUseGeneration.load(std::memory_order_relaxed); |
| 161 | if (_isInUseCacheGeneration == currentGen) { |
| 162 | return _isInUseCache; |
| 163 | } |
| 164 | |
| 165 | bool inUse = false; |
| 166 | const auto ref = GetRef(); |
| 167 | |
| 168 | if (ref.HasValidID()) { |
| 169 | for (const auto ¯o : GetAllMacros()) { |
| 170 | if (segmentsReferTo(macro->Conditions(), ref) || |
| 171 | segmentsReferTo(macro->Actions(), ref) || |
| 172 | segmentsReferTo(macro->ElseActions(), ref)) { |
| 173 | inUse = true; |
| 174 | break; |
| 175 | } |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | _isInUseCache = inUse; |
| 180 | _isInUseCacheGeneration = currentGen; |
| 181 | return inUse; |
| 182 | } |
| 183 | |
| 184 | void IncrementTempVarInUseGeneration() |
| 185 | { |
no test coverage detected