Skip to content

Commit 68db107

Browse files
committed
[examples] Use loadable modules instead of shared libraries for Clang plugins.
This avoids linking in extra copies of, say, LLVMSupport. llvm-svn: 201256
1 parent 6860c81 commit 68db107

File tree

3 files changed

+3
-30
lines changed

3 files changed

+3
-30
lines changed
Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
set( LLVM_LINK_COMPONENTS
2-
Support
3-
)
4-
51
# If we don't need RTTI or EH, there's no reason to export anything
62
# from the plugin.
73
if( NOT WIN32 ) # Win32 mangles symbols differently, and
@@ -13,7 +9,7 @@ if( NOT WIN32 ) # Win32 mangles symbols differently, and
139
endif()
1410
endif()
1511

16-
add_clang_library(PrintFunctionNames MODULE PrintFunctionNames.cpp)
12+
add_llvm_loadable_module(PrintFunctionNames PrintFunctionNames.cpp)
1713

1814
add_dependencies(PrintFunctionNames
1915
ClangAttrClasses
@@ -23,14 +19,3 @@ add_dependencies(PrintFunctionNames
2319
ClangDiagnosticCommon
2420
ClangStmtNodes
2521
)
26-
27-
target_link_libraries(PrintFunctionNames
28-
clangAST
29-
clangBasic
30-
clangFrontend
31-
)
32-
33-
set_target_properties(PrintFunctionNames
34-
PROPERTIES
35-
LINKER_LANGUAGE CXX
36-
PREFIX "")

clang/examples/PrintFunctionNames/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ endif
1919
endif
2020

2121
LINK_LIBS_IN_SHARED = 0
22-
SHARED_LIBRARY = 1
22+
LOADABLE_MODULE = 1
2323

2424
include $(CLANG_LEVEL)/Makefile
2525

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
set(LLVM_LINK_COMPONENTS
2-
Support
3-
)
4-
5-
add_clang_library(SampleAnalyzerPlugin MODULE MainCallChecker.cpp)
1+
add_llvm_loadable_module(SampleAnalyzerPlugin MainCallChecker.cpp)
62

73
add_dependencies(SampleAnalyzerPlugin
84
ClangAttrClasses
@@ -11,15 +7,7 @@ add_dependencies(SampleAnalyzerPlugin
117
ClangDeclNodes
128
ClangDiagnosticCommon
139
ClangStmtNodes
14-
)
15-
16-
target_link_libraries(SampleAnalyzerPlugin
1710
clangAST
1811
clangAnalysis
1912
clangStaticAnalyzerCore
2013
)
21-
22-
set_target_properties(SampleAnalyzerPlugin
23-
PROPERTIES
24-
LINKER_LANGUAGE CXX
25-
PREFIX "")

0 commit comments

Comments
 (0)