Skip to content

Commit 03d4d11

Browse files
author
Nuri Amari
committed
Remove Decl* declarations made using auto
A non functional change replacing auto with Decl* for some declarations using ClangImporter::Implementation::importDecl. Increases clarity and makes subsequent planned changes easier.
1 parent d993112 commit 03d4d11

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2876,7 +2876,7 @@ void ClangImporter::lookupTypeDecl(
28762876
!isa<clang::ObjCCompatibleAliasDecl>(clangDecl)) {
28772877
continue;
28782878
}
2879-
auto *imported = Impl.importDecl(clangDecl, Impl.CurrentVersion);
2879+
Decl *imported = Impl.importDecl(clangDecl, Impl.CurrentVersion);
28802880

28812881
// Namespaces are imported as extensions for enums.
28822882
if (auto ext = dyn_cast_or_null<ExtensionDecl>(imported)) {
@@ -3008,7 +3008,7 @@ void ClangModuleUnit::getTopLevelDecls(SmallVectorImpl<Decl*> &results) const {
30083008
llvm::SmallPtrSet<ExtensionDecl *, 8> knownExtensions;
30093009
for (auto entry : lookupTable->allGlobalsAsMembers()) {
30103010
auto decl = entry.get<clang::NamedDecl *>();
3011-
auto importedDecl = owner.importDecl(decl, owner.CurrentVersion);
3011+
Decl *importedDecl = owner.importDecl(decl, owner.CurrentVersion);
30123012
if (!importedDecl) continue;
30133013

30143014
// Find the enclosing extension, if there is one.
@@ -3374,9 +3374,7 @@ void ClangModuleUnit::lookupObjCMethods(
33743374
if (objcMethod->isPropertyAccessor())
33753375
(void)owner.importDecl(objcMethod->findPropertyDecl(true),
33763376
owner.CurrentVersion);
3377-
3378-
auto imported =
3379-
owner.importDecl(objcMethod, owner.CurrentVersion);
3377+
Decl *imported = owner.importDecl(objcMethod, owner.CurrentVersion);
33803378
if (!imported) continue;
33813379

33823380
if (auto func = dyn_cast<AbstractFunctionDecl>(imported))

lib/ClangImporter/ImportDecl.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,8 +2486,8 @@ namespace {
24862486
// that we add this to the parent enum (in the "__ObjC" module) and not
24872487
// to the extension.
24882488
auto parentNS = cast<clang::NamespaceDecl>(decl->getParent());
2489-
auto parent =
2490-
Impl.importDecl(parentNS, getVersion(), /*UseCanonicalDecl*/ false);
2489+
Decl *parent = Impl.importDecl(parentNS, getVersion(),
2490+
/*UseCanonicalDecl*/ false);
24912491
// Sometimes when the parent namespace is imported, this namespace
24922492
// also gets imported. If that's the case, then the parent namespace
24932493
// will be an enum (because it was able to be fully imported) in which
@@ -3590,7 +3590,7 @@ namespace {
35903590
}
35913591
}
35923592

3593-
auto member = Impl.importDecl(nd, getActiveSwiftVersion());
3593+
Decl *member = Impl.importDecl(nd, getActiveSwiftVersion());
35943594
if (!member) {
35953595
if (!isa<clang::TypeDecl>(nd) && !isa<clang::FunctionDecl>(nd)) {
35963596
// We don't know what this member is.
@@ -5941,8 +5941,7 @@ namespace {
59415941
auto name = importedName.getDeclName().getBaseIdentifier();
59425942

59435943
if (name.empty()) return nullptr;
5944-
5945-
auto importedDecl =
5944+
Decl *importedDecl =
59465945
Impl.importDecl(decl->getClassInterface(), getActiveSwiftVersion());
59475946
auto typeDecl = dyn_cast_or_null<TypeDecl>(importedDecl);
59485947
if (!typeDecl) return nullptr;
@@ -9986,7 +9985,7 @@ bool ClangImporter::Implementation::addMemberAndAlternatesToExtension(
99869985
return true;
99879986

99889987
// Then try to import the decl under the specified name.
9989-
auto *member = importDecl(decl, nameVersion);
9988+
Decl *member = importDecl(decl, nameVersion);
99909989
if (!member)
99919990
return false;
99929991

0 commit comments

Comments
 (0)