Skip to content

Commit d2f7a27

Browse files
committed
[NFC] Const-ify Some ClangImporter Interfaces
1 parent ddcb1d5 commit d2f7a27

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ getDefaultMakeStructRawValuedOptions() {
104104
return opts;
105105
}
106106

107-
static bool isInSystemModule(DeclContext *D) {
107+
static bool isInSystemModule(const DeclContext *D) {
108108
return cast<ClangModuleUnit>(D->getModuleScopeContext())->isSystemModule();
109109
}
110110

@@ -4091,7 +4091,7 @@ namespace {
40914091
/// Check whether we have already imported a method with the given
40924092
/// selector in the given context.
40934093
bool isMethodAlreadyImported(ObjCSelector selector, bool isInstance,
4094-
DeclContext *dc,
4094+
const DeclContext *dc,
40954095
llvm::function_ref<bool(AbstractFunctionDecl *fn)> filter) {
40964096
// We only need to perform this check for classes.
40974097
auto classDecl
@@ -4425,7 +4425,7 @@ namespace {
44254425
/// NSArray(capacity: 1024)
44264426
/// \endcode
44274427
ConstructorDecl *importConstructor(const clang::ObjCMethodDecl *objcMethod,
4428-
DeclContext *dc,
4428+
const DeclContext *dc,
44294429
bool implicit,
44304430
Optional<CtorInitializerKind> kind,
44314431
bool required);
@@ -4454,7 +4454,7 @@ namespace {
44544454
/// This variant of the function is responsible for actually binding the
44554455
/// constructor declaration appropriately.
44564456
ConstructorDecl *importConstructor(const clang::ObjCMethodDecl *objcMethod,
4457-
DeclContext *dc,
4457+
const DeclContext *dc,
44584458
bool implicit,
44594459
CtorInitializerKind kind,
44604460
bool required,
@@ -4527,7 +4527,7 @@ namespace {
45274527

45284528
/// Import constructors from our superclasses (and their
45294529
/// categories/extensions), effectively "inheriting" constructors.
4530-
void importInheritedConstructors(ClassDecl *classDecl,
4530+
void importInheritedConstructors(const ClassDecl *classDecl,
45314531
SmallVectorImpl<Decl *> &newMembers);
45324532

45334533
Decl *VisitObjCCategoryDecl(const clang::ObjCCategoryDecl *decl) {
@@ -6083,7 +6083,7 @@ SwiftDeclConverter::getImplicitProperty(ImportedName importedName,
60836083
}
60846084

60856085
ConstructorDecl *SwiftDeclConverter::importConstructor(
6086-
const clang::ObjCMethodDecl *objcMethod, DeclContext *dc, bool implicit,
6086+
const clang::ObjCMethodDecl *objcMethod, const DeclContext *dc, bool implicit,
60876087
Optional<CtorInitializerKind> kind, bool required) {
60886088
// Only methods in the 'init' family can become constructors.
60896089
assert(isInitMethod(objcMethod) && "Not a real init method");
@@ -6234,7 +6234,7 @@ bool SwiftDeclConverter::existingConstructorIsWorse(
62346234
/// This variant of the function is responsible for actually binding the
62356235
/// constructor declaration appropriately.
62366236
ConstructorDecl *SwiftDeclConverter::importConstructor(
6237-
const clang::ObjCMethodDecl *objcMethod, DeclContext *dc, bool implicit,
6237+
const clang::ObjCMethodDecl *objcMethod, const DeclContext *dc, bool implicit,
62386238
CtorInitializerKind kind, bool required, ObjCSelector selector,
62396239
ImportedName importedName, ArrayRef<const clang::ParmVarDecl *> args,
62406240
bool variadic, bool &redundant) {
@@ -6354,7 +6354,7 @@ ConstructorDecl *SwiftDeclConverter::importConstructor(
63546354
/*NameLoc=*/SourceLoc(), failability, /*FailabilityLoc=*/SourceLoc(),
63556355
/*Throws=*/importedName.getErrorInfo().hasValue(),
63566356
/*ThrowsLoc=*/SourceLoc(), bodyParams,
6357-
/*GenericParams=*/nullptr, dc);
6357+
/*GenericParams=*/nullptr, const_cast<DeclContext *>(dc));
63586358

63596359
addObjCAttribute(result, selector);
63606360

@@ -7189,7 +7189,7 @@ void SwiftDeclConverter::importNonOverriddenMirroredMethods(DeclContext *dc,
71897189
}
71907190

71917191
void SwiftDeclConverter::importInheritedConstructors(
7192-
ClassDecl *classDecl, SmallVectorImpl<Decl *> &newMembers) {
7192+
const ClassDecl *classDecl, SmallVectorImpl<Decl *> &newMembers) {
71937193
if (!classDecl->hasSuperclass())
71947194
return;
71957195

lib/ClangImporter/ImporterImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation
492492
/// Keep track of initializer declarations that correspond to
493493
/// imported methods.
494494
llvm::DenseMap<
495-
std::tuple<const clang::ObjCMethodDecl *, DeclContext *, Version>,
495+
std::tuple<const clang::ObjCMethodDecl *, const DeclContext *, Version>,
496496
ConstructorDecl *> Constructors;
497497

498498
/// Keep track of all initializers that have been imported into a

0 commit comments

Comments
 (0)