| 147 | } |
| 148 | |
| 149 | bool 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 | |
| 175 | bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc) |
| 176 | { |
no test coverage detected