-
Notifications
You must be signed in to change notification settings - Fork 339
Implement a warning that detects Swift compile units that were compiled with #3361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a warning that detects Swift compile units that were compiled with #3361
Conversation
# RUN: %target-swiftc -g \ | ||
# RUN: -module-cache-path %t/cache %S/Inputs/main.swift \ | ||
# RUN: -module-name main -o a.ll -emit-ir | ||
# RUN: sed -i -e 's/producer: "Swift [^"]*"/producer: "Swift (swiftlang-9999.8.7.6)"/g' a.ll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool
@@ -241,6 +241,9 @@ let Definition = "process" in { | |||
def WarningUnsupportedLanguage: Property<"unsupported-language-warnings", "Boolean">, | |||
DefaultTrue, | |||
Desc<"If true, warn when stopped in code that is written in a source language that LLDB does not support.">; | |||
def WarningToolchainMismatch: Property<"toolchain-mismatch-warnings", "Boolean">, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which scenarios would people want this off?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any warning that potentially prints on every frame should be switchable. More specifically, I can see how this warning gets annoying when you use LLDB to debug or symbolicate crashes of previously built production software where you just don't have access to a historical matching LLDB.
ca38811
to
676f4f3
Compare
Also added a sanity check to the test. |
@JDevlieghere Do you think it's reasonable to expect the swiftlang tag to match or should we just match the three most significant components of the version number? |
One thing to add: this change may be complimentary, or redundant, to a change in swiftc where it will begin to embed the sdk into swiftmodules. When that happens, deserializing such swiftmodules will return a status of |
This has the nice side-effect that it can actually store the quadruple version numbers that Apple's tools are using nowadays. rdar://82982162 Differential Revision: https://reviews.llvm.org/D111200 (cherry picked from commit 14aa3f3) Conflicts: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
(cherry picked from commit 2edb905)
(cherry picked from commit 8c5f334)
This patch adds support for Swift compiler producer strings to DWARFUnit. Differential Revision: https://reviews.llvm.org/D111278 (cherry picked from commit aab7afeec1fb771c8ae044257d44f6362d72c732)
4aa3e49
to
58c5b07
Compare
After discussing this with @JDevlieghere I changed the check to leave off the build number, to reduce the risk of benign mismatches triggering false positives. Due to procedural reasons the compiler and debugger may be legitimately a few numbers apart. |
@swift-ci test |
58c5b07
to
20f6069
Compare
@swift-ci test |
20f6069
to
3401d34
Compare
@swift-ci test |
@@ -93,6 +93,9 @@ class ProcessProperties : public Properties { | |||
void SetDetachKeepsStopped(bool keep_stopped); | |||
bool GetWarningsOptimization() const; | |||
bool GetWarningsUnsupportedLanguage() const; | |||
#ifdef LLDB_ENABLE_SWIFT | |||
bool GetWarningsToolchainMismatch() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a follow up patch, can we get rid of this function and the PrintWarning.*
ones below by moving them into the language plugin?
if (GetProducer() == eProducerClang) | ||
return GetProducerVersion() >= llvm::VersionTuple(425, 0, 13); | ||
// Assume all other compilers didn't have incorrect ObjC bitfield info. | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't this live upstream?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a cherry-pick.
@swift-ci test |
1 similar comment
@swift-ci test |
3401d34
to
11f8538
Compare
@swift-ci test |
11f8538
to
0a60d71
Compare
@swift-ci test |
…ed with a different Swift compiler than the one that is embedded in LLDB. rdar://82982242
0a60d71
to
639b9f6
Compare
@swift-ci test |
1 similar comment
@swift-ci test |
Implement a warning that detects Swift compile units that were compiled with a different Swift compiler than the one that is embedded in LLDB.
rdar://82982242