forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 344
Partially revert 70d2ba016129e54dbb35947d5c44d8ae5f17e47c. #4083
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
Merged
adrian-prantl
merged 1 commit into
swiftlang:stable/20211026
from
adrian-prantl:89836973-framework-paths
Mar 18, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@_implementationOnly import Discovered | ||
public class D { | ||
public init() { member = Invisible() } | ||
private let member : Invisible | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
struct Invisible {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "Discovered.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
SWIFT_SOURCES := main.swift | ||
|
||
SWIFTFLAGS_EXTRAS = -F $(BUILDDIR) -framework Direct -Xlinker -rpath -Xlinker $(BUILDDIR) | ||
|
||
all: Direct.framework $(EXE) | ||
|
||
include Makefile.rules | ||
|
||
Discovered.framework: Discovered.h | ||
$(MAKE) -f $(MAKEFILE_RULES) \ | ||
DYLIB_ONLY=YES \ | ||
DYLIB_NAME=Discovered \ | ||
DYLIB_OBJC_SOURCES=Discovered.m \ | ||
FRAMEWORK_HEADERS=$(SRCDIR)/Discovered.h \ | ||
FRAMEWORK_MODULES=$(SRCDIR)/module.modulemap \ | ||
FRAMEWORK=Discovered | ||
|
||
Direct.framework: $(SRCDIR)/Direct.swift.in Discovered.framework | ||
mkdir -p $(BUILDDIR)/secret_path | ||
cp $< $(BUILDDIR)/Direct.swift | ||
mv Discovered.framework $(BUILDDIR)/secret_path | ||
$(MAKE) -f $(MAKEFILE_RULES) \ | ||
DYLIB_NAME=Direct \ | ||
DYLIB_SWIFT_SOURCES=Direct.swift \ | ||
DYLIB_MODULENAME=Direct \ | ||
FRAMEWORK=Direct \ | ||
SWIFTFLAGS_EXTRAS=-F$(BUILDDIR)/secret_path | ||
rm -f $(BUILDDIR)/Direct.swiftmodule $(BUILDDIR)/Direct.swiftinterface $(BUILDDIR)/Direct.swift | ||
ln -s $(BUILDDIR)/Direct.framework/Direct $(BUILDDIR)/Direct # FIXME |
32 changes: 32 additions & 0 deletions
32
lldb/test/API/lang/swift/framework_paths/TestSwiftFrameworkPaths.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import lldb | ||
from lldbsuite.test.decorators import * | ||
import lldbsuite.test.lldbtest as lldbtest | ||
import lldbsuite.test.lldbutil as lldbutil | ||
import os | ||
import unittest2 | ||
|
||
|
||
class TestSwiftSystemFramework(lldbtest.TestBase): | ||
|
||
NO_DEBUG_INFO_TESTCASE = True | ||
mydir = lldbtest.TestBase.compute_mydir(__file__) | ||
|
||
@swiftTest | ||
@skipIf(oslist=no_match(["macosx"])) | ||
def test_system_framework(self): | ||
"""Test the discovery of framework search paths from framework dependencies.""" | ||
self.build() | ||
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint( | ||
self, 'break here', lldb.SBFileSpec('main.swift')) | ||
|
||
log = self.getBuildArtifact("types.log") | ||
self.runCmd('log enable lldb types -f "%s"' % log) | ||
self.expect("expression -- 0") | ||
pos = 0 | ||
import io | ||
with open(log, "r", encoding='utf-8') as logfile: | ||
for line in logfile: | ||
if "SwiftASTContextForExpressions::LogConfiguration()" in line and \ | ||
"/secret_path" in line: | ||
pos += 1 | ||
self.assertEqual(pos, 1, "framework search path discovery is broken") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import Direct | ||
let d = D() | ||
print("break here") | ||
print(d) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
framework module Discovered { header "Discovered.h" } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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 standalone routine, this would be an inefficient way to make sure that all the ASTContexts which we know about have been made, since once they have been made, you're spinning up a thread pool and adding a job to it for each module, when the call GetModuleSwiftASTContext which will just return the already made AST context.
The routine isn't a problem in this context, so far as I can tell, because its actual use is gated by handled_sdk_path, and so it only happens for the first module of the first big load where we discover the SDK. But the structure of the code doesn't make that clear.
You could make that clear by moving the definition of warmup_astcontexts into the if (!handled_sdk_path) scope so it can't be misused, or maybe just add a better comment.
You could make warmup_astcontexts cheap by having a GetModuleSwiftASTContext(bool can_build) which you call passing false before starting up the thread pool, so that you only set up the thread pool if there's work to do. But I don't think you intend this as a generally useful routine so that seems overkill.
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.
For context, the warmup code I put back in in this commit is identical to the code I removed a month ago.
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.
Okay. As long as this only gets run once it's okay. I had to think some to ensure that it wasn't, but since it's a temporary hack not many other people will have to warm up their brain pans over it so that's fine.