Skip to content

Commit 4960ad1

Browse files
authored
[ClangImporter] Fix another lifetime extension issue. (#5255)
The StringRef here referred to a temporary std::string. rdar://problem/28699869
1 parent 6ce4be9 commit 4960ad1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,8 +1137,9 @@ void ClangImporter::collectSubModuleNames(
11371137
}
11381138
auto submoduleNameLength = submodule->getFullModuleName().length();
11391139
for (auto sub : submodule->submodules()) {
1140-
StringRef full = sub->getFullModuleName();
1141-
names.push_back(full.substr(submoduleNameLength + 1).str());
1140+
std::string full = sub->getFullModuleName();
1141+
full.erase(0, submoduleNameLength + 1);
1142+
names.push_back(std::move(full));
11421143
}
11431144
}
11441145

0 commit comments

Comments
 (0)