Skip to content

[NFC-ish] Overhaul ASTDumper #38257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/swift/AST/Attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2438,6 +2438,9 @@ class TypeAttributes {
llvm::iterator_range<iterator> getCustomAttrs() const {
return llvm::make_range(iterator(CustomAttrs), iterator());
}

void print(llvm::raw_ostream &OS) const;
void print(ASTPrinter &Printer, const PrintOptions &Options) const;
};

void simple_display(llvm::raw_ostream &out, const DeclAttribute *attr);
Expand Down
2 changes: 2 additions & 0 deletions include/swift/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -6776,6 +6776,8 @@ enum class CtorInitializerKind {
Factory
};

StringRef getCtorInitializerKindString(CtorInitializerKind value);

/// Specifies the kind of initialization call performed within the body
/// of the constructor, e.g., self.init or super.init.
enum class BodyInitKind {
Expand Down
3 changes: 3 additions & 0 deletions include/swift/AST/ExtInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ template <typename Repr> constexpr bool shouldStoreClangType(Repr repr) {
llvm_unreachable("Unhandled SILFunctionTypeRepresentation.");
}

StringRef
getSILFunctionTypeRepresentationString(SILFunctionTypeRepresentation value);

// MARK: - ASTExtInfoBuilder
/// A builder type for creating an \c ASTExtInfo.
///
Expand Down
3 changes: 3 additions & 0 deletions include/swift/AST/Import.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ inline bool isScopedImportKind(ImportKind importKind) {
return importKind != ImportKind::Module;
}

StringRef getImportKindString(ImportKind importKind);
Optional<StringRef> getImportKindKeyword(ImportKind importKind);

/// Possible attributes for imports in source files.
enum class ImportFlags {
/// The imported module is exposed to anyone who imports the parent module.
Expand Down
4 changes: 4 additions & 0 deletions include/swift/AST/PrintOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ struct PrintOptions {
/// Whether we are printing part of SIL body.
bool PrintInSILBody = false;

/// Whether we should print an @opened(...) attr on archetypes. Ignored and
/// treated as `true` if PrintForSIL is set.
bool PrintOpenedTypeAttr = false;

/// Whether to use an empty line to separate two members in a single decl.
bool EmptyLineBetweenMembers = false;

Expand Down
2 changes: 0 additions & 2 deletions include/swift/AST/ProtocolConformanceRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ class ProtocolConformanceRef {
void dump(llvm::raw_ostream &out, unsigned indent = 0,
bool details = true) const;

void print(llvm::raw_ostream &out) const;

bool operator==(ProtocolConformanceRef other) const {
return Union == other.Union;
}
Expand Down
2 changes: 2 additions & 0 deletions include/swift/AST/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2561,6 +2561,8 @@ enum class MetatypeRepresentation : char {
Last_MetatypeRepresentation = ObjC
};

StringRef getMetatypeRepresentationString(MetatypeRepresentation value);

/// AnyMetatypeType - A common parent class of MetatypeType and
/// ExistentialMetatypeType.
class AnyMetatypeType : public TypeBase {
Expand Down
Loading