Skip to content

Commit 6aa461c

Browse files
authored
[SYCLomatic] Remove deprecated helper function customization feature and it's test (#1006)
Signed-off-by: Jiang, Zhiwei <[email protected]>
1 parent 776b2b7 commit 6aa461c

File tree

344 files changed

+7
-8406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

344 files changed

+7
-8406
lines changed

clang/include/clang/DPCT/DPCTOptions.inc

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -253,29 +253,6 @@ DPCT_NON_ENUM_OPTION(DPCT_OPT_TYPE(static llvm::cl::opt<bool>), EnableComments,
253253
llvm::cl::desc("Insert comments explaining the generated code. Default: off."),
254254
llvm::cl::cat(DPCTCat), llvm::cl::init(false))
255255

256-
DPCT_ENUM_OPTION(DPCT_OPT_TYPE(static llvm::cl::opt<HelperFilesCustomizationLevel>), UseCustomHelperFileLevel, "use-custom-helper",
257-
DPCT_OPTION_VALUES(
258-
DPCT_OPT_ENUM("none", int(HelperFilesCustomizationLevel::HFCL_None),
259-
"No customization (default).", false),
260-
DPCT_OPT_ENUM("file", int(HelperFilesCustomizationLevel::HFCL_File),
261-
"Limit helper header files to only the necessary files for the migrated code and\n"
262-
"place them in the --out-root directory.", false),
263-
DPCT_OPT_ENUM("api", int(HelperFilesCustomizationLevel::HFCL_API),
264-
"Limit helper header files to only the necessary APIs for the migrated code and\n"
265-
"place them in the --out-root directory.", false),
266-
DPCT_OPT_ENUM("all", int(HelperFilesCustomizationLevel::HFCL_All),
267-
"Generate a complete set of helper header files and place them in the --out-root\n"
268-
"directory.", false)
269-
),
270-
llvm::cl::desc("DEPRECATED: Customize the helper header files for migrated code. The values are:\n"),
271-
llvm::cl::init(HelperFilesCustomizationLevel::HFCL_None), llvm::cl::value_desc("value"), llvm::cl::cat(DPCTCat),
272-
llvm::cl::Optional)
273-
274-
DPCT_NON_ENUM_OPTION(DPCT_OPT_TYPE(static llvm::cl::opt<std::string>), CustomHelperFileName, "custom-helper-name",
275-
llvm::cl::desc("DEPRECATED: Specifies the helper headers folder name and main helper header file name.\n"
276-
"Default: dpct."),
277-
llvm::cl::init("dpct"), llvm::cl::value_desc("name"), llvm::cl::cat(DPCTCat), llvm::cl::Optional)
278-
279256
DPCT_NON_ENUM_OPTION(DPCT_OPT_TYPE(static llvm::cl::opt<bool, true>), AsyncHandler, "always-use-async-handler",
280257
llvm::cl::desc("Use async exception handler when creating new sycl::queue "
281258
"with dpct::create_queue\nin addition to default "

clang/lib/DPCT/DPCT.cpp

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -790,22 +790,10 @@ int runDPCT(int argc, const char **argv) {
790790
}
791791
ValidateInputDirectory(Tool, AnalysisScope);
792792

793-
if (GenHelperFunction.getNumOccurrences() &&
794-
(UseCustomHelperFileLevel.getNumOccurrences() ||
795-
CustomHelperFileName.getNumOccurrences())) {
796-
ShowStatus(MigrationErrorConflictOptions,
797-
"Option --gen-helper-function cannot be used with "
798-
"--use-custom-helper or --custom-helper-name together");
799-
dpctExit(MigrationErrorConflictOptions);
800-
}
801793
if (GenHelperFunction.getValue()) {
802794
dpct::genHelperFunction(dpct::DpctGlobalInfo::getOutRoot());
803795
}
804796

805-
validateCustomHelperFileNameArg(UseCustomHelperFileLevel,
806-
CustomHelperFileName,
807-
dpct::DpctGlobalInfo::getOutRoot());
808-
809797
Tool.appendArgumentsAdjuster(
810798
getInsertArgumentAdjuster("-nocudalib", ArgumentInsertPosition::BEGIN));
811799

@@ -859,18 +847,11 @@ int runDPCT(int argc, const char **argv) {
859847
DpctGlobalInfo::setSyclNamedLambda(SyclNamedLambdaFlag);
860848
DpctGlobalInfo::setUsmLevel(USMLevel);
861849
DpctGlobalInfo::setIsIncMigration(!NoIncrementalMigration);
862-
DpctGlobalInfo::setHelperFilesCustomizationLevel(UseCustomHelperFileLevel);
863-
if (UseCustomHelperFileLevel.getNumOccurrences()) {
864-
clang::dpct::PrintMsg("Note: Option --use-custom-helper is deprecated and "
865-
"may be removed in the future.\n");
866-
}
850+
DpctGlobalInfo::setHelperFilesCustomizationLevel(
851+
HelperFilesCustomizationLevel::HFCL_None);
867852
DpctGlobalInfo::setCheckUnicodeSecurityFlag(CheckUnicodeSecurityFlag);
868853
DpctGlobalInfo::setEnablepProfilingFlag(EnablepProfilingFlag);
869-
DpctGlobalInfo::setCustomHelperFileName(CustomHelperFileName);
870-
if (CustomHelperFileName.getNumOccurrences()) {
871-
clang::dpct::PrintMsg("Note: Option --custom-helper-name is deprecated and "
872-
"may be removed in the future.\n");
873-
}
854+
DpctGlobalInfo::setCustomHelperFileName("dpct");
874855
HelperFileNameMap[HelperFileEnum::Dpct] =
875856
DpctGlobalInfo::getCustomHelperFileName() + ".hpp";
876857
DpctGlobalInfo::setFormatRange(FormatRng);
@@ -939,8 +920,7 @@ int runDPCT(int argc, const char **argv) {
939920
DpctGlobalInfo::isCommentsEnabled(),
940921
EnableComments.getNumOccurrences());
941922
setValueToOptMap(clang::dpct::OPTION_CustomHelperFileName,
942-
DpctGlobalInfo::getCustomHelperFileName(),
943-
CustomHelperFileName.getNumOccurrences());
923+
DpctGlobalInfo::getCustomHelperFileName(), 0);
944924
setValueToOptMap(clang::dpct::OPTION_CtadEnabled,
945925
DpctGlobalInfo::isCtadEnabled(),
946926
EnableCTAD.getNumOccurrences());

clang/lib/DPCT/Error.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -140,20 +140,6 @@ void ShowStatus(int Status, std::string Message) {
140140
"Error: The input for option --use-explicit-namespace is not valid. "
141141
"Run 'dpct --help' to see supported options and values.";
142142
break;
143-
case MigrationErrorCustomHelperFileNameContainInvalidChar:
144-
StatusString =
145-
"Error: Custom helper header file name is invalid. The name can only "
146-
"contain digits(0-9), underscore(_) or letters(a-zA-Z).";
147-
break;
148-
case MigrationErrorCustomHelperFileNameTooLong:
149-
StatusString = "Error: Custom helper header file name is too long.";
150-
break;
151-
case MigrationErrorCustomHelperFileNamePathTooLong:
152-
StatusString =
153-
"Error: The path resulted from --out-root and --custom-helper-name "
154-
"option values: \"" +
155-
Message + "\" is too long.";
156-
break;
157143
case MigrationErrorDifferentOptSet:
158144
StatusString =
159145
"Error: Incremental migration requires the same option sets used "
@@ -175,9 +161,6 @@ void ShowStatus(int Status, std::string Message) {
175161
StatusString = "Error: The path for --analysis-scope-path is not the same "
176162
"as or a parent directory of --in-root";
177163
break;
178-
case MigrationErrorConflictOptions:
179-
StatusString = "Error: " + Message;
180-
break;
181164
default:
182165
DpctLog() << "Unknown error\n";
183166
dpctExit(-1);

clang/lib/DPCT/Error.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ enum ProcessStatus {
4646
MigrationErrorCudaVersionUnsupported = -31,
4747
MigrationErrorSupportedCudaVersionNotAvailable = -32,
4848
MigrationErrorInvalidExplicitNamespace = -33,
49-
MigrationErrorCustomHelperFileNameContainInvalidChar = -34,
50-
MigrationErrorCustomHelperFileNameTooLong = -35,
51-
MigrationErrorCustomHelperFileNamePathTooLong = -36,
5249
MigrationErrorDifferentOptSet = -37,
5350
MigrationErrorInvalidRuleFilePath = -38,
5451
MigrationErrorCannotParseRuleFile = -39,

clang/lib/DPCT/ValidateArguments.cpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -238,36 +238,3 @@ bool checkReportArgs(ReportTypeEnum &RType, ReportFormatEnum &RFormat,
238238

239239
return Success;
240240
}
241-
242-
void validateCustomHelperFileNameArg(HelperFilesCustomizationLevel Level,
243-
std::string &Name,
244-
const std::string &OutRoot) {
245-
if ((Level == HelperFilesCustomizationLevel::HFCL_None) && (Name != "dpct")) {
246-
clang::dpct::PrintMsg("Warning: Ignored \"--custom-helper-name\", since "
247-
"\"--use-custom-helper\" is not specified or "
248-
"has \"none\" value.\n");
249-
Name = "dpct";
250-
return;
251-
}
252-
253-
std::string FileName = Name + ".hpp";
254-
if (FileName.size() >= MAX_NAME_LEN) {
255-
clang::dpct::ShowStatus(MigrationErrorCustomHelperFileNameTooLong);
256-
dpctExit(MigrationErrorCustomHelperFileNameTooLong);
257-
}
258-
259-
std::string FilePath = OutRoot + "/include/" + Name + "/" + FileName;
260-
if (FilePath.size() >= MAX_PATH_LEN) {
261-
clang::dpct::ShowStatus(MigrationErrorCustomHelperFileNamePathTooLong,
262-
FilePath);
263-
dpctExit(MigrationErrorCustomHelperFileNamePathTooLong);
264-
}
265-
266-
for (size_t Idx = 0, End = Name.size(); Idx < End; Idx++) {
267-
if ((!isdigit(Name[Idx])) && (!isalpha(Name[Idx])) && (Name[Idx] != '_')) {
268-
clang::dpct::ShowStatus(
269-
MigrationErrorCustomHelperFileNameContainInvalidChar);
270-
dpctExit(MigrationErrorCustomHelperFileNameContainInvalidChar);
271-
}
272-
}
273-
}

clang/lib/DPCT/ValidateArguments.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,4 @@ bool checkReportArgs(ReportTypeEnum &RType, ReportFormatEnum &RFormat,
103103
/// -1: Path is invalid
104104
int checkSDKPathOrIncludePath(const std::string &Path, std::string &RealPath);
105105

106-
void validateCustomHelperFileNameArg(HelperFilesCustomizationLevel Level,
107-
std::string &Name,
108-
const std::string &OutRoot);
109106
#endif // DPCT_VALIDATE_ARGUMENTS_H

clang/test/dpct/autocomplete.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
// DASH-NEXT: --comments
1818
// DASH-NEXT: --compilation-database
1919
// DASH-NEXT: --cuda-include-path
20-
// DASH-NEXT: --custom-helper-name
2120
// DASH-NEXT: --enable-ctad
2221
// DASH-NEXT: --enable-profiling
2322
// DASH-NEXT: --extra-arg
@@ -47,7 +46,6 @@
4746
// DASH-NEXT: --suppress-warnings
4847
// DASH-NEXT: --suppress-warnings-all
4948
// DASH-NEXT: --sycl-named-lambda
50-
// DASH-NEXT: --use-custom-helper=
5149
// DASH-NEXT: --use-dpcpp-extensions=
5250
// DASH-NEXT: --use-experimental-features=
5351
// DASH-NEXT: --use-explicit-namespace=

clang/test/dpct/check_header_files_with_option_all.cpp

Lines changed: 0 additions & 126 deletions
This file was deleted.

0 commit comments

Comments
 (0)