forked from OSchip/llvm-project
In Twine::str(), if the Twine stores only a std::string, just return a direct copy of that instead of first copying to a SmallString and converting that to a std::string. Also fix some indentation.
llvm-svn: 135267
This commit is contained in:
parent
c5d10504d5
commit
f8bf4c213a
|
@ -14,6 +14,11 @@
|
|||
using namespace llvm;
|
||||
|
||||
std::string Twine::str() const {
|
||||
// If we're storing only a std::string, just return it.
|
||||
if (LHSKind == StdStringKind && RHSKind == EmptyKind)
|
||||
return *static_cast<const std::string*>(LHS);
|
||||
|
||||
// Otherwise, flatten and copy the contents first.
|
||||
SmallString<256> Vec;
|
||||
return toStringRef(Vec).str();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue