forked from OSchip/llvm-project
[NFC][testing] 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
ad17ea12e7
commit
08eb614e30
|
@ -73,7 +73,7 @@ struct TestClangConfig {
|
|||
std::string Result;
|
||||
llvm::raw_string_ostream OS(Result);
|
||||
OS << "{ Language=" << Language << ", Target=" << Target << " }";
|
||||
return OS.str();
|
||||
return Result;
|
||||
}
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &OS,
|
||||
|
|
|
@ -111,7 +111,7 @@ template <typename... NodeType> std::string dumpASTString(NodeType &&... N) {
|
|||
|
||||
Dumper.Visit(std::forward<NodeType &&>(N)...);
|
||||
|
||||
return OS.str();
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
template <typename... NodeType>
|
||||
|
@ -126,7 +126,7 @@ std::string dumpASTString(TraversalKind TK, NodeType &&... N) {
|
|||
|
||||
Dumper.Visit(std::forward<NodeType &&>(N)...);
|
||||
|
||||
return OS.str();
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
const FunctionDecl *getFunctionNode(clang::ASTUnit *AST,
|
||||
|
|
|
@ -95,14 +95,14 @@ protected:
|
|||
std::string Buf;
|
||||
llvm::raw_string_ostream OS{Buf};
|
||||
Ctx.dumpExpandedTextsToStream(OS);
|
||||
return OS.str();
|
||||
return Buf;
|
||||
}
|
||||
|
||||
static std::string dumpExpansionRanges(const MacroExpansionContext &Ctx) {
|
||||
std::string Buf;
|
||||
llvm::raw_string_ostream OS{Buf};
|
||||
Ctx.dumpExpansionRangesToStream(OS);
|
||||
return OS.str();
|
||||
return Buf;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ protected:
|
|||
|
||||
OS << "]";
|
||||
|
||||
return OS.str();
|
||||
return Storage;
|
||||
}
|
||||
|
||||
std::string dumpNodes(ArrayRef<Node *> Nodes) {
|
||||
|
@ -218,7 +218,7 @@ protected:
|
|||
|
||||
OS << "]";
|
||||
|
||||
return OS.str();
|
||||
return Storage;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue