Commit 4e227702 authored by Nilanjana Basu's avatar Nilanjana Basu
Browse files

Changes to display code view debug info type records in hex format

llvm-svn: 366390
parent 749f556b
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -134,15 +134,21 @@ inline raw_ostream &operator<<(raw_ostream &OS, const MCExpr &E) {
////  Represent a constant integer expression.
class MCConstantExpr : public MCExpr {
  int64_t Value;
  bool PrintInHex = false;

  explicit MCConstantExpr(int64_t Value)
  MCConstantExpr(int64_t Value)
      : MCExpr(MCExpr::Constant, SMLoc()), Value(Value) {}

  MCConstantExpr(int64_t Value, bool PrintInHex)
      : MCExpr(MCExpr::Constant, SMLoc()), Value(Value),
        PrintInHex(PrintInHex) {}

public:
  /// \name Construction
  /// @{

  static const MCConstantExpr *create(int64_t Value, MCContext &Ctx);
  static const MCConstantExpr *create(int64_t Value, MCContext &Ctx,
                                      bool PrintInHex = false);

  /// @}
  /// \name Accessors
@@ -150,6 +156,8 @@ public:

  int64_t getValue() const { return Value; }

  bool useHexFormat() const { return PrintInHex; }

  /// @}

  static bool classof(const MCExpr *E) {
+7 −0
Original line number Diff line number Diff line
@@ -626,6 +626,13 @@ public:
  /// to pass in a MCExpr for constant integers.
  virtual void EmitIntValue(uint64_t Value, unsigned Size);

  /// Special case of EmitValue that avoids the client having to pass
  /// in a MCExpr for constant integers & prints in Hex format for certain
  /// modes.
  virtual void EmitIntValueInHex(uint64_t Value, unsigned Size) {
    EmitIntValue(Value, Size);
  }

  virtual void EmitULEB128Value(const MCExpr *Value);

  virtual void EmitSLEB128Value(const MCExpr *Value);
+1 −1
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ public:
  void EmitBytes(StringRef Data) { OS->EmitBytes(Data); }

  void EmitIntValue(uint64_t Value, unsigned Size) {
    OS->EmitIntValue(Value, Size);
    OS->EmitIntValueInHex(Value, Size);
  }

  void EmitBinaryData(StringRef Data) { OS->EmitBinaryData(Data); }
+1 −1
Original line number Diff line number Diff line
@@ -306,7 +306,7 @@ Error TypeRecordMapping::visitKnownRecord(CVType &CVR, VFTableRecord &Record) {
    for (auto Name : Record.MethodNames)
      NamesLen += Name.size() + 1;
  }
  error(IO.mapInteger(NamesLen, ""));
  error(IO.mapInteger(NamesLen));
  error(IO.mapVectorTail(
      Record.MethodNames,
      [](CodeViewRecordIO &IO, StringRef &S) {
+5 −0
Original line number Diff line number Diff line
@@ -188,6 +188,7 @@ public:
  void EmitValueImpl(const MCExpr *Value, unsigned Size,
                     SMLoc Loc = SMLoc()) override;
  void EmitIntValue(uint64_t Value, unsigned Size) override;
  void EmitIntValueInHex(uint64_t Value, unsigned Size) override;

  void EmitULEB128Value(const MCExpr *Value) override;

@@ -923,6 +924,10 @@ void MCAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size) {
  EmitValue(MCConstantExpr::create(Value, getContext()), Size);
}

void MCAsmStreamer::EmitIntValueInHex(uint64_t Value, unsigned Size) {
  EmitValue(MCConstantExpr::create(Value, getContext(), true), Size);
}

void MCAsmStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
                                  SMLoc Loc) {
  assert(Size <= 8 && "Invalid size");
Loading