Skip to content

Commit

Permalink
[SPIRV] Fix return type mismatch for createSPIRVEmitNonSemanticDIPass (
Browse files Browse the repository at this point in the history
…llvm#105889)

The declaration in SPIRV.h had this returning a `MachineFunctionPass *`,
but the implementation returned a `FunctionPass *`. This showed up as a
build error on windows, but it was clearly a mistake regardless.

I also updated the pass to include SPIRV.h rather than using its own
declarations for pass initialization, as this results in better errors
for this kind of typo.

Fixes a build break after llvm#97558
  • Loading branch information
bogner authored Aug 23, 2024
1 parent b48ef8d commit 3e763db
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "MCTargetDesc/SPIRVBaseInfo.h"
#include "MCTargetDesc/SPIRVMCTargetDesc.h"
#include "SPIRV.h"
#include "SPIRVGlobalRegistry.h"
#include "SPIRVRegisterInfo.h"
#include "SPIRVTargetMachine.h"
Expand Down Expand Up @@ -33,12 +34,6 @@ struct SPIRVEmitNonSemanticDI : public MachineFunctionPass {
bool IsGlobalDIEmitted = false;
bool emitGlobalDI(MachineFunction &MF);
};

void initializeSPIRVEmitNonSemanticDIPass(PassRegistry &);

FunctionPass *createSPIRVEmitNonSemanticDIPass(SPIRVTargetMachine *TM) {
return new SPIRVEmitNonSemanticDI(TM);
}
} // namespace llvm

using namespace llvm;
Expand All @@ -48,6 +43,11 @@ INITIALIZE_PASS(SPIRVEmitNonSemanticDI, DEBUG_TYPE,

char SPIRVEmitNonSemanticDI::ID = 0;

MachineFunctionPass *
llvm::createSPIRVEmitNonSemanticDIPass(SPIRVTargetMachine *TM) {
return new SPIRVEmitNonSemanticDI(TM);
}

SPIRVEmitNonSemanticDI::SPIRVEmitNonSemanticDI(SPIRVTargetMachine *TM)
: MachineFunctionPass(ID), TM(TM) {
initializeSPIRVEmitNonSemanticDIPass(*PassRegistry::getPassRegistry());
Expand Down

0 comments on commit 3e763db

Please sign in to comment.