mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
aef32901b4
PDB files have a lot of noise in them, with hundreds (or thousands) of symbols from system libraries and compiler generated types. If you're only looking for a specific type, this can be problematic. This CL allows you to display *only* types, variables, or compilands matching a particular pattern. These filters can even be combined with exclude filters. Include-only filters are given priority, so that first the set of items to display is limited only to those that match the include filters, and then the set of exclude filters is applied to those. If there are no include filters specified, then it means "display everything". llvm-svn: 248822
94 lines
2.1 KiB
C++
94 lines
2.1 KiB
C++
//===- LinePrinter.h ------------------------------------------ *- C++ --*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TOOLS_LLVMPDBDUMP_LINEPRINTER_H
|
|
#define LLVM_TOOLS_LLVMPDBDUMP_LINEPRINTER_H
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
#include "llvm/ADT/Twine.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
#include "llvm/Support/Regex.h"
|
|
|
|
#include <list>
|
|
|
|
namespace llvm {
|
|
|
|
class LinePrinter {
|
|
friend class WithColor;
|
|
|
|
public:
|
|
LinePrinter(int Indent, raw_ostream &Stream);
|
|
|
|
void Indent();
|
|
void Unindent();
|
|
void NewLine();
|
|
|
|
raw_ostream &getStream() { return OS; }
|
|
int getIndentLevel() const { return CurrentIndent; }
|
|
|
|
bool IsTypeExcluded(llvm::StringRef TypeName);
|
|
bool IsSymbolExcluded(llvm::StringRef SymbolName);
|
|
bool IsCompilandExcluded(llvm::StringRef CompilandName);
|
|
|
|
private:
|
|
template <typename Iter>
|
|
void SetFilters(std::list<Regex> &List, Iter Begin, Iter End) {
|
|
List.clear();
|
|
for (; Begin != End; ++Begin)
|
|
List.emplace_back(StringRef(*Begin));
|
|
}
|
|
|
|
raw_ostream &OS;
|
|
int IndentSpaces;
|
|
int CurrentIndent;
|
|
|
|
std::list<Regex> ExcludeCompilandFilters;
|
|
std::list<Regex> ExcludeTypeFilters;
|
|
std::list<Regex> ExcludeSymbolFilters;
|
|
|
|
std::list<Regex> IncludeCompilandFilters;
|
|
std::list<Regex> IncludeTypeFilters;
|
|
std::list<Regex> IncludeSymbolFilters;
|
|
};
|
|
|
|
template <class T>
|
|
inline raw_ostream &operator<<(LinePrinter &Printer, const T &Item) {
|
|
Printer.getStream() << Item;
|
|
return Printer.getStream();
|
|
}
|
|
|
|
enum class PDB_ColorItem {
|
|
None,
|
|
Address,
|
|
Type,
|
|
Keyword,
|
|
Offset,
|
|
Identifier,
|
|
Path,
|
|
SectionHeader,
|
|
LiteralValue,
|
|
Register,
|
|
};
|
|
|
|
class WithColor {
|
|
public:
|
|
WithColor(LinePrinter &P, PDB_ColorItem C);
|
|
~WithColor();
|
|
|
|
raw_ostream &get() { return OS; }
|
|
|
|
private:
|
|
void translateColor(PDB_ColorItem C, raw_ostream::Colors &Color,
|
|
bool &Bold) const;
|
|
raw_ostream &OS;
|
|
};
|
|
}
|
|
|
|
#endif
|