[llvm] r231209 - Constify AsmPrinter passed to DIE methods.

Frederic Riss friss at apple.com
Tue Mar 3 18:30:08 PST 2015


Author: friss
Date: Tue Mar  3 20:30:08 2015
New Revision: 231209

URL: http://llvm.org/viewvc/llvm-project?rev=231209&view=rev
Log:
Constify AsmPrinter passed to DIE methods.

Modified:
    llvm/trunk/include/llvm/CodeGen/DIE.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp

Modified: llvm/trunk/include/llvm/CodeGen/DIE.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DIE.h?rev=231209&r1=231208&r2=231209&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/DIE.h (original)
+++ llvm/trunk/include/llvm/CodeGen/DIE.h Tue Mar  3 20:30:08 2015
@@ -95,7 +95,7 @@ public:
 
   /// Emit - Print the abbreviation using the specified asm printer.
   ///
-  void Emit(AsmPrinter *AP) const;
+  void Emit(const AsmPrinter *AP) const;
 
 #ifndef NDEBUG
   void print(raw_ostream &O);
@@ -230,11 +230,11 @@ public:
 
   /// EmitValue - Emit value via the Dwarf writer.
   ///
-  virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const = 0;
+  virtual void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const = 0;
 
   /// SizeOf - Return the size of a value in bytes.
   ///
-  virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const = 0;
+  virtual unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const = 0;
 
 #ifndef NDEBUG
   virtual void print(raw_ostream &O) const = 0;
@@ -275,13 +275,13 @@ public:
 
   /// EmitValue - Emit integer of appropriate size.
   ///
-  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   uint64_t getValue() const { return Integer; }
 
   /// SizeOf - Determine size of integer value in bytes.
   ///
-  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *I) { return I->getType() == isInteger; }
@@ -302,7 +302,7 @@ public:
 
   /// EmitValue - Emit expression value.
   ///
-  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// getValue - Get MCExpr.
   ///
@@ -310,7 +310,7 @@ public:
 
   /// SizeOf - Determine size of expression value in bytes.
   ///
-  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *E) { return E->getType() == isExpr; }
@@ -331,7 +331,7 @@ public:
 
   /// EmitValue - Emit label value.
   ///
-  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// getValue - Get MCSymbol.
   ///
@@ -339,7 +339,7 @@ public:
 
   /// SizeOf - Determine size of label value in bytes.
   ///
-  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *L) { return L->getType() == isLabel; }
@@ -362,11 +362,11 @@ public:
 
   /// EmitValue - Emit delta value.
   ///
-  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// SizeOf - Determine size of delta value in bytes.
   ///
-  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *D) { return D->getType() == isDelta; }
@@ -392,11 +392,11 @@ public:
 
   /// EmitValue - Emit delta value.
   ///
-  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// SizeOf - Determine size of delta value in bytes.
   ///
-  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *D) { return D->getType() == isString; }
@@ -421,17 +421,17 @@ public:
 
   /// EmitValue - Emit debug information entry offset.
   ///
-  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// SizeOf - Determine size of debug information entry in bytes.
   ///
-   unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override {
+   unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const override {
     return Form == dwarf::DW_FORM_ref_addr ? getRefAddrSize(AP)
                                            : sizeof(int32_t);
   }
 
   /// Returns size of a ref_addr entry.
-  static unsigned getRefAddrSize(AsmPrinter *AP);
+  static unsigned getRefAddrSize(const AsmPrinter *AP);
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *E) { return E->getType() == isEntry; }
@@ -451,10 +451,10 @@ public:
       : DIEValue(isTypeSignature), Unit(Unit) {}
 
   /// \brief Emit type unit signature.
-  void EmitValue(AsmPrinter *Asm, dwarf::Form Form) const override;
+  void EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const override;
 
   /// Returns size of a ref_sig8 entry.
-  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override {
+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const override {
     assert(Form == dwarf::DW_FORM_ref_sig8);
     return 8;
   }
@@ -479,7 +479,7 @@ public:
 
   /// ComputeSize - Calculate the size of the location expression.
   ///
-  unsigned ComputeSize(AsmPrinter *AP) const;
+  unsigned ComputeSize(const AsmPrinter *AP) const;
 
   /// BestForm - Choose the best form for data.
   ///
@@ -498,11 +498,11 @@ public:
 
   /// EmitValue - Emit location data.
   ///
-  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// SizeOf - Determine size of location data in bytes.
   ///
-  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *E) { return E->getType() == isLoc; }
@@ -522,7 +522,7 @@ public:
 
   /// ComputeSize - Calculate the size of the location expression.
   ///
-  unsigned ComputeSize(AsmPrinter *AP) const;
+  unsigned ComputeSize(const AsmPrinter *AP) const;
 
   /// BestForm - Choose the best form for data.
   ///
@@ -538,11 +538,11 @@ public:
 
   /// EmitValue - Emit location data.
   ///
-  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// SizeOf - Determine size of location data in bytes.
   ///
-  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *E) { return E->getType() == isBlock; }
@@ -568,11 +568,11 @@ public:
 
   /// EmitValue - Emit location data.
   ///
-  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// SizeOf - Determine size of location data in bytes.
   ///
-  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *E) { return E->getType() == isLocList; }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=231209&r1=231208&r2=231209&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Tue Mar  3 20:30:08 2015
@@ -60,7 +60,7 @@ void DIEAbbrev::Profile(FoldingSetNodeID
 
 /// Emit - Print the abbreviation using the specified asm printer.
 ///
-void DIEAbbrev::Emit(AsmPrinter *AP) const {
+void DIEAbbrev::Emit(const AsmPrinter *AP) const {
   // Emit its Dwarf tag type.
   AP->EmitULEB128(Tag, dwarf::TagString(Tag));
 
@@ -204,7 +204,7 @@ void DIEValue::dump() const {
 
 /// EmitValue - Emit integer of appropriate size.
 ///
-void DIEInteger::EmitValue(AsmPrinter *Asm, dwarf::Form Form) const {
+void DIEInteger::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
   unsigned Size = ~0U;
   switch (Form) {
   case dwarf::DW_FORM_flag_present:
@@ -236,7 +236,7 @@ void DIEInteger::EmitValue(AsmPrinter *A
 
 /// SizeOf - Determine size of integer value in bytes.
 ///
-unsigned DIEInteger::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {
+unsigned DIEInteger::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
   switch (Form) {
   case dwarf::DW_FORM_flag_present: return 0;
   case dwarf::DW_FORM_flag:  // Fall thru
@@ -272,13 +272,13 @@ void DIEInteger::print(raw_ostream &O) c
 
 /// EmitValue - Emit expression value.
 ///
-void DIEExpr::EmitValue(AsmPrinter *AP, dwarf::Form Form) const {
+void DIEExpr::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
   AP->OutStreamer.EmitValue(Expr, SizeOf(AP, Form));
 }
 
 /// SizeOf - Determine size of expression value in bytes.
 ///
-unsigned DIEExpr::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {
+unsigned DIEExpr::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
   if (Form == dwarf::DW_FORM_data4) return 4;
   if (Form == dwarf::DW_FORM_sec_offset) return 4;
   if (Form == dwarf::DW_FORM_strp) return 4;
@@ -298,7 +298,7 @@ void DIEExpr::print(raw_ostream &O) cons
 
 /// EmitValue - Emit label value.
 ///
-void DIELabel::EmitValue(AsmPrinter *AP, dwarf::Form Form) const {
+void DIELabel::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
   AP->EmitLabelReference(Label, SizeOf(AP, Form),
                          Form == dwarf::DW_FORM_strp ||
                              Form == dwarf::DW_FORM_sec_offset ||
@@ -307,7 +307,7 @@ void DIELabel::EmitValue(AsmPrinter *AP,
 
 /// SizeOf - Determine size of label value in bytes.
 ///
-unsigned DIELabel::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {
+unsigned DIELabel::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
   if (Form == dwarf::DW_FORM_data4) return 4;
   if (Form == dwarf::DW_FORM_sec_offset) return 4;
   if (Form == dwarf::DW_FORM_strp) return 4;
@@ -326,13 +326,13 @@ void DIELabel::print(raw_ostream &O) con
 
 /// EmitValue - Emit delta value.
 ///
-void DIEDelta::EmitValue(AsmPrinter *AP, dwarf::Form Form) const {
+void DIEDelta::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
   AP->EmitLabelDifference(LabelHi, LabelLo, SizeOf(AP, Form));
 }
 
 /// SizeOf - Determine size of delta value in bytes.
 ///
-unsigned DIEDelta::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {
+unsigned DIEDelta::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
   if (Form == dwarf::DW_FORM_data4) return 4;
   if (Form == dwarf::DW_FORM_sec_offset) return 4;
   if (Form == dwarf::DW_FORM_strp) return 4;
@@ -351,13 +351,13 @@ void DIEDelta::print(raw_ostream &O) con
 
 /// EmitValue - Emit string value.
 ///
-void DIEString::EmitValue(AsmPrinter *AP, dwarf::Form Form) const {
+void DIEString::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
   Access->EmitValue(AP, Form);
 }
 
 /// SizeOf - Determine size of delta value in bytes.
 ///
-unsigned DIEString::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {
+unsigned DIEString::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
   return Access->SizeOf(AP, Form);
 }
 
@@ -397,7 +397,7 @@ static void emitLabelOffsetDifference(MC
 
 /// EmitValue - Emit debug information entry offset.
 ///
-void DIEEntry::EmitValue(AsmPrinter *AP, dwarf::Form Form) const {
+void DIEEntry::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
 
   if (Form == dwarf::DW_FORM_ref_addr) {
     const DwarfDebug *DD = AP->getDwarfDebug();
@@ -420,7 +420,7 @@ void DIEEntry::EmitValue(AsmPrinter *AP,
     AP->EmitInt32(Entry.getOffset());
 }
 
-unsigned DIEEntry::getRefAddrSize(AsmPrinter *AP) {
+unsigned DIEEntry::getRefAddrSize(const AsmPrinter *AP) {
   // DWARF4: References that use the attribute form DW_FORM_ref_addr are
   // specified to be four bytes in the DWARF 32-bit format and eight bytes
   // in the DWARF 64-bit format, while DWARF Version 2 specifies that such
@@ -441,7 +441,7 @@ void DIEEntry::print(raw_ostream &O) con
 //===----------------------------------------------------------------------===//
 // DIETypeSignature Implementation
 //===----------------------------------------------------------------------===//
-void DIETypeSignature::EmitValue(AsmPrinter *Asm, dwarf::Form Form) const {
+void DIETypeSignature::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
   assert(Form == dwarf::DW_FORM_ref_sig8);
   Asm->OutStreamer.EmitIntValue(Unit.getTypeSignature(), 8);
 }
@@ -460,7 +460,7 @@ void DIETypeSignature::dump() const { pr
 
 /// ComputeSize - calculate the size of the location expression.
 ///
-unsigned DIELoc::ComputeSize(AsmPrinter *AP) const {
+unsigned DIELoc::ComputeSize(const AsmPrinter *AP) const {
   if (!Size) {
     const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();
     for (unsigned i = 0, N = Values.size(); i < N; ++i)
@@ -472,7 +472,7 @@ unsigned DIELoc::ComputeSize(AsmPrinter
 
 /// EmitValue - Emit location data.
 ///
-void DIELoc::EmitValue(AsmPrinter *Asm, dwarf::Form Form) const {
+void DIELoc::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
   switch (Form) {
   default: llvm_unreachable("Improper form for block");
   case dwarf::DW_FORM_block1: Asm->EmitInt8(Size);    break;
@@ -490,7 +490,7 @@ void DIELoc::EmitValue(AsmPrinter *Asm,
 
 /// SizeOf - Determine size of location data in bytes.
 ///
-unsigned DIELoc::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {
+unsigned DIELoc::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
   switch (Form) {
   case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);
   case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);
@@ -515,7 +515,7 @@ void DIELoc::print(raw_ostream &O) const
 
 /// ComputeSize - calculate the size of the block.
 ///
-unsigned DIEBlock::ComputeSize(AsmPrinter *AP) const {
+unsigned DIEBlock::ComputeSize(const AsmPrinter *AP) const {
   if (!Size) {
     const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();
     for (unsigned i = 0, N = Values.size(); i < N; ++i)
@@ -527,7 +527,7 @@ unsigned DIEBlock::ComputeSize(AsmPrinte
 
 /// EmitValue - Emit block data.
 ///
-void DIEBlock::EmitValue(AsmPrinter *Asm, dwarf::Form Form) const {
+void DIEBlock::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
   switch (Form) {
   default: llvm_unreachable("Improper form for block");
   case dwarf::DW_FORM_block1: Asm->EmitInt8(Size);    break;
@@ -543,7 +543,7 @@ void DIEBlock::EmitValue(AsmPrinter *Asm
 
 /// SizeOf - Determine size of block data in bytes.
 ///
-unsigned DIEBlock::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {
+unsigned DIEBlock::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
   switch (Form) {
   case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);
   case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);
@@ -564,7 +564,7 @@ void DIEBlock::print(raw_ostream &O) con
 // DIELocList Implementation
 //===----------------------------------------------------------------------===//
 
-unsigned DIELocList::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {
+unsigned DIELocList::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
   if (Form == dwarf::DW_FORM_data4)
     return 4;
   if (Form == dwarf::DW_FORM_sec_offset)
@@ -574,7 +574,7 @@ unsigned DIELocList::SizeOf(AsmPrinter *
 
 /// EmitValue - Emit label value.
 ///
-void DIELocList::EmitValue(AsmPrinter *AP, dwarf::Form Form) const {
+void DIELocList::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
   DwarfDebug *DD = AP->getDwarfDebug();
   MCSymbol *Label = DD->getDebugLocEntries()[Index].Label;
 





More information about the llvm-commits mailing list