|
16 | 16 | #include "swift/SIL/SILBridgingUtils.h" |
17 | 17 | #include "swift/SIL/SILGlobalVariable.h" |
18 | 18 | #include "swift/SIL/SILBuilder.h" |
| 19 | +#include <string> |
19 | 20 |
|
20 | 21 | using namespace swift; |
21 | 22 |
|
@@ -149,11 +150,12 @@ BridgedStringRef SILFunction_getName(BridgedFunction function) { |
149 | 150 | return getBridgedStringRef(castToFunction(function)->getName()); |
150 | 151 | } |
151 | 152 |
|
152 | | -BridgedStringRef SILFunction_debugDescription(BridgedFunction function) { |
| 153 | +std::string SILFunction_debugDescription(BridgedFunction function) { |
153 | 154 | std::string str; |
154 | 155 | llvm::raw_string_ostream os(str); |
155 | 156 | castToFunction(function)->print(os); |
156 | | - return getCopiedBridgedStringRef(str, /*removeTrailingNewline*/ true); |
| 157 | + str.pop_back(); // Remove trailing newline. |
| 158 | + return str; |
157 | 159 | } |
158 | 160 |
|
159 | 161 | OptionalBridgedBasicBlock SILFunction_firstBlock(BridgedFunction function) { |
@@ -239,11 +241,12 @@ BridgedFunction SILBasicBlock_getFunction(BridgedBasicBlock block) { |
239 | 241 | return {castToBasicBlock(block)->getParent()}; |
240 | 242 | } |
241 | 243 |
|
242 | | -BridgedStringRef SILBasicBlock_debugDescription(BridgedBasicBlock block) { |
| 244 | +std::string SILBasicBlock_debugDescription(BridgedBasicBlock block) { |
243 | 245 | std::string str; |
244 | 246 | llvm::raw_string_ostream os(str); |
245 | 247 | castToBasicBlock(block)->print(os); |
246 | | - return getCopiedBridgedStringRef(str, /*removeTrailingNewline*/ true); |
| 248 | + str.pop_back(); // Remove trailing newline. |
| 249 | + return str; |
247 | 250 | } |
248 | 251 |
|
249 | 252 | OptionalBridgedInstruction SILBasicBlock_firstInst(BridgedBasicBlock block) { |
@@ -308,11 +311,12 @@ SwiftInt SILArgument_isExclusiveIndirectParameter(BridgedArgument argument) { |
308 | 311 | static_assert(BridgedOperandSize == sizeof(Operand), |
309 | 312 | "wrong bridged Operand size"); |
310 | 313 |
|
311 | | -BridgedStringRef SILNode_debugDescription(BridgedNode node) { |
| 314 | +std::string SILNode_debugDescription(BridgedNode node) { |
312 | 315 | std::string str; |
313 | 316 | llvm::raw_string_ostream os(str); |
314 | 317 | castToSILNode(node)->print(os); |
315 | | - return getCopiedBridgedStringRef(str, /*removeTrailingNewline*/ true); |
| 318 | + str.pop_back(); // Remove trailing newline. |
| 319 | + return str; |
316 | 320 | } |
317 | 321 |
|
318 | 322 | BridgedFunction SILNode_getFunction(BridgedNode node) { |
@@ -465,11 +469,12 @@ BridgedStringRef SILGlobalVariable_getName(BridgedGlobalVar global) { |
465 | 469 | return getBridgedStringRef(castToGlobal(global)->getName()); |
466 | 470 | } |
467 | 471 |
|
468 | | -BridgedStringRef SILGlobalVariable_debugDescription(BridgedGlobalVar global) { |
| 472 | +std::string SILGlobalVariable_debugDescription(BridgedGlobalVar global) { |
469 | 473 | std::string str; |
470 | 474 | llvm::raw_string_ostream os(str); |
471 | 475 | castToGlobal(global)->print(os); |
472 | | - return getCopiedBridgedStringRef(str, /*removeTrailingNewline*/ true); |
| 476 | + str.pop_back(); // Remove trailing newline. |
| 477 | + return str; |
473 | 478 | } |
474 | 479 |
|
475 | 480 | //===----------------------------------------------------------------------===// |
|
0 commit comments