Skip to content

Commit ece06da

Browse files
committed
unit build cmakes
1 parent 6e4090d commit ece06da

File tree

39 files changed

+63
-5
lines changed

39 files changed

+63
-5
lines changed

clang/examples/JumboSupport/JumboSupport.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ASTConsumer : public clang::ASTConsumer {
6161

6262
ASTConsumer *ASTConsumer::Instance = nullptr;
6363

64-
class PPCallbacks : public clang::PPCallbacks {
64+
class UnityPPCallbacks : public clang::PPCallbacks {
6565
clang::Preprocessor &PP;
6666
clang::SourceManager &SM;
6767

@@ -70,10 +70,11 @@ class PPCallbacks : public clang::PPCallbacks {
7070
std::set<std::string> DefinedMacros;
7171

7272
public:
73-
PPCallbacks(clang::Preprocessor &PP) : PP(PP), SM(PP.getSourceManager()) {}
73+
UnityPPCallbacks(clang::Preprocessor &PP)
74+
: PP(PP), SM(PP.getSourceManager()) {}
7475

7576
static void Register(clang::Preprocessor &PP) {
76-
PP.addPPCallbacks(std::make_unique<PPCallbacks>(PP));
77+
PP.addPPCallbacks(std::make_unique<UnityPPCallbacks>(PP));
7778
}
7879

7980
void
@@ -134,6 +135,10 @@ class JumboFrontendAction : public clang::PluginASTAction {
134135
const std::vector<std::string> &args) override {
135136
return true;
136137
}
138+
139+
JumboFrontendAction::ActionType getActionType() override {
140+
return AddBeforeMainAction;
141+
}
137142
};
138143

139144
class PragmaJumbo : public clang::PragmaHandler {
@@ -152,7 +157,7 @@ class PragmaJumbo : public clang::PragmaHandler {
152157
return;
153158
}
154159

155-
PPCallbacks::Register(PP);
160+
UnityPPCallbacks::Register(PP);
156161
}
157162
};
158163

llvm/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,9 @@ add_subdirectory(lib/Demangle)
13201320
add_subdirectory(lib/Support)
13211321
add_subdirectory(lib/TableGen)
13221322

1323+
set(CMAKE_UNITY_BUILD_BATCH_SIZE 1)
13231324
add_subdirectory(utils/TableGen)
1325+
set(CMAKE_UNITY_BUILD_BATCH_SIZE 0)
13241326

13251327
add_subdirectory(include)
13261328

llvm/lib/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include(LLVM-Build)
22

3+
set(CMAKE_UNITY_BUILD_BATCH_SIZE 1)
34
# `Demangle', `Support' and `TableGen' libraries are added on the top-level
45
# CMakeLists.txt
56

@@ -69,3 +70,5 @@ endif()
6970
# Component post-processing
7071
LLVMBuildResolveComponentsLink()
7172
LLVMBuildGenerateCFragment(OUTPUT ${LLVMCONFIGLIBRARYDEPENDENCIESINC})
73+
74+
set(CMAKE_UNITY_BUILD_BATCH_SIZE 0)

llvm/lib/Demangle/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ add_llvm_component_library(LLVMDemangle
1010
"${LLVM_MAIN_INCLUDE_DIR}/llvm/Demangle"
1111

1212
)
13+
14+
set_target_properties(LLVMDemangle PROPERTIES UNITY_BUILD_BATCH_SIZE 1)

llvm/utils/TableGen/Basic/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ target_include_directories(LLVMTableGenBasic
2727
INTERFACE
2828
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
2929
)
30+
31+
set_target_properties(LLVMTableGenBasic PROPERTIES UNITY_BUILD_BATCH_SIZE 1)

mlir/lib/Analysis/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ add_mlir_library(MLIRAnalysis
6060
MLIRViewLikeInterface
6161
)
6262

63+
set_target_properties(obj.MLIRAnalysis PROPERTIES UNITY_BUILD_BATCH_SIZE 1)

mlir/lib/Conversion/LLVMCommon/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ add_mlir_conversion_library(MLIRLLVMCommonConversion
1717
MLIRSupport
1818
MLIRTransforms
1919
)
20+
21+
set_target_properties(obj.MLIRLLVMCommonConversion PROPERTIES UNITY_BUILD_BATCH_SIZE 1)

mlir/lib/Conversion/SCFToGPU/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ add_mlir_conversion_library(MLIRSCFToGPU
2222
MLIRSideEffectInterfaces
2323
MLIRTransforms
2424
)
25+
26+
set_target_properties(obj.MLIRSCFToGPU PROPERTIES UNITY_BUILD_BATCH_SIZE 1)

mlir/lib/Conversion/ShapeToStandard/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ add_mlir_conversion_library(MLIRShapeToStandard
2525
MLIRSCFDialect
2626
MLIRTransforms
2727
)
28+
set_target_properties(obj.MLIRShapeToStandard PROPERTIES UNITY_BUILD_BATCH_SIZE 1)

mlir/lib/Debug/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ add_mlir_library(MLIRDebug
1717
MLIRObservers
1818
)
1919

20+
set_target_properties(obj.MLIRDebug PROPERTIES UNITY_BUILD_BATCH_SIZE 1)

0 commit comments

Comments
 (0)