[flang-commits] [flang] f0346a5 - [Frontend] Use SmallString::operator std::string (NFC)

Kazu Hirata via flang-commits flang-commits at lists.llvm.org
Thu Jan 25 18:17:31 PST 2024


Author: Kazu Hirata
Date: 2024-01-25T18:17:18-08:00
New Revision: f0346a5862cc2f177e102d96f9f88da55fe82fd3

URL: https://github.com/llvm/llvm-project/commit/f0346a5862cc2f177e102d96f9f88da55fe82fd3
DIFF: https://github.com/llvm/llvm-project/commit/f0346a5862cc2f177e102d96f9f88da55fe82fd3.diff

LOG: [Frontend] Use SmallString::operator std::string (NFC)

Added: 
    

Modified: 
    flang/lib/Frontend/CompilerInstance.cpp
    flang/lib/Frontend/TextDiagnosticBuffer.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Frontend/CompilerInstance.cpp b/flang/lib/Frontend/CompilerInstance.cpp
index 555ac91f6dc7c07..c78137346640a09 100644
--- a/flang/lib/Frontend/CompilerInstance.cpp
+++ b/flang/lib/Frontend/CompilerInstance.cpp
@@ -80,7 +80,7 @@ static std::string getOutputFilePath(llvm::StringRef outputFilename,
   if (!extension.empty() && (inputFilename != "-")) {
     llvm::SmallString<128> path(inputFilename);
     llvm::sys::path::replace_extension(path, extension);
-    outFile = std::string(path.str());
+    outFile = std::string(path);
   }
 
   return outFile;

diff  --git a/flang/lib/Frontend/TextDiagnosticBuffer.cpp b/flang/lib/Frontend/TextDiagnosticBuffer.cpp
index 13ecbb300361cba..1f3b86f92dc7440 100644
--- a/flang/lib/Frontend/TextDiagnosticBuffer.cpp
+++ b/flang/lib/Frontend/TextDiagnosticBuffer.cpp
@@ -35,20 +35,20 @@ void TextDiagnosticBuffer::HandleDiagnostic(
     llvm_unreachable("Diagnostic not handled during diagnostic buffering!");
   case clang::DiagnosticsEngine::Note:
     all.emplace_back(level, notes.size());
-    notes.emplace_back(info.getLocation(), std::string(buf.str()));
+    notes.emplace_back(info.getLocation(), std::string(buf));
     break;
   case clang::DiagnosticsEngine::Warning:
     all.emplace_back(level, warnings.size());
-    warnings.emplace_back(info.getLocation(), std::string(buf.str()));
+    warnings.emplace_back(info.getLocation(), std::string(buf));
     break;
   case clang::DiagnosticsEngine::Remark:
     all.emplace_back(level, remarks.size());
-    remarks.emplace_back(info.getLocation(), std::string(buf.str()));
+    remarks.emplace_back(info.getLocation(), std::string(buf));
     break;
   case clang::DiagnosticsEngine::Error:
   case clang::DiagnosticsEngine::Fatal:
     all.emplace_back(level, errors.size());
-    errors.emplace_back(info.getLocation(), std::string(buf.str()));
+    errors.emplace_back(info.getLocation(), std::string(buf));
     break;
   }
 }


        


More information about the flang-commits mailing list