Author: Jonas Devlieghere Date: 2020-01-29T21:27:46-08:00 New Revision: 509e21a1b9debc7fcbfb3eaf56a5dcf57de55e0e
URL: https://github.com/llvm/llvm-project/commit/509e21a1b9debc7fcbfb3eaf56a5dcf57de55e0e DIFF: https://github.com/llvm/llvm-project/commit/509e21a1b9debc7fcbfb3eaf56a5dcf57de55e0e.diff LOG: [clang] Replace SmallStr.str().str() with std::string conversion operator. Use the std::string conversion operator introduced in d7049213d0fcda691c9e79f9b41e357198d99738. Added: Modified: clang/lib/AST/Expr.cpp clang/lib/CodeGen/CoverageMappingGen.cpp clang/lib/CrossTU/CrossTranslationUnit.cpp clang/lib/Driver/Driver.cpp clang/lib/Lex/HeaderSearch.cpp clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp clang/tools/clang-refactor/TestSupport.cpp clang/unittests/Driver/SanitizerArgsTest.cpp clang/unittests/Frontend/FrontendActionTest.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index a0d11ee9982f..51d29aef3267 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -856,7 +856,7 @@ std::string PredefinedExpr::ComputeName(IdentKind IK, const Decl *CurrentDecl) { Out << Proto; - return Name.str().str(); + return std::string(Name); } if (const CapturedDecl *CD = dyn_cast<CapturedDecl>(CurrentDecl)) { for (const DeclContext *DC = CD->getParent(); DC; DC = DC->getParent()) @@ -887,7 +887,7 @@ std::string PredefinedExpr::ComputeName(IdentKind IK, const Decl *CurrentDecl) { MD->getSelector().print(Out); Out << ']'; - return Name.str().str(); + return std::string(Name); } if (isa<TranslationUnitDecl>(CurrentDecl) && IK == PrettyFunction) { // __PRETTY_FUNCTION__ -> "top level", the others produce an empty string. diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index bdecff39c88f..ee85694f043a 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -1282,7 +1282,7 @@ std::string normalizeFilename(StringRef Filename) { llvm::SmallString<256> Path(Filename); llvm::sys::fs::make_absolute(Path); llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true); - return Path.str().str(); + return std::string(Path); } } // end anonymous namespace diff --git a/clang/lib/CrossTU/CrossTranslationUnit.cpp b/clang/lib/CrossTU/CrossTranslationUnit.cpp index f182f5c2cb4d..d138985c57fd 100644 --- a/clang/lib/CrossTU/CrossTranslationUnit.cpp +++ b/clang/lib/CrossTU/CrossTranslationUnit.cpp @@ -149,7 +149,7 @@ parseCrossTUIndex(StringRef IndexPath, StringRef CrossTUDir) { StringRef FileName = LineRef.substr(Pos + 1); SmallString<256> FilePath = CrossTUDir; llvm::sys::path::append(FilePath, FileName); - Result[LookupName] = FilePath.str().str(); + Result[LookupName] = std::string(FilePath); } else return llvm::make_error<IndexError>( index_error_code::invalid_index_format, IndexPath.str(), LineNo); diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 0813146406ad..6db791ab8333 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -4650,7 +4650,7 @@ std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const { SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir); llvm::sys::path::append(P, Name); if (llvm::sys::fs::exists(Twine(P))) - return P.str().str(); + return std::string(P); } return None; }; diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index ff9272ec3e1a..73c02d7f6e6d 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -159,7 +159,7 @@ std::string HeaderSearch::getPrebuiltModuleFileName(StringRef ModuleName, llvm::sys::fs::make_absolute(Result); llvm::sys::path::append(Result, ModuleName + ".pcm"); if (getFileMgr().getFile(Result.str())) - return Result.str().str(); + return std::string(Result); } return {}; } diff --git a/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp index fb7758bfbd2a..a415ed32c05a 100644 --- a/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp @@ -106,7 +106,7 @@ static std::string fileNameToURI(StringRef Filename) { } }); - return Ret.str().str(); + return std::string(Ret); } static json::Object createArtifactLocation(const FileEntry &FE) { diff --git a/clang/tools/clang-refactor/TestSupport.cpp b/clang/tools/clang-refactor/TestSupport.cpp index 617a671d1271..02b816d5235c 100644 --- a/clang/tools/clang-refactor/TestSupport.cpp +++ b/clang/tools/clang-refactor/TestSupport.cpp @@ -190,7 +190,7 @@ bool TestRefactoringResultConsumer::handleAllResults() { const PartialDiagnosticAt &Diag = Err.getDiagnostic(); llvm::SmallString<100> DiagText; Diag.second.EmitToString(getDiags(), DiagText); - ErrorMessage = DiagText.str().str(); + ErrorMessage = std::string(DiagText); }); } if (!CanonicalResult && !CanonicalErrorMessage) { diff --git a/clang/unittests/Driver/SanitizerArgsTest.cpp b/clang/unittests/Driver/SanitizerArgsTest.cpp index e58826c2669a..dac1caddc055 100644 --- a/clang/unittests/Driver/SanitizerArgsTest.cpp +++ b/clang/unittests/Driver/SanitizerArgsTest.cpp @@ -43,7 +43,7 @@ std::string concatPaths(llvm::ArrayRef<StringRef> Components) { llvm::SmallString<128> P; for (StringRef C : Components) llvm::sys::path::append(P, C); - return P.str().str(); + return std::string(P); } class SanitizerArgsTest : public ::testing::Test { diff --git a/clang/unittests/Frontend/FrontendActionTest.cpp b/clang/unittests/Frontend/FrontendActionTest.cpp index 9f8a7466ecbb..97dacfb440bd 100644 --- a/clang/unittests/Frontend/FrontendActionTest.cpp +++ b/clang/unittests/Frontend/FrontendActionTest.cpp @@ -252,8 +252,8 @@ TEST(ASTFrontendAction, ExternalSemaSource) { ASSERT_TRUE(Compiler.ExecuteAction(TestAction)); // There should be one error correcting to 'moo' and a note attached to it. EXPECT_EQ("use of undeclared identifier 'foo'; did you mean 'moo'?", - TDC->Error.str().str()); - EXPECT_EQ("This is a note", TDC->Note.str().str()); + std::string(TDC->Error)); + EXPECT_EQ("This is a note", std::string(TDC->Note)); } TEST(GeneratePCHFrontendAction, CacheGeneratedPCH) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits