summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2019-08-02 01:05:47 +0000
committerEric Christopher <echristo@gmail.com>2019-08-02 01:05:47 +0000
commit5a00b0772aba8639a9cdec95c130aa3021e94e30 (patch)
treeddbbb526223bf805bb09b21383a6f65e08bb7a36 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
parent975c51c3ff0f83dffb8b01ab06f376924bab7200 (diff)
downloadbcm5719-llvm-5a00b0772aba8639a9cdec95c130aa3021e94e30.tar.gz
bcm5719-llvm-5a00b0772aba8639a9cdec95c130aa3021e94e30.zip
Temporarily revert "Changes to improve CodeView debug info type record inline comments"
due to a sanitizer failure. This reverts commit 367623. llvm-svn: 367640
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index f4514335cb3..b3dabca0a8a 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -98,8 +98,7 @@ using namespace llvm::codeview;
namespace {
class CVMCAdapter : public CodeViewRecordStreamer {
public:
- CVMCAdapter(MCStreamer &OS, TypeCollection &TypeTable)
- : OS(&OS), TypeTable(TypeTable) {}
+ CVMCAdapter(MCStreamer &OS) : OS(&OS) {}
void EmitBytes(StringRef Data) { OS->EmitBytes(Data); }
@@ -111,24 +110,8 @@ public:
void AddComment(const Twine &T) { OS->AddComment(T); }
- void AddRawComment(const Twine &T) { OS->emitRawComment(T); }
-
- bool isVerboseAsm() { return OS->isVerboseAsm(); }
-
- StringRef getTypeName(TypeIndex TI) {
- StringRef TypeName;
- if (!TI.isNoneType()) {
- if (TI.isSimple())
- TypeName = TypeIndex::simpleTypeName(TI);
- else
- TypeName = TypeTable.getTypeName(TI);
- }
- return TypeName;
- }
-
private:
MCStreamer *OS = nullptr;
- TypeCollection &TypeTable;
};
} // namespace
@@ -634,6 +617,13 @@ emitNullTerminatedSymbolName(MCStreamer &OS, StringRef S,
OS.EmitBytes(NullTerminatedString);
}
+static StringRef getTypeLeafName(TypeLeafKind TypeKind) {
+ for (const EnumEntry<TypeLeafKind> &EE : getTypeLeafNames())
+ if (EE.Value == TypeKind)
+ return EE.Name;
+ return "";
+}
+
void CodeViewDebug::emitTypeInformation() {
if (TypeTable.empty())
return;
@@ -650,11 +640,11 @@ void CodeViewDebug::emitTypeInformation() {
}
TypeTableCollection Table(TypeTable.records());
- TypeVisitorCallbackPipeline Pipeline;
SmallString<512> CommentBlock;
raw_svector_ostream CommentOS(CommentBlock);
std::unique_ptr<ScopedPrinter> SP;
std::unique_ptr<TypeDumpVisitor> TDV;
+ TypeVisitorCallbackPipeline Pipeline;
if (OS.isVerboseAsm()) {
// To construct block comment describing the type record for readability.
@@ -665,7 +655,7 @@ void CodeViewDebug::emitTypeInformation() {
}
// To emit type record using Codeview MCStreamer adapter
- CVMCAdapter CVMCOS(OS, Table);
+ CVMCAdapter CVMCOS(OS);
TypeRecordMapping typeMapping(CVMCOS);
Pipeline.addCallbackToPipeline(typeMapping);
@@ -675,6 +665,16 @@ void CodeViewDebug::emitTypeInformation() {
CVType Record = Table.getType(*B);
CommentBlock.clear();
+
+ auto RecordLen = Record.length();
+ auto RecordKind = Record.kind();
+ if (OS.isVerboseAsm())
+ CVMCOS.AddComment("Record length");
+ CVMCOS.EmitIntValue(RecordLen - 2, 2);
+ if (OS.isVerboseAsm())
+ CVMCOS.AddComment("Record kind: " + getTypeLeafName(RecordKind));
+ CVMCOS.EmitIntValue(RecordKind, sizeof(RecordKind));
+
Error E = codeview::visitTypeRecord(Record, *B, Pipeline);
if (E) {
OpenPOWER on IntegriCloud