Skip to content

Commit 3e763db

Browse files
authored
[SPIRV] Fix return type mismatch for createSPIRVEmitNonSemanticDIPass (#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 #97558
1 parent b48ef8d commit 3e763db

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "MCTargetDesc/SPIRVBaseInfo.h"
22
#include "MCTargetDesc/SPIRVMCTargetDesc.h"
3+
#include "SPIRV.h"
34
#include "SPIRVGlobalRegistry.h"
45
#include "SPIRVRegisterInfo.h"
56
#include "SPIRVTargetMachine.h"
@@ -33,12 +34,6 @@ struct SPIRVEmitNonSemanticDI : public MachineFunctionPass {
3334
bool IsGlobalDIEmitted = false;
3435
bool emitGlobalDI(MachineFunction &MF);
3536
};
36-
37-
void initializeSPIRVEmitNonSemanticDIPass(PassRegistry &);
38-
39-
FunctionPass *createSPIRVEmitNonSemanticDIPass(SPIRVTargetMachine *TM) {
40-
return new SPIRVEmitNonSemanticDI(TM);
41-
}
4237
} // namespace llvm
4338

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

4944
char SPIRVEmitNonSemanticDI::ID = 0;
5045

46+
MachineFunctionPass *
47+
llvm::createSPIRVEmitNonSemanticDIPass(SPIRVTargetMachine *TM) {
48+
return new SPIRVEmitNonSemanticDI(TM);
49+
}
50+
5151
SPIRVEmitNonSemanticDI::SPIRVEmitNonSemanticDI(SPIRVTargetMachine *TM)
5252
: MachineFunctionPass(ID), TM(TM) {
5353
initializeSPIRVEmitNonSemanticDIPass(*PassRegistry::getPassRegistry());

0 commit comments

Comments
 (0)