Skip to content

Commit feb03eb

Browse files
author
Matt Davis
committed
[DiagnosticVerifier] Explicit convert a StringRef into a std::string.
The newer llvm StringRef library has removed the implicit StringRef to std::string conversion. (See: llvm/llvm-project@adcd026) This patch also uses a StringRef to compare another StringRef eliminating the need to perform a StringRef to std::string conversion. I am concerned that StringRef's are being stored in ExpectedEducationalNotes, but as long as the StringRef does not out live the definition this is totally cool then.
1 parent 1af01ed commit feb03eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Frontend/DiagnosticVerifier.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ DiagnosticVerifier::Result DiagnosticVerifier::verifyFile(unsigned BufferID) {
740740
// Verify educational notes
741741
for (auto &foundName : FoundDiagnostic.EducationalNotes) {
742742
llvm::erase_if(expectedNotes->Names,
743-
[&](std::string item) { return item == foundName; });
743+
[&](StringRef item) { return item.equals(foundName); });
744744
}
745745

746746
if (!expectedNotes->Names.empty()) {
@@ -950,7 +950,7 @@ void DiagnosticVerifier::handleDiagnostic(SourceManager &SM,
950950

951951
llvm::SmallVector<std::string, 1> eduNotes;
952952
for (auto &notePath : Info.EducationalNotePaths) {
953-
eduNotes.push_back(llvm::sys::path::stem(notePath));
953+
eduNotes.push_back(llvm::sys::path::stem(notePath).str());
954954
}
955955

956956
llvm::SmallString<128> message;

0 commit comments

Comments
 (0)