| ... | @@ -357,8 +357,8 @@ pub const BinaryAnnotation = union(enum) { | ... | @@ -357,8 +357,8 @@ pub const BinaryAnnotation = union(enum) { |
| 357 | .change_file => |file_id| { | 357 | .change_file => |file_id| { |
| 358 | self.curr.file_id = file_id; | 358 | self.curr.file_id = file_id; |
| 359 | }, | 359 | }, |
| 360 | // LLVM never emits this opcode, but it's clear enough how to interpret it so we may as | 360 | // LLVM never emits this opcode, but it's clear enough how to interpret it so we |
| 361 | // well in case they use it in the future | 361 | // may as well in case they use it in the future |
| 362 | .change_code_length_and_code_offset => |info| { | 362 | .change_code_length_and_code_offset => |info| { |
| 363 | self.curr.code_length = info.length; | 363 | self.curr.code_length = info.length; |
| 364 | self.curr.code_offset += info.delta; | 364 | self.curr.code_offset += info.delta; |
| ... | @@ -371,21 +371,24 @@ pub const BinaryAnnotation = union(enum) { | ... | @@ -371,21 +371,24 @@ pub const BinaryAnnotation = union(enum) { |
| 371 | self.curr.line_offset += info.line_delta; | 371 | self.curr.line_offset += info.line_delta; |
| 372 | }, | 372 | }, |
| 373 | | 373 | |
| 374 | // Not emitted by LLVM at the time of writing, but if we get it from elsewhere it should | 374 | // Not emitted by LLVM at the time of writing, and we don't want to add support |
| 375 | // be safe to ignore since we don't use this info. Theoretically we could use column | 375 | // without a test csae. Safe to ignore since we don't use this info right now. |
| 376 | // info if it was present, but it's not easy to test since LLVM doesn't output it. | | |
| 377 | .change_line_end_delta, | 376 | .change_line_end_delta, |
| 378 | .change_column_start, | 377 | .change_column_start, |
| 379 | .change_column_end_delta, | 378 | .change_column_end_delta, |
| 380 | .change_column_end, | 379 | .change_column_end, |
| 381 | => {}, | 380 | => {}, |
| 382 | | 381 | |
| 383 | // Not emitted by LLVM at the time of writing. Various sources conflict on how these | 382 | // Not emitted by LLVM at the time of writing. Various sources conflict on how |
| 384 | // instructions should be interpreted, so we make no attempt to handle them. | 383 | // these opcodes should be interpreted, so we make no attempt to handle them. |
| 385 | .code_offset, | 384 | .code_offset, |
| 386 | .change_code_offset_base, | 385 | .change_code_offset_base, |
| 387 | .change_range_kind, | 386 | .change_range_kind, |
| 388 | => @panic("unimplemented"), | 387 | => { |
| | 388 | self.annotations = .empty; |
| | 389 | self.prev = null; |
| | 390 | return null; |
| | 391 | }, |
| 389 | } | 392 | } |
| 390 | | 393 | |
| 391 | switch (annotation) { | 394 | switch (annotation) { |
| ... | @@ -433,6 +436,8 @@ pub const BinaryAnnotation = union(enum) { | ... | @@ -433,6 +436,8 @@ pub const BinaryAnnotation = union(enum) { |
| 433 | pub const Iterator = struct { | 436 | pub const Iterator = struct { |
| 434 | reader: Io.Reader, | 437 | reader: Io.Reader, |
| 435 | | 438 | |
| | 439 | pub const empty: Iterator = .{ .reader = .ending_instance }; |
| | 440 | |
| 436 | pub fn next(self: *Iterator) error{InvalidDebugInfo}!?BinaryAnnotation { | 441 | pub fn next(self: *Iterator) error{InvalidDebugInfo}!?BinaryAnnotation { |
| 437 | return take(&self.reader) catch |err| switch (err) { | 442 | return take(&self.reader) catch |err| switch (err) { |
| 438 | error.ReadFailed => return error.InvalidDebugInfo, | 443 | error.ReadFailed => return error.InvalidDebugInfo, |