File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1144,6 +1144,14 @@ ClangImporter::Implementation::getNextIncludeLoc() {
1144
1144
if (!DummyIncludeBuffer.isValid ()) {
1145
1145
clang::SourceLocation includeLoc =
1146
1146
srcMgr.getLocForStartOfFile (srcMgr.getMainFileID ());
1147
+ // Picking the beginning of the main FileID as include location is also what
1148
+ // the clang PCH mechanism is doing (see
1149
+ // clang::ASTReader::getImportLocation()). Choose the next source location
1150
+ // here to avoid having the exact same import location as the clang PCH.
1151
+ // Otherwise, if we are using a PCH for bridging header, we'll have
1152
+ // problems with source order comparisons of clang source locations not
1153
+ // being deterministic.
1154
+ includeLoc = includeLoc.getLocWithOffset (1 );
1147
1155
DummyIncludeBuffer = srcMgr.createFileID (
1148
1156
llvm::make_unique<ZeroFilledMemoryBuffer>(
1149
1157
256 *1024 , StringRef (moduleImportBufferName)),
Original file line number Diff line number Diff line change
1
+ @import Foundation ;
1
2
@import somemod1 ;
3
+
4
+ void func_in_bridge (void );
Original file line number Diff line number Diff line change 1
- // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP -code-completion-comments=true \
1
+ // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=TOP -code-completion-comments=true \
2
2
// RUN: -import-objc-header %S/Inputs/bridge.h -I %S/Inputs/somemod1 -I %S/Inputs/somemod2 | %FileCheck %s -check-prefix=CHECK-TOP
3
+ // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=TOP -code-completion-comments=true \
4
+ // RUN: -import-objc-header %S/Inputs/bridge.h -pch-output-dir %t.pch -I %S/Inputs/somemod1 -I %S/Inputs/somemod2 | %FileCheck %s -check-prefix=CHECK-TOP
3
5
4
6
// REQUIRES: objc_interop
5
7
You can’t perform that action at this time.
0 commit comments