[llvm] 88436af - [LoongArch] Fix several Clang warnings. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 25 22:15:40 PDT 2022


Author: Fangrui Song
Date: 2022-03-25T22:15:35-07:00
New Revision: 88436afe3073bbf5a1fe3205dbac01c1e0dd5981

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

LOG: [LoongArch] Fix several Clang warnings. NFC

Added: 
    

Modified: 
    llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
    llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
    llvm/lib/Target/LoongArch/LoongArchInstrInfo.h
    llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h
    llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp b/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
index 467ae0cc16658..f753b5317f501 100644
--- a/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
+++ b/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
@@ -24,8 +24,6 @@ using namespace llvm;
 #define DEBUG_TYPE "loongarch-asm-parser"
 
 namespace {
-struct LoongArchOperand;
-
 class LoongArchAsmParser : public MCTargetAsmParser {
   SMLoc getLoc() const { return getParser().getTok().getLoc(); }
 
@@ -82,8 +80,7 @@ class LoongArchAsmParser : public MCTargetAsmParser {
   }
 };
 
-/// LoongArchOperand - Instances of this class represent a parsed LoongArch
-/// machine instruction.
+// Instances of this class represent a parsed LoongArch machine instruction.
 class LoongArchOperand : public MCParsedAsmOperand {
   enum class KindTy {
     Token,

diff  --git a/llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp b/llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
index 07b11fe302d8e..e45c8ff8e9323 100644
--- a/llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
@@ -19,6 +19,4 @@ using namespace llvm;
 
 LoongArchInstrInfo::LoongArchInstrInfo(LoongArchSubtarget &STI)
     // FIXME: add CFSetup and CFDestroy Inst when we implement function call.
-    : LoongArchGenInstrInfo(),
-
-      STI(STI) {}
+    : LoongArchGenInstrInfo() {}

diff  --git a/llvm/lib/Target/LoongArch/LoongArchInstrInfo.h b/llvm/lib/Target/LoongArch/LoongArchInstrInfo.h
index 9d737fa1a988b..b056fff1c95e5 100644
--- a/llvm/lib/Target/LoongArch/LoongArchInstrInfo.h
+++ b/llvm/lib/Target/LoongArch/LoongArchInstrInfo.h
@@ -23,8 +23,6 @@ namespace llvm {
 class LoongArchSubtarget;
 
 class LoongArchInstrInfo : public LoongArchGenInstrInfo {
-  const LoongArchSubtarget &STI;
-
 public:
   explicit LoongArchInstrInfo(LoongArchSubtarget &STI);
 };

diff  --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h
index 282137b8480a2..77bbfb095747c 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h
@@ -22,14 +22,12 @@
 namespace llvm {
 
 class LoongArchAsmBackend : public MCAsmBackend {
-  const MCSubtargetInfo &STI;
   uint8_t OSABI;
   bool Is64Bit;
 
 public:
   LoongArchAsmBackend(const MCSubtargetInfo &STI, uint8_t OSABI, bool Is64Bit)
-      : MCAsmBackend(support::little), STI(STI), OSABI(OSABI),
-        Is64Bit(Is64Bit) {}
+      : MCAsmBackend(support::little), OSABI(OSABI), Is64Bit(Is64Bit) {}
   ~LoongArchAsmBackend() override {}
 
   void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,

diff  --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
index 254d619c06faa..95e1314f363a9 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
@@ -45,7 +45,6 @@ unsigned LoongArchELFObjectWriter::getRelocType(MCContext &Ctx,
                                                 const MCValue &Target,
                                                 const MCFixup &Fixup,
                                                 bool IsPCRel) const {
-  const MCExpr *Expr = Fixup.getValue();
   // Determine the type of the relocation
   unsigned Kind = Fixup.getTargetKind();
 


        


More information about the llvm-commits mailing list