diff options
author | Nilanjana Basu <nilanjana.basu87@gmail.com> | 2019-07-17 21:01:12 +0000 |
---|---|---|
committer | Nilanjana Basu <nilanjana.basu87@gmail.com> | 2019-07-17 21:01:12 +0000 |
commit | 6e4076699c342ce3bde6ed6373849301b6f2e447 (patch) | |
tree | bb2ecd0f6d3a8db023bf0a904bb59a5d08b2afb8 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | 9f2b290addfc4d9f514790b47773b141682b0db5 (diff) | |
download | llvm-6e4076699c342ce3bde6ed6373849301b6f2e447.zip llvm-6e4076699c342ce3bde6ed6373849301b6f2e447.tar.gz llvm-6e4076699c342ce3bde6ed6373849301b6f2e447.tar.bz2 |
Adding inline comments to code view type record directives for better readability
llvm-svn: 366372
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 40f874b..bd0ace9 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -108,6 +108,8 @@ public: void EmitBinaryData(StringRef Data) { OS->EmitBinaryData(Data); } + void AddComment(const Twine &T) { OS->AddComment(T); } + private: MCStreamer *OS = nullptr; }; @@ -615,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; @@ -659,8 +668,12 @@ void CodeViewDebug::emitTypeInformation() { auto RecordLen = Record.length(); auto RecordKind = Record.kind(); - OS.EmitIntValue(RecordLen - 2, 2); - OS.EmitIntValue(RecordKind, sizeof(RecordKind)); + 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); |