[ARMTargetParser] Follow-up for r239099: one case was missed
[oota-llvm.git] / tools / llvm-pdbdump / LinePrinter.cpp
index 09ba329ad0a7172e0c3d9130866348dc0c0a909f..6bbc403f5caf9aac7ef6b90daded4f06f1445df2 100644 (file)
@@ -9,12 +9,22 @@
 
 #include "LinePrinter.h"
 
+#include "llvm-pdbdump.h"
+
+#include "llvm/Support/Regex.h"
+
 #include <algorithm>
 
 using namespace llvm;
 
 LinePrinter::LinePrinter(int Indent, llvm::raw_ostream &Stream)
-    : OS(Stream), IndentSpaces(Indent), CurrentIndent(0) {}
+    : OS(Stream), IndentSpaces(Indent), CurrentIndent(0) {
+  SetFilters(TypeFilters, opts::ExcludeTypes.begin(), opts::ExcludeTypes.end());
+  SetFilters(SymbolFilters, opts::ExcludeSymbols.begin(),
+             opts::ExcludeSymbols.end());
+  SetFilters(CompilandFilters, opts::ExcludeCompilands.begin(),
+             opts::ExcludeCompilands.end());
+}
 
 void LinePrinter::Indent() { CurrentIndent += IndentSpaces; }
 
@@ -27,6 +37,39 @@ void LinePrinter::NewLine() {
   OS.indent(CurrentIndent);
 }
 
+bool LinePrinter::IsTypeExcluded(llvm::StringRef TypeName) {
+  if (TypeName.empty())
+    return false;
+
+  for (auto &Expr : TypeFilters) {
+    if (Expr.match(TypeName))
+      return true;
+  }
+  return false;
+}
+
+bool LinePrinter::IsSymbolExcluded(llvm::StringRef SymbolName) {
+  if (SymbolName.empty())
+    return false;
+
+  for (auto &Expr : SymbolFilters) {
+    if (Expr.match(SymbolName))
+      return true;
+  }
+  return false;
+}
+
+bool LinePrinter::IsCompilandExcluded(llvm::StringRef CompilandName) {
+  if (CompilandName.empty())
+    return false;
+
+  for (auto &Expr : CompilandFilters) {
+    if (Expr.match(CompilandName))
+      return true;
+  }
+  return false;
+}
+
 WithColor::WithColor(LinePrinter &P, PDB_ColorItem C) : OS(P.OS) {
   if (C == PDB_ColorItem::None)
     OS.resetColor();
@@ -51,6 +94,7 @@ void WithColor::translateColor(PDB_ColorItem C, raw_ostream::Colors &Color,
     Color = raw_ostream::MAGENTA;
     Bold = true;
     return;
+  case PDB_ColorItem::Register:
   case PDB_ColorItem::Offset:
     Color = raw_ostream::YELLOW;
     Bold = false;