Clang: Use only filePathId for comparison

The filePathId is already unique and the directoryId is there only to
improve the access time for the directory. So it is already strongly
ordered if we compare only filePathId.

Change-Id: I67255bea1d36d41a59421eeb51964440c053b1e3
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-08-22 17:35:22 +02:00
parent d02d9b0f43
commit aca14a36e9
2 changed files with 10 additions and 14 deletions

View File

@@ -51,10 +51,7 @@ public:
friend bool operator==(FilePathId first, FilePathId second)
{
return first.isValid()
&& second.isValid()
&& first.directoryId == second.directoryId
&& first.filePathId == second.filePathId;
return first.isValid() && first.filePathId == second.filePathId;
}
friend bool operator!=(FilePathId first, FilePathId second)
@@ -64,8 +61,7 @@ public:
friend bool operator<(FilePathId first, FilePathId second)
{
return std::tie(first.directoryId, first.filePathId)
< std::tie(second.directoryId, second.filePathId);
return first.filePathId < second.filePathId;
}
friend QDataStream &operator<<(QDataStream &out, const FilePathId &filePathId)

View File

@@ -43,26 +43,26 @@ protected:
{"--er"},
{{"ER","2"}},
{"/bar"},
{{2, 1}},
{{2, 2}}};
{{2, 3}},
{{2, 4}}};
ClangBackEnd::V2::ProjectPartContainer projectPart2b{"ProjectPart2",
{"--liang"},
{{"LIANG","3"}},
{"/liang"},
{{2, 3}},
{{2, 2}, {2, 4}}};
{{2, 5}},
{{2, 4}, {2, 6}}};
ClangBackEnd::V2::ProjectPartContainer projectPart3{"ProjectPart3",
{"--san"},
{{"SAN","2"}},
{"/SAN"},
{{3, 1}},
{{3, 2}}};
{{3, 7}},
{{3, 8}}};
ClangBackEnd::V2::ProjectPartContainer projectPartMerged{"ProjectPart2",
{"--liang"},
{{"LIANG","3"}},
{"/liang"},
{{2, 1}, {2, 3}},
{{2, 2}, {2, 4}}};
{{2, 3}, {2, 5}},
{{2, 4}, {2, 6}}};
};
TEST_F(ProjectPartQueue, AddProjectPart)