From 98bb926065926133278fa5dafd31bfc5007edf96 Mon Sep 17 00:00:00 2001 From: gerioldman Date: Sun, 27 Aug 2023 14:02:50 +0200 Subject: [PATCH] AddTasking RSP syntax to printCompdb functionality --- src/ninja.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ninja.cc b/src/ninja.cc index 887d89f8d8..2520f31174 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -882,7 +882,7 @@ std::string EvaluateCommandWithRspfile(const Edge* edge, return command; size_t index = command.find(rspfile); - if (index == 0 || index == string::npos || command[index - 1] != '@') + if (index == 0 || index == string::npos || ( command[index - 1] != '@' && command.find("--option-file=") != index - 14 && command.find("-f ") != index - 3 )) return command; string rspfile_content = edge->GetBinding("rspfile_content"); @@ -892,7 +892,12 @@ std::string EvaluateCommandWithRspfile(const Edge* edge, rspfile_content.replace(newline_index, 1, 1, ' '); ++newline_index; } - command.replace(index - 1, rspfile.length() + 1, rspfile_content); + if (command[index - 1] == '@') + command.replace(index - 1, rspfile.length() + 1, rspfile_content); + else if (command.find("-f ") == index - 3) + command.replace(index - 3, rspfile.length() + 3, rspfile_content); + else + command.replace(index - 14, rspfile.length() + 14, rspfile_content); return command; }