mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 02:24:22 +00:00
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:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user