4242
4343namespace  llvm  {
4444
45- template <typename  KeyT, typename  ValueT, typename  Config>
45+ template   <typename  KeyT, typename  ValueT, typename  Config>
4646class  ValueMapCallbackVH ;
47- template <typename  DenseMapT, typename  KeyT>
48- class  ValueMapIterator ;
49- template <typename  DenseMapT, typename  KeyT>
50- class  ValueMapConstIterator ;
47+ template  <typename  DenseMapT, typename  KeyT> class  ValueMapIterator ;
48+ template  <typename  DenseMapT, typename  KeyT> class  ValueMapConstIterator ;
5149
5250// / This class defines the default behavior for configurable aspects of
5351// / ValueMap<>.  User Configs should inherit from this class to be as compatible
5452// / as possible with future versions of ValueMap.
55- template <typename  KeyT, typename  MutexT = sys::Mutex>
56- struct  ValueMapConfig  {
53+ template  <typename  KeyT, typename  MutexT = sys::Mutex> struct  ValueMapConfig  {
5754  using  mutex_type = MutexT;
5855
5956  // / If FollowRAUW is true, the ValueMap will update mappings on RAUW. If it's
@@ -66,21 +63,24 @@ struct ValueMapConfig {
6663  //  override all the defaults.
6764  struct  ExtraData  {};
6865
69-   template <typename  ExtraDataT>
66+   template   <typename  ExtraDataT>
7067  static  void  onRAUW (const  ExtraDataT & /* Data*/  , KeyT /* Old*/  , KeyT /* New*/  ) {}
71-   template <typename  ExtraDataT>
72-   static  void  onDelete (const  ExtraDataT &/* Data*/  , KeyT /* Old*/  ) {}
68+   template   <typename  ExtraDataT>
69+   static  void  onDelete (const  ExtraDataT &  /* Data*/  , KeyT /* Old*/  ) {}
7370
7471  // / Returns a mutex that should be acquired around any changes to the map.
7572  // / This is only acquired from the CallbackVH (and held around calls to onRAUW
7673  // / and onDelete) and not inside other ValueMap methods.  NULL means that no
7774  // / mutex is necessary.
78-   template <typename  ExtraDataT>
79-   static  mutex_type *getMutex (const  ExtraDataT &/* Data*/  ) { return  nullptr ; }
75+   template  <typename  ExtraDataT>
76+   static  mutex_type *getMutex (const  ExtraDataT & /* Data*/  ) {
77+     return  nullptr ;
78+   }
8079};
8180
8281// / See the file comment.
83- template <typename  KeyT, typename  ValueT, typename  Config =ValueMapConfig<KeyT>>
82+ template  <typename  KeyT, typename  ValueT,
83+           typename  Config = ValueMapConfig<KeyT>>
8484class  ValueMap  {
8585  friend  class  ValueMapCallbackVH <KeyT, ValueT, Config>;
8686
@@ -157,9 +157,7 @@ class ValueMap {
157157    return  Map.find_as (Val) == Map.end () ? 0  : 1 ;
158158  }
159159
160-   iterator find (const  KeyT &Val) {
161-     return  iterator (Map.find_as (Val));
162-   }
160+   iterator find (const  KeyT &Val) { return  iterator (Map.find_as (Val)); }
163161  const_iterator find (const  KeyT &Val) const  {
164162    return  const_iterator (Map.find_as (Val));
165163  }
@@ -186,8 +184,7 @@ class ValueMap {
186184  }
187185
188186  // / insert - Range insertion of pairs.
189-   template <typename  InputIt>
190-   void  insert (InputIt I, InputIt E) {
187+   template  <typename  InputIt> void  insert (InputIt I, InputIt E) {
191188    for  (; I != E; ++I)
192189      insert (*I);
193190  }
@@ -200,17 +197,13 @@ class ValueMap {
200197    Map.erase (I);
201198    return  true ;
202199  }
203-   void  erase (iterator I) {
204-     return  Map.erase (I.base ());
205-   }
200+   void  erase (iterator I) { return  Map.erase (I.base ()); }
206201
207-   value_type&  FindAndConstruct (const  KeyT &Key) {
202+   value_type & FindAndConstruct (const  KeyT &Key) {
208203    return  Map.FindAndConstruct (Wrap (Key));
209204  }
210205
211-   ValueT &operator [](const  KeyT &Key) {
212-     return  Map[Wrap (Key)];
213-   }
206+   ValueT &operator [](const  KeyT &Key) { return  Map[Wrap (Key)]; }
214207
215208  // / isPointerIntoBucketsArray - Return true if the specified pointer points
216209  // / somewhere into the ValueMap's array of buckets (i.e. either to a key or
@@ -235,7 +228,7 @@ class ValueMap {
235228    //  the const_cast incorrect) is if it gets inserted into the map.  But then
236229    //  this function must have been called from a non-const method, making the
237230    //  const_cast ok.
238-     return  ValueMapCVH (key, const_cast <ValueMap*>(this ));
231+     return  ValueMapCVH (key, const_cast <ValueMap  *>(this ));
239232  }
240233};
241234
@@ -252,7 +245,7 @@ class ValueMapCallbackVH final : public CallbackVH {
252245  ValueMapT *Map;
253246
254247  ValueMapCallbackVH (KeyT Key, ValueMapT *Map)
255-       : CallbackVH(const_cast <Value*>(static_cast <const  Value*>(Key))),
248+       : CallbackVH(const_cast <Value  *>(static_cast <const  Value  *>(Key))),
256249        Map (Map) {}
257250
258251  //  Private constructor used to create empty/tombstone DenseMap keys.
@@ -268,8 +261,8 @@ class ValueMapCallbackVH final : public CallbackVH {
268261    std::unique_lock<typename  Config::mutex_type> Guard;
269262    if  (M)
270263      Guard = std::unique_lock<typename  Config::mutex_type>(*M);
271-     Config::onDelete (Copy.Map ->Data , Copy.Unwrap ());   //  May destroy *this.
272-     Copy.Map ->Map .erase (Copy);   //  Definitely destroys *this.
264+     Config::onDelete (Copy.Map ->Data , Copy.Unwrap ()); //  May destroy *this.
265+     Copy.Map ->Map .erase (Copy); //  Definitely destroys *this.
273266  }
274267
275268  void  allUsesReplacedWith (Value *new_key) override  {
@@ -291,14 +284,14 @@ class ValueMapCallbackVH final : public CallbackVH {
291284      //  removed the old mapping.
292285      if  (I != Copy.Map ->Map .end ()) {
293286        ValueT Target (std::move (I->second ));
294-         Copy.Map ->Map .erase (I);   //  Definitely destroys *this.
287+         Copy.Map ->Map .erase (I); //  Definitely destroys *this.
295288        Copy.Map ->insert (std::make_pair (typed_new_key, std::move (Target)));
296289      }
297290    }
298291  }
299292};
300293
301- template <typename  KeyT, typename  ValueT, typename  Config>
294+ template   <typename  KeyT, typename  ValueT, typename  Config>
302295struct  DenseMapInfo <ValueMapCallbackVH<KeyT, ValueT, Config>> {
303296  using  VH = ValueMapCallbackVH<KeyT, ValueT, Config>;
304297
@@ -318,9 +311,7 @@ struct DenseMapInfo<ValueMapCallbackVH<KeyT, ValueT, Config>> {
318311    return  DenseMapInfo<KeyT>::getHashValue (Val);
319312  }
320313
321-   static  bool  isEqual (const  VH &LHS, const  VH &RHS) {
322-     return  LHS == RHS;
323-   }
314+   static  bool  isEqual (const  VH &LHS, const  VH &RHS) { return  LHS == RHS; }
324315
325316  static  bool  isEqual (const  KeyT &LHS, const  VH &RHS) {
326317    return  LHS == RHS.getValPtr ();
@@ -347,7 +338,7 @@ template <typename DenseMapT, typename KeyT> class ValueMapIterator {
347338
348339  struct  ValueTypeProxy  {
349340    const  KeyT first;
350-     ValueT&  second;
341+     ValueT & second;
351342
352343    ValueTypeProxy *operator ->() { return  this ; }
353344
@@ -361,23 +352,19 @@ template <typename DenseMapT, typename KeyT> class ValueMapIterator {
361352    return  Result;
362353  }
363354
364-   ValueTypeProxy operator ->() const  {
365-     return  operator *();
366-   }
355+   ValueTypeProxy operator ->() const  { return  operator *(); }
367356
368-   bool  operator ==(const  ValueMapIterator &RHS) const  {
369-     return  I == RHS.I ;
370-   }
371-   bool  operator !=(const  ValueMapIterator &RHS) const  {
372-     return  I != RHS.I ;
373-   }
357+   bool  operator ==(const  ValueMapIterator &RHS) const  { return  I == RHS.I ; }
358+   bool  operator !=(const  ValueMapIterator &RHS) const  { return  I != RHS.I ; }
374359
375-   inline  ValueMapIterator&  operator ++() {   //  Preincrement
360+   inline  ValueMapIterator & operator ++() { //  Preincrement
376361    ++I;
377362    return  *this ;
378363  }
379-   ValueMapIterator operator ++(int ) {  //  Postincrement
380-     ValueMapIterator tmp = *this ; ++*this ; return  tmp;
364+   ValueMapIterator operator ++(int ) { //  Postincrement
365+     ValueMapIterator tmp = *this ;
366+     ++*this ;
367+     return  tmp;
381368  }
382369};
383370
@@ -397,13 +384,13 @@ template <typename DenseMapT, typename KeyT> class ValueMapConstIterator {
397384  ValueMapConstIterator () : I() {}
398385  ValueMapConstIterator (BaseT I) : I(I) {}
399386  ValueMapConstIterator (ValueMapIterator<DenseMapT, KeyT> Other)
400-     : I(Other.base()) {}
387+        : I(Other.base()) {}
401388
402389  BaseT base () const  { return  I; }
403390
404391  struct  ValueTypeProxy  {
405392    const  KeyT first;
406-     const  ValueT&  second;
393+     const  ValueT & second;
407394    ValueTypeProxy *operator ->() { return  this ; }
408395    operator  std::pair<KeyT, ValueT>() const  {
409396      return  std::make_pair (first, second);
@@ -415,23 +402,19 @@ template <typename DenseMapT, typename KeyT> class ValueMapConstIterator {
415402    return  Result;
416403  }
417404
418-   ValueTypeProxy operator ->() const  {
419-     return  operator *();
420-   }
405+   ValueTypeProxy operator ->() const  { return  operator *(); }
421406
422-   bool  operator ==(const  ValueMapConstIterator &RHS) const  {
423-     return  I == RHS.I ;
424-   }
425-   bool  operator !=(const  ValueMapConstIterator &RHS) const  {
426-     return  I != RHS.I ;
427-   }
407+   bool  operator ==(const  ValueMapConstIterator &RHS) const  { return  I == RHS.I ; }
408+   bool  operator !=(const  ValueMapConstIterator &RHS) const  { return  I != RHS.I ; }
428409
429-   inline  ValueMapConstIterator&  operator ++() {   //  Preincrement
410+   inline  ValueMapConstIterator & operator ++() { //  Preincrement
430411    ++I;
431412    return  *this ;
432413  }
433-   ValueMapConstIterator operator ++(int ) {  //  Postincrement
434-     ValueMapConstIterator tmp = *this ; ++*this ; return  tmp;
414+   ValueMapConstIterator operator ++(int ) { //  Postincrement
415+     ValueMapConstIterator tmp = *this ;
416+     ++*this ;
417+     return  tmp;
435418  }
436419};
437420
0 commit comments