@@ -181,6 +181,9 @@ struct ExplicitModuleInfo {
181
181
std::string moduleSourceInfoPath;
182
182
// A flag that indicates whether this module is a framework
183
183
bool isFramework;
184
+ // A flag that indicates whether this module is a system module
185
+ // Set the default to be false.
186
+ bool isSystem = false ;
184
187
};
185
188
186
189
// / Parser of explicit module maps passed into the compiler.
@@ -239,7 +242,18 @@ class ExplicitModuleMapParser {
239
242
SmallString<32 > Buffer;
240
243
return Saver.save (cast<llvm::yaml::ScalarNode>(N)->getValue (Buffer));
241
244
}
242
-
245
+
246
+ static bool parseBoolValue (StringRef val) {
247
+ auto valStr = val.str ();
248
+ valStr.erase (std::remove (valStr.begin (), valStr.end (), ' \n ' ), valStr.end ());
249
+ if (valStr.compare (" true" ) == 0 )
250
+ return true ;
251
+ else if (valStr.compare (" false" ) == 0 )
252
+ return false ;
253
+ else
254
+ llvm_unreachable (" Unexpected JSON value for isFramework" );
255
+ }
256
+
243
257
bool parseSingleModuleEntry (llvm::yaml::Node &node,
244
258
llvm::StringMap<ExplicitModuleInfo> &moduleMap) {
245
259
using namespace llvm ::yaml;
@@ -260,14 +274,9 @@ class ExplicitModuleMapParser {
260
274
} else if (key == " sourceInfoPath" ) {
261
275
result.moduleSourceInfoPath = val.str ();
262
276
} else if (key == " isFramework" ) {
263
- auto valStr = val.str ();
264
- valStr.erase (std::remove (valStr.begin (), valStr.end (), ' \n ' ), valStr.end ());
265
- if (valStr.compare (" true" ) == 0 )
266
- result.isFramework = true ;
267
- else if (valStr.compare (" false" ) == 0 )
268
- result.isFramework = false ;
269
- else
270
- llvm_unreachable (" Unexpected JSON value for isFramework" );
277
+ result.isFramework = parseBoolValue (val);
278
+ } else if (key == " isSystem" ) {
279
+ result.isSystem = parseBoolValue (val);
271
280
} else {
272
281
// Being forgiving for future fields.
273
282
continue ;
0 commit comments