Skip to content

Commit d015c8b

Browse files
committed
finish renaming to SHP
1 parent 25dcedc commit d015c8b

File tree

8 files changed

+36
-36
lines changed

8 files changed

+36
-36
lines changed

clang/include/clang/Basic/CodeGenOptions.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,12 @@ class CodeGenOptions : public CodeGenOptionsBase {
502502
/// A list of functions that are replacable by the loader.
503503
std::vector<std::string> LoaderReplaceableFunctionNames;
504504
/// The name of a file that contains functions which will be compiled for
505-
/// hotpatching. See -fms-hot-patch-functions-file.
506-
std::string MSHotPatchFunctionsFile;
505+
/// hotpatching. See -fms-secure-hotpatch-functions-file.
506+
std::string MSSecureHotPatchFunctionsFile;
507507

508508
/// A list of functions which will be compiled for hotpatching.
509-
/// See -fms-hot-patch-functions-list.
510-
std::vector<std::string> MSHotPatchFunctionsList;
509+
/// See -fms-secure-hotpatch-functions-list.
510+
std::vector<std::string> MSSecureHotPatchFunctionsList;
511511

512512
public:
513513
// Define accessors/mutators for code generation options of enumeration type.

clang/include/clang/Driver/Options.td

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3830,20 +3830,24 @@ def fms_hotpatch : Flag<["-"], "fms-hotpatch">, Group<f_Group>,
38303830
Visibility<[ClangOption, CC1Option, CLOption]>,
38313831
HelpText<"Ensure that all functions can be hotpatched at runtime">,
38323832
MarshallingInfoFlag<CodeGenOpts<"HotPatch">>;
3833-
def fms_hotpatch_functions_file
3834-
: Joined<["-"], "fms-hotpatch-functions-file=">,
3833+
3834+
// See llvm/lib/CodeGen/WindowsSecureHotPatching.cpp
3835+
def fms_secure_hotpatch_functions_file
3836+
: Joined<["-"], "fms-secure-hotpatch-functions-file=">,
38353837
Group<f_Group>,
38363838
Visibility<[ClangOption, CC1Option, CLOption]>,
3837-
MarshallingInfoString<CodeGenOpts<"MSHotPatchFunctionsFile">>,
3838-
HelpText<"Path to a file that contains a list of mangled symbol names of "
3839-
"functions that should be hot-patched">;
3840-
def fms_hotpatch_functions_list
3841-
: CommaJoined<["-"], "fms-hotpatch-functions-list=">,
3839+
MarshallingInfoString<CodeGenOpts<"MSSecureHotPatchFunctionsFile">>,
3840+
HelpText<"Path to a file that contains a list of mangled names of "
3841+
"functions that should be hot-patched for Windows Secure "
3842+
"Hot-Patching">;
3843+
def fms_secure_hotpatch_functions_list
3844+
: CommaJoined<["-"], "fms-secure-hotpatch-functions-list=">,
38423845
Group<f_Group>,
38433846
Visibility<[ClangOption, CC1Option, CLOption]>,
3844-
MarshallingInfoStringVector<CodeGenOpts<"MSHotPatchFunctionsList">>,
3847+
MarshallingInfoStringVector<CodeGenOpts<"MSSecureHotPatchFunctionsList">>,
38453848
HelpText<"List of mangled symbol names of functions that should be "
3846-
"hot-patched">;
3849+
"hot-patched for Windows Secure Hot-Patching">;
3850+
38473851
def fpcc_struct_return : Flag<["-"], "fpcc-struct-return">, Group<f_Group>,
38483852
Visibility<[ClangOption, CC1Option]>,
38493853
HelpText<"Override the default ABI to return all structs on the stack">;

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -454,35 +454,33 @@ CodeGenModule::CodeGenModule(ASTContext &C,
454454
getModule().addModuleFlag(llvm::Module::Error, "NumRegisterParameters",
455455
CodeGenOpts.NumRegisterParameters);
456456

457-
// If there are any functions that are marked for Windows hot-patching,
457+
// If there are any functions that are marked for Windows secure hot-patching,
458458
// then build the list of functions now.
459-
if (!CGO.MSHotPatchFunctionsFile.empty() ||
460-
!CGO.MSHotPatchFunctionsList.empty()) {
461-
if (!CGO.MSHotPatchFunctionsFile.empty()) {
462-
auto BufOrErr = llvm::MemoryBuffer::getFile(CGO.MSHotPatchFunctionsFile);
459+
if (!CGO.MSSecureHotPatchFunctionsFile.empty() ||
460+
!CGO.MSSecureHotPatchFunctionsList.empty()) {
461+
if (!CGO.MSSecureHotPatchFunctionsFile.empty()) {
462+
auto BufOrErr =
463+
llvm::MemoryBuffer::getFile(CGO.MSSecureHotPatchFunctionsFile);
463464
if (BufOrErr) {
464465
const llvm::MemoryBuffer &FileBuffer = **BufOrErr;
465466
for (llvm::line_iterator I(FileBuffer.getMemBufferRef(), true), E;
466-
I != E; ++I) {
467+
I != E; ++I)
467468
this->MSHotPatchFunctions.push_back(std::string{*I});
468-
}
469469
} else {
470470
auto &DE = Context.getDiagnostics();
471471
unsigned DiagID =
472472
DE.getCustomDiagID(DiagnosticsEngine::Error,
473473
"failed to open hotpatch functions file "
474474
"(-fms-hotpatch-functions-file): %0 : %1");
475-
DE.Report(DiagID) << CGO.MSHotPatchFunctionsFile
475+
DE.Report(DiagID) << CGO.MSSecureHotPatchFunctionsFile
476476
<< BufOrErr.getError().message();
477477
}
478478
}
479479

480-
for (const auto &FuncName : CGO.MSHotPatchFunctionsList) {
480+
for (const auto &FuncName : CGO.MSSecureHotPatchFunctionsList)
481481
this->MSHotPatchFunctions.push_back(FuncName);
482-
}
483482

484-
std::sort(this->MSHotPatchFunctions.begin(),
485-
this->MSHotPatchFunctions.end());
483+
llvm::sort(this->MSHotPatchFunctions);
486484
}
487485
}
488486

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6946,15 +6946,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
69466946

69476947
Args.AddLastArg(CmdArgs, options::OPT_fms_hotpatch);
69486948

6949-
if (Arg *A = Args.getLastArg(options::OPT_fms_hotpatch_functions_file)) {
6950-
Args.AddLastArg(CmdArgs, options::OPT_fms_hotpatch_functions_file);
6951-
}
6949+
if (Arg *A = Args.getLastArg(options::OPT_fms_secure_hotpatch_functions_file))
6950+
Args.AddLastArg(CmdArgs, options::OPT_fms_secure_hotpatch_functions_file);
69526951

69536952
for (const auto &A :
6954-
Args.getAllArgValues(options::OPT_fms_hotpatch_functions_list)) {
6953+
Args.getAllArgValues(options::OPT_fms_secure_hotpatch_functions_list))
69556954
CmdArgs.push_back(
6956-
Args.MakeArgString("-fms-hotpatch-functions-list=" + Twine(A)));
6957-
}
6955+
Args.MakeArgString("-fms-secure-hotpatch-functions-list=" + Twine(A)));
69586956

69596957
if (TC.SupportsProfiling()) {
69606958
Args.AddLastArg(CmdArgs, options::OPT_pg);

clang/test/CodeGen/ms-secure-hotpatch-bad-file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// This verifies that we correctly handle a -fms-hotpatch-functions-file argument that points
1+
// This verifies that we correctly handle a -fms-secure-hotpatch-functions-file argument that points
22
// to a missing file.
33
//
4-
// RUN: not %clang_cl -c --target=x86_64-windows-msvc -O2 /Z7 -fms-hotpatch-functions-file=%S/this-file-is-intentionally-missing-do-not-create-it.txt /Fo%t.obj %s 2>&1 | FileCheck %s
4+
// RUN: not %clang_cl -c --target=x86_64-windows-msvc -O2 /Z7 -fms-secure-hotpatch-functions-file=%S/this-file-is-intentionally-missing-do-not-create-it.txt /Fo%t.obj %s 2>&1 | FileCheck %s
55
// CHECK: failed to open hotpatch functions file
66

77
void this_might_have_side_effects();

clang/test/CodeGen/ms-secure-hotpatch-cpp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This verifies that hotpatch function attributes are correctly propagated when compiling directly to OBJ,
22
// and that name mangling works as expected.
33
//
4-
// RUN: %clang_cl -c --target=x86_64-windows-msvc -O2 /Z7 -fms-hotpatch-functions-list=?this_gets_hotpatched@@YAHXZ /Fo%t.obj %s
4+
// RUN: %clang_cl -c --target=x86_64-windows-msvc -O2 /Z7 -fms-secure-hotpatch-functions-list=?this_gets_hotpatched@@YAHXZ /Fo%t.obj %s
55
// RUN: llvm-readobj --codeview %t.obj | FileCheck %s
66

77
void this_might_have_side_effects();

clang/test/CodeGen/ms-secure-hotpatch-lto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This verifies that hotpatch function attributes are correctly propagated through LLVM IR when compiling with LTO.
22
//
3-
// RUN: %clang_cl -c --target=x86_64-windows-msvc -O2 /Z7 -fms-hotpatch-functions-list=this_gets_hotpatched -flto /Fo%t.bc %s
3+
// RUN: %clang_cl -c --target=x86_64-windows-msvc -O2 /Z7 -fms-secure-hotpatch-functions-list=this_gets_hotpatched -flto /Fo%t.bc %s
44
// RUN: llvm-dis %t.bc -o - | FileCheck %s
55
//
66
// CHECK: ; Function Attrs: marked_for_windows_hot_patching mustprogress nofree noinline norecurse nosync nounwind sspstrong willreturn memory(none) uwtable

clang/test/CodeGen/ms-secure-hotpatch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This verifies that hotpatch function attributes are correctly propagated when compiling directly to OBJ.
22
//
33
// RUN: echo this_gets_hotpatched > %t.patch-functions.txt
4-
// RUN: %clang_cl -c --target=x86_64-windows-msvc -O2 /Z7 -fms-hotpatch-functions-file=%t.patch-functions.txt /Fo%t.obj %s
4+
// RUN: %clang_cl -c --target=x86_64-windows-msvc -O2 /Z7 -fms-secure-hotpatch-functions-file=%t.patch-functions.txt /Fo%t.obj %s
55
// RUN: llvm-readobj --codeview %t.obj | FileCheck %s
66

77
void this_might_have_side_effects();

0 commit comments

Comments
 (0)