forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[codeview] Move dumper into lib/DebugInfo/CodeView
So that we can call it from llvm-pdbdump. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268580 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
8 changed files
with
949 additions
and
813 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
//===-- TypeDumper.h - CodeView type info dumper ----------------*- C++ -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPEDUMPER_H | ||
#define LLVM_DEBUGINFO_CODEVIEW_TYPEDUMPER_H | ||
|
||
#include "llvm/ADT/ArrayRef.h" | ||
#include "llvm/ADT/StringSet.h" | ||
#include "llvm/DebugInfo/CodeView/TypeIndex.h" | ||
#include "llvm/DebugInfo/CodeView/TypeRecord.h" | ||
|
||
namespace llvm { | ||
class ScopedPrinter; | ||
|
||
namespace codeview { | ||
|
||
/// Dumper for CodeView type streams found in COFF object files and PDB files. | ||
class CVTypeDumper { | ||
public: | ||
CVTypeDumper(ScopedPrinter &W, bool PrintRecordBytes) | ||
: W(W), PrintRecordBytes(PrintRecordBytes) {} | ||
|
||
StringRef getTypeName(TypeIndex TI); | ||
void printTypeIndex(StringRef FieldName, TypeIndex TI); | ||
|
||
/// Dumps the type records in Data. Returns false if there was a type stream | ||
/// parse error, and true otherwise. | ||
bool dump(ArrayRef<uint8_t> Data); | ||
|
||
/// Gets the type index for the next type record. | ||
unsigned getNextTypeIndex() const { | ||
return 0x1000 + CVUDTNames.size(); | ||
} | ||
|
||
/// Records the name of a type, and reserves its type index. | ||
void recordType(StringRef Name) { CVUDTNames.push_back(Name); } | ||
|
||
/// Saves the name in a StringSet and creates a stable StringRef. | ||
StringRef saveName(StringRef TypeName) { | ||
return TypeNames.insert(TypeName).first->getKey(); | ||
} | ||
|
||
private: | ||
ScopedPrinter &W; | ||
|
||
bool PrintRecordBytes = false; | ||
|
||
/// All user defined type records in .debug$T live in here. Type indices | ||
/// greater than 0x1000 are user defined. Subtract 0x1000 from the index to | ||
/// index into this vector. | ||
SmallVector<StringRef, 10> CVUDTNames; | ||
|
||
StringSet<> TypeNames; | ||
}; | ||
|
||
} // end namespace codeview | ||
} // end namespace llvm | ||
|
||
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPEDUMPER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.