forked from OSchip/llvm-project
don't use count + insert, just do insert + failure. Also, instead of deleting from
the middle of a vector, swap the last element in and pop_back. Also saves 330 bytes :) llvm-svn: 82365
This commit is contained in:
parent
41f8b0b7a6
commit
28610b9878
|
@ -1051,14 +1051,17 @@ public:
|
||||||
std::ptr_fun(ShowHidden ? isReallyHidden : isHidden)),
|
std::ptr_fun(ShowHidden ? isReallyHidden : isHidden)),
|
||||||
Opts.end());
|
Opts.end());
|
||||||
|
|
||||||
// Eliminate duplicate entries in table (from enum flags options, f.e.)
|
// Eliminate duplicate entries in table (from enum flags options, f.e.).
|
||||||
{ // Give OptionSet a scope
|
{ // Give OptionSet a scope
|
||||||
SmallPtrSet<Option*, 32> OptionSet;
|
SmallPtrSet<Option*, 32> OptionSet;
|
||||||
for (unsigned i = 0; i != Opts.size(); ++i)
|
for (unsigned i = 0; i != Opts.size(); ++i) {
|
||||||
if (OptionSet.count(Opts[i]) == 0)
|
if (OptionSet.insert(Opts[i])) // Add new entry to set
|
||||||
OptionSet.insert(Opts[i]); // Add new entry to set
|
continue;
|
||||||
else
|
// Erase duplicate.
|
||||||
Opts.erase(Opts.begin()+i--); // Erase duplicate
|
Opts[i] = Opts.back();
|
||||||
|
Opts.pop_back();
|
||||||
|
--i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ProgramOverview)
|
if (ProgramOverview)
|
||||||
|
|
Loading…
Reference in New Issue