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

Function HandlePopFrontCommand

Source/cmListCommand.cxx:246–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246bool HandlePopFrontCommand(std::vector<std::string> const& args,
247 cmExecutionStatus& status)
248{
249 assert(args.size() >= 2);
250
251 cmMakefile& makefile = status.GetMakefile();
252 auto ai = args.cbegin();
253 ++ai; // Skip subcommand name
254 std::string const& listName = *ai++;
255 auto list = GetList(listName, makefile);
256
257 if (!list) {
258 // Can't get the list definition... undefine any vars given after.
259 for (; ai != args.cend(); ++ai) {
260 makefile.RemoveDefinition(*ai);
261 }
262 return true;
263 }
264
265 if (!list->empty()) {
266 if (ai == args.cend()) {
267 // No variables are given... Just remove one element.
268 list->pop_front();
269 } else {
270 // Ok, assign elements to be removed to the given variables
271 auto vi = list->begin();
272 for (; vi != list->end() && ai != args.cend(); ++ai, ++vi) {
273 assert(!ai->empty());
274 makefile.AddDefinition(*ai, *vi);
275 }
276 list->erase(list->begin(), vi);
277 // Undefine the rest variables if the list gets empty earlier...
278 for (; ai != args.cend(); ++ai) {
279 makefile.RemoveDefinition(*ai);
280 }
281 }
282
283 makefile.AddDefinition(listName, list->to_string());
284
285 } else if (ai !=
286 args.cend()) { // The list is empty, but some args were given
287 // Need to *undefine* 'em all, cuz there are no items to assign...
288 for (; ai != args.cend(); ++ai) {
289 makefile.RemoveDefinition(*ai);
290 }
291 }
292
293 return true;
294}
295
296bool HandleFindCommand(std::vector<std::string> const& args,
297 cmExecutionStatus& status)

Callers

nothing calls this directly

Calls 13

cbeginMethod · 0.80
cendMethod · 0.80
pop_frontMethod · 0.80
eraseMethod · 0.80
to_stringMethod · 0.80
GetListFunction · 0.70
sizeMethod · 0.45
GetMakefileMethod · 0.45
RemoveDefinitionMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…