ClangTools: Add header files to the list of files to be analyzed

Now that the CMakeProjectManager is reporting the header files as
source files, it makes sense to analyze the headers as source files.

Note that the header type needs to change to source type since the
"cxx-header" argument that will be send if the Kind is CxxHeader is
handled by the compiler as an argument to produce a precompiled
header, which is not what we want.

Fixes: QTCREATORBUG-21452
Fixes: QTCREATORBUG-25644
Fixes: QTCREATORBUG-25782
Change-Id: Icd674962ff8312b8fbfa46491938eb721edd761d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Cristian Adam
2021-10-01 16:32:47 +02:00
parent 2fcd764d56
commit 60fca0596a
4 changed files with 42 additions and 4 deletions

View File

@@ -160,11 +160,12 @@ static FileInfo getFileInfo(const FilePath &file, Project *project)
if (!projectFile.active)
continue;
// found the best candidate, early return
ProjectFile::Kind sourceKind = ProjectFile::sourceKind(projectFile.kind);
if (projectPart->buildTargetType != BuildTargetType::Unknown)
return FileInfo(projectFilePath, projectFile.kind, projectPart);
return FileInfo(projectFilePath, sourceKind, projectPart);
// found something but keep looking for better candidates
if (candidate.projectPart.isNull())
candidate = FileInfo(projectFilePath, projectFile.kind, projectPart);
candidate = FileInfo(projectFilePath, sourceKind, projectPart);
}
}