MCPcopy Create free account
hub / github.com/Kitware/CMake / VariableAccessed

Method VariableAccessed

Source/cmVariableWatch.cxx:65–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65bool cmVariableWatch::VariableAccessed(std::string const& variable,
66 int access_type, char const* newValue,
67 cmMakefile const* mf) const
68{
69 auto mit = this->WatchMap.find(variable);
70 if (mit != this->WatchMap.end()) {
71 // The strategy here is to copy the list of callbacks, and ignore
72 // new callbacks that existing ones may add.
73 std::vector<std::weak_ptr<Pair>> vp(mit->second.begin(),
74 mit->second.end());
75 for (auto& weak_it : vp) {
76 // In the case where a callback was removed, the weak_ptr will not be
77 // lockable, and so this ensures we don't attempt to call into freed
78 // memory
79 if (auto it = weak_it.lock()) {
80 it->Method(variable, access_type, it->ClientData, newValue, mf);
81 }
82 }
83 return true;
84 }
85 return false;
86}

Callers 6

AddDefinitionMethod · 0.80
RemoveDefinitionMethod · 0.80
IsDefinitionSetMethod · 0.80
IsNormalDefinitionSetMethod · 0.80
GetDefinitionMethod · 0.80
RaiseScopeMethod · 0.80

Calls 5

lockMethod · 0.80
findMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
MethodMethod · 0.45

Tested by

no test coverage detected