Skip to content

Commit cab9855

Browse files
committed
[NFC] Address review comments
Use SmallVector for bundler args, add TODOs for -foffload-static-lib removal Signed-off-by: Michael D Toguchi <[email protected]>
1 parent 36447ce commit cab9855

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

clang/lib/Driver/Driver.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -2476,6 +2476,7 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args,
24762476
Diag(diag::note_use_dashdash);
24772477
}
24782478
}
2479+
// TODO: remove when -foffload-static-lib support is dropped.
24792480
else if (A->getOption().matches(options::OPT_offload_lib_Group)) {
24802481
// Add the foffload-static-lib library to the command line to allow
24812482
// processing when no source or object is supplied as well as proper
@@ -2497,7 +2498,7 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args,
24972498
}
24982499
}
24992500

2500-
static bool runBundler(const std::vector<StringRef> &BundlerArgs,
2501+
static bool runBundler(const SmallVectorImpl<StringRef> &BundlerArgs,
25012502
Compilation &C) {
25022503
// Find bundler.
25032504
StringRef ExecPath(C.getArgs().MakeArgString(C.getDriver().Dir));
@@ -2536,8 +2537,8 @@ bool hasFPGABinary(Compilation &C, std::string Object, types::ID Type) {
25362537
const char *Inputs = C.getArgs().MakeArgString(Twine("-inputs=") + Object);
25372538
// Always use -type=ao for aocx/aocr bundle checking. The 'bundles' are
25382539
// actually archives.
2539-
std::vector<StringRef> BundlerArgs = {"clang-offload-bundler", "-type=ao",
2540-
Targets, Inputs, "-check-section"};
2540+
SmallVector<StringRef, 6> BundlerArgs = {"clang-offload-bundler", "-type=ao",
2541+
Targets, Inputs, "-check-section"};
25412542
return runBundler(BundlerArgs, C);
25422543
}
25432544

@@ -2556,8 +2557,8 @@ static bool hasOffloadSections(Compilation &C, const StringRef &Archive,
25562557
const char *Inputs = Args.MakeArgString(Twine("-inputs=") + Archive.str());
25572558
// Always use -type=ao for bundle checking. The 'bundles' are
25582559
// actually archives.
2559-
std::vector<StringRef> BundlerArgs = {"clang-offload-bundler", "-type=ao",
2560-
Targets, Inputs, "-check-section"};
2560+
SmallVector<StringRef, 6> BundlerArgs = {"clang-offload-bundler", "-type=ao",
2561+
Targets, Inputs, "-check-section"};
25612562
return runBundler(BundlerArgs, C);
25622563
}
25632564

@@ -2663,6 +2664,7 @@ bool Driver::checkForOffloadStaticLib(Compilation &C,
26632664

26642665
// Right off the bat, assume the presense of -foffload-static-lib means
26652666
// the need to perform linking steps for fat static archive offloading.
2667+
// TODO: remove when -foffload-static-lib support is dropped.
26662668
if (Args.hasArg(options::OPT_offload_lib_Group))
26672669
return true;
26682670
SmallVector<const char *, 16> OffloadLibArgs(getLinkerArgs(C, Args));

0 commit comments

Comments
 (0)