Skip to content

Commit af3390e

Browse files
committed
[lldb] Replace -triple with --target= in clang extra args
1 parent c9355a2 commit af3390e

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ bool ConsumeIncludeOption(StringRef &arg, StringRef &prefix) {
14911491

14921492
std::array<StringRef, 2> macro_flags = { "-D", "-U" };
14931493
std::array<StringRef, 6> multi_arg_flags = {
1494-
"-D", "-U", "-I", "-F", "-working-directory", "-triple"};
1494+
"-D", "-U", "-I", "-F", "-working-directory", "--target="};
14951495
std::array<StringRef, 6> args_to_unique = {
14961496
"-D", "-U", "-I", "-F", "-fmodule-file=", "-fmodule-map-file="};
14971497

@@ -1537,16 +1537,15 @@ void SwiftASTContext::AddExtraClangArgs(const std::vector<std::string> &source,
15371537
llvm::find(source, "-fno-implicit-modules") != source.end();
15381538

15391539
for (const std::string &arg : source) {
1540-
// Ignore the `-triple` flag. First, this is not a driver flag, and second,
1541-
// lldb has its own logic to determine the target. Ignore now, before
1542-
// appending the argument.
1543-
if (clang_argument == "-triple") {
1544-
clang_argument.clear();
1545-
continue;
1540+
if (arg == "-triple") {
1541+
// Clang extra args are for driver flags. Replace the frontend `-triple`
1542+
// flag with a `--target=` driver flag.
1543+
clang_argument = "--target=";
1544+
} else {
1545+
// Join multi-arg options for uniquing.
1546+
clang_argument += arg;
15461547
}
15471548

1548-
// Join multi-arg options for uniquing.
1549-
clang_argument += arg;
15501549
if (IsMultiArgClangFlag(clang_argument))
15511550
continue;
15521551

0 commit comments

Comments
 (0)