Skip to content

[ClangImporter] Don't add duplicate search paths #12169

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
merged 2 commits into from
Oct 24, 2017

Conversation

jrose-apple
Copy link
Contributor

Besides saving some calls to stat(), this also causes problems when the user specifies a search path that Clang already adds by default, like $SDKROOT/Library/Frameworks/. Why? Because Swift adds its search paths after Clang has already configured its defaults, but Clang reconfigures its search paths from scratch when compiling a module to a PCM file to cache. This led to system search paths being found sooner in the primary Clang instance than in the PCM files, which in turn resulted in the PCM files being considered out of date.

This isn't likely to affect people much in practice, but it's better to get right. (We ran into this during Doug's experiments in making /System/Library/PrivateFrameworks a default search path in Clang r313317; turns out that's problematic for other reasons as well.)

While here, tweak the filtering for Clang diagnostics so that next time something like this breaks we'll actually see it in the build log.

rdar://problem/34664596

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 308f2c6425306e2282978d040260e8bc71fc3f9f

Besides saving some calls to stat(), this also causes problems when
the user specifies a search path that Clang already adds by default,
like $SDKROOT/Library/Frameworks/. Why? Because Swift adds its search
paths after Clang has already configured its defaults, but Clang
reconfigures its search paths from scratch when compiling a module to
a PCM file to cache. This led to system search paths being found
sooner in the primary Clang instance than in the PCM files, which in
turn resulted in the PCM files being considered out of date.

This isn't likely to affect people much in practice, but it's better
to get right. (We ran into this during Doug's experiments in making
/System/Library/PrivateFrameworks a default search path in Clang
r313317; turns out that's problematic for other reasons as well.)

rdar://problem/34664596
We don't want to show "included from <bridging-header>" to the user--
that's just not helpful--but we /do/ want to see any unexpected
diagnostics that happen to be reported in the importer's synthetic
buffers. This would have helped us track down rdar://problem/34664596
much sooner.
@jrose-apple jrose-apple force-pushed the dance-dance-deduplication branch from 308f2c6 to d78d1dc Compare September 29, 2017 17:00
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 308f2c6425306e2282978d040260e8bc71fc3f9f

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 308f2c6425306e2282978d040260e8bc71fc3f9f

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test source compatibility

@jrose-apple
Copy link
Contributor Author

This is not at all urgent but I'd like to merge it before it gets stale. Review ping?

@swift-ci Please smoke test

@jrose-apple
Copy link
Contributor Author

Jenkins issue

@swift-ci Please smoke test Linux

@jrose-apple
Copy link
Contributor Author

/home/buildnode/jenkins/workspace/swift-PR-Linux-smoke-test/branch-master/swiftpm/Tests/SourceControlTests/RepositoryManagerTests.swift:199: error: RepositoryManagerTests.testBasics : Asynchronous wait failed - Exceeded timeout of 1.0 seconds, with unfulfilled expectations: Repository lookup expectation

@aciidb0mb3r, interesting or no?

@swift-ci Please smoke test Linux

@aciidgh
Copy link
Contributor

aciidgh commented Oct 11, 2017

@jrose-apple Looks random, have you seen this before?

@jrose-apple
Copy link
Contributor Author

Nope, but anything that does network access seems suspicious to be in the test suite.

@aciidgh
Copy link
Contributor

aciidgh commented Oct 11, 2017

It is mocked, nothing in the SwiftPM test suite requires network access :)

@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test Linux

2 similar comments
@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test Linux

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, sorry for the delay.

@jrose-apple
Copy link
Contributor Author

Thanks, Doug. Let's double-check that nothing changed…

@swift-ci Please smoke test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@jrose-apple jrose-apple merged commit d09669b into swiftlang:master Oct 24, 2017
@jrose-apple jrose-apple deleted the dance-dance-deduplication branch October 24, 2017 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants