Author: Youngsuk Kim Date: 2024-07-16T10:06:08-05:00 New Revision: 1cd6359f39ab7fa55f00086c322bc183adb583bc
URL: https://github.com/llvm/llvm-project/commit/1cd6359f39ab7fa55f00086c322bc183adb583bc DIFF: https://github.com/llvm/llvm-project/commit/1cd6359f39ab7fa55f00086c322bc183adb583bc.diff LOG: [clang][ASTReaderStmt] Use helper function 'saveStrToCtx' (NFC) Added: Modified: clang/lib/Serialization/ASTReaderStmt.cpp Removed: ################################################################################ diff --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp index 7a3b81fc358ac..6955b42f14e06 100644 --- a/clang/lib/Serialization/ASTReaderStmt.cpp +++ b/clang/lib/Serialization/ASTReaderStmt.cpp @@ -921,14 +921,10 @@ void ASTStmtReader::VisitRequiresExpr(RequiresExpr *E) { case concepts::Requirement::RK_Nested: { bool HasInvalidConstraint = Record.readInt(); if (HasInvalidConstraint) { - std::string InvalidConstraint = Record.readString(); - char *InvalidConstraintBuf = - new (Record.getContext()) char[InvalidConstraint.size()]; - std::copy(InvalidConstraint.begin(), InvalidConstraint.end(), - InvalidConstraintBuf); + StringRef InvalidConstraint = + saveStrToCtx(Record.readString(), Record.getContext()); R = new (Record.getContext()) concepts::NestedRequirement( - Record.getContext(), - StringRef(InvalidConstraintBuf, InvalidConstraint.size()), + Record.getContext(), InvalidConstraint, readConstraintSatisfaction(Record)); break; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits