Skip to content

Commit 5b63b49

Browse files
authored
Merge pull request #3631 from apple/lldb-Include-swiftc-version-number-in-mismatch-warning
[lldb] Include swiftc version number in mismatch warning
2 parents e9927eb + 84c649c commit 5b63b49

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

lldb/source/Target/Process.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5897,14 +5897,21 @@ void Process::PrintWarningToolchainMismatch(const SymbolContext &sc) {
58975897
return;
58985898
if (sc.GetLanguage() != eLanguageTypeSwift)
58995899
return;
5900-
if (SymbolFile *sym_file = sc.module_sp->GetSymbolFile())
5901-
if (sym_file->GetProducerVersion(*sc.comp_unit) !=
5902-
swift::version::Version::getCurrentCompilerVersion())
5903-
PrintWarning(Process::Warnings::eWarningsToolchainMismatch,
5904-
sc.module_sp.get(),
5905-
"%s was compiled with a Swift compiler from a different "
5906-
"toolchain. Swift expression evaluation may not work.\n",
5907-
sc.module_sp->GetFileSpec().GetFilename().GetCString());
5900+
if (SymbolFile *sym_file = sc.module_sp->GetSymbolFile()) {
5901+
llvm::VersionTuple sym_file_version =
5902+
sym_file->GetProducerVersion(*sc.comp_unit);
5903+
llvm::VersionTuple swift_version =
5904+
swift::version::Version::getCurrentCompilerVersion();
5905+
if (sym_file_version != swift_version)
5906+
PrintWarning(
5907+
Process::Warnings::eWarningsToolchainMismatch, sc.module_sp.get(),
5908+
"%s was compiled with a Swift compiler from a different toolchain "
5909+
"(version '%s') than the Swift compiler integrated into LLDB "
5910+
"(version '%s'). Swift expression evaluation may not work.\n",
5911+
sc.module_sp->GetFileSpec().GetFilename().GetCString(),
5912+
sym_file_version.getAsString().c_str(),
5913+
swift_version.getAsString().c_str());
5914+
}
59085915
}
59095916
#endif
59105917

lldb/test/Shell/Swift/ToolchainMismatch.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ run
3232
quit
3333

3434
# The {{ }} avoids accidentally matching the input script!
35-
# CHECK: {{a\.out}} was compiled with a Swift compiler from a different toolchain.
35+
# CHECK: {{a\.out}} was compiled with a Swift compiler from a different toolchain
3636
# CHECK: stop reason{{ = }}breakpoint
37-
# SANITY-NOT: {{a\.out}} was compiled with a Swift compiler from a different toolchain.
37+
# SANITY-NOT: {{a\.out}} was compiled with a Swift compiler from a different toolchain
3838
# SANITY: stop reason{{ = }}breakpoint

0 commit comments

Comments
 (0)