clang: Make sure include paths are unique
ClosedPublic

Authored by aspotashev on Sep 13 2016, 11:08 PM.

Details

Summary

std::unique() is not enough because it only removes consecutive
duplicates.

In my case Path(url).parent() pushed into the list at line
"paths.push_front(Path(url).parent());" was duplicating an existing
include path probably generated by CMake.

BUG: 361716

Diff Detail

Repository
R32 KDevelop
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
aspotashev updated this revision to Diff 6709.Sep 13 2016, 11:08 PM
aspotashev retitled this revision from to clang: Make sure include paths are unique.
aspotashev updated this object.
aspotashev edited the test plan for this revision. (Show Details)
aspotashev added a reviewer: mwolff.
aspotashev added a subscriber: kfunk.
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptSep 13 2016, 11:08 PM
brauch added a subscriber: brauch.Sep 13 2016, 11:12 PM

Looks good to me -- std::unique is really a hideous function. Milian should give his ok though :)

kfunk accepted this revision.Sep 14 2016, 8:07 AM
kfunk added a reviewer: kfunk.

Makes sense to me. The order of the include paths is not really relevant for the include path completion.

Please check if this change does not break unit tests.

languages/clang/codecompletion/includepathcompletioncontext.cpp
168

Performance: If we sort paths later on, pushing to front makes no sense. Can push to the end here.

This revision is now accepted and ready to land.Sep 14 2016, 8:07 AM
This revision was automatically updated to reflect the committed changes.
mwolff edited edge metadata.Sep 15 2016, 8:09 AM

thank you ;-)