Changeset View
Changeset View
Standalone View
Standalone View
languages/clang/codecompletion/includepathcompletioncontext.cpp
Show First 20 Lines • Show All 159 Lines • ▼ Show 20 Line(s) | |||||
160 | } | 160 | } | ||
161 | 161 | | |||
162 | QVector<KDevelop::IncludeItem> includeItemsForUrl(const QUrl& url, const IncludePathProperties& properties, const Path::List& includePaths ) | 162 | QVector<KDevelop::IncludeItem> includeItemsForUrl(const QUrl& url, const IncludePathProperties& properties, const Path::List& includePaths ) | ||
163 | { | 163 | { | ||
164 | QVector<IncludeItem> includeItems; | 164 | QVector<IncludeItem> includeItems; | ||
165 | Path::List paths = includePaths; | 165 | Path::List paths = includePaths; | ||
166 | 166 | | |||
167 | if (properties.local) { | 167 | if (properties.local) { | ||
168 | paths.push_front(Path(url).parent()); | 168 | paths.push_front(Path(url).parent()); | ||
kfunk: Performance: If we sort paths later on, pushing to front makes no sense. Can push to the end… | |||||
169 | } | 169 | } | ||
170 | 170 | | |||
171 | std::sort(paths.begin(), paths.end()); | ||||
171 | auto last = std::unique(paths.begin(), paths.end()); | 172 | auto last = std::unique(paths.begin(), paths.end()); | ||
172 | 173 | | |||
173 | int pathNumber = 0; | 174 | int pathNumber = 0; | ||
174 | for (auto it = paths.begin(); it != last; it++ ) { | 175 | for (auto it = paths.begin(); it != last; it++ ) { | ||
175 | auto searchPath = *it; | 176 | auto searchPath = *it; | ||
176 | if (!properties.prefixPath.isEmpty()) { | 177 | if (!properties.prefixPath.isEmpty()) { | ||
177 | searchPath.addPath(properties.prefixPath); | 178 | searchPath.addPath(properties.prefixPath); | ||
178 | } | 179 | } | ||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |
Performance: If we sort paths later on, pushing to front makes no sense. Can push to the end here.