[PATCH] D158561: [-Wunsafe-buffer-usage] Add AST info to the unclaimed DRE debug notes for analysis

2023-10-20 Thread Ziqing Luo via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGa4323586fcbb: [-Wunsafe-buffer-usage] Add AST info to the unclaimed DRE debug notes for… (authored by ziqingluo-90). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm

[PATCH] D158561: [-Wunsafe-buffer-usage] Add AST info to the unclaimed DRE debug notes for analysis

2023-10-03 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 557579. ziqingluo-90 added a comment. address comments CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158561/new/ https://reviews.llvm.org/D158561 Files: clang/lib/Analysis/UnsafeBufferUsage.cpp clang/test/SemaCXX/warn-unsafe-buffer-usage-d

[PATCH] D158561: [-Wunsafe-buffer-usage] Add AST info to the unclaimed DRE debug notes for analysis

2023-09-25 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 557330. ziqingluo-90 added a comment. Address comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158561/new/ https://reviews.llvm.org/D158561 Files: clang/lib/Analysis/UnsafeBufferUsage.cpp clang/test/SemaCXX/warn-unsafe-buffer-usage-

[PATCH] D157441: [-Wunsafe-buffer-usage] Use `Strategy` to determine whether to fix a parameter

2023-09-21 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 rG700baeb765cf: [-Wunsafe-buffer-usage] Use `Strategy` to determine whether to fix a parameter (authored

[PATCH] D157441: [-Wunsafe-buffer-usage] Use `Strategy` to determine whether to fix a parameter

2023-09-21 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 marked an inline comment as done. ziqingluo-90 added a comment. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2586 #endif it = FixablesForAllVars.byVar.erase(it); } else if (Tracker.hasUnclaimedUses(it->first)) { NoQ wrote:

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

2023-09-21 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 rG33f6161d9eaa: [-Wunsafe-buffer-usage] Group parameter fix-its (authored by ziqingluo-90). Changed prior to commit: https://reviews.llvm.org/D15305

[PATCH] D158561: [-Wunsafe-buffer-usage] Add AST info to the unclaimed DRE debug notes for analysis

2023-09-06 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 556070. ziqingluo-90 added a comment. Add a test CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158561/new/ https://reviews.llvm.org/D158561 Files: clang/lib/Analysis/UnsafeBufferUsage.cpp clang/test/SemaCXX/warn-unsafe-buffer-usage-debug-u

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

2023-08-24 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 553285. ziqingluo-90 marked 2 inline comments as done. ziqingluo-90 added a comment. Address comments CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153059/new/ https://reviews.llvm.org/D153059 Files: clang/include/clang/Analysis/Analyses/Uns

[PATCH] D157441: [-Wunsafe-buffer-usage] Use `Strategy` to determine whether to fix a parameter

2023-08-24 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2586 #endif it = FixablesForAllVars.byVar.erase(it); } else if (Tracker.hasUnclaimedUses(it->first)) { We cannot fix reference type variable declarations for

[PATCH] D157441: [-Wunsafe-buffer-usage] Use `Strategy` to determine whether to fix a parameter

2023-08-24 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 553226. ziqingluo-90 marked an inline comment as done. ziqingluo-90 edited the summary of this revision. ziqingluo-90 added a comment. In our offline discussion, we realized that `p = q.data()` is not always a correct fix to `p = q` for cases where only

[PATCH] D158561: [-Wunsafe-buffer-usage] Add AST info to the unclaimed DRE debug notes for analysis

2023-08-22 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision. ziqingluo-90 added reviewers: jkorous, NoQ, t-rasmud, malavikasamak. Herald added a project: All. ziqingluo-90 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. The debug note for an unclaimed DRE highlight

[PATCH] D156192: [-Wunsafe-buffer-usage] Stop generating incorrect fix-its for variable declarations with unsupported specifiers

2023-08-21 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 rGb58e52889808: [-Wunsafe-buffer-usage] Stop generating incorrect fix-its for variable… (authored by ziq

[PATCH] D156189: [-Wunsafe-buffer-usage] Refactor to let local variable fix-its and parameter fix-its share common code

2023-08-21 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added a comment. Addressed comments and have landed this patch. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156189/new/ https://reviews.llvm.org/D156189 ___ cfe-commits mailing list cfe-co

[PATCH] D156189: [-Wunsafe-buffer-usage] Refactor to let local variable fix-its and parameter fix-its share common code

2023-08-21 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 4 inline comments as done. Closed by commit rG3a67b912386e: [-Wunsafe-buffer-usage] Refactor to let local variable fix-its and parameter… (authored

[PATCH] D156762: [-Wunsafe-buffer-usage][NFC] Refactor `getFixIts`---where fix-its are generated

2023-08-18 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 rGacc8a33b257f: [-Wunsafe-buffer-usage][NFC] Refactor `getFixIts`---where fix-its are generated (authored by ziqingluo-90). Changed prior to commit:

[PATCH] D156474: [-Wunsafe-buffer-usage][NFC] Slightly refactor and optimize the code

2023-08-17 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 rG843784764ab5: [-Wunsafe-buffer-usage][NFC] Slightly refactor and optimize the code (authored by ziqingluo-90). Changed prior to commit: https://re

[PATCH] D156188: [-Wunsafe-buffer-usage] Refactor and improve for parameter fix-its

2023-08-17 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 2 inline comments as done. Closed by commit rG41279e870fa5: [-Wunsafe-buffer-usage] Refactor and improve for parameter fix-its (authored by ziqinglu

[PATCH] D157441: [-Wunsafe-buffer-usage] Use `Strategy` to determine whether to fix a parameter

2023-08-09 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added a comment. >> Extend PointerAssignmentGadget and PointerInitGadget to generate fix-its for >> cases where the left-hand side >> has won't fix strategy and the right-hand side has std::span strategy. > > Hmm, is this intertwined with other changes, or is this completely separat

[PATCH] D156188: [-Wunsafe-buffer-usage] Refactor and improve for parameter fix-its

2023-08-09 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added a comment. > Btw, how does this work with `int **`? Given that the pointee type `int *` > isn't a simple identifier. It does not require the pointee type to be a simple identifier. The (source range of) pointee type is obtained by analyzing the `TypeLoc` of a variable decl

[PATCH] D157441: [-Wunsafe-buffer-usage] Use `Strategy` to determine whether to fix a parameter

2023-08-08 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:1624 // Inserts the [0] -std::optional EndOfOperand = -getEndCharLoc(BaseDeclRefExpr, SM, Ctx.getLangOpts()); -if (EndOfOperand) { +if (auto LocPastOperand = +

[PATCH] D157441: [-Wunsafe-buffer-usage] Use `Strategy` to determine whether to fix a parameter

2023-08-08 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision. ziqingluo-90 added reviewers: t-rasmud, NoQ, 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. - Use `Strategy` to determine whether to fix

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

2023-08-04 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:1891-1892 + for (unsigned i = 0; i < NumParms; i++) { +if (!ParmsMask[i]) + continue; + NoQ wrote: > Speaking of [[ https://reviews.llvm.org/D156762#inline-1517322

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

2023-08-04 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 547425. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153059/new/ https://reviews.llvm.org/D153059 Files: clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/Analysis/UnsafeB

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

2023-08-04 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 547422. ziqingluo-90 marked an inline comment as done. ziqingluo-90 added a comment. Address comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153059/new/ https://reviews.llvm.org/D153059 Files: clang/include/clang/Analysis/Analyses/Un

[PATCH] D156762: [-Wunsafe-buffer-usage][NFC] Refactor `getFixIts`---where fix-its are generated

2023-08-04 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 547405. ziqingluo-90 marked 6 inline comments as done. ziqingluo-90 added a comment. Address comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156762/new/ https://reviews.llvm.org/D156762 Files: clang/lib/Analysis/UnsafeBufferUsage.cpp

[PATCH] D156762: [-Wunsafe-buffer-usage][NFC] Refactor `getFixIts`---where fix-its are generated

2023-08-03 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2219 + // cannot be fixed... + eraseVarsForUnfixableGroupMates(FixItsForVariable, VarGrpMgr); + // Now `FixItsForVariable` gets further reduced: a variable is in NoQ wrote

[PATCH] D156474: [-Wunsafe-buffer-usage][NFC] Slightly refactor and optimize the code

2023-08-02 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2179 + if (FixItsForVariable.count(GrpMate)) +FinalFixItsForVariable[Var].insert(FinalFixItsForVariable[Var].end(), + FixItsForVariable[

[PATCH] D155814: Fix the linting problems which causes `clang/utils/ci/run-buildbot check-format` to return 1.

2023-08-01 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added a comment. Hi @AMP999 I have committed this patch on behalf of you. Unfortunately, I cannot amend an old commit for you as it will cause rewriting a bunch of the history. I made a correction message along with the commit. Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D155814: Fix the linting problems which causes `clang/utils/ci/run-buildbot check-format` to return 1.

2023-08-01 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 rG82b94a9f7be9: Fix the linting problems in UnsafeBufferUsage.cpp (authored by AMP999, committed by ziqingluo-90). Changed prior to commit: https://

[PATCH] D156192: [-Wunsafe-buffer-usage] Stop generating incorrect fix-its for variable declarations with unsupported specifiers

2023-08-01 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added a comment. > Note that your patch doesn't actually address //type// attributes, only > //declaration// attributes. It does not address type attribute. We can address it in a follow-up patch. > So it's likely that we have to give up on unsupported type attributes very > earl

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

2023-07-31 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-multi-parm-span.cpp:37-39 +// CHECK: fix-it:{{.*}}:{[[@LINE+3]]:24-[[@LINE+3]]:30}:"std::span p" +// CHECK: fix-it:{{.*}}:{[[@LINE+2]]:32-[[@LINE+2]]:39}:"std::span q" +// CHECK: f

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

2023-07-31 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 545872. ziqingluo-90 marked 4 inline comments as done. ziqingluo-90 added a comment. Carved out NFC changes from the original diff. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153059/new/ https://reviews.llvm.org/D153059 Files: clang/inclu

[PATCH] D156762: [-Wunsafe-buffer-usage][NFC] Refactor `getFixIts`---where fix-its are generated

2023-07-31 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision. ziqingluo-90 added reviewers: NoQ, jkorous, t-rasmud, malavikasamak. Herald added a project: All. ziqingluo-90 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Refactor the `getFixIts` function for better

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

2023-07-27 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added a comment. Thanks for the suggestion of splitting this patch to smaller ones. I have one such smaller patch ready here: https://reviews.llvm.org/D156474. It does make it easier in describing and discussing about the changes. Comment at: clang/lib/Analysis/

[PATCH] D156474: [-Wunsafe-buffer-usage][NFC] Slightly refactor and optimize the code

2023-07-27 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h:25 + +class VariableGroupsManager { +public: Use the `VariableGroupsManager` class as an interface to clients. It hides the details about how groups are im

[PATCH] D156474: [-Wunsafe-buffer-usage][NFC] Slightly refactor and optimize the code

2023-07-27 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision. Herald added a reviewer: NoQ. Herald added a project: All. ziqingluo-90 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Slightly refactor and optimize the code in preparation for implementing grouping pa

[PATCH] D155524: [-Wunsafe-buffer-usage] Ignore the FixableGadgets that will not be fixed at an earlier stage

2023-07-25 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:1095-1102 // Gadgets "claim" variables they're responsible for. Once this loop finishes, // the tracker will only track DREs that weren't claimed by any gadgets, // i.e. not underst

[PATCH] D155524: [-Wunsafe-buffer-usage] Ignore the FixableGadgets that will not be fixed at an earlier stage

2023-07-25 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 rGcfcf76c6ad72: [-Wunsafe-buffer-usage] Ignore the FixableGadgets that will not be fixed at an… (authore

[PATCH] D156189: [-Wunsafe-buffer-usage] Refactor to let local variable fix-its and parameter fix-its share common code

2023-07-25 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:1824 + + if (!IdentText) +return {}; t-rasmud wrote: > When will this condition be satisfied? I just want to understand if there are > code examples where there is no i

[PATCH] D156189: [-Wunsafe-buffer-usage] Refactor to let local variable fix-its and parameter fix-its share common code

2023-07-25 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 544111. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156189/new/ https://reviews.llvm.org/D156189 Files: clang/lib/Analysis/UnsafeBufferUsage.cpp clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-local-var-span.cpp clang/test/SemaCXX/war

[PATCH] D156188: [-Wunsafe-buffer-usage] Refactor and improve for parameter fix-its

2023-07-25 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 544104. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156188/new/ https://reviews.llvm.org/D156188 Files: clang/lib/Analysis/UnsafeBufferUsage.cpp clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span.cpp clang/test/SemaCXX/warn-uns

[PATCH] D154880: [-Wunsafe-buffer-usage][WIP] Add a facility for debugging low fixit coverage.

2023-07-25 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added a comment. This is a lot of work, thank you @t-rasmud & @NoQ ! I have a minor suggestion: can we use some macros to make the debug stub even shorter? The prefix `"failed to produce fixit for declaration"` is used in many places so probably we do not have to repeat it everywh

[PATCH] D155814: Fix the linting problems which causes `clang/utils/ci/run-buildbot check-format` to return 1.

2023-07-24 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. Thanks for cleaning the trailing whites. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155814/new/ https://reviews.llvm.org/D155814 __

[PATCH] D156192: [-Wunsafe-buffer-usage] Stop generating incorrect fix-its for variable declarations with unsupported specifiers

2023-07-24 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision. ziqingluo-90 added reviewers: NoQ, jkorous, t-rasmud, malavikasamak. Herald added a project: All. ziqingluo-90 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. We have to give up on fixing a variable decla

[PATCH] D156189: [-Wunsafe-buffer-usage] Refactor to let local variable fix-its and parameter fix-its share common code

2023-07-24 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-local-var-span.cpp:242 ptr[2] = 30; - auto p = new int[10]; - // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:11}:"std::span p" We no longer generat

[PATCH] D156189: [-Wunsafe-buffer-usage] Refactor to let local variable fix-its and parameter fix-its share common code

2023-07-24 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision. ziqingluo-90 added reviewers: NoQ, jkorous, t-rasmud, malavikasamak. Herald added a project: All. ziqingluo-90 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Refactor the code for local variable fix-its

[PATCH] D156188: Refactor and improve for parameter fix-its

2023-07-24 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision. ziqingluo-90 added reviewers: NoQ, jkorous, t-rasmud, malavikasamak. Herald added a project: All. ziqingluo-90 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. - Factor out the code that will be shared by

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

2023-07-24 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 abandoned this revision. ziqingluo-90 added a comment. In D150338#4503802 , @ziqingluo-90 wrote: > Re-landed in `a07a6f6c74a03405eccdcd3832acb2187d8b9c21` > > Moved the use of `clang::Sema` from `UnsafeBufferAnalysis` to > `AnalysisBasedWar

[PATCH] D155667: [-Wunsafe-buffer-usage] Check source location validity before using `TypeLoc`s

2023-07-19 Thread Ziqing Luo via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGa6302b6934b3: [-Wunsafe-buffer-usage] Check source location validity before using `TypeLoc`s (authored by ziqingluo-90). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.

[PATCH] D155524: [-Wunsafe-buffer-usage] Ignore the FixableGadgets that will not be fixed at an earlier stage

2023-07-19 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 542199. ziqingluo-90 added a comment. Address comments CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155524/new/ https://reviews.llvm.org/D155524 Files: clang/lib/Analysis/UnsafeBufferUsage.cpp clang/test/SemaCXX/warn-unsafe-buffer-usage-p

[PATCH] D155641: [-Wunsafe-buffer-usage] Do not assert that function parameters have names.

2023-07-19 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 rG4b5f17e008c6: [-Wunsafe-buffer-usage] Do not assert that function parameters have names (authored by z

[PATCH] D155641: [-Wunsafe-buffer-usage] Do not assert that function parameters have names.

2023-07-19 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/Analysis/UnsafeBufferUsage.cpp:1890-1891 + // A parameter of a function definition has no name. + // FIXME: We should create a name for the parameter as part of the

[PATCH] D155667: [-Wunsafe-buffer-usage] Check source location validity before using `TypeLoc`s

2023-07-18 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision. ziqingluo-90 added reviewers: NoQ, jkorous, t-rasmud, malavikasamak. Herald added a project: All. ziqingluo-90 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. The safe-buffer analysis analyzes `TypeLoc`s

[PATCH] D155524: [-Wunsafe-buffer-usage] Ignore the FixableGadgets that will not be fixed at an earlier stage

2023-07-18 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:1095-1102 // Gadgets "claim" variables they're responsible for. Once this loop finishes, // the tracker will only track DREs that weren't claimed by any gadgets, // i.e. not underst

[PATCH] D155641: [-Wunsafe-buffer-usage] Do not assert that function parameters have names.

2023-07-18 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision. ziqingluo-90 added reviewers: jkorous, NoQ, t-rasmud, malavikasamak. Herald added a project: All. ziqingluo-90 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. It is possible that a function parameter does

[PATCH] D155524: [-Wunsafe-buffer-usage] Ignore the FixableGadgets that will not be fixed at an earlier stage

2023-07-18 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 541652. ziqingluo-90 marked an inline comment as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155524/new/ https://reviews.llvm.org/D155524 Files: clang/lib/Analysis/UnsafeBufferUsage.cpp clang/test/SemaCXX/warn-unsafe-buffer-usage-pra

[PATCH] D155524: [-Wunsafe-buffer-usage] Ignore the FixableGadgets that will not be fixed at an earlier stage

2023-07-17 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/Analysis/UnsafeBufferUsage.cpp:2346 + // computed above. We do not want to generate fix-its for such variables, + // since they are neither warned nor reachable from a warn

[PATCH] D155524: [-Wunsafe-buffer-usage] Ignore the FixableGadgets that will not be fixed at an earlier stage

2023-07-17 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 541279. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155524/new/ https://reviews.llvm.org/D155524 Files: clang/lib/Analysis/UnsafeBufferUsage.cpp clang/test/SemaCXX/warn-unsafe-buffer-usage-pragma-fixit.cpp Index: clang/test/SemaCXX/warn-u

[PATCH] D155524: [-Wunsafe-buffer-usage] Ignore the FixableGadgets that will not be fixed at an earlier stage

2023-07-17 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 541269. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155524/new/ https://reviews.llvm.org/D155524 Files: clang/lib/Analysis/UnsafeBufferUsage.cpp clang/test/SemaCXX/warn-unsafe-buffer-usage-pragma-fixit.cpp Index: clang/test/SemaCXX/warn-u

[PATCH] D155524: [-Wunsafe-buffer-usage] Ignore the FixableGadgets that will not be fixed at an earlier stage

2023-07-17 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision. ziqingluo-90 added reviewers: NoQ, jkorous, t-rasmud, malavikasamak. Herald added a project: All. ziqingluo-90 requested review of this revision. Herald added subscribers: cfe-commits, wangpc. Herald added a project: clang. When some unsafe operations are suppre

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

2023-07-15 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added a comment. Re-landed in `a07a6f6c74a03405eccdcd3832acb2187d8b9c21` Moved the use of `clang::Sema` from `UnsafeBufferAnalysis` to `AnalysisBasedWarnings`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150338/new/ https://reviews

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

2023-07-15 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added a comment. In D150338#4502885 , @chapuni wrote: > Excuse me, I have reverted this due to circular deps. > `clangAnalysis` should not depend on `clangSema`. Thank you @chapuni , I will fix it soon. Repository: rG LLVM Github Monore

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

2023-07-14 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 rG5b012bf5ab5f: [-Wunsafe-buffer-usage] Improving insertion of the [[clang… (authored by ziqingluo-90). Repository: rG LLVM Github Monorepo CHANGES

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

2023-07-14 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 540548. ziqingluo-90 added a comment. rebase CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150338/new/ https://reviews.llvm.org/D150338 Files: clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h clang/lib/Analysis/UnsafeBufferUsage.c

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

2023-07-12 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added a comment. - a major change to the patch: Parameters are now grouped after the grouping of all variables. The groups that contain parameters of the function will form a union group. - changes to the grouping algorithm: Groups will reside in the vector `Groups` and being ac

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

2023-07-12 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 539720. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153059/new/ https://reviews.llvm.org/D153059 Files: clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/Analysis/UnsafeB

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

2023-06-23 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2293 +// search of connected components. +if (!ParmsNeedFix.empty()) { + auto First = ParmsNeedFix.begin(), Last = First; NoQ wrote: > ziqingluo-90 wrote: >

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

2023-06-22 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2293 +// search of connected components. +if (!ParmsNeedFix.empty()) { + auto First = ParmsNeedFix.begin(), Last = First; NoQ wrote: > ziqingluo-90 wrote: >

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

2023-06-22 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-multi-parm-span.cpp:13-15 + expected-note{{change type of 'p' to 'std::span' to preserve bounds information, and change 'q' and 'a' to 'std::span' to propagate bounds informati

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

2023-06-21 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2077 + for (const auto &[VD, Fixables] : FixablesForUnsafeVars.byVar) { FixItsForVariable[VD] = NoQ wrote: > There's a bug in variable naming: `FixablesForUnsafeVars`

[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] 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 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] 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] 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-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] 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-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] 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-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] 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 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-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-05 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 519958. ziqingluo-90 marked an inline comment as done. 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.cp

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

2023-05-05 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:2363-2364 + if (isa(Node)) { +// to visit implicit children of `LambdaExpr`s: +IsVisitingLambda = true; +

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

2023-05-04 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:2335 + // To analyze callables: + if (isa(Node)) { +// For code in dependent contexts, we'll do this at instantiation time: NoQ wrote: > The intended way to

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

2023-05-04 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 519719. ziqingluo-90 marked 3 inline comments as done. ziqingluo-90 added a comment. Addressed the comments: - 1) about using a more traditional way of AST traversal; and - 2) about the concern on `ObjcMethodDecl` traversal. CHANGES SINCE LAST ACTION

[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] 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] D144304: [-Wunsafe-buffer-usage] Add a Fixable for pointer pre-increment

2023-04-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. Closed by commit rG762af11d4c5d: [-Wunsafe-buffer-usage] Add a Fixable for pointer pre-increment (authored by ziqingluo-90). Changed prior to commit: https://reviews

[PATCH] D144064: [-Wunsafe-buffer-usage] Match unsafe pointers being casted to bool or participating in pointer subtractions

2023-04-11 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 rG88f7f018e23b: [-Wunsafe-buffer-usage] Match unsafe pointers being casted to bool or… (authored by ziqingluo-90). Changed prior to commit: https://

[PATCH] D143680: [-Wunsafe-buffer-usage] Improve fix-its for local variable declarations with null pointer initializers

2023-04-10 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 rG63413015099b: [-Wunsafe-buffer-usage] Improve fix-its for local variable declarations with… (authored by ziqingluo-90). Changed prior to commit: h

cfe-commits@lists.llvm.org

2023-04-05 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added a comment. In D143128#4245112 , @DavidSpickett wrote: > I've reverted this, please try to fix the test then reland. > > The full test output can be downloaded from the buildbot page, if you need > any more information let me know. Th

[PATCH] D144304: [-Wunsafe-buffer-usage] Add a Fixable for pointer pre-increment

2023-04-04 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 marked an inline comment as done. ziqingluo-90 added inline comments. Comment at: clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-addressof-arraysubscript.cpp:19 bool a = (bool) &p[5]; - // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:19-[[@LINE-1]]:24}:"(p.data() + 5

cfe-commits@lists.llvm.org

2023-04-04 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 rG87b5807d3802: [-Wunsafe-buffer-usage] Fix-Its transforming `&DRE[any]` to `&DRE.data()[any]` (authored by ziqingluo-90). Changed prior to commit:

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

2023-03-27 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added a comment. In D137379#4225000 , @manojgupta wrote: > This is firing even in checked length codes, is that expected? Yes, it is expected. The unsafe buffer analysis is syntax-based. The analysis warns operations that do not follow t

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

2023-03-24 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 updated this revision to Diff 508249. ziqingluo-90 added a comment. Address comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146342/new/ https://reviews.llvm.org/D146342 Files: clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h clang/include/clang/Sema/An

[PATCH] D146669: [-Wunsafe-buffer-usage] Hide fixits/suggestions behind an extra flag, -fsafe-buffer-usage-suggestions.

2023-03-23 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:2203 +if (IsRelatedToDecl) { + assert(!SuggestSuggestions && + "Variables blamed for unsafe buffer usage without suggestions!"); nitpick: I was a bit co

[PATCH] D146669: [-Wunsafe-buffer-usage] Hide fixits/suggestions behind an extra flag, -fsafe-buffer-usage-suggestions.

2023-03-23 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments. Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:1139 UnsafeBufferUsageHandler &Handler, + bool EmitSuggestions, bool EmitFixits) { --

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

2023-03-22 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added a comment. The template specialization information is still available but we may need to print it by ourselves. I will add a FIXME there and we will deal with it in a follow-up patch. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.or

  1   2   3   >