[-Wunsafe-buffer-usage] Bug fix: Handles the assertion violations for code within...
authorMalavikaSamak <malavika2@apple.com>
Fri, 21 Apr 2023 17:55:01 +0000 (10:55 -0700)
committerMalavikaSamak <malavika2@apple.com>
Mon, 24 Apr 2023 23:10:15 +0000 (16:10 -0700)
commit9bd0db80784e30d40a4a65f1b47109c833f05b54
tree3197ffde19174825140fdd80c2b01b75a8907b85
parent1e8960c7a588c117bf703221ce656aeb034219c5
[-Wunsafe-buffer-usage] Bug fix: Handles the assertion violations for code within macros

When macros get expanded, the source location for the expanded code received by the Fixable
gadgets is invalid. We do not want to emit fixits for macro expanded code and it currently
crashes the analysis. This patch fixes the assertion violations that were introduced for
handling code with such invalid locations.

Reviewed by: NoQ, ziqingluo-90, jkorous

Differential revision: https://reviews.llvm.org/D146450
clang/lib/Analysis/UnsafeBufferUsage.cpp
clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-local-var-span.cpp