[PATCH] D146342: [-Wunsafe-buffer-usage] Move the whole analysis to the end of a translation unit

2023-05-09 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 520859. ziqingluo-90 added a comment. Visit `LambdaExpr` properly CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146342/new/ https://reviews.llvm.org/D146342 Files: clang/include/clang/Sema/AnalysisBasedWarnings.h clang/lib/Sema/AnalysisBas

[PATCH] D146342: [-Wunsafe-buffer-usage] Move the whole analysis to the end of a translation unit

2023-05-10 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 521176. ziqingluo-90 added a comment. Clean up the code for early return in case of ignoring `unsafe_buffer_usage` warnings. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146342/new/ https://reviews.llvm.org/D146342 Files: clang/include/cla

[PATCH] D146342: [-Wunsafe-buffer-usage] Move the whole analysis to the end of a translation unit

2023-05-10 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 521177. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146342/new/ https://reviews.llvm.org/D146342 Files: clang/include/clang/Sema/AnalysisBasedWarnings.h clang/lib/Sema/AnalysisBasedWarnings.cpp clang/lib/Sema/Sema.cpp clang/test/SemaCX

[PATCH] D146342: [-Wunsafe-buffer-usage] Move the whole analysis to the end of a translation unit

2023-05-10 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 521184. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146342/new/ https://reviews.llvm.org/D146342 Files: clang/include/clang/Sema/AnalysisBasedWarnings.h clang/lib/Sema/AnalysisBasedWarnings.cpp clang/lib/Sema/Sema.cpp clang/test/SemaCX

[PATCH] D150338: [-Wunsafe-buffer-usage][WIP] Improving insertion of the [[clang::unsafe_buffer_usage]] attribute

2023-05-10 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision. ziqingluo-90 added reviewers: jkorous, NoQ, malavikasamak, t-rasmud. Herald added a subscriber: jdoerfert. Herald added a project: All. ziqingluo-90 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. For fix

[PATCH] D146342: [-Wunsafe-buffer-usage] Move the whole analysis to the end of a translation unit

2023-05-11 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 521409. ziqingluo-90 added a comment. Address comments: refactor the callable-definition visitor to take a lambda Callback, who calls various analyses that need whole-TU information.If one needs to add a new such analysis later, just add a call i

[PATCH] D146342: [-Wunsafe-buffer-usage] Move the whole analysis to the end of a translation unit

2023-05-12 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 marked an inline comment as done. ziqingluo-90 added inline comments. Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:2364 + Node->getBeginLoc())) { + UnsafeBufferUsageReporter R(S); + clang::checkUnsafeBufferUsage(Node, R, Unsa

[PATCH] D146342: [-Wunsafe-buffer-usage] Move the whole analysis to the end of a translation unit

2023-05-12 Thread Ziqing Luo via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. ziqingluo-90 marked an inline comment as done. Closed by commit rG6d861d498de1: [-Wunsafe-buffer-usage] Move the whole analysis to the end of a translation unit (author

[PATCH] D146773: [-Wunsafe-buffer-usage] Make raw (ungrouped) warnings a bit more verbose.

2023-05-18 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 accepted this revision. ziqingluo-90 added a comment. This revision is now accepted and ready to land. LGTM, Thanks! Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146773/new/ https://reviews.llvm.org/D146773

[PATCH] D146342: [-Wunsafe-buffer-usage] Move the whole analysis to the end of a translation unit

2023-04-26 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 517413. ziqingluo-90 added a comment. Move the traversal framework to `AnalysisBasedWarnings` so that the `UnsafeBufferUsage` analyzer (as well as other possible analyzers) is still function based. It is in the same pattern as the original `IssueWarnin

[PATCH] D146342: [-Wunsafe-buffer-usage] Move the whole analysis to the end of a translation unit

2023-05-01 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 518608. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146342/new/ https://reviews.llvm.org/D146342 Files: clang/include/clang/Sema/AnalysisBasedWarnings.h clang/lib/Sema/AnalysisBasedWarnings.cpp clang/lib/Sema/Sema.cpp clang/test/SemaCX

[PATCH] D143048: [-Wunsafe-buffer-usage] Add T* -> span Fix-Its for function parameters

2023-06-09 Thread Ziqing Luo via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG1e270be0886c: [-Wunsafe-buffer-usage] Add fix-its for function parameters using the `span`… (authored by ziqingluo-90). Herald added a project: clang

[PATCH] D153059: [-Wunsafe-buffer-usage][WIP] Group parameter fix-its

2023-06-15 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision. ziqingluo-90 added reviewers: NoQ, t-rasmud, jkorous, malavikasamak. Herald added a project: All. ziqingluo-90 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. For a function `F` whose parameters need to b

[PATCH] D153059: [-Wunsafe-buffer-usage][WIP] Group parameter fix-its

2023-06-15 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2085 continue; } for (const auto &F : Fixables) { I changed the rest of this function drastically so let me explain what I did. The table `FixItsForVariable

[PATCH] D153059: [-Wunsafe-buffer-usage][WIP] Group parameter fix-its

2023-06-15 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2264 + // variable `x` implicates fixing `y`: DepMapTy PtrAssignmentGraph{}; + ziqingluo-90 wrote: > How about changing the variable name to `PtrImplicationGraph`? For t

[PATCH] D137379: [-Wunsafe-buffer-usage] Add warnings for unsafe buffer accesses by array subscript operations

2022-12-06 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/test/SemaCXX/warn-unsafe-buffer-usage.cpp:16 +void testArraySubscripts(int *p, int **pp) { + foo(p[0], // expected-warning{{unchecked operation on raw buffer in expression}} + pp[0][0], // expected-w

[PATCH] D137379: [-Wunsafe-buffer-usage] Add warnings for unsafe buffer accesses by array subscript operations

2022-12-06 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 480703. ziqingluo-90 added a comment. Addressing all the comments we have so far. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D137379/new/ https://reviews.llvm.org/D137379 Files: clang/include/clang/Analysis/Analyses/UnsafeBufferUsageGadget

[PATCH] D139737: [-Wunsafe-buffer-usage] Initiate Fix-it generation for local variable declarations

2022-12-09 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision. ziqingluo-90 added reviewers: jkorous, NoQ, t-rasmud, malavikasamak, aaron.ballman, xazax.hun, gribozavr. Herald added a subscriber: rnkovacs. Herald added a project: All. ziqingluo-90 requested review of this revision. Herald added a project: clang. Herald adde

[PATCH] D140179: [WIP][-Wunsafe-buffer-usage] Add safe buffer opt-out pragma

2022-12-15 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision. ziqingluo-90 added reviewers: jkorous, NoQ, malavikasamak, t-rasmud. Herald added a project: All. ziqingluo-90 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Add a pair of clang pragmas: `#pragma clang u

[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 clang/include/clang/B

[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 clang/include/clang/Basi

[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 warn

[PATCH] D138318: [-Wunsafe-buffer-usage] Improve pointer match pattern

2022-12-16 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 483658. ziqingluo-90 added a comment. Addressing comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138318/new/ https://reviews.llvm.org/D138318 Files: clang/lib/Analysis/UnsafeBufferUsage.cpp clang/test/SemaCXX/warn-unsafe-buffer-usa

[PATCH] D137379: [-Wunsafe-buffer-usage] Add warnings for unsafe buffer accesses by array subscript operations

2022-12-16 Thread Ziqing Luo via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG6d1d055fad50: [-Wunsafe-buffer-usage] Add warnings for unsafe buffer accesses by array… (authored by ziqingluo-90). Repository: rG LLVM Github Mon

[PATCH] D138318: [-Wunsafe-buffer-usage] Improve pointer match pattern

2022-12-16 Thread Ziqing Luo via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG04202b94b684: [-Wunsafe-buffer-usage] Improve pointer matching pattern (authored by ziqingluo-90). Changed prior to commit: https://reviews.llvm.o

[PATCH] D138321: [-Wunsafe-buffer-usage] Ignore array subscript on literal zero

2022-12-16 Thread Ziqing Luo via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGf6c54cdbc439: [-Wunsafe-buffer-usage] Ignore array subscript on literal zero (authored by ziqingluo-90). Changed prior to commit: https://reviews.

<    1   2   3