Skip to content

Commit 504f634

Browse files
committed
Add build settings to control the emission of the Index Store
Add build settings that allow fine-tuning how the index store is being emitted during index-while-building.
1 parent 0f72152 commit 504f634

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed

Sources/SWBApplePlatform/Specs/MetalCompiler.xcspec

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,19 @@
235235
NO = ();
236236
};
237237
},
238+
{
239+
Name = "METAL_INDEX_STORE_ONLY_PROJECT_FILES";
240+
Type = Boolean;
241+
DefaultValue = "$(INDEX_STORE_ONLY_PROJECT_FILES)";
242+
CommandLineArgs = {
243+
YES = (
244+
// See corresponding definition in Clang.xcspec
245+
"-index-ignore-system-symbols",
246+
"-index-ignore-pcms",
247+
);
248+
NO = ();
249+
};
250+
},
238251
{
239252
Name = "MTL_LANGUAGE_REVISION";
240253
Type = Enumeration;

Sources/SWBCore/Specs/CoreBuildSystem.xcspec

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3505,6 +3505,20 @@ For more information on mergeable libraries, see [Configuring your project to us
35053505
DisplayName = "Enable Index-While-Building Functionality";
35063506
Description = "Control whether the compiler should emit index data while building.";
35073507
},
3508+
{
3509+
Name = "INDEX_STORE_ONLY_PROJECT_FILES";
3510+
Type = Boolean;
3511+
DefaultValue = NO;
3512+
DisplayName = "Index only project files";
3513+
Description = "Only index the source files that are being compiled within this project. Do not emit data into the index store for system modules.";
3514+
},
3515+
{
3516+
Name = "INDEX_STORE_COMPRESS";
3517+
Type = Boolean;
3518+
DefaultValue = NO;
3519+
DisplayName = "Compress Index Store";
3520+
Description = "Compress the index store, reducing its size on disk.";
3521+
},
35083522
{
35093523
Name = TOOLCHAINS;
35103524
Type = StringList;

Sources/SWBUniversalPlatform/Specs/Clang.xcspec

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,6 +3116,43 @@
31163116
NO = ();
31173117
};
31183118
},
3119+
{
3120+
Name = "CLANG_INDEX_STORE_ONLY_PROJECT_FILES";
3121+
Type = Boolean;
3122+
DefaultValue = "$(INDEX_STORE_ONLY_PROJECT_FILES)";
3123+
CommandLineArgs = {
3124+
YES = (
3125+
"-index-ignore-system-symbols",
3126+
// If the PCM covers files generated within the project, we should have indexed them in the task that compiles them, otherwise it's a system module that we don't want to index.
3127+
"-index-ignore-pcms",
3128+
);
3129+
NO = ();
3130+
};
3131+
},
3132+
{
3133+
Name = "CLANG_INDEX_STORE_COMPRESS";
3134+
Type = Boolean;
3135+
DefaultValue = "$(INDEX_STORE_COMPRESS)";
3136+
CommandLineArgs = {
3137+
YES = (
3138+
"-index-store-compress",
3139+
);
3140+
NO = ();
3141+
};
3142+
},
3143+
{
3144+
Name = "CLANG_INDEX_STORE_IGNORE_MACROS";
3145+
Type = Boolean;
3146+
DefaultValue = "$(INDEX_STORE_COMPRESS)";
3147+
DisplayName = "Do not index C macros";
3148+
Description = "Do not emit entries for C macros into the Index Store.";
3149+
CommandLineArgs = {
3150+
YES = (
3151+
"-index-ignore-macros",
3152+
);
3153+
NO = ();
3154+
};
3155+
},
31193156

31203157
{
31213158
Name = "CLANG_ENABLE_COMPILE_CACHE";

Sources/SWBUniversalPlatform/Specs/Swift.xcspec

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,31 @@
13111311
NO = ();
13121312
};
13131313
},
1314+
{
1315+
Name = "SWIFT_INDEX_STORE_ONLY_PROJECT_FILES";
1316+
Type = Boolean;
1317+
DefaultValue = "$(INDEX_STORE_ONLY_PROJECT_FILES)";
1318+
CommandLineArgs = {
1319+
YES = (
1320+
// Assume that clang modules are getting indexed by a clang file within them. While this is technically not correct, since you could have a clang module that only consists of header files and is only included from Swift, such scenarios are rare.
1321+
"-index-ignore-clang-modules",
1322+
"-index-ignore-system-modules",
1323+
);
1324+
NO = ();
1325+
};
1326+
},
1327+
{
1328+
Name = "SWIFT_INDEX_STORE_COMPRESS";
1329+
Type = Boolean;
1330+
DefaultValue = "$(INDEX_STORE_COMPRESS)";
1331+
CommandLineArgs = {
1332+
YES = (
1333+
"-Xfrontend",
1334+
"-index-store-compress",
1335+
);
1336+
NO = ();
1337+
};
1338+
},
13141339

13151340
// Swift caching options.
13161341
{

0 commit comments

Comments
 (0)