Clang: Handle native file in the file cache

Different types are introduced for normalized and native file path. So the
compiler is warning you if you try the wrong format.

Change-Id: I1da0686b142cbf9bb7578468c2b50f90a94cebf9
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2017-11-16 17:48:53 +01:00
parent bb2f9574b4
commit a15250051d
38 changed files with 985 additions and 287 deletions

View File

@@ -81,8 +81,8 @@ public:
auto notAlreadyIncluded = isNotAlreadyIncluded(fileUID);
if (notAlreadyIncluded.first) {
m_alreadyIncludedFileUIDs.insert(notAlreadyIncluded.second, fileUID);
Utils::PathString filePath = filePathFromFile(file);
if (!filePath.isEmpty()) {
FilePath filePath = filePathFromFile(file);
if (!filePath.empty()) {
FilePathId includeId = m_filePathCache.filePathId(filePath);
m_includeIds.emplace_back(includeId);
}
@@ -146,13 +146,9 @@ public:
return {range.first == range.second, range.first};
}
static Utils::PathString filePathFromFile(const clang::FileEntry *file)
static FilePath filePathFromFile(const clang::FileEntry *file)
{
clang::StringRef realPath = file->tryGetRealPathName();
if (!realPath.empty())
return fromNativePath(realPath);
return fromNativePath(absolutePath(file->getName()));
return FilePath::fromNativeFilePath(absolutePath(file->getName()));
}
private: