[llvm] cc6a704 - [MC] Make MCCodeEmitter::encodeInstruction pure virtual

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 21:49:53 PDT 2023


Author: Fangrui Song
Date: 2023-08-10T21:49:48-07:00
New Revision: cc6a704e6de56a09fb9c4be19d17ae71a1d754b7

URL: https://github.com/llvm/llvm-project/commit/cc6a704e6de56a09fb9c4be19d17ae71a1d754b7
DIFF: https://github.com/llvm/llvm-project/commit/cc6a704e6de56a09fb9c4be19d17ae71a1d754b7.diff

LOG: [MC] Make MCCodeEmitter::encodeInstruction pure virtual

An empty implementation is almost always inappropriate
(DXILMCCodeEmitter::encodeInstruction is an exception).
Make the function pure virtual as before https://reviews.llvm.org/D145791

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCCodeEmitter.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCCodeEmitter.h b/llvm/include/llvm/MC/MCCodeEmitter.h
index 0df7e8586d73ea..e4f4b27816bb3e 100644
--- a/llvm/include/llvm/MC/MCCodeEmitter.h
+++ b/llvm/include/llvm/MC/MCCodeEmitter.h
@@ -39,7 +39,7 @@ class MCCodeEmitter {
   /// Encode the given \p Inst to bytes and append to \p CB.
   virtual void encodeInstruction(const MCInst &Inst, SmallVectorImpl<char> &CB,
                                  SmallVectorImpl<MCFixup> &Fixups,
-                                 const MCSubtargetInfo &STI) const {}
+                                 const MCSubtargetInfo &STI) const = 0;
 };
 
 } // end namespace llvm


        


More information about the llvm-commits mailing list