<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62985>62985</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
False positive clang-analyzer-cplusplus.NewDelete for QWeakPointer when using `-isystem` flags
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
timxx
</td>
</tr>
</table>
<pre>
For the following example code, run the clang-tidy as `clang-tidy foo.cpp -- -isystem /usr/include/qt/QtCore/ -I/usr/include/qt/` (Suppose the qt5 headers installed at /usr/include/qt)
```C++
#include <QWeakPointer>
void test(const QWeakPointer<QObject>& p)
{
QWeakPointer<QObject> t;
t = p;
}
```
The following warning generated
```
1 warning generated.
/usr/include/qt/QtCore/qsharedpointer_impl.h:159:50: warning: Use of memory after it is freed [clang-analyzer-cplusplus.NewDelete]
inline void operator delete(void *ptr) { ::operator delete(ptr); }
^
```
It's strange when using `-I` instead of `-isystem`, it won't report this problem, which is expected (Even using -header-filter=.*).
It can be reproduce on Windows platform too.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVE1z4zYM_TXwBSONTFmydNDBH9FMLm0zbWePHUqELLYUyZBUHPfXdyg762S32fXQpgU9AHwPALn38qSJGij2UBxXfA6jcU2Q0-vrqjPi0rTGYRgJB6OUOUt9Qnrlk1WEvREE7IBu1guiV1yfkiDFBblHKLN3hsGYtLcWMUkwkf7iA00IrJ29A9ZK3as5BmufA7D2KRyMi0-YPH6GgTJDYNXvs7XG05L_ORQ4EhfkPErtA1eKBPLwWZ4asiNku9tvmV3XAdg-rquV5TcfhPzw9IX4P78ZqQM5yB_eu78YKTCQD8Cq3mgf8CP48PRr9zf1IbqxEu09-_YtVVZ_6oIB8jssIORHtHfT9vgNh_cn--ND7c7c6bifSJPjgcT_eq6_x6VvgvykZM9-5I6EvbL4S05WpSPku3VRQ74rMsh3b8Hj3z89oRlwosm4C_IhkEMZUHocHJFAKPbXLuKaq8u_5JLeqtnHb_oLnY-kKBAUNwHw9pFaSU24FMXYSMA4FFcsqxYzsJ0NDliNsN0j5DvId99DrxDI9_hVZITi4QdyPwZgW48-OK5PhOeRNM4-SgllljzGto29SVxE3tF2m4YYhx0i-bPRwLYBHVnjAoZRerTOdIqmiDiPsh-jQvRqqQ9RJFY9vHzNk1xnIBmkWvromALbAavTj8fEnmvsKGZxRsw9odH4RWphzh6t4mEwbsJgTLoSTS7qvOYratZlVeRlkdfr1dhkmz6rulJU23LoeM_6ruo4Y6LbiHKdbcRKNixjeVawep1neValxVDUHas3LNtW67obYJPRxKVKlXqZUuNOK-n9TE3J6qpYKd6R8svVxJimMy4vgbF4U7km-iTdfPKwyZT0wd-jBBkUNS1XntAaL4N8ebufftRIOBj3YXC_rd-9VjgofvKr2almDMH62EGsBdaeZBjnLu3NBKyNB7ptiXVmGWfWLjQ8sHah-V8AAAD___GvuV4">