Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #1440 (cherry-pick #180 to release_18x) #187

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions clang/lib/Driver/ToolChains/ClassicFlang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,22 +240,35 @@ void ClassicFlang::ConstructJob(Compilation &C, const JobAction &JA,
}
}

// Treat backslashes as regular characters
for (auto Arg : Args.filtered(options::OPT_fno_backslash, options::OPT_Mbackslash)) {
Arg->claim();
if (auto *A =
Args.getLastArg(options::OPT_fno_backslash, options::OPT_Mbackslash,
options::OPT_fbackslash, options::OPT_Mnobackslash)) {
for (auto Arg :
Args.filtered(options::OPT_fno_backslash, options::OPT_Mbackslash,
options::OPT_fbackslash, options::OPT_Mnobackslash)) {
Arg->claim();
}
// Treat backslashes as regular characters
if (A->getOption().matches(options::OPT_fno_backslash) ||
A->getOption().matches(options::OPT_Mbackslash)) {
CommonCmdArgs.push_back("-x");
CommonCmdArgs.push_back("124");
CommonCmdArgs.push_back("0x40");
}
// Treat backslashes as C-style escape characters
if (A->getOption().matches(options::OPT_fbackslash) ||
A->getOption().matches(options::OPT_Mnobackslash)) {
CommonCmdArgs.push_back("-y");
CommonCmdArgs.push_back("124");
CommonCmdArgs.push_back("0x40");
}
} else {
// By default treat backslashes as regular characters
CommonCmdArgs.push_back("-x");
CommonCmdArgs.push_back("124");
CommonCmdArgs.push_back("0x40");
}

// Treat backslashes as C-style escape characters
for (auto Arg : Args.filtered(options::OPT_fbackslash, options::OPT_Mnobackslash)) {
Arg->claim();
CommonCmdArgs.push_back("-y");
CommonCmdArgs.push_back("124");
CommonCmdArgs.push_back("0x40");
}

// handle OpemMP options
if (auto *A = Args.getLastArg(options::OPT_mp, options::OPT_nomp,
options::OPT_fopenmp, options::OPT_fno_openmp)) {
Expand Down
Loading