Skip to content

Commit edf1059

Browse files
committed
CmdLineParser: filter out files before running de-duplication in fillSettingsFromArgs()
1 parent 3ccfb5c commit edf1059

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

cli/cmdlineparser.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,6 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[])
206206
assert(!(!pathnamesRef.empty() && !fileSettingsRef.empty()));
207207

208208
if (!fileSettingsRef.empty()) {
209-
// TODO: de-duplicate
210-
211209
std::list<FileSettings> fileSettings;
212210
if (!mSettings.fileFilters.empty()) {
213211
// filter only for the selected filenames from all project files
@@ -225,6 +223,8 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[])
225223
fileSettings = fileSettingsRef;
226224
}
227225

226+
// TODO: de-duplicate
227+
228228
mFileSettings.clear();
229229

230230
frontend::applyLang(fileSettings, mSettings, mEnforcedLang);
@@ -265,19 +265,6 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[])
265265
return false;
266266
}
267267

268-
// de-duplicate files
269-
{
270-
auto it = filesResolved.begin();
271-
while (it != filesResolved.end()) {
272-
const std::string& absname = it->abspath();
273-
// TODO: log if duplicated files were dropped
274-
filesResolved.erase(std::remove_if(std::next(it), filesResolved.end(), [&](const FileWithDetails& entry) {
275-
return entry.abspath() == absname;
276-
}), filesResolved.end());
277-
++it;
278-
}
279-
}
280-
281268
std::list<FileWithDetails> files;
282269
if (!mSettings.fileFilters.empty()) {
283270
files = filterFiles(mSettings.fileFilters, filesResolved);
@@ -291,6 +278,19 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[])
291278
files = std::move(filesResolved);
292279
}
293280

281+
// de-duplicate files
282+
{
283+
auto it = files.begin();
284+
while (it != files.end()) {
285+
const std::string& absname = it->abspath();
286+
// TODO: log if duplicated files were dropped
287+
files.erase(std::remove_if(std::next(it), files.end(), [&](const FileWithDetails& entry) {
288+
return entry.abspath() == absname;
289+
}), files.end());
290+
++it;
291+
}
292+
}
293+
294294
frontend::applyLang(files, mSettings, mEnforcedLang);
295295

296296
// sort the markup last

0 commit comments

Comments
 (0)