File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed
llvm/include/llvm/Support Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change 4343#include < map>
4444#include < memory>
4545#include < string>
46+ #include < type_traits>
4647
4748namespace llvm {
4849namespace util {
@@ -191,18 +192,12 @@ class PropertySetRegistry {
191192
192193 // Function for bulk addition of an entire property set under given category
193194 // (property set name).
194- template <typename T>
195- void add (StringRef Category, const std::map<StringRef, T> &Props) {
196- assert (PropSetMap. find (Category) == PropSetMap. end () &&
197- " category already added " );
198- auto &PropSet = PropSetMap[Category] ;
195+ template <typename MapTy> void add (StringRef Category, const MapTy &Props) {
196+ using KeyTy = typename MapTy::value_type::first_type;
197+ static_assert (std::is_same< typename std::remove_const<KeyT>::type,
198+ llvm::StringRef>::value,
199+ " wrong key type " ) ;
199200
200- for (const auto &Prop : Props)
201- PropSet.insert (std::make_pair (Prop.first , PropertyValue (Prop.second )));
202- }
203-
204- template <typename T>
205- void add (StringRef Category, const MapVector<StringRef, T> &Props) {
206201 assert (PropSetMap.find (Category) == PropSetMap.end () &&
207202 " category already added" );
208203 auto &PropSet = PropSetMap[Category];
You can’t perform that action at this time.
0 commit comments