diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-01 11:47:00 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-01 11:47:00 +0000 |
commit | 3a377bce4e134406920a3ee744e2ef9edd21762f (patch) | |
tree | 7242f0b2d56078d18ded3c7927059b85a8f2d201 /llvm/lib/Support/CommandLine.cpp | |
parent | f4cde83d3a284a53869baa12d9eabe0342678e93 (diff) | |
download | bcm5719-llvm-3a377bce4e134406920a3ee744e2ef9edd21762f.tar.gz bcm5719-llvm-3a377bce4e134406920a3ee744e2ef9edd21762f.zip |
Now that we have C++11, turn simple functors into lambdas and remove a ton of boilerplate.
No intended functionality change.
llvm-svn: 202588
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); } |