Skip to content

Commit 58d82f0

Browse files
committedOct 27, 2022
IDE: Break CMake cycle involving IDE, FrontendTool, Frontend, and Migrator.
These libraries formed a strongly connected component in the CMake build graph. The weakest link I could find was from IDE to FrontendTool and Frontend, which was necessitated by the `CompileInstance` class (#40645). I moved a few files out of IDE into a new IDETools library to break the cycle.
1 parent b0de482 commit 58d82f0

19 files changed

+28
-16
lines changed
 
File renamed without changes.

‎lib/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ add_subdirectory(Frontend)
3232
add_subdirectory(FrontendTool)
3333
add_subdirectory(Index)
3434
add_subdirectory(IDE)
35+
add_subdirectory(IDETool)
3536
add_subdirectory(Immediate)
3637
add_subdirectory(IRGen)
3738
add_subdirectory(LLVMPasses)

‎lib/Frontend/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ add_dependencies(swiftFrontend
1818
SwiftOptions)
1919
target_link_libraries(swiftFrontend PRIVATE
2020
swiftAST
21+
swiftConstExtract
2122
swiftSIL
2223
swiftMigrator
2324
swiftOption

‎lib/IDE/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@ add_swift_host_library(swiftIDE STATIC
1515
CodeCompletionString.cpp
1616
CodeCompletionStringPrinter.cpp
1717
CommentConversion.cpp
18-
CompileInstance.cpp
19-
CompletionInstance.cpp
2018
CompletionLookup.cpp
2119
CompletionOverrideLookup.cpp
2220
ConformingMethodList.cpp
23-
DependencyChecking.cpp
2421
ExprCompletion.cpp
2522
ExprContextAnalysis.cpp
2623
Formatting.cpp
@@ -45,8 +42,6 @@ target_link_libraries(swiftIDE PRIVATE
4542
swiftAST
4643
swiftClangImporter
4744
swiftDriver
48-
swiftFrontend
49-
swiftFrontendTool
5045
swiftIndex
5146
swiftParse
5247
swiftSema)

‎lib/IDETool/CMakeLists.txt

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
add_swift_host_library(swiftIDETool STATIC
3+
CompileInstance.cpp
4+
CompletionInstance.cpp
5+
DependencyChecking.cpp
6+
)
7+
8+
target_link_libraries(swiftIDETool PRIVATE
9+
swiftAST
10+
swiftDriver
11+
swiftFrontend
12+
swiftFrontendTool)
13+
14+
set_swift_llvm_is_available(swiftIDETool)

‎lib/IDE/CompileInstance.cpp ‎lib/IDETool/CompileInstance.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "swift/IDE/CompileInstance.h"
13+
#include "swift/IDETool/CompileInstance.h"
1414

1515
#include "DependencyChecking.h"
1616
#include "swift/AST/ASTContext.h"
@@ -25,7 +25,6 @@
2525
#include "swift/Driver/FrontendUtil.h"
2626
#include "swift/Frontend/Frontend.h"
2727
#include "swift/FrontendTool/FrontendTool.h"
28-
#include "swift/IDE/Utils.h"
2928
#include "swift/Parse/Lexer.h"
3029
#include "swift/Parse/PersistentParserState.h"
3130
#include "swift/Subsystems.h"

‎lib/IDE/CompletionInstance.cpp ‎lib/IDETool/CompletionInstance.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "swift/IDE/CompletionInstance.h"
13+
#include "swift/IDETool/CompletionInstance.h"
1414

1515
#include "DependencyChecking.h"
1616
#include "swift/AST/ASTContext.h"
File renamed without changes.
File renamed without changes.

‎tools/SourceKit/lib/SwiftLang/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ target_link_libraries(SourceKitSwiftLang PRIVATE
3131
swiftFrontend
3232
swiftClangImporter
3333
swiftIDE
34+
swiftIDETool
3435
swiftAST
3536
swiftMarkup
3637
swiftParse

‎tools/SourceKit/lib/SwiftLang/SwiftCompile.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include "SourceKit/Support/FileSystemProvider.h"
1717

18-
#include "swift/IDE/CompileInstance.h"
18+
#include "swift/IDETool/CompileInstance.h"
1919
#include "llvm/Support/Compiler.h"
2020
#include "llvm/Support/MemoryBuffer.h"
2121

‎tools/SourceKit/lib/SwiftLang/SwiftCompletion.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "swift/Frontend/PrintingDiagnosticConsumer.h"
2424
#include "swift/IDE/CodeCompletionCache.h"
2525
#include "swift/IDE/CodeCompletionResultPrinter.h"
26-
#include "swift/IDE/CompletionInstance.h"
26+
#include "swift/IDETool/CompletionInstance.h"
2727

2828
#include "llvm/Support/Compiler.h"
2929
#include "llvm/Support/MemoryBuffer.h"

‎tools/SourceKit/lib/SwiftLang/SwiftConformingMethodList.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "swift/Frontend/Frontend.h"
1717
#include "swift/Frontend/PrintingDiagnosticConsumer.h"
1818
#include "swift/IDE/ConformingMethodList.h"
19-
#include "swift/IDE/CompletionInstance.h"
19+
#include "swift/IDETool/CompletionInstance.h"
2020
#include "clang/AST/ASTContext.h"
2121
#include "clang/AST/Comment.h"
2222
#include "clang/AST/Decl.h"

‎tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
#include "swift/Config.h"
2727
#include "swift/Frontend/PrintingDiagnosticConsumer.h"
2828
#include "swift/IDE/CodeCompletionCache.h"
29-
#include "swift/IDE/CompletionInstance.h"
3029
#include "swift/IDE/SyntaxModel.h"
3130
#include "swift/IDE/Utils.h"
31+
#include "swift/IDETool/CompletionInstance.h"
3232

3333
#include "clang/Lex/HeaderSearch.h"
3434
#include "clang/Lex/Preprocessor.h"

‎tools/SourceKit/lib/SwiftLang/SwiftLangSupport.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
#include "swift/AST/DiagnosticConsumer.h"
2525
#include "swift/Basic/ThreadSafeRefCounted.h"
2626
#include "swift/IDE/CancellableResult.h"
27-
#include "swift/IDE/CompileInstance.h"
28-
#include "swift/IDE/CompletionInstance.h"
2927
#include "swift/IDE/Indenting.h"
3028
#include "swift/IDE/Refactoring.h"
29+
#include "swift/IDETool/CompileInstance.h"
30+
#include "swift/IDETool/CompletionInstance.h"
3131
#include "swift/Index/IndexSymbol.h"
3232
#include "llvm/ADT/IntrusiveRefCntPtr.h"
3333
#include "llvm/ADT/StringMap.h"

‎tools/SourceKit/lib/SwiftLang/SwiftTypeContextInfo.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#include "SwiftEditorDiagConsumer.h"
1616
#include "swift/Frontend/Frontend.h"
1717
#include "swift/Frontend/PrintingDiagnosticConsumer.h"
18-
#include "swift/IDE/CompletionInstance.h"
1918
#include "swift/IDE/TypeContextInfo.h"
19+
#include "swift/IDETool/CompletionInstance.h"
2020
#include "clang/AST/ASTContext.h"
2121
#include "clang/AST/Comment.h"
2222
#include "clang/AST/Decl.h"

‎tools/swift-ide-test/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ target_link_libraries(swift-ide-test
1212
swiftDriver
1313
swiftFrontend
1414
swiftIDE
15+
swiftIDETool
1516
swiftCompilerModules)
1617

1718
# If libxml2 is available, make it available for swift-ide-test.

‎tools/swift-ide-test/swift-ide-test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include "swift/Frontend/PrintingDiagnosticConsumer.h"
3939
#include "swift/IDE/CodeCompletionResultPrinter.h"
4040
#include "swift/IDE/CommentConversion.h"
41-
#include "swift/IDE/CompletionInstance.h"
4241
#include "swift/IDE/ConformingMethodList.h"
4342
#include "swift/IDE/IDERequests.h"
4443
#include "swift/IDE/ModuleInterfacePrinting.h"
@@ -47,6 +46,7 @@
4746
#include "swift/IDE/SyntaxModel.h"
4847
#include "swift/IDE/TypeContextInfo.h"
4948
#include "swift/IDE/Utils.h"
49+
#include "swift/IDETool/CompletionInstance.h"
5050
#include "swift/Index/Index.h"
5151
#include "swift/Markup/Markup.h"
5252
#include "swift/Parse/ParseVersion.h"

0 commit comments

Comments
 (0)