File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
source/Plugins/Language/Swift
test/API/functionalities/data-formatter/swift-unsafe Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -383,8 +383,11 @@ std::unique_ptr<SwiftUnsafeType> SwiftUnsafeType::Create(ValueObject &valobj) {
383
383
}
384
384
385
385
llvm::StringRef valobj_type_name (type.GetTypeName ().GetCString ());
386
- bool is_raw = valobj_type_name.contains (" Raw" );
387
- bool is_buffer_ptr = valobj_type_name.contains (" BufferPointer" );
386
+ valobj_type_name.consume_front (" Swift." );
387
+ valobj_type_name.consume_front (" Unsafe" );
388
+ valobj_type_name.consume_front (" Mutable" );
389
+ bool is_raw = valobj_type_name.consume_front (" Raw" );
390
+ bool is_buffer_ptr = valobj_type_name.consume_front (" Buffer" );
388
391
UnsafePointerKind kind =
389
392
static_cast <UnsafePointerKind>(is_buffer_ptr << 1 | is_raw);
390
393
Original file line number Diff line number Diff line change @@ -35,6 +35,12 @@ class Number<T:Numeric> {
35
35
}
36
36
}
37
37
38
+ // Ensure "Raw" in the name doesn't confuse the data formatters into thinking
39
+ // it's a raw value.
40
+ struct NotRaw {
41
+ var x : Int
42
+ }
43
+
38
44
func main( ) {
39
45
// UnsafeBufferPointer
40
46
let structArray = [ IntPair ( 1 ) , IntPair ( - 2 ) , IntPair ( 3 ) ]
@@ -204,6 +210,16 @@ func main() {
204
210
//% substrs=['(UInt8) [0] = 1'])
205
211
}
206
212
213
+ let cooked : [ NotRaw ] = [ . init( x: 1 ) , . init( x: 2 ) , . init( x: 4 ) ]
214
+ cooked. withUnsafeBufferPointer { buffer in
215
+ //% self.expect("frame variable buffer",
216
+ //% patterns=[
217
+ //% '\(UnsafeBufferPointer<a.NotRaw>\) buffer = 3 values \(0[xX][0-9a-fA-F]+\) {',
218
+ //% '\[0\] = \(x = 1\)',
219
+ //% '\[1\] = \(x = 2\)',
220
+ //% '\[2\] = \(x = 4\)',
221
+ //% ])
222
+ }
207
223
}
208
224
209
225
main ( )
You can’t perform that action at this time.
0 commit comments