Commit 85fb0bd
[infer][llvm][swift] log DISubprogram-vs-instruction source-file mismatches (observability)
Summary:
Detection-only scuba probe for the Swift wrong-source-attribution reports
(synthesized accessors and real procedures anchored in the wrong file --
T273760556 / T273770363).
Under cross-module optimization, swiftc can stamp a function's `DISubprogram`
with a source file its body never references, while the body's per-instruction
`DILocation`s keep the real file(s). `Llair2Textual.should_translate` routes
each function to a per-source-file Textual module by its `DISubprogram` file, so
a mis-stamped function lands in the wrong file's module and its reports anchor at
unactionable lines.
The misattribution has not reproduced locally even with the production toolchain,
so this lands a zero-behaviour-change probe. For each translated Swift function
whose `DISubprogram` file is a real source file that appears on *none* of the
body's instruction `DILocation`s, it emits both a `swift_disubprogram_file_mismatch`
count and a `StatsLogging.log_message_with_location` event carrying:
- `proc` -- the (mangled) function name;
- `flavor` -- `accessor` (`.get`/`.set`/`.modify`, the T273760556 shape) vs
`function` (the T273770363 shape);
- `subprogram=<file>:<line>` -- the file `should_translate` routed by;
- `instr_files=[...]` -- the distinct real source files on the body's
instructions (one file => routing by an instruction loc would be safe; several
=> CMO inlined across sources).
That payload lets a production run answer, from scuba alone, how widespread the
issue is, which flavour, and whether routing by instruction loc is a viable fix.
Reviewed By: thomasorton
Differential Revision: D107270071
fbshipit-source-id: 445c6532867b6fd3160db653c32cf491248c274e1 parent 8b1c1ac commit 85fb0bd
1 file changed
Lines changed: 51 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1767 | 1767 | | |
1768 | 1768 | | |
1769 | 1769 | | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
1770 | 1819 | | |
1771 | 1820 | | |
1772 | 1821 | | |
| |||
1775 | 1824 | | |
1776 | 1825 | | |
1777 | 1826 | | |
| 1827 | + | |
| 1828 | + | |
1778 | 1829 | | |
1779 | 1830 | | |
1780 | 1831 | | |
| |||
0 commit comments