|
15 | 15 | #include "swift/SIL/SILGlobalVariable.h" |
16 | 16 | #include "swift/SIL/SILBuilder.h" |
17 | 17 |
|
| 18 | +#include <string> |
| 19 | + |
18 | 20 | using namespace swift; |
19 | 21 |
|
20 | 22 | namespace { |
@@ -159,11 +161,12 @@ BridgedStringRef SILFunction_getName(BridgedFunction function) { |
159 | 161 | return getBridgedStringRef(castToFunction(function)->getName()); |
160 | 162 | } |
161 | 163 |
|
162 | | -BridgedStringRef SILFunction_debugDescription(BridgedFunction function) { |
| 164 | +std::string SILFunction_debugDescription(BridgedFunction function) { |
163 | 165 | std::string str; |
164 | 166 | llvm::raw_string_ostream os(str); |
165 | 167 | castToFunction(function)->print(os); |
166 | | - return getCopiedBridgedStringRef(str, /*removeTrailingNewline*/ true); |
| 168 | + str.pop_back(); // Remove trailing newline. |
| 169 | + return str; |
167 | 170 | } |
168 | 171 |
|
169 | 172 | OptionalBridgedBasicBlock SILFunction_firstBlock(BridgedFunction function) { |
@@ -207,11 +210,12 @@ BridgedFunction SILBasicBlock_getFunction(BridgedBasicBlock block) { |
207 | 210 | return {castToBasicBlock(block)->getParent()}; |
208 | 211 | } |
209 | 212 |
|
210 | | -BridgedStringRef SILBasicBlock_debugDescription(BridgedBasicBlock block) { |
| 213 | +std::string SILBasicBlock_debugDescription(BridgedBasicBlock block) { |
211 | 214 | std::string str; |
212 | 215 | llvm::raw_string_ostream os(str); |
213 | 216 | castToBasicBlock(block)->print(os); |
214 | | - return getCopiedBridgedStringRef(str, /*removeTrailingNewline*/ true); |
| 217 | + str.pop_back(); // Remove trailing newline. |
| 218 | + return str; |
215 | 219 | } |
216 | 220 |
|
217 | 221 | OptionalBridgedInstruction SILBasicBlock_firstInst(BridgedBasicBlock block) { |
@@ -271,11 +275,12 @@ BridgedBasicBlock SILArgument_getParent(BridgedArgument argument) { |
271 | 275 | static_assert(BridgedOperandSize == sizeof(Operand), |
272 | 276 | "wrong bridged Operand size"); |
273 | 277 |
|
274 | | -BridgedStringRef SILNode_debugDescription(BridgedNode node) { |
| 278 | +std::string SILNode_debugDescription(BridgedNode node) { |
275 | 279 | std::string str; |
276 | 280 | llvm::raw_string_ostream os(str); |
277 | 281 | castToSILNode(node)->print(os); |
278 | | - return getCopiedBridgedStringRef(str, /*removeTrailingNewline*/ true); |
| 282 | + str.pop_back(); // Remove trailing newline. |
| 283 | + return str; |
279 | 284 | } |
280 | 285 |
|
281 | 286 | static Operand *castToOperand(BridgedOperand operand) { |
@@ -318,11 +323,12 @@ BridgedStringRef SILGlobalVariable_getName(BridgedGlobalVar global) { |
318 | 323 | return getBridgedStringRef(castToGlobal(global)->getName()); |
319 | 324 | } |
320 | 325 |
|
321 | | -BridgedStringRef SILGlobalVariable_debugDescription(BridgedGlobalVar global) { |
| 326 | +std::string SILGlobalVariable_debugDescription(BridgedGlobalVar global) { |
322 | 327 | std::string str; |
323 | 328 | llvm::raw_string_ostream os(str); |
324 | 329 | castToGlobal(global)->print(os); |
325 | | - return getCopiedBridgedStringRef(str, /*removeTrailingNewline*/ true); |
| 330 | + str.pop_back(); // Remove trailing newline. |
| 331 | + return str; |
326 | 332 | } |
327 | 333 |
|
328 | 334 | //===----------------------------------------------------------------------===// |
|
0 commit comments