[clang] [analyzer] Don't display the offset value in underflows (PR #98621)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 12 12:47:38 PDT 2024


NagyDonat wrote:

> I wonder if we could have something in between. I'm thinking of having the concrete offset as a separate note, instead of having it part of the primary message. That way after BR selection, we would still deterministically pick the shortest parh, and also have the offset in the path notes.

Actually I had a better solution for achieving this: during my earlier experimentation I noticed that the `Profile()` methods of the `BugReporter` use the (long) `Description` field (which is "Access of `<region>` at negative byte offset -124", the final note on the bug path), but ignore the `ShortDescription` field (which is "Out of bound access to memory preceding `<region>`", the stand-alone warning message). In the commit that I just pushed, I tweaked `Profile()` to ensure that it uses the short description and ignores the long one -- which yields the right deduplication behavior.

I'd guess that `ShortDescription` was missing from the `Profile()` method because it was introduced at a later point in the development, and there are very few checkers that actually set different short and long descriptions.

(For more details see the commit message of the commit that I just pushed onto this PR.)



https://github.com/llvm/llvm-project/pull/98621


More information about the cfe-commits mailing list