[PATCH] D34551: [AVR] Migrate to new MCAsmBackend applyFixup Use a MutableArrayRef

Leslie Zhai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 23 02:44:58 PDT 2017


xiangzhai updated this revision to Diff 103706.
xiangzhai added a comment.

Removed useless DataSize.


Repository:
  rL LLVM

https://reviews.llvm.org/D34551

Files:
  lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
  lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h


Index: lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
===================================================================
--- lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
+++ lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
@@ -333,9 +333,8 @@
                                   MCELFObjectTargetWriter::getOSABI(OSType));
 }
 
-void AVRAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,
-                               unsigned DataSize, uint64_t Value,
-                               bool IsPCRel, MCContext &Ctx) const {
+void AVRAsmBackend::applyFixup(const MCFixup &Fixup, MutableArrayRef<char> Data,
+                               uint64_t Value, bool IsPCRel, MCContext &Ctx) const {
   if (Value == 0)
     return; // Doesn't change encoding.
 
@@ -349,7 +348,7 @@
   Value <<= Info.TargetOffset;
 
   unsigned Offset = Fixup.getOffset();
-  assert(Offset + NumBytes <= DataSize && "Invalid fixup offset!");
+  assert(Offset + NumBytes <= Data.size() && "Invalid fixup offset!");
 
   // For each byte of the fragment that the fixup touches, mask in the
   // bits from the fixup value.
Index: lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h
===================================================================
--- lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h
+++ lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h
@@ -40,7 +40,7 @@
 
   MCObjectWriter *createObjectWriter(raw_pwrite_stream &OS) const override;
 
-  void applyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
+  void applyFixup(const MCFixup &Fixup, MutableArrayRef<char> Data,
                   uint64_t Value, bool IsPCRel, MCContext &Ctx) const override;
 
   const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34551.103706.patch
Type: text/x-patch
Size: 1715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170623/86e8c055/attachment.bin>


More information about the llvm-commits mailing list