From 88436afe3073bbf5a1fe3205dbac01c1e0dd5981 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 25 Mar 2022 22:15:35 -0700 Subject: [PATCH] [LoongArch] Fix several Clang warnings. NFC --- llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp | 5 +---- llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp | 4 +--- llvm/lib/Target/LoongArch/LoongArchInstrInfo.h | 2 -- llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h | 4 +--- .../LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp | 1 - 5 files changed, 3 insertions(+), 13 deletions(-) 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();