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

Method MatchesAmbiguousExtension

Source/cmSourceFileLocation.cxx:149–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149bool cmSourceFileLocation::MatchesAmbiguousExtension(
150 cmSourceFileLocation const& loc) const
151{
152 assert(this->Makefile);
153 // This location's extension is not ambiguous but loc's extension
154 // is. See if the names match as-is.
155 if (this->Name == loc.Name) {
156 return true;
157 }
158
159 // Check if loc's name could possibly be extended to our name by
160 // adding an extension.
161 if (!(this->Name.size() > loc.Name.size() &&
162 this->Name[loc.Name.size()] == '.' &&
163 cmHasPrefix(this->Name, loc.Name))) {
164 return false;
165 }
166
167 // Only a fixed set of extensions will be tried to match a file on
168 // disk. One of these must match if loc refers to this source file.
169 auto ext = cm::string_view(this->Name).substr(loc.Name.size() + 1);
170 cmMakefile const* mf = this->Makefile;
171 auto* cm = mf->GetCMakeInstance();
172 return cm->IsAKnownExtension(ext);
173}
174
175bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
176{

Callers 1

MatchesMethod · 0.80

Calls 5

cmHasPrefixFunction · 0.85
IsAKnownExtensionMethod · 0.80
sizeMethod · 0.45
substrMethod · 0.45
GetCMakeInstanceMethod · 0.45

Tested by

no test coverage detected