Skip to content

Commit cbc0e80

Browse files
authored
Merge pull request #83032 from Xazax-hun/import-source-loc-assert
[cxx-interop] Fix assert failure due to invalid location
2 parents a4eeae2 + f694044 commit cbc0e80

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2885,9 +2885,10 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
28852885
// Estimate locations for the begin and end of parameter list.
28862886
auto begin = clangDecl->getLocation();
28872887
auto end = begin;
2888-
if (!params.empty()) {
2889-
begin = params.front()->getBeginLoc();
2890-
end = params.back()->getEndLoc();
2888+
auto paramsRange = clangDecl->getParametersSourceRange();
2889+
if (paramsRange.isValid()) {
2890+
begin = paramsRange.getBegin();
2891+
end = paramsRange.getEnd();
28912892
}
28922893
return ParameterList::create(SwiftContext, importSourceLoc(begin), parameters,
28932894
importSourceLoc(end));

0 commit comments

Comments
 (0)