Skip to content

Commit e7577ce

Browse files
committed
Updated comments and formatting
1 parent c912fcc commit e7577ce

File tree

2 files changed

+27
-31
lines changed

2 files changed

+27
-31
lines changed

include/swift/AST/Decl.h

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,10 +1132,9 @@ class ImportDecl final : public Decl,
11321132

11331133
SourceLoc ImportLoc;
11341134
SourceLoc KindLoc;
1135-
// Used to store the real module name corresponding to this import decl
1136-
// in case module aliasing is used. For example if '-module-alias Foo=Bar'
1137-
// was passed and this decl is 'import Foo', the real name 'Bar' will be
1138-
// stored.
1135+
/// Used to store the real module name corresponding to this import decl in
1136+
/// case module aliasing is used. For example if '-module-alias Foo=Bar' was
1137+
/// passed and this decl is 'import Foo', the real name 'Bar' will be stored.
11391138
Identifier RealModuleName;
11401139

11411140
/// The resolved module.
@@ -1168,39 +1167,36 @@ class ImportDecl final : public Decl,
11681167

11691168
/// Retrieves the import path as written in the source code.
11701169
///
1171-
/// \returns An \c ImportPath corresponding to this import decl. If module
1172-
/// aliasing was used, this will contain the aliased name of the module;
1173-
/// for instance, if you wrote 'import Foo' but passed
1174-
/// '-module-alias Foo=Bar', this import path will include 'Foo'. This
1175-
/// return value is always owned by the AST context, so it can be
1176-
/// persisted.
1170+
/// \returns An \c ImportPath corresponding to this import decl. If module aliasing
1171+
/// was used, this will contain the aliased name of the module; for instance,
1172+
/// if you wrote 'import Foo' but passed '-module-alias Foo=Bar', this import
1173+
/// path will include 'Foo'. This return value is always owned by \c ImportDecl
1174+
/// (which is owned by the AST context), so it can be persisted.
11771175
ImportPath getImportPath() const {
1178-
return ImportPath({ getTrailingObjects<ImportPath::Element>(),
1179-
static_cast<size_t>(Bits.ImportDecl.NumPathElements) });
1176+
return ImportPath({ getTrailingObjects<ImportPath::Element>(),
1177+
static_cast<size_t>(Bits.ImportDecl.NumPathElements) });
11801178
}
11811179

11821180
/// Retrieves the import path, replacing any module aliases with real names.
11831181
///
11841182
/// \param scratch An \c ImportPath::Builder which may, if necessary, be used to
11851183
/// construct the return value. It may go unused, so you should not try to
11861184
/// read the result from it; use the return value instead.
1187-
/// \returns An \c ImportPath corresponding to this import decl. If module
1188-
/// aliasing was used, this will contain the real name of the module;
1189-
/// for instance, if you wrote 'import Foo' but passed
1190-
/// '-module-alias Foo=Bar', this import path will include 'Bar'. This
1191-
/// return value may be owned by \p scratch, so it should not be used
1192-
/// after \p scratch is destroyed.
1185+
/// \returns An \c ImportPath corresponding to this import decl. If module aliasing
1186+
/// was used, this will contain the real name of the module; for instance,
1187+
/// if you wrote 'import Foo' but passed '-module-alias Foo=Bar', this import
1188+
/// path will include 'Bar'. This return value may be owned by \p scratch,
1189+
/// so it should not be used after \p scratch is destroyed.
11931190
ImportPath getRealImportPath(ImportPath::Builder &scratch) const;
11941191

11951192
/// Retrieves the part of the import path that contains the module name,
11961193
/// as written in the source code.
11971194
///
1198-
/// \returns A \c ModulePath corresponding to this import decl. If module
1199-
/// aliasing was used, this will contain the aliased name of the module;
1200-
/// for instance, if you wrote 'import Foo' but passed
1201-
/// '-module-alias Foo=Bar', this module path will include 'Foo'. This
1202-
/// return value is always owned by the AST context, so it can be
1203-
/// persisted.
1195+
/// \returns A \c ImportPath::Module corresponding to this import decl. If module
1196+
/// aliasing was used, this will contain the aliased name of the module; for
1197+
/// instance, if you wrote 'import Foo' but passed '-module-alias Foo=Bar',
1198+
/// this module path will contain 'Foo'. This return value is always owned by
1199+
/// \c ImportDecl (which is owned by the AST context), so it can be persisted.
12041200
ImportPath::Module getModulePath() const {
12051201
return getImportPath().getModulePath(getImportKind());
12061202
}
@@ -1211,12 +1207,11 @@ class ImportDecl final : public Decl,
12111207
/// \param scratch An \c ImportPath::Builder which may, if necessary, be used to
12121208
/// construct the return value. It may go unused, so you should not try to
12131209
/// read the result from it; use the return value instead.
1214-
/// \returns An \c ImportPath corresponding to this import decl. If module
1215-
/// aliasing was used, this will contain the real name of the module;
1216-
/// for instance, if you wrote 'import Foo' but passed
1217-
/// '-module-alias Foo=Bar', this import path will include 'Bar'. This
1218-
/// return value may be owned by \p scratch, so it should not be used
1219-
/// after \p scratch is destroyed.
1210+
/// \returns An \c ImportPath::Module corresponding to this import decl. If module
1211+
/// aliasing was used, this will contain the real name of the module; for
1212+
/// instance, if you wrote 'import Foo' but passed '-module-alias Foo=Bar',
1213+
/// the returned path will contain 'Bar'. This return value may be owned
1214+
/// by \p scratch, so it should not be used after \p scratch is destroyed.
12201215
ImportPath::Module getRealModulePath(ImportPath::Builder &scratch) const {
12211216
return getRealImportPath(scratch).getModulePath(getImportKind());
12221217
}

lib/AST/Decl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,8 @@ ImportDecl *ImportDecl::create(ASTContext &Ctx, DeclContext *DC,
10661066
auto D = new (ptr) ImportDecl(DC, ImportLoc, Kind, KindLoc, Path);
10671067
if (ClangN)
10681068
D->setClangNode(ClangN);
1069-
auto realNameIfExists = Ctx.getRealModuleName(Path.front().Item, ASTContext::ModuleAliasLookupOption::realNameFromAlias);
1069+
auto realNameIfExists = Ctx.getRealModuleName(Path.front().Item,
1070+
ASTContext::ModuleAliasLookupOption::realNameFromAlias);
10701071
if (!realNameIfExists.empty()) {
10711072
D->RealModuleName = realNameIfExists;
10721073
}

0 commit comments

Comments
 (0)