|
15 | 15 | #include "swift/SIL/SILGlobalVariable.h" |
16 | 16 | #include "swift/SIL/SILBuilder.h" |
17 | 17 |
|
18 | | -#include <string> |
19 | | - |
20 | 18 | using namespace swift; |
21 | 19 |
|
22 | 20 | namespace { |
@@ -165,12 +163,11 @@ BridgedStringRef SILFunction_getName(BridgedFunction function) { |
165 | 163 | return getBridgedStringRef(castToFunction(function)->getName()); |
166 | 164 | } |
167 | 165 |
|
168 | | -std::string SILFunction_debugDescription(BridgedFunction function) { |
| 166 | +BridgedStringRef SILFunction_debugDescription(BridgedFunction function) { |
169 | 167 | std::string str; |
170 | 168 | llvm::raw_string_ostream os(str); |
171 | 169 | castToFunction(function)->print(os); |
172 | | - str.pop_back(); // Remove trailing newline. |
173 | | - return str; |
| 170 | + return getCopiedBridgedStringRef(str, /*removeTrailingNewline*/ true); |
174 | 171 | } |
175 | 172 |
|
176 | 173 | OptionalBridgedBasicBlock SILFunction_firstBlock(BridgedFunction function) { |
@@ -226,12 +223,11 @@ BridgedFunction SILBasicBlock_getFunction(BridgedBasicBlock block) { |
226 | 223 | return {castToBasicBlock(block)->getParent()}; |
227 | 224 | } |
228 | 225 |
|
229 | | -std::string SILBasicBlock_debugDescription(BridgedBasicBlock block) { |
| 226 | +BridgedStringRef SILBasicBlock_debugDescription(BridgedBasicBlock block) { |
230 | 227 | std::string str; |
231 | 228 | llvm::raw_string_ostream os(str); |
232 | 229 | castToBasicBlock(block)->print(os); |
233 | | - str.pop_back(); // Remove trailing newline. |
234 | | - return str; |
| 230 | + return getCopiedBridgedStringRef(str, /*removeTrailingNewline*/ true); |
235 | 231 | } |
236 | 232 |
|
237 | 233 | OptionalBridgedInstruction SILBasicBlock_firstInst(BridgedBasicBlock block) { |
@@ -291,12 +287,11 @@ BridgedBasicBlock SILArgument_getParent(BridgedArgument argument) { |
291 | 287 | static_assert(BridgedOperandSize == sizeof(Operand), |
292 | 288 | "wrong bridged Operand size"); |
293 | 289 |
|
294 | | -std::string SILNode_debugDescription(BridgedNode node) { |
| 290 | +BridgedStringRef SILNode_debugDescription(BridgedNode node) { |
295 | 291 | std::string str; |
296 | 292 | llvm::raw_string_ostream os(str); |
297 | 293 | castToSILNode(node)->print(os); |
298 | | - str.pop_back(); // Remove trailing newline. |
299 | | - return str; |
| 294 | + return getCopiedBridgedStringRef(str, /*removeTrailingNewline*/ true); |
300 | 295 | } |
301 | 296 |
|
302 | 297 | static Operand *castToOperand(BridgedOperand operand) { |
@@ -347,12 +342,11 @@ BridgedStringRef SILGlobalVariable_getName(BridgedGlobalVar global) { |
347 | 342 | return getBridgedStringRef(castToGlobal(global)->getName()); |
348 | 343 | } |
349 | 344 |
|
350 | | -std::string SILGlobalVariable_debugDescription(BridgedGlobalVar global) { |
| 345 | +BridgedStringRef SILGlobalVariable_debugDescription(BridgedGlobalVar global) { |
351 | 346 | std::string str; |
352 | 347 | llvm::raw_string_ostream os(str); |
353 | 348 | castToGlobal(global)->print(os); |
354 | | - str.pop_back(); // Remove trailing newline. |
355 | | - return str; |
| 349 | + return getCopiedBridgedStringRef(str, /*removeTrailingNewline*/ true); |
356 | 350 | } |
357 | 351 |
|
358 | 352 | //===----------------------------------------------------------------------===// |
|
0 commit comments