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

Function cmTrimWhitespace

Source/cmStringAlgorithms.cxx:24–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24std::string cmTrimWhitespace(cm::string_view str)
25{
26 // XXX(clang-tidy): This declaration and the next cannot be `const auto*`
27 // because the qualification of `auto` is platform-dependent.
28 // NOLINTNEXTLINE(readability-qualified-auto)
29 auto start = str.begin();
30 while (start != str.end() && cmsysString_isspace(*start)) {
31 ++start;
32 }
33 if (start == str.end()) {
34 return std::string();
35 }
36 // NOLINTNEXTLINE(readability-qualified-auto)
37 auto stop = str.end() - 1;
38 while (cmsysString_isspace(*stop)) {
39 --stop;
40 }
41 return std::string(start, stop + 1);
42}
43
44cm::string_view cmStripWhitespace(cm::string_view str)
45{

Callers 15

testStringAlgorithmsFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85
ParseKnownAttributesMethod · 0.85
CreateBuildSettingsMethod · 0.85
GetIncludeFlagsMethod · 0.85
cmCMakeString.cxxFile · 0.85
operator()Method · 0.85
CreateSolutionMethod · 0.85
WriteVariableMethod · 0.85
FindMakeProgramMethod · 0.85
ParseImplMethod · 0.85
ParseKeyValuePairMethod · 0.85

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by 1

testStringAlgorithmsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…