@@ -84,11 +84,10 @@ void registerFromSPIRVTranslation() {
8484static size_t validationFileCounter = 0 ;
8585
8686static LogicalResult
87- serializeModule (spirv::ModuleOp module , raw_ostream &output,
87+ serializeModule (spirv::ModuleOp moduleOp , raw_ostream &output,
8888 const spirv::SerializationOptions &options) {
89-
9089 SmallVector<uint32_t , 0 > binary;
91- if (failed (spirv::serialize (module , binary)))
90+ if (failed (spirv::serialize (moduleOp , binary)))
9291 return failure ();
9392
9493 size_t sizeInBytes = binary.size () * sizeof (uint32_t );
@@ -110,7 +109,8 @@ serializeModule(spirv::ModuleOp module, raw_ostream &output,
110109 std::string errorMessage;
111110 std::string filename =
112111 options.validationFilePrefix + std::to_string (validationFileCounter++);
113- auto validationOutput = openOutputFile (filename, &errorMessage);
112+ std::unique_ptr<llvm::ToolOutputFile> validationOutput =
113+ openOutputFile (filename, &errorMessage);
114114 if (!validationOutput) {
115115 llvm::errs () << errorMessage << " \n " ;
116116 return failure ();
@@ -132,14 +132,16 @@ void registerToSPIRVTranslation() {
132132 " saved to an additional file that starts with the given prefix. This "
133133 " is used to generate separate binaries for validation, where "
134134 " `--split-input-file` normally combines all outputs into one. The "
135- " one combined output (`-o`) is still written." ),
135+ " one combined output (`-o`) is still written. Created files need to "
136+ " be "
137+ " removed manually once processed." ),
136138 llvm::cl::init (" " ));
137139
138140 TranslateFromMLIRRegistration toBinary (
139141 " serialize-spirv" , " serialize SPIR-V dialect" ,
140- [](spirv::ModuleOp module , raw_ostream &output) {
141- return serializeModule (module , output,
142- {true , false , (validationFilesPrefix != " " ),
142+ [](spirv::ModuleOp moduleOp , raw_ostream &output) {
143+ return serializeModule (moduleOp , output,
144+ {true , false , !validationFilesPrefix. empty ( ),
143145 validationFilesPrefix});
144146 },
145147 [](DialectRegistry ®istry) {
0 commit comments