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

Method Evaluate

Source/cmGeneratorExpressionNode.cxx:454–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

452 int NumExpectedParameters() const override { return 3; }
453
454 std::string Evaluate(
455 std::vector<std::string> const& parameters, cm::GenEx::Evaluation* eval,
456 GeneratorExpressionContent const* content,
457 cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
458 {
459 if (parameters.size() != 3) {
460 reportError(eval, content->GetOriginalExpression(),
461 "$<FILTER:...> expression requires three parameters");
462 return {};
463 }
464
465 if (parameters[1] != "INCLUDE" && parameters[1] != "EXCLUDE") {
466 reportError(
467 eval, content->GetOriginalExpression(),
468 "$<FILTER:...> second parameter must be either INCLUDE or EXCLUDE");
469 return {};
470 }
471
472 try {
473 return cmList{ parameters.front(), cmList::EmptyElements::Yes }
474 .filter(parameters[2],
475 parameters[1] == "EXCLUDE" ? cmList::FilterMode::EXCLUDE
476 : cmList::FilterMode::INCLUDE)
477 .to_string();
478 } catch (std::invalid_argument&) {
479 reportError(eval, content->GetOriginalExpression(),
480 "$<FILTER:...> failed to compile regex");
481 return {};
482 }
483 }
484} filterNode;
485
486static const struct RemoveDuplicatesNode : public cmGeneratorExpressionNode

Callers

nothing calls this directly

Calls 6

reportErrorFunction · 0.85
GetOriginalExpressionMethod · 0.80
to_stringMethod · 0.80
filterMethod · 0.80
sizeMethod · 0.45
frontMethod · 0.45

Tested by

no test coverage detected