summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/llvm-readobj/StreamWriter.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/llvm-readobj/StreamWriter.h')
-rw-r--r--contrib/llvm/tools/llvm-readobj/StreamWriter.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/contrib/llvm/tools/llvm-readobj/StreamWriter.h b/contrib/llvm/tools/llvm-readobj/StreamWriter.h
index 2fc53ee..f3cc57e 100644
--- a/contrib/llvm/tools/llvm-readobj/StreamWriter.h
+++ b/contrib/llvm/tools/llvm-readobj/StreamWriter.h
@@ -96,9 +96,10 @@ public:
}
}
- template<typename T, typename TFlag>
- void printFlags(StringRef Label, T Value, ArrayRef<EnumEntry<TFlag> > Flags,
- TFlag EnumMask = TFlag(0)) {
+ template <typename T, typename TFlag>
+ void printFlags(StringRef Label, T Value, ArrayRef<EnumEntry<TFlag>> Flags,
+ TFlag EnumMask1 = {}, TFlag EnumMask2 = {},
+ TFlag EnumMask3 = {}) {
typedef EnumEntry<TFlag> FlagEntry;
typedef SmallVector<FlagEntry, 10> FlagVector;
FlagVector SetFlags;
@@ -107,6 +108,13 @@ public:
if (Flag.Value == 0)
continue;
+ TFlag EnumMask{};
+ if (Flag.Value & EnumMask1)
+ EnumMask = EnumMask1;
+ else if (Flag.Value & EnumMask2)
+ EnumMask = EnumMask2;
+ else if (Flag.Value & EnumMask3)
+ EnumMask = EnumMask3;
bool IsEnum = (Flag.Value & EnumMask) != 0;
if ((!IsEnum && (Value & Flag.Value) == Flag.Value) ||
(IsEnum && (Value & EnumMask) == Flag.Value)) {
@@ -173,8 +181,8 @@ public:
startLine() << Label << ": " << (Value ? "Yes" : "No") << '\n';
}
- template <typename T_>
- void printList(StringRef Label, const SmallVectorImpl<T_> &List) {
+ template <typename T>
+ void printList(StringRef Label, const T &List) {
startLine() << Label << ": [";
bool Comma = false;
for (const auto &Item : List) {
OpenPOWER on IntegriCloud