@@ -1211,10 +1211,33 @@ class ImportDecl final : public Decl,
1211
1211
return scratch.get ();
1212
1212
}
1213
1213
1214
- ImportPath::Module getModulePath (ImportPath::Module::Builder *outRealModuleName = nullptr ) const {
1215
- if (outRealModuleName != nullptr && !RealModuleName.empty ()) {
1216
- outRealModuleName->push_back (RealModuleName);
1217
- }
1214
+ // / Retrieves the part of the import path that contains the module name,
1215
+ // / as written in the source code.
1216
+ // /
1217
+ // / \returns A \c ModulePath corresponding to this import decl. If module
1218
+ // / aliasing was used, this will contain the aliased name of the module;
1219
+ // / for instance, if you wrote 'import Foo' but passed
1220
+ // / '-module-alias Foo=Bar', this module path will include 'Foo'. This
1221
+ // / return value is always owned by the AST context, so it can be
1222
+ // / persisted.
1223
+ ImportPath::Module getModulePath () const {
1224
+ return getImportPath ().getModulePath (getImportKind ());
1225
+ }
1226
+
1227
+ // / Retrieves the part of the import path that contains the module name,
1228
+ // / replacing any module aliases with real names.
1229
+ // /
1230
+ // / \param scratch An \c ImportPath::Builder which may, if necessary, be used to
1231
+ // / construct the return value. It may go unused, so you should not try to
1232
+ // / read the result from it; use the return value instead.
1233
+ // / \returns An \c ImportPath corresponding to this import decl. If module
1234
+ // / aliasing was used, this will contain the real name of the module;
1235
+ // / for instance, if you wrote 'import Foo' but passed
1236
+ // / '-module-alias Foo=Bar', this import path will include 'Bar'. This
1237
+ // / return value may be owned by \p scratch, so it should not be used
1238
+ // / after \p scratch is destroyed.
1239
+ ImportPath::Module getRealModulePath (ImportPath::Builder &scratch) const {
1240
+ return getRealImportPath (scratch).getModulePath (getImportKind ());
1218
1241
return getImportPath ().getModulePath (getImportKind ());
1219
1242
}
1220
1243
0 commit comments