Taking the address of a reference parameter might be valid, and without
CFA, false positives are going to be more trouble than they're worth.
This reverts commit 499571ea835daf786626a0db1e12f890b6cd8f8d.
Differential D102728
[clang][Sema] removes -Wfree-nonheap-object reference param false positive cjdb on May 18 2021, 3:02 PM. Authored by
Details Taking the address of a reference parameter might be valid, and without This reverts commit 499571ea835daf786626a0db1e12f890b6cd8f8d.
Diff Detail
Event TimelineComment Actions Thanks for following up on this.
Comment Actions Oops, looks like I never submitted my replies!
Comment Actions Could probably haggle over the tests some more, but might be diminishing returns at this point. Looks good! Might suggest separating the code cleanup mlir changes from the warning change (committing the warning change first, then as a follow-up committing the mlir change), ideally. Not a huge deal either way - but the usual "separable changes should be separated". |
It doesn't look like the parameter case is tested, is it? And is it necessary? I think it'd be reasonable to warn on void f1(int i) { free(&i); } - so I think it's only the "is it a reference type" that's the important property.