Skip to content

Commit 26de61d

Browse files
committed
[cmake] APIDigester, IDE: Specify Clang link dependencies
This way, CMake will propagate the interface compile definitions of the Clang dependencies, which is important on Windows because Clang visibility macro expansions, controlled by compile definitions, must match between the Swift and Clang library. See https://github.com/llvm/llvm-project/pull/108276/files#diff-4dd645a8b76bb3886a505258a8c2e598aeddea770e7b0a2b51689124a5ea6e9a.
1 parent 91b4fab commit 26de61d

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

include/swift/APIDigester/ModuleAnalyzerNodes.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
#ifndef __SWIFT_ABI_DIGESTER_MODULE_NODES_H__
1818
#define __SWIFT_ABI_DIGESTER_MODULE_NODES_H__
1919

20-
#include "clang/AST/ASTContext.h"
21-
#include "clang/AST/DeclObjC.h"
22-
#include "clang/Lex/Preprocessor.h"
23-
#include "clang/Sema/Lookup.h"
24-
#include "clang/Sema/Sema.h"
2520
#include "llvm/ADT/TinyPtrVector.h"
2621
#include "llvm/ADT/STLExtras.h"
2722
#include "llvm/Support/CommandLine.h"

lib/APIDigester/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,10 @@ add_swift_host_library(swiftAPIDigester STATIC
77
target_link_libraries(swiftAPIDigester PRIVATE
88
swiftIDE)
99

10+
# Clang dependencies. These are private because APIDigester's public
11+
# interface does not use Clang symbols.
12+
target_link_libraries(swiftAPIDigester PRIVATE
13+
clangAST
14+
clangLex)
15+
1016
set_swift_llvm_is_available(swiftAPIDigester)

lib/APIDigester/ModuleAnalyzerNodes.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include "swift/Basic/Defer.h"
44
#include "swift/Parse/Lexer.h"
55
#include "swift/Sema/IDETypeChecking.h"
6+
#include "clang/AST/DeclObjC.h"
7+
#include "clang/Lex/Preprocessor.h"
68
#include "llvm/ADT/STLExtras.h"
79
#include <algorithm>
810
#include <swift/APIDigester/ModuleAnalyzerNodes.h>

lib/IDE/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ target_link_libraries(swiftIDE PRIVATE
4646
swiftParse
4747
swiftSema)
4848

49+
# Clang dependencies. These are private because IDE's public
50+
# interface does not use Clang symbols.
51+
target_link_libraries(swiftIDE PRIVATE
52+
clangAST
53+
clangBasic
54+
clangIndex
55+
clangLex)
56+
4957
if (SWIFT_BUILD_SWIFT_SYNTAX)
5058
target_link_libraries(swiftIDE PRIVATE
5159
swiftIDEUtilsBridging

0 commit comments

Comments
 (0)