Skip to content

Commit 332564f

Browse files
committed
Claim fil-c driver flags to prevent unused-argument warnings
1 parent 88edd04 commit 332564f

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,9 +595,10 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
595595
auto GetYoloLibPath = [&] (const StringRef str) -> std::string {
596596
if (ToolChain.getDriver().HasPizfix) {
597597
std::string BasePath;
598-
if (Arg *A = Args.getLastArg(options::OPT_filc_crt_path))
598+
if (Arg *A = Args.getLastArg(options::OPT_filc_crt_path)) {
599+
A->claim();
599600
BasePath = A->getValue();
600-
else {
601+
} else {
601602
SmallString<128> P(ToolChain.getDriver().PizfixRoot);
602603
llvm::sys::path::append(P, "lib");
603604
BasePath = std::string(P);
@@ -689,9 +690,10 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
689690

690691
if (ToolChain.getDriver().HasPizfix) {
691692
std::string BasePath;
692-
if (Arg *A = Args.getLastArg(options::OPT_filc_crt_path))
693+
if (Arg *A = Args.getLastArg(options::OPT_filc_crt_path)) {
694+
A->claim();
693695
BasePath = A->getValue();
694-
else {
696+
} else {
695697
SmallString<128> P(ToolChain.getDriver().PizfixRoot);
696698
llvm::sys::path::append(P, "lib");
697699
BasePath = std::string(P);

clang/lib/Driver/ToolChains/Linux.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,10 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
458458

459459
if ((true)) {
460460
// Check for explicit override flag
461-
if (Arg *A = Args.getLastArg(options::OPT_filc_dynamic_linker))
461+
if (Arg *A = Args.getLastArg(options::OPT_filc_dynamic_linker)) {
462+
A->claim();
462463
return std::string(A->getValue());
464+
}
463465

464466
if (getDriver().HasPizfix) {
465467
SmallString<128> P(getDriver().PizfixRoot);
@@ -660,9 +662,10 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
660662
if (D.HasPizfix) {
661663
{
662664
std::string P;
663-
if (Arg *A = DriverArgs.getLastArg(options::OPT_filc_stdfil_include))
665+
if (Arg *A = DriverArgs.getLastArg(options::OPT_filc_stdfil_include)) {
666+
A->claim();
664667
P = A->getValue();
665-
else {
668+
} else {
666669
SmallString<128> Path(D.PizfixRoot);
667670
llvm::sys::path::append(Path, "stdfil-include");
668671
P = std::string(Path);
@@ -672,9 +675,10 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
672675

673676
{
674677
std::string P;
675-
if (Arg *A = DriverArgs.getLastArg(options::OPT_filc_os_include))
678+
if (Arg *A = DriverArgs.getLastArg(options::OPT_filc_os_include)) {
679+
A->claim();
676680
P = A->getValue();
677-
else {
681+
} else {
678682
SmallString<128> Path(D.PizfixRoot);
679683
llvm::sys::path::append(Path, "os-include");
680684
P = std::string(Path);
@@ -685,9 +689,10 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
685689
if (!DriverArgs.hasArg(clang::driver::options::OPT_nostdinc)
686690
&& !DriverArgs.hasArg(options::OPT_nostdlibinc)) {
687691
std::string P;
688-
if (Arg *A = DriverArgs.getLastArg(options::OPT_filc_include))
692+
if (Arg *A = DriverArgs.getLastArg(options::OPT_filc_include)) {
693+
A->claim();
689694
P = A->getValue();
690-
else {
695+
} else {
691696
SmallString<128> Path(D.PizfixRoot);
692697
llvm::sys::path::append(Path, "include");
693698
P = std::string(Path);

0 commit comments

Comments
 (0)