Skip to content

Commit 992d9af

Browse files
committed
[NFC] Indicate whether dumped types are imported
1 parent 610d07e commit 992d9af

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
@@ -4870,18 +4870,34 @@ namespace {
48704870
printCommon(#Name, label); \
48714871
\
48724872
printFieldQuoted(T->getDecl()->printRef(), "decl"); \
4873+
printFlag(T->getDecl()->hasClangNode(), "foreign"); \
48734874
\
48744875
if (T->getParent()) \
48754876
printRec(T->getParent(), "parent"); \
48764877
\
48774878
printFoot(); \
48784879
}
48794880

4880-
VISIT_NOMINAL_TYPE(EnumType, enum_type)
4881-
VISIT_NOMINAL_TYPE(StructType, struct_type)
4882-
VISIT_NOMINAL_TYPE(ClassType, class_type)
4881+
#define VISIT_BINDABLE_NOMINAL_TYPE(TypeClass, Name) \
4882+
VISIT_NOMINAL_TYPE(TypeClass, Name) \
4883+
void visitBoundGeneric##TypeClass( \
4884+
BoundGeneric##TypeClass *T, StringRef label) { \
4885+
printCommon("bound_generic_" #Name, label); \
4886+
printFieldQuoted(T->getDecl()->printRef(), "decl"); \
4887+
printFlag(T->getDecl()->hasClangNode(), "foreign"); \
4888+
if (T->getParent()) \
4889+
printRec(T->getParent(), "parent"); \
4890+
for (auto arg : T->getGenericArgs()) \
4891+
printRec(arg); \
4892+
printFoot(); \
4893+
}
4894+
4895+
VISIT_BINDABLE_NOMINAL_TYPE(EnumType, enum_type)
4896+
VISIT_BINDABLE_NOMINAL_TYPE(StructType, struct_type)
4897+
VISIT_BINDABLE_NOMINAL_TYPE(ClassType, class_type)
48834898
VISIT_NOMINAL_TYPE(ProtocolType, protocol_type)
48844899

4900+
#undef VISIT_BINDABLE_NOMINAL_TYPE
48854901
#undef VISIT_NOMINAL_TYPE
48864902

48874903
void visitBuiltinTupleType(BuiltinTupleType *T, StringRef label) {
@@ -4916,6 +4932,7 @@ namespace {
49164932
void visitModuleType(ModuleType *T, StringRef label) {
49174933
printCommon("module_type", label);
49184934
printDeclNameField(T->getModule(), "module");
4935+
printFlag(T->getModule()->isNonSwiftModule(), "foreign");
49194936
printFoot();
49204937
}
49214938

@@ -5033,7 +5050,7 @@ namespace {
50335050
void printAnyFunctionParamsRec(ArrayRef<AnyFunctionType::Param> params,
50345051
StringRef label) {
50355052
printRecArbitrary([&](StringRef label) {
5036-
printCommon("function_params", label);
5053+
printHead("function_params", FieldLabelColor, label);
50375054

50385055
printField(params.size(), "num_params");
50395056
for (const auto &param : params) {
@@ -5244,37 +5261,6 @@ namespace {
52445261
printFoot();
52455262
}
52465263

5247-
void visitBoundGenericClassType(BoundGenericClassType *T, StringRef label) {
5248-
printCommon("bound_generic_class_type", label);
5249-
printFieldQuoted(T->getDecl()->printRef(), "decl");
5250-
if (T->getParent())
5251-
printRec(T->getParent(), "parent");
5252-
for (auto arg : T->getGenericArgs())
5253-
printRec(arg);
5254-
printFoot();
5255-
}
5256-
5257-
void visitBoundGenericStructType(BoundGenericStructType *T,
5258-
StringRef label) {
5259-
printCommon("bound_generic_struct_type", label);
5260-
printFieldQuoted(T->getDecl()->printRef(), "decl");
5261-
if (T->getParent())
5262-
printRec(T->getParent(), "parent");
5263-
for (auto arg : T->getGenericArgs())
5264-
printRec(arg);
5265-
printFoot();
5266-
}
5267-
5268-
void visitBoundGenericEnumType(BoundGenericEnumType *T, StringRef label) {
5269-
printCommon("bound_generic_enum_type", label);
5270-
printFieldQuoted(T->getDecl()->printRef(), "decl");
5271-
if (T->getParent())
5272-
printRec(T->getParent(), "parent");
5273-
for (auto arg : T->getGenericArgs())
5274-
printRec(arg);
5275-
printFoot();
5276-
}
5277-
52785264
void visitTypeVariableType(TypeVariableType *T, StringRef label) {
52795265
printCommon("type_variable_type", label);
52805266
printField(T->getID(), "id");

0 commit comments

Comments
 (0)