MCPcopy Create free account
hub / github.com/KDE/kdevelop / scanIncludePaths

Function scanIncludePaths

plugins/clang/duchain/unknowndeclarationproblem.cpp:70–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70QStringList scanIncludePaths( const QString& identifier, const QDir& dir, int maxDepth = 3 )
71{
72 if (!maxDepth) {
73 return {};
74 }
75
76 QStringList candidates;
77 const auto path = dir.absolutePath();
78
79 if( isBlacklisted( path ) ) {
80 return {};
81 }
82
83 const QStringList nameFilters = {identifier, identifier + QLatin1String(".*")};
84 const auto& files = dir.entryList(nameFilters, QDir::Files);
85 for (const auto& file : files) {
86 if (identifier.compare(file, Qt::CaseInsensitive) == 0 || ClangHelpers::isHeader(file)) {
87 const QString filePath = path + QLatin1Char('/') + file;
88 clangDebug() << "Found candidate file" << filePath;
89 candidates.append( filePath );
90 }
91 }
92
93 maxDepth--;
94 const auto& subdirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
95 for (const auto& subdir : subdirs) {
96 candidates += scanIncludePaths( identifier, QDir{ path + QLatin1Char('/') + subdir }, maxDepth );
97 }
98
99 return candidates;
100}
101
102/**
103 * Find files in dir that match the given identifier. Matches common C++ header file extensions only.

Callers 1

includeFilesFunction · 0.85

Calls 9

isBlacklistedFunction · 0.85
sortFunction · 0.85
toLocalFileMethod · 0.80
compareMethod · 0.45
appendMethod · 0.45
toStringMethod · 0.45
lastMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected