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

Method ExtractFlagRegex

Source/cmGlobalXCodeGenerator.cxx:2311–2337  ·  view source on GitHub ↗

This function removes each matching occurrence of the expression and returns the last one (i.e., the dominant flag in GCC)

Source from the content-addressed store, hash-verified

2309// This function removes each matching occurrence of the expression and
2310// returns the last one (i.e., the dominant flag in GCC)
2311std::string cmGlobalXCodeGenerator::ExtractFlagRegex(char const* exp,
2312 int matchIndex,
2313 std::string& flags)
2314{
2315 std::string retFlag;
2316
2317 cmsys::RegularExpression regex(exp);
2318 assert(regex.is_valid());
2319 if (!regex.is_valid()) {
2320 return retFlag;
2321 }
2322
2323 std::string::size_type offset = 0;
2324
2325 while (regex.find(&flags[offset])) {
2326 std::string::size_type const startPos = offset + regex.start(matchIndex);
2327 std::string::size_type const endPos = offset + regex.end(matchIndex);
2328 std::string::size_type const size = endPos - startPos;
2329
2330 offset = startPos + 1;
2331
2332 retFlag.assign(flags, startPos, size);
2333 flags.replace(startPos, size, size, ' ');
2334 }
2335
2336 return retFlag;
2337}
2338
2339//----------------------------------------------------------------------------
2340// This function strips off Xcode attributes that do not target the current

Callers 1

CreateBuildSettingsMethod · 0.95

Calls 4

assignMethod · 0.80
findMethod · 0.45
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected