@@ -998,14 +998,12 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
998
998
//
999
999
}
1000
1000
1001
- static void appendOneArg (InputArgList &Args, const Arg *Opt,
1002
- const Arg *BaseArg) {
1001
+ static void appendOneArg (InputArgList &Args, const Arg *Opt) {
1003
1002
// The args for config files or /clang: flags belong to different InputArgList
1004
1003
// objects than Args. This copies an Arg from one of those other InputArgLists
1005
1004
// to the ownership of Args.
1006
1005
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);
1009
1007
Copy->getValues () = Opt->getValues ();
1010
1008
if (Opt->isClaimed ())
1011
1009
Copy->claim ();
@@ -1052,7 +1050,7 @@ bool Driver::readConfigFile(StringRef FileName,
1052
1050
llvm::SmallString<128 > CfgFileName (FileName);
1053
1051
llvm::sys::path::native (CfgFileName);
1054
1052
bool ContainErrors;
1055
- std::unique_ptr<InputArgList> NewOptions = std::make_unique<InputArgList>(
1053
+ auto NewOptions = std::make_unique<InputArgList>(
1056
1054
ParseArgStrings (NewCfgArgs, /* UseDriverMode=*/ true , ContainErrors));
1057
1055
if (ContainErrors)
1058
1056
return true ;
@@ -1066,12 +1064,8 @@ bool Driver::readConfigFile(StringRef FileName,
1066
1064
CfgOptions = std::move (NewOptions);
1067
1065
else {
1068
1066
// 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);
1075
1069
}
1076
1070
ConfigFiles.push_back (std::string (CfgFileName));
1077
1071
return false ;
@@ -1256,14 +1250,9 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
1256
1250
: std::move (*CLOptions));
1257
1251
1258
1252
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);
1267
1256
1268
1257
// In CL mode, look for any pass-through arguments
1269
1258
if (IsCLMode () && !ContainsError) {
@@ -1281,9 +1270,8 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
1281
1270
ContainsError));
1282
1271
1283
1272
if (!ContainsError)
1284
- for (auto *Opt : *CLModePassThroughOptions) {
1285
- appendOneArg (Args, Opt, nullptr );
1286
- }
1273
+ for (auto *Opt : *CLModePassThroughOptions)
1274
+ appendOneArg (Args, Opt);
1287
1275
}
1288
1276
}
1289
1277
0 commit comments