Skip to content

Commit 5fec104

Browse files
authored
Merge pull request #36922 from artemcm/ResetLibSwiftScanLLVMArgParse
[Dependency Scanning] Reset LLVM option occurences for each libSwiftScan query
2 parents b331c62 + e1b3ad8 commit 5fec104

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/DependencyScan/DependencyScanningTool.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ DependencyScanningTool::initCompilerInstanceForScan(
101101
SmallString<128> WorkingDirectory;
102102
llvm::sys::fs::current_path(WorkingDirectory);
103103

104+
// We must reset option occurences because we are handling an unrelated
105+
// command-line to those possibly parsed parsed before using the same tool.
106+
// We must do so because LLVM options parsing is done using a managed
107+
// static `GlobalParser`.
108+
llvm::cl::ResetAllOptionOccurrences();
109+
104110
// Parse arguments.
105111
std::string CommandString;
106112
for (const auto *c : Command) {

0 commit comments

Comments
 (0)