[ClangImporter] Fix another lifetime extension issue. (#5255)

The StringRef here referred to a temporary std::string.

rdar://problem/28699869
This commit is contained in:
Jordan Rose
2016-10-13 13:47:37 -07:00
committed by GitHub
parent 6ce4be96f1
commit 4960ad14da

View File

@@ -1137,8 +1137,9 @@ void ClangImporter::collectSubModuleNames(
}
auto submoduleNameLength = submodule->getFullModuleName().length();
for (auto sub : submodule->submodules()) {
StringRef full = sub->getFullModuleName();
names.push_back(full.substr(submoduleNameLength + 1).str());
std::string full = sub->getFullModuleName();
full.erase(0, submoduleNameLength + 1);
names.push_back(std::move(full));
}
}