Skip to content

Commit 75dc936

Browse files
committed
[NFC] Indicate whether dumped types are imported
1 parent e5f514d commit 75dc936

File tree

1 file changed

+21
-35
lines changed

1 file changed

+21
-35
lines changed

lib/AST/ASTDumper.cpp

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4167,18 +4167,34 @@ namespace {
41674167
printCommon(#Name, label); \
41684168
\
41694169
printFieldQuoted(T->getDecl()->printRef(), "decl"); \
4170+
printFlag(T->getDecl()->hasClangNode(), "foreign"); \
41704171
\
41714172
if (T->getParent()) \
41724173
printRec(T->getParent(), "parent"); \
41734174
\
41744175
printFoot(); \
41754176
}
41764177

4177-
VISIT_NOMINAL_TYPE(EnumType, enum_type)
4178-
VISIT_NOMINAL_TYPE(StructType, struct_type)
4179-
VISIT_NOMINAL_TYPE(ClassType, class_type)
4178+
#define VISIT_BINDABLE_NOMINAL_TYPE(TypeClass, Name) \
4179+
VISIT_NOMINAL_TYPE(TypeClass, Name) \
4180+
void visitBoundGeneric##TypeClass( \
4181+
BoundGeneric##TypeClass *T, StringRef label) { \
4182+
printCommon("bound_generic_" #Name, label); \
4183+
printFieldQuoted(T->getDecl()->printRef(), "decl"); \
4184+
printFlag(T->getDecl()->hasClangNode(), "foreign"); \
4185+
if (T->getParent()) \
4186+
printRec(T->getParent(), "parent"); \
4187+
for (auto arg : T->getGenericArgs()) \
4188+
printRec(arg); \
4189+
printFoot(); \
4190+
}
4191+
4192+
VISIT_BINDABLE_NOMINAL_TYPE(EnumType, enum_type)
4193+
VISIT_BINDABLE_NOMINAL_TYPE(StructType, struct_type)
4194+
VISIT_BINDABLE_NOMINAL_TYPE(ClassType, class_type)
41804195
VISIT_NOMINAL_TYPE(ProtocolType, protocol_type)
41814196

4197+
#undef VISIT_BINDABLE_NOMINAL_TYPE
41824198
#undef VISIT_NOMINAL_TYPE
41834199

41844200
void visitBuiltinTupleType(BuiltinTupleType *T, StringRef label) {
@@ -4213,6 +4229,7 @@ namespace {
42134229
void visitModuleType(ModuleType *T, StringRef label) {
42144230
printCommon("module_type", label);
42154231
printDeclNameField(T->getModule(), "module");
4232+
printFlag(T->getModule()->isNonSwiftModule(), "foreign");
42164233
printFoot();
42174234
}
42184235

@@ -4330,7 +4347,7 @@ namespace {
43304347
void printAnyFunctionParamsRec(ArrayRef<AnyFunctionType::Param> params,
43314348
StringRef label) {
43324349
printRecArbitrary([&](StringRef label) {
4333-
printCommon("function_params", label);
4350+
printHead("function_params", FieldLabelColor, label);
43344351

43354352
printField(params.size(), "num_params");
43364353
for (const auto &param : params) {
@@ -4541,37 +4558,6 @@ namespace {
45414558
printFoot();
45424559
}
45434560

4544-
void visitBoundGenericClassType(BoundGenericClassType *T, StringRef label) {
4545-
printCommon("bound_generic_class_type", label);
4546-
printFieldQuoted(T->getDecl()->printRef(), "decl");
4547-
if (T->getParent())
4548-
printRec(T->getParent(), "parent");
4549-
for (auto arg : T->getGenericArgs())
4550-
printRec(arg);
4551-
printFoot();
4552-
}
4553-
4554-
void visitBoundGenericStructType(BoundGenericStructType *T,
4555-
StringRef label) {
4556-
printCommon("bound_generic_struct_type", label);
4557-
printFieldQuoted(T->getDecl()->printRef(), "decl");
4558-
if (T->getParent())
4559-
printRec(T->getParent(), "parent");
4560-
for (auto arg : T->getGenericArgs())
4561-
printRec(arg);
4562-
printFoot();
4563-
}
4564-
4565-
void visitBoundGenericEnumType(BoundGenericEnumType *T, StringRef label) {
4566-
printCommon("bound_generic_enum_type", label);
4567-
printFieldQuoted(T->getDecl()->printRef(), "decl");
4568-
if (T->getParent())
4569-
printRec(T->getParent(), "parent");
4570-
for (auto arg : T->getGenericArgs())
4571-
printRec(arg);
4572-
printFoot();
4573-
}
4574-
45754561
void visitTypeVariableType(TypeVariableType *T, StringRef label) {
45764562
printCommon("type_variable_type", label);
45774563
printField(T->getID(), "id");

0 commit comments

Comments
 (0)