<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Uninitialized Reads Cannot Be Suppressed On A Per-Field Level"
href="https://bugs.llvm.org/show_bug.cgi?id=34521">34521</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Uninitialized Reads Cannot Be Suppressed On A Per-Field Level
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Static Analyzer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>kremenek@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>russ@eatnumber1.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>I have a type which is by-design intended to behave like a primitive type. E.g.
class MyInt {
int i_;
public:
int get() { return i_; }
void assign(int i) { i_ = i; )
};
ClangTidy marks the read of i_ in get() as an uninitialized read (which it is)
by emitting clang-analyzer-core.CallAndMessage; but since MyInt is intended to
work like a primitive type, it is intended that the following code is UB:
MyInt i;
i.get();
I could simply add a // NOLINT(clang-analyzer-core.CallAndMessage) suppression
to the read of i_, but future changes to the class which introduce additional
reads of i_ will need to duplicate the suppression. Ideally, there would be a
way to suppress the warning on the declaration of i_ such that it will not emit
the warning on any reads of the field. Even better, it would be ideal to be
able to mark MyInt as a "primitive-like" type so the CallAndMessage analyzer
would warn on uninitialized reads of the MyInt type.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>