forked from OSchip/llvm-project
[NFC][AST] Return underlying strings directly instead of OS.str()
This avoids an unnecessary copy required by 'return OS.str()', allowing
instead for NRVO or implicit move. The .str() call (which flushes the
stream) is no longer required since 65b13610a5
,
which made raw_string_ostream unbuffered by default.
Differential Revision: https://reviews.llvm.org/D115374
This commit is contained in:
parent
715c72b4fb
commit
ad17ea12e7
|
@ -335,7 +335,7 @@ ConvertTypeToDiagnosticString(ASTContext &Context, QualType Ty,
|
|||
OS << "'" << S << "' (vector of " << VTy->getNumElements() << " '"
|
||||
<< VTy->getElementType().getAsString(Context.getPrintingPolicy())
|
||||
<< "' " << Values << ")";
|
||||
return OS.str();
|
||||
return DecoratedString;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ std::string LoopHintAttr::getValueString(const PrintingPolicy &Policy) const {
|
|||
else
|
||||
OS << "disable";
|
||||
OS << ")";
|
||||
return OS.str();
|
||||
return ValueName;
|
||||
}
|
||||
|
||||
// Return a string suitable for identifying this attribute in diagnostics.
|
||||
|
|
|
@ -1589,7 +1589,7 @@ std::string NamedDecl::getQualifiedNameAsString() const {
|
|||
std::string QualName;
|
||||
llvm::raw_string_ostream OS(QualName);
|
||||
printQualifiedName(OS, getASTContext().getPrintingPolicy());
|
||||
return OS.str();
|
||||
return QualName;
|
||||
}
|
||||
|
||||
void NamedDecl::printQualifiedName(raw_ostream &OS) const {
|
||||
|
|
|
@ -236,7 +236,7 @@ std::string DeclarationName::getAsString() const {
|
|||
std::string Result;
|
||||
llvm::raw_string_ostream OS(Result);
|
||||
OS << *this;
|
||||
return OS.str();
|
||||
return Result;
|
||||
}
|
||||
|
||||
void *DeclarationName::getFETokenInfoSlow() const {
|
||||
|
@ -460,7 +460,7 @@ std::string DeclarationNameInfo::getAsString() const {
|
|||
std::string Result;
|
||||
llvm::raw_string_ostream OS(Result);
|
||||
OS << *this;
|
||||
return OS.str();
|
||||
return Result;
|
||||
}
|
||||
|
||||
raw_ostream &clang::operator<<(raw_ostream &OS, DeclarationNameInfo DNInfo) {
|
||||
|
|
|
@ -2454,7 +2454,7 @@ std::string OMPTraitInfo::getMangledName() const {
|
|||
Property.RawString);
|
||||
}
|
||||
}
|
||||
return OS.str();
|
||||
return MangledName;
|
||||
}
|
||||
|
||||
OMPTraitInfo::OMPTraitInfo(StringRef MangledName) {
|
||||
|
|
Loading…
Reference in New Issue