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

Method Scan

Source/cmDependsC.cxx:344–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342}
343
344void cmDependsC::Scan(std::istream& is, std::string const& directory,
345 std::string const& fullName)
346{
347 cmIncludeLines& newCacheEntry = this->FileCache[fullName];
348 newCacheEntry.Used = true;
349
350 // Read one line at a time.
351 std::string line;
352 while (cmSystemTools::GetLineFromStream(is, line)) {
353 // Transform the line content first.
354 if (!this->TransformRules.empty()) {
355 this->TransformLine(line);
356 }
357
358 // Match include directives.
359 if (this->IncludeRegexLine.find(line)) {
360 // Get the file being included.
361 UnscannedEntry entry;
362 entry.FileName = this->IncludeRegexLine.match(2);
363 cmSystemTools::ConvertToUnixSlashes(entry.FileName);
364 if (this->IncludeRegexLine.match(3) == "\"" &&
365 !cmSystemTools::FileIsFullPath(entry.FileName)) {
366 // This was a double-quoted include with a relative path. We
367 // must check for the file in the directory containing the
368 // file we are scanning.
369 entry.QuotedLocation =
370 cmSystemTools::CollapseFullPath(entry.FileName, directory);
371 }
372
373 // Queue the file if it has not yet been encountered and it
374 // matches the regular expression for recursive scanning. Note
375 // that this check does not account for the possibility of two
376 // headers with the same name in different directories when one
377 // is included by double-quotes and the other by angle brackets.
378 // It also does not work properly if two header files with the same
379 // name exist in different directories, and both are included from a
380 // file their own directory by simply using "filename.h" (#12619)
381 // This kind of problem will be fixed when a more
382 // preprocessor-like implementation of this scanner is created.
383 if (this->IncludeRegexScan.find(entry.FileName)) {
384 newCacheEntry.UnscannedEntries.push_back(entry);
385 if (this->Encountered.find(entry.FileName) ==
386 this->Encountered.end()) {
387 this->Encountered.insert(entry.FileName);
388 this->Unscanned.push(entry);
389 }
390 }
391 }
392 }
393}
394
395void cmDependsC::SetupTransforms()
396{

Callers 1

WriteDependenciesMethod · 0.95

Calls 7

TransformLineMethod · 0.95
push_backMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45
matchMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected