r243966 - [AST] Use StringRef's convenient copy method. No functionality change.
Benjamin Kramer
benny.kra at googlemail.com
Tue Aug 4 03:22:38 PDT 2015
Author: d0k
Date: Tue Aug 4 05:22:38 2015
New Revision: 243966
URL: http://llvm.org/viewvc/llvm-project?rev=243966&view=rev
Log:
[AST] Use StringRef's convenient copy method. No functionality change.
Modified:
cfe/trunk/lib/AST/Stmt.cpp
Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=243966&r1=243965&r2=243966&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Tue Aug 4 05:22:38 2015
@@ -724,12 +724,7 @@ MSAsmStmt::MSAsmStmt(const ASTContext &C
}
static StringRef copyIntoContext(const ASTContext &C, StringRef str) {
- if (str.empty())
- return StringRef();
- size_t size = str.size();
- char *buffer = new (C) char[size];
- memcpy(buffer, str.data(), size);
- return StringRef(buffer, size);
+ return str.copy(C.getAllocator());
}
void MSAsmStmt::initialize(const ASTContext &C, StringRef asmstr,
More information about the cfe-commits
mailing list