Use C++14 heteregenous lookup for a couple of std::map<std::string, ...>
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 21 Aug 2019 21:17:34 +0000 (21:17 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 21 Aug 2019 21:17:34 +0000 (21:17 +0000)
These call find with a StringRef, heterogenous lookup saves a temporary
std::string there.

llvm-svn: 369581

clang/include/clang/ASTMatchers/ASTMatchersInternal.h
llvm/include/llvm/IR/Attributes.h
llvm/include/llvm/ProfileData/SampleProf.h
llvm/include/llvm/TableGen/Record.h

index ae7b9e7..e9fa920 100644 (file)
@@ -183,7 +183,8 @@ public:
   /// Note that we're using std::map here, as for memoization:
   /// - we need a comparison operator
   /// - we need an assignment operator
-  using IDToNodeMap = std::map<std::string, ast_type_traits::DynTypedNode>;
+  using IDToNodeMap =
+      std::map<std::string, ast_type_traits::DynTypedNode, std::less<>>;
 
   const IDToNodeMap &getMap() const {
     return NodeMap;
index 4efa3a9..719b999 100644 (file)
@@ -705,7 +705,7 @@ template <> struct DenseMapInfo<AttributeList> {
 /// equality, presence of attributes, etc.
 class AttrBuilder {
   std::bitset<Attribute::EndAttrKinds> Attrs;
-  std::map<std::string, std::string> TargetDepAttrs;
+  std::map<std::string, std::string, std::less<>> TargetDepAttrs;
   MaybeAlign Alignment;
   MaybeAlign StackAlignment;
   uint64_t DerefBytes = 0;
index 453e1a0..37cdb5c 100644 (file)
@@ -228,7 +228,7 @@ class FunctionSamples;
 using BodySampleMap = std::map<LineLocation, SampleRecord>;
 // NOTE: Using a StringMap here makes parsed profiles consume around 17% more
 // memory, which is *very* significant for large profiles.
-using FunctionSamplesMap = std::map<std::string, FunctionSamples>;
+using FunctionSamplesMap = std::map<std::string, FunctionSamples, std::less<>>;
 using CallsiteSampleMap = std::map<LineLocation, FunctionSamplesMap>;
 
 /// Representation of the samples collected for a function.
index 6a3e2a9..606ab1c 100644 (file)
@@ -1687,10 +1687,10 @@ raw_ostream &operator<<(raw_ostream &OS, const Record &R);
 
 class RecordKeeper {
   friend class RecordRecTy;
-  using RecordMap = std::map<std::string, std::unique_ptr<Record>>;
+  using RecordMap = std::map<std::string, std::unique_ptr<Record>, std::less<>>;
   RecordMap Classes, Defs;
   FoldingSet<RecordRecTy> RecordTypePool;
-  std::map<std::string, Init *> ExtraGlobals;
+  std::map<std::string, Init *, std::less<>> ExtraGlobals;
   unsigned AnonCounter = 0;
 
 public: