================ @@ -453,6 +453,37 @@ CodeGenModule::CodeGenModule(ASTContext &C, if (Context.getTargetInfo().getTriple().getArch() == llvm::Triple::x86) getModule().addModuleFlag(llvm::Module::Error, "NumRegisterParameters", CodeGenOpts.NumRegisterParameters); + + // If there are any functions that are marked for Windows hot-patching, + // then build the list of functions now. + if (!CGO.MSHotPatchFunctionsFile.empty() || + !CGO.MSHotPatchFunctionsList.empty()) { + if (!CGO.MSHotPatchFunctionsFile.empty()) { + auto BufOrErr = llvm::MemoryBuffer::getFile(CGO.MSHotPatchFunctionsFile); + if (BufOrErr) { + const llvm::MemoryBuffer &FileBuffer = **BufOrErr; + for (llvm::line_iterator I(FileBuffer.getMemBufferRef(), true), E; + I != E; ++I) { + this->MSHotPatchFunctions.push_back(std::string{*I}); + } + } else { + auto &DE = Context.getDiagnostics(); + unsigned DiagID = + DE.getCustomDiagID(DiagnosticsEngine::Error, + "failed to open hotpatch functions file " + "(-fms-hotpatch-functions-file): %0 : %1"); + DE.Report(DiagID) << CGO.MSHotPatchFunctionsFile + << BufOrErr.getError().message(); + } + } + + for (const auto &FuncName : CGO.MSHotPatchFunctionsList) { + this->MSHotPatchFunctions.push_back(FuncName); + } + + std::sort(this->MSHotPatchFunctions.begin(), ---------------- aganea wrote:
You can just write `llvm::sort(this->MSHotPatchFunctions);`. https://github.com/llvm/llvm-project/pull/138972 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits