#include <cmath>
#include <limits>
#include <type_traits>
+#include <utility>
#include <vector>
namespace llvm {
// The number of attributes that StratifiedAttrs should contain. Attributes are
// described below, and 32 was an arbitrary choice because it fits nicely in 32
// bits (because we use a bitset for StratifiedAttrs).
-static LLVM_CONSTEXPR unsigned NumStratifiedAttrs = 32;
+static const unsigned NumStratifiedAttrs = 32;
// These are attributes that the users of StratifiedSets/StratifiedSetBuilders
// may use for various purposes. These also have the special property of that
// Optional<StratifiedIndex> because Optional<StratifiedIndex> would
// eat up a considerable amount of extra memory, after struct
// padding/alignment is taken into account.
- static LLVM_CONSTEXPR auto SetSentinel =
- std::numeric_limits<StratifiedIndex>::max();
+ static const StratifiedIndex SetSentinel;
// \brief The index for the set "above" current
StratifiedIndex Above;
}
StratifiedIndex Number = StratLinks.size();
- Remaps.insert({Link.Number, Number});
+ Remaps.insert(std::make_pair(Link.Number, Number));
StratLinks.push_back(Link.getLink());
}
SmallSet<StratifiedIndex, 16> Visited;
for (unsigned I = 0, E = Links.size(); I < E; ++I) {
auto CurrentIndex = getHighestParentAbove(I);
- if (!Visited.insert(CurrentIndex)) {
+ if (!Visited.insert(CurrentIndex).second) {
continue;
}
// necessary.
bool addAtMerging(const T &ToAdd, StratifiedIndex Index) {
StratifiedInfo Info = {Index};
- auto Pair = Values.insert({ToAdd, Info});
+ auto Pair = Values.insert(std::make_pair(ToAdd, Info));
if (Pair.second)
return true;
return Link;
}
- bool inbounds(StratifiedIndex N) const { return N >= 0 && N < Links.size(); }
+ bool inbounds(StratifiedIndex N) const { return N < Links.size(); }
};
}
#endif // LLVM_ADT_STRATIFIEDSETS_H