Skip to content

Commit 691e556

Browse files
committed
[Driver] BuildCompilation: remove unused BaseArg. NFC
setBaseArg, only used by -XArch_* options, are called in BuildJobs. When processing --config and CL /clang:, BaseArg is always nullptr. The unneeded parameter was introduced in https://reviews.llvm.org/D24933
1 parent b9ac390 commit 691e556

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -998,14 +998,12 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
998998
//
999999
}
10001000

1001-
static void appendOneArg(InputArgList &Args, const Arg *Opt,
1002-
const Arg *BaseArg) {
1001+
static void appendOneArg(InputArgList &Args, const Arg *Opt) {
10031002
// The args for config files or /clang: flags belong to different InputArgList
10041003
// objects than Args. This copies an Arg from one of those other InputArgLists
10051004
// to the ownership of Args.
10061005
unsigned Index = Args.MakeIndex(Opt->getSpelling());
1007-
Arg *Copy = new llvm::opt::Arg(Opt->getOption(), Args.getArgString(Index),
1008-
Index, BaseArg);
1006+
Arg *Copy = new Arg(Opt->getOption(), Args.getArgString(Index), Index);
10091007
Copy->getValues() = Opt->getValues();
10101008
if (Opt->isClaimed())
10111009
Copy->claim();
@@ -1052,7 +1050,7 @@ bool Driver::readConfigFile(StringRef FileName,
10521050
llvm::SmallString<128> CfgFileName(FileName);
10531051
llvm::sys::path::native(CfgFileName);
10541052
bool ContainErrors;
1055-
std::unique_ptr<InputArgList> NewOptions = std::make_unique<InputArgList>(
1053+
auto NewOptions = std::make_unique<InputArgList>(
10561054
ParseArgStrings(NewCfgArgs, /*UseDriverMode=*/true, ContainErrors));
10571055
if (ContainErrors)
10581056
return true;
@@ -1066,12 +1064,8 @@ bool Driver::readConfigFile(StringRef FileName,
10661064
CfgOptions = std::move(NewOptions);
10671065
else {
10681066
// If this is a subsequent config file, append options to the previous one.
1069-
for (auto *Opt : *NewOptions) {
1070-
const Arg *BaseArg = &Opt->getBaseArg();
1071-
if (BaseArg == Opt)
1072-
BaseArg = nullptr;
1073-
appendOneArg(*CfgOptions, Opt, BaseArg);
1074-
}
1067+
for (auto *Opt : *NewOptions)
1068+
appendOneArg(*CfgOptions, Opt);
10751069
}
10761070
ConfigFiles.push_back(std::string(CfgFileName));
10771071
return false;
@@ -1256,14 +1250,9 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
12561250
: std::move(*CLOptions));
12571251

12581252
if (HasConfigFile)
1259-
for (auto *Opt : *CLOptions) {
1260-
if (Opt->getOption().matches(options::OPT_config))
1261-
continue;
1262-
const Arg *BaseArg = &Opt->getBaseArg();
1263-
if (BaseArg == Opt)
1264-
BaseArg = nullptr;
1265-
appendOneArg(Args, Opt, BaseArg);
1266-
}
1253+
for (auto *Opt : *CLOptions)
1254+
if (!Opt->getOption().matches(options::OPT_config))
1255+
appendOneArg(Args, Opt);
12671256

12681257
// In CL mode, look for any pass-through arguments
12691258
if (IsCLMode() && !ContainsError) {
@@ -1281,9 +1270,8 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
12811270
ContainsError));
12821271

12831272
if (!ContainsError)
1284-
for (auto *Opt : *CLModePassThroughOptions) {
1285-
appendOneArg(Args, Opt, nullptr);
1286-
}
1273+
for (auto *Opt : *CLModePassThroughOptions)
1274+
appendOneArg(Args, Opt);
12871275
}
12881276
}
12891277

0 commit comments

Comments
 (0)