Now that we have C++11, turn simple functors into lambdas and remove a ton of boilerplate.

No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202588 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer
2014-03-01 11:47:00 +00:00
parent 73bbab9d75
commit ee5e607355
20 changed files with 114 additions and 312 deletions

View File

@ -125,20 +125,12 @@ static ManagedStatic<OptionCatSet> RegisteredOptionCategories;
// Initialise the general option category.
OptionCategory llvm::cl::GeneralCategory("General options");
struct HasName {
HasName(StringRef Name) : Name(Name) {}
bool operator()(const OptionCategory *Category) const {
return Name == Category->getName();
}
StringRef Name;
};
void OptionCategory::registerCategory()
{
void OptionCategory::registerCategory() {
assert(std::count_if(RegisteredOptionCategories->begin(),
RegisteredOptionCategories->end(),
HasName(getName())) == 0 &&
"Duplicate option categories");
[this](const OptionCategory *Category) {
return getName() == Category->getName();
}) == 0 && "Duplicate option categories");
RegisteredOptionCategories->insert(this);
}