[lld] r233452 - Use lambda instead of defining a class with operator().

Rui Ueyama ruiu at google.com
Fri Mar 27 16:47:01 PDT 2015


Author: ruiu
Date: Fri Mar 27 18:47:01 2015
New Revision: 233452

URL: http://llvm.org/viewvc/llvm-project?rev=233452&view=rev
Log:
Use lambda instead of defining a class with operator().

Modified:
    lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h

Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=233452&r1=233451&r2=233452&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Fri Mar 27 18:47:01 2015
@@ -159,13 +159,6 @@ public:
   typedef std::unordered_map<SegmentKey, Segment<ELFT> *, SegmentHashKey>
   SegmentMapT;
 
-  /// \brief find a absolute atom pair given a absolute atom name
-  struct FindByName {
-    const std::string _name;
-    FindByName(StringRef name) : _name(name) {}
-    bool operator()(const lld::AtomLayout *j) { return j->_atom->name() == _name; }
-  };
-
   typedef typename std::vector<lld::AtomLayout *>::iterator AbsoluteAtomIterT;
 
   typedef llvm::DenseSet<const Atom *> AtomSetT;
@@ -212,8 +205,9 @@ public:
 
   /// \brief find a absolute atom given a name
   AbsoluteAtomIterT findAbsoluteAtom(StringRef name) {
-    return std::find_if(_absoluteAtoms.begin(), _absoluteAtoms.end(),
-                        FindByName(name));
+    return std::find_if(
+        _absoluteAtoms.begin(), _absoluteAtoms.end(),
+        [=](const AtomLayout *a) { return a->_atom->name() == name; });
   }
 
   // Output sections with the same name into a OutputSection





More information about the llvm-commits mailing list