diff options
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r-- | llvm/lib/Support/CommandLine.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index 9e807265878..e94206ee3d7 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -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); } |