Skip to content

Commit 4c6cef0

Browse files
committed
AST: Const-ify some methods on ClassDecl
1 parent ef5a44f commit 4c6cef0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

include/swift/AST/Decl.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4026,7 +4026,7 @@ class ClassDecl final : public NominalTypeDecl {
40264026
ClassDecl *getSuperclassDecl() const;
40274027

40284028
/// Check if this class is a superclass or equal to the given class.
4029-
bool isSuperclassOf(ClassDecl *other) const;
4029+
bool isSuperclassOf(const ClassDecl *other) const;
40304030

40314031
/// Set the superclass of this class.
40324032
void setSuperclass(Type superclass);
@@ -4121,7 +4121,7 @@ class ClassDecl final : public NominalTypeDecl {
41214121

41224122
/// Whether the class uses the ObjC object model (reference counting,
41234123
/// allocation, etc.), the Swift model, or has no reference counting at all.
4124-
ReferenceCounting getObjectModel() {
4124+
ReferenceCounting getObjectModel() const {
41254125
if (isForeignReferenceType())
41264126
return ReferenceCounting::None;
41274127

@@ -4131,7 +4131,7 @@ class ClassDecl final : public NominalTypeDecl {
41314131
return ReferenceCounting::Native;
41324132
}
41334133

4134-
LayoutConstraintKind getLayoutConstraintKind() {
4134+
LayoutConstraintKind getLayoutConstraintKind() const {
41354135
if (getObjectModel() == ReferenceCounting::ObjC)
41364136
return LayoutConstraintKind::Class;
41374137

@@ -4261,7 +4261,7 @@ class ClassDecl final : public NominalTypeDecl {
42614261
/// Used to determine if this class decl is a foriegn reference type. I.e., a
42624262
/// non-reference-counted swift reference type that was imported from a C++
42634263
/// record.
4264-
bool isForeignReferenceType();
4264+
bool isForeignReferenceType() const;
42654265
};
42664266

42674267
/// The set of known protocols for which derived conformances are supported.

lib/AST/Decl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4937,7 +4937,7 @@ void swift::simple_display(llvm::raw_ostream &out, AncestryFlags value) {
49374937
out << " }";
49384938
}
49394939

4940-
bool ClassDecl::isSuperclassOf(ClassDecl *other) const {
4940+
bool ClassDecl::isSuperclassOf(const ClassDecl *other) const {
49414941
llvm::SmallPtrSet<const ClassDecl *, 8> visited;
49424942

49434943
do {
@@ -5082,7 +5082,7 @@ bool ClassDecl::walkSuperclasses(
50825082
return false;
50835083
}
50845084

5085-
bool ClassDecl::isForeignReferenceType() {
5085+
bool ClassDecl::isForeignReferenceType() const {
50865086
return getClangDecl() && isa<clang::RecordDecl>(getClangDecl());
50875087
}
50885088

0 commit comments

Comments
 (0)