[PATCH] D140179: [WIP][-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas

2023-01-19 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:551-555 +allOf(declStmt().bind("any_ds"), notInSafeBufferOptOut()) +// We match all DREs regardless of whether they are in safe-buffer +// opt-out region. Because an

[PATCH] D140179: [WIP][-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas

2023-01-19 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:543 #define GADGET(x) \ -x ## Gadget::matcher().bind(#x), +allOf(x ## Gadget::matcher().bind(#x),

[PATCH] D140179: [WIP][-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas

2023-01-19 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:551-555 +allOf(declStmt().bind("any_ds"), notInSafeBufferOptOut()) +// We match all DREs regardless of whether they are in safe-buffer +// opt-out region. Because an unclaimed

[PATCH] D140179: [WIP][-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas

2023-01-19 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/include/clang/Basic/Diagnostic.h:1040-1043 + // An ordered sequence of "-Wunsafe-buffer-usage" opt-out regions in one + // translation unit. Each region is represented by a pair of start and end + // locations. +

[PATCH] D140179: [WIP][-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas

2023-01-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/include/clang/Basic/Diagnostic.h:1040-1043 + // An ordered sequence of "-Wunsafe-buffer-usage" opt-out regions in one + // translation unit. Each region is represented by a pair of start and end + // locations. + SmallVector, 8>

[PATCH] D140179: [WIP][-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas

2023-01-13 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 489136. ziqingluo-90 added a comment. Rebase the patch. Move the check of whether a node is in an opt-out region to an earlier stage---the AST matching stage. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D140179/new/

[PATCH] D140179: [WIP][-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas

2022-12-16 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/include/clang/Basic/DiagnosticLexKinds.td:943 +def warn_pragma_unsafe_buffer_usage_misorder : +ExtWarn<"pragma unsafe_buffer_usage used in misorder">, + InGroup; NoQ wrote: > IIUC `ExtWarn` means it's a

[PATCH] D140179: [WIP][-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas

2022-12-16 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 483645. ziqingluo-90 added a comment. Addressing comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D140179/new/ https://reviews.llvm.org/D140179 Files: clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h

[PATCH] D140179: [WIP][-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas

2022-12-16 Thread Jan Korous via Phabricator via cfe-commits
jkorous added inline comments. Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:2379 +for (auto UnsafeUse : UnsafeUses) + if (!DE.isSafeBufferOptOut(SM, UnsafeUse->getBeginLoc())) +UnsafeUsesToReport.push_back(UnsafeUse); NoQ wrote: > I

[PATCH] D140179: [WIP][-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas

2022-12-16 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 483579. ziqingluo-90 added a comment. Fixing bugs in my test. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D140179/new/ https://reviews.llvm.org/D140179 Files: clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h

[PATCH] D140179: [WIP][-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas

2022-12-15 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/include/clang/Basic/DiagnosticLexKinds.td:943 +def warn_pragma_unsafe_buffer_usage_misorder : +ExtWarn<"pragma unsafe_buffer_usage used in misorder">, + InGroup; IIUC `ExtWarn` means it's a warning of the form