[PATCH] D158771: [clang][tooling] Fix `name` range-selector to handle TypeLocs correctly.

2023-08-24 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua accepted this revision. li.zhe.hua added inline comments. This revision is now accepted and ready to land. Comment at: clang/lib/Tooling/Transformer/RangeSelector.cpp:239-240 + !SpecLoc.isNull()) +return CharSourceRange::getTokenRange(SpecLoc.getTempla

[PATCH] D149677: [clang][TypePrinter] Add option to skip over elaborated types

2023-06-06 Thread Eric Li 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 rG3cb6ead77c66: [clang][TypePrinter] Add option to skip over elaborated types (authored by li.zhe.hua). Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D149677: [clang][TypePrinter] Add option to skip over elaborated types

2023-05-26 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added inline comments. Comment at: clang/lib/AST/TypePrinter.cpp:1570 + if (Policy.IgnoreElaboratedQualifiers) { +printBefore(T->getNamedType(), OS); aaron.ballman wrote: > So, effectively, the idea here is: you want the ability to skip printing

[PATCH] D149677: [clang][TypePrinter] Add option to skip over elaborated types

2023-05-26 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 526128. li.zhe.hua added a comment. Switch option name to SuppressElaboration Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D149677/new/ https://reviews.llvm.org/D149677 Files: clang/include/clang/AST/Pret

[PATCH] D149677: [clang][TypePrinter] Add option to skip over elaborated types

2023-05-17 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added a comment. In D149677#4349523 , @aaron.ballman wrote: > In D149677#4320178 , @li.zhe.hua > wrote: > >> Some additional context: I'm working on a refactoring tool to, in part, >> deprecate an al

[PATCH] D149677: [clang][TypePrinter] Add option to skip over elaborated types

2023-05-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added a comment. In D149677#4319646 , @aaron.ballman wrote: > Will this new printing policy be used in tree? Not initially, no. (I'm understanding "in tree" as "in the LLVM project".) Some additional context: I'm working on a refactoring too

[PATCH] D149677: [clang][TypePrinter] Add option to skip over elaborated types

2023-05-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 519643. li.zhe.hua marked an inline comment as done. li.zhe.hua added a comment. Accept suggested edits. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D149677/new/ https://reviews.llvm.org/D149677 Files: c

[PATCH] D149677: [clang][TypePrinter] Add option to skip over elaborated types

2023-05-02 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Elaborated types are sugar that represent how the type was spelled in the original source. When printing a type outsid

[PATCH] D141636: [libTooling] Rename `getRangeForEdit` as `getFileRangeForEdit`

2023-01-18 Thread Eric Li 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 rG2307029b1a43: [libTooling] Rename `getRangeForEdit` as `getFileRangeForEdit` (authored by li.zhe.hua). Repository: rG LLVM Github Monorepo CHANGE

[PATCH] D141636: [libTooling] Rename `getRangeForEdit` as `getFileRangeForEdit`

2023-01-18 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 490248. li.zhe.hua added a comment. Update test name Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141636/new/ https://reviews.llvm.org/D141636 Files: clang/include/clang/Tooling/Transformer/SourceCode.h

[PATCH] D141634: [libTooling] Add `getFileRange` as an alternative to `getRangeForEdit`

2023-01-12 Thread Eric Li 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 rG7d0cdbf69edf: [libTooling] Add `getFileRange` as an alternative to `getRangeForEdit` (authored by li.zhe.hua). Repository: rG LLVM Github Monorepo

[PATCH] D141634: [libTooling] Add `getFileRange` as an alternative to `getRangeForEdit`

2023-01-12 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 488780. li.zhe.hua added a comment. Try this again... Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141634/new/ https://reviews.llvm.org/D141634 Files: clang/include/clang/Tooling/Transformer/SourceCode.h

[PATCH] D141634: [libTooling] Add `getFileRange` as an alternative to `getRangeForEdit`

2023-01-12 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 488779. li.zhe.hua added a comment. Upload correct commit this time... Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141634/new/ https://reviews.llvm.org/D141634 Files: clang/include/clang/Tooling/Transfo

[PATCH] D141634: [libTooling] Add `getFileRange` as an alternative to `getRangeForEdit`

2023-01-12 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 488778. li.zhe.hua added a comment. Fix description. Remove default argument. Fix copy/paste error. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141634/new/ https://reviews.llvm.org/D141634 Files: clang/

[PATCH] D141636: [libTooling] Rename `getRangeForEdit` as `getFileRangeForEdit`

2023-01-12 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. With the addition of `getFileRange`, we rename `getRangeForEdit` as `getFileRang

[PATCH] D141634: [libTooling] Add `getFileRange` as an alternative to `getRangeForEdit`

2023-01-12 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Add a `getFileRange` function alongside the existing `getRangeForEdit` as a way

[PATCH] D139676: [libTooling] Add flag to getRangeForEdit to ignore macro expansions

2022-12-08 Thread Eric Li via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. li.zhe.hua marked an inline comment as done. Closed by commit rGa78d4b5ba716: [libTooling] Add flag to getRangeForEdit to ignore macro expansions (authored by li.zhe.hu

[PATCH] D139676: [libTooling] Add flag to getRangeForEdit to ignore macro expansions

2022-12-08 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua marked 2 inline comments as done. li.zhe.hua added inline comments. Comment at: clang/lib/Tooling/Transformer/SourceCode.cpp:90-92 + Loc = Expansion.getExpansionLocStart(); + if (Loc.isFileID()) +return true; ymandel wrote: > can you

[PATCH] D139676: [libTooling] Add flag to getRangeForEdit to ignore macro expansions

2022-12-08 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 481506. li.zhe.hua added a comment. Address comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D139676/new/ https://reviews.llvm.org/D139676 Files: clang/include/clang/Tooling/Transformer/SourceCode.h

[PATCH] D139676: [libTooling] Add flag to getRangeForEdit to ignore macro expansions

2022-12-08 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. This commit resolves the FIXME around the behavior of `Lexer::makeFileCharRange`

[PATCH] D137948: [clang][dataflow] Add widening API and implement it for built-in boolean model.

2022-11-15 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added inline comments. Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h:166 + + // The second-choice implementation: `transferBranch` is implemented. No-op. + template I think this is missing a word. Comme

[PATCH] D135816: [clang] Support `constexpr` for some `ASTNodeKind` member functions

2022-10-13 Thread Eric Li via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. li.zhe.hua marked an inline comment as done. Closed by commit rG576283c3a8ef: [clang] Support `constexpr` for some `ASTNodeKind` member functions (authored by li.zhe.hu

[PATCH] D135816: [clang] Support `constexpr` for some `ASTNodeKind` member functions

2022-10-13 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua marked an inline comment as done. li.zhe.hua added inline comments. Comment at: clang/include/clang/AST/ASTTypeTraits.h:90-92 bool operator<(const ASTNodeKind &Other) const { return KindId < Other.KindId; } aaron.ballman wrote: > Any reason

[PATCH] D135816: [clang] Support `constexpr` for some `ASTNodeKind` member functions

2022-10-13 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 467512. li.zhe.hua added a comment. Appease clang-format, add constexpr to operator<. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135816/new/ https://reviews.llvm.org/D135816 Files: clang/include/clang/

[PATCH] D135816: [clang] Support `constexpr` for some `ASTNodeKind` member functions

2022-10-12 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: aaron.ballman. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Add `constexpr` support for: - The `getFromNodeKind` factory function - `

[PATCH] D131646: [clang][dataflow] Restructure loops to call widen on back edges

2022-08-19 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added inline comments. Comment at: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:168-169 +// back edge block. (That is, all paths from the entry block to the back edge +// block must go through `Block`.) It also means that there are only two +// pred

[PATCH] D131646: [clang][dataflow] Restructure loops to call widen on back edges

2022-08-19 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 454089. li.zhe.hua marked 4 inline comments as done. li.zhe.hua added a comment. Address comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131646/new/ https://reviews.llvm.org/D131646 Files: clang/li

[PATCH] D131646: [clang][dataflow] Restructure loops to call widen on back edges

2022-08-11 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua marked an inline comment as done. li.zhe.hua added inline comments. Comment at: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:168-169 +// back edge block. (That is, all paths from the entry block to the back edge +// block must go through `Block`.) I

[PATCH] D131646: [clang][dataflow] Restructure loops to call widen on back edges

2022-08-11 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 451926. li.zhe.hua added a comment. Fix incorrect assumption that back edge blocks have an empty body. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131646/new/ https://reviews.llvm.org/D131646 Files: cla

[PATCH] D131645: [clang][dataflow] Allow user-provided lattices to provide a widen operator

2022-08-11 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added a comment. In D131645#3716464 , @xazax.hun wrote: > probably you are already aware of most of this Actually, more likely than not I don't! I don't have a strong background in PL (or, really any background), so I'm really just learning a

[PATCH] D131645: [clang][dataflow] Allow user-provided lattices to provide a widen operator

2022-08-11 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 451887. li.zhe.hua marked an inline comment as done. li.zhe.hua added a comment. Add FIXME Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131645/new/ https://reviews.llvm.org/D131645 Files: clang/include/c

[PATCH] D131691: [clang][dataflow] Remove references of LatticeJoinEffect from dataflow

2022-08-11 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added subscribers: martong, xazax.hun. Herald added a reviewer: NoQ. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. A fo

[PATCH] D131688: [clang][dataflow][NFC] Remove LatticeJoinEffect from framework interfaces

2022-08-11 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added subscribers: martong, xazax.hun. Herald added a reviewer: NoQ. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Thou

[PATCH] D131645: [clang][dataflow] Allow user-provided lattices to provide a widen operator

2022-08-11 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua marked an inline comment as done. li.zhe.hua added inline comments. Comment at: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp:119 + std::unique_ptr AST = + tooling::buildASTFromCodeWithArgs("int x = 0;", {"-std=c++11"}); + HasWidenAn

[PATCH] D131646: [clang][dataflow] Restructure loops to call widen on back edges

2022-08-11 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added inline comments. Comment at: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:180 + assert(Block->pred_size() == 2); + BackEdge = Pred; +} ymandel wrote: > Might it be worth simply returning the backedge when you find

[PATCH] D131646: [clang][dataflow] Restructure loops to call widen on back edges

2022-08-11 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 451861. li.zhe.hua marked 2 inline comments as done. li.zhe.hua added a comment. Address comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131646/new/ https://reviews.llvm.org/D131646 Files: clang/li

[PATCH] D131644: [clang][dataflow] Don't skip the entry block

2022-08-10 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 451721. li.zhe.hua added a comment. Fix commit message Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131644/new/ https://reviews.llvm.org/D131644 Files: clang/lib/Analysis/FlowSensitive/TypeErasedDataflow

[PATCH] D131646: [clang][dataflow] Restructure loops to call widen on back edges

2022-08-10 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. Herald added subscribers: martong, xazax.hun. Herald added a reviewer: NoQ. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. When navigating a loop block, we call the

[PATCH] D131645: [clang][dataflow] Allow user-provided lattices to provide a widen operator

2022-08-10 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. Herald added subscribers: martong, xazax.hun. Herald added a reviewer: NoQ. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. In order to better support convergence in

[PATCH] D131644: [clang][dataflow] Don't skip the entry block

2022-08-10 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. Herald added subscribers: martong, xazax.hun. Herald added a reviewer: NoQ. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. In DXXX, we implement widen by taking

[PATCH] D131178: [clang][dataflow][NFC] Convert mutable vector references to ArrayRef

2022-08-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua closed this revision. li.zhe.hua added a comment. Bah, I think I screwed up `arc` at some point. This was committed as 18034aee63eeac673496a88d9e90c8dd73d15927 . Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D131177: [clang][dataflow][NFC] Resize vector directly with ctor

2022-08-04 Thread Eric Li 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 rG5659908f4c6d: [clang][dataflow][NFC] Resize vector directly with ctor (authored by li.zhe.hua). Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D131177: [clang][dataflow][NFC] Resize vector directly with ctor

2022-08-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added subscribers: martong, xazax.hun. Herald added a reviewer: NoQ. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Repo

[PATCH] D131178: [clang][dataflow][NFC] Convert mutable vector references to ArrayRef

2022-08-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added subscribers: martong, xazax.hun. Herald added a reviewer: NoQ. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. `tra

[PATCH] D131109: [clang][dataflow][NFC] Fix outdated comment on getStableStorageLocation

2022-08-04 Thread Eric Li via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG54d24eae9872: [clang][dataflow][NFC] Fix outdated comment on getStableStorageLocation (authored by li.zhe.hua). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/

[PATCH] D131109: [clang][dataflow][NFC] Fix outdated comment on getStableStorageLocation

2022-08-03 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: sgatev. Herald added subscribers: martong, xazax.hun. Herald added a reviewer: NoQ. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Follo

[PATCH] D129097: [clang][dataflow] Handle null pointers of type std::nullptr_t

2022-08-03 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua marked an inline comment as done. li.zhe.hua added inline comments. Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h:96 /// /// `Type` must not be null. StorageLocation &getStableStorageLocation(QualType Type); ---

[PATCH] D130600: [clang][dataflow] Handle return statements

2022-07-27 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added inline comments. Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h:114 + /// + /// `return` must not be assigned a storage location. + void setReturnStorageLocation(StorageLocation &Loc) { samestep wrote: > li.

[PATCH] D130600: [clang][dataflow] Handle return statements

2022-07-27 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added inline comments. Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h:114 + /// + /// `return` must not be assigned a storage location. + void setReturnStorageLocation(StorageLocation &Loc) { Fix this as well? A r

[PATCH] D130653: [clang][dataflow][NFC] Remove last use of deprecated ctor

2022-07-27 Thread Eric Li via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG5e28923e332f: [clang][dataflow][NFC] Remove last use of deprecated

[PATCH] D130653: [clang][dataflow][NFC] Remove last use of deprecated ctor

2022-07-27 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 448105. li.zhe.hua added a comment. Explicitly name `TransferOptions` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130653/new/ https://reviews.llvm.org/D130653 Files: clang/include/clang/Analysis/FlowSen

[PATCH] D130653: [clang][dataflow][NFC] Remove last use of deprecated ctor

2022-07-27 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added subscribers: martong, tschuett, xazax.hun. Herald added a reviewer: NoQ. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-comm

[PATCH] D130497: [clang][dataflow] Fix MapLattice::insert() to not drop return value

2022-07-25 Thread Eric Li 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 rG29d35ece8249: [clang][dataflow] Fix MapLattice::insert() to not drop return value (authored by li.zhe.hua). Repository: rG LLVM Github Monorepo C

[PATCH] D130497: [clang][dataflow] Fix MapLattice::insert() to not drop return value

2022-07-25 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added subscribers: martong, tschuett, xazax.hun. Herald added a reviewer: NoQ. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-comm

[PATCH] D130306: [clang][dataflow] Analyze calls to in-TU functions

2022-07-22 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added inline comments. Comment at: clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h:64 TypeErasedDataflowAnalysis(bool ApplyBuiltinTransfer) : Options({ApplyBuiltinTransfer}) {} Nit: `-Wmissing-field-initializers` is

[PATCH] D129097: [clang][dataflow] Handle null pointers of type std::nullptr_t

2022-07-05 Thread Eric Li 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 rGf10d271ae27f: [clang][dataflow] Handle null pointers of type std::nullptr_t (authored by li.zhe.hua). Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D129097: [clang][dataflow] Handle null pointers of type std::nullptr_t

2022-07-05 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 442291. li.zhe.hua marked 2 inline comments as done. li.zhe.hua added a comment. Address comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129097/new/ https://reviews.llvm.org/D129097 Files: clang/i

[PATCH] D129097: [clang][dataflow] Handle null pointers of type std::nullptr_t

2022-07-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: gribozavr2. Herald added subscribers: martong, tschuett, xazax.hun. Herald added a reviewer: NoQ. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-c

[PATCH] D128807: [clang][transformer] Finish plumbing `Note` all the way to the output.

2022-06-30 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added a comment. In D128807#3620573 , @ymandel wrote: > Eric -- what do you think? You've thought a lot more about metadata recently. (Apologies for the delay. Still struggling to figure out a good workflow for reviewing patches...) Can you

[PATCH] D128848: Fix assertion when analyzing a for-loop with no condition expression

2022-06-29 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua abandoned this revision. li.zhe.hua added a comment. In D128848#3620185 , @ymandel wrote: > Looks like you and Stanislav had the same idea? > https://reviews.llvm.org/D128833 Seems like it. Repository: rG LLVM Github Monorepo CHANGES SINC

[PATCH] D128848: Fix assertion when analyzing a for-loop with no condition expression

2022-06-29 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. For loops are allowed to have an empty conditional expression; we should not ass

[PATCH] D126413: [clang][dataflow] Fix incorrect CXXThisExpr pointee for lambdas

2022-05-25 Thread Eric Li 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 rG5520c5839016: [clang][dataflow] Fix incorrect CXXThisExpr pointee for lambdas (authored by li.zhe.hua). Repository: rG LLVM Github Monorepo CHANG

[PATCH] D126405: [clang][dataflow] Relax assert on existence of `this` pointee storage

2022-05-25 Thread Eric Li 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 rG33b598a808b9: [clang][dataflow] Relax assert on existence of `this` pointee storage (authored by li.zhe.hua). Repository: rG LLVM Github Monorepo

[PATCH] D126413: [clang][dataflow] Fix incorrect CXXThisExpr pointee for lambdas

2022-05-25 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 432124. li.zhe.hua added a comment. Address reviewer comment. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126413/new/ https://reviews.llvm.org/D126413 Files: clang/lib/Analysis/FlowSensitive/DataflowEnv

[PATCH] D126405: [clang][dataflow] Relax assert on existence of `this` pointee storage

2022-05-25 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 432119. li.zhe.hua added a comment. Accidentally a word... Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126405/new/ https://reviews.llvm.org/D126405 Files: clang/lib/Analysis/FlowSensitive/Transfer.cpp

[PATCH] D126405: [clang][dataflow] Relax assert on existence of `this` pointee storage

2022-05-25 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 432117. li.zhe.hua marked 2 inline comments as done. li.zhe.hua added a comment. Address reviewer comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126405/new/ https://reviews.llvm.org/D126405 Files:

[PATCH] D126413: [clang][dataflow] Fix incorrect CXXThisExpr pointee for lambdas

2022-05-25 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added subscribers: tschuett, steakhal. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. When constructing the `Environment

[PATCH] D126405: [clang][dataflow] Relax assert on existence of `this` pointee storage

2022-05-25 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added subscribers: tschuett, steakhal. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Support for unions is incomplete (

[PATCH] D125821: [clang][dataflow] Fix double visitation of nested logical operators

2022-05-17 Thread Eric Li via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. li.zhe.hua marked an inline comment as done. Closed by commit rG5bbef2e3fff1: [clang][dataflow] Fix double visitation of nested logical operators (authored by li.zhe.hua). Repository: rG LLVM Github Monorepo CHANGES SINC

[PATCH] D125821: [clang][dataflow] Fix double visitation of nested logical operators

2022-05-17 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua marked an inline comment as done. li.zhe.hua added inline comments. Comment at: clang/lib/Analysis/FlowSensitive/Transfer.cpp:574 -// Sub-expressions that are logic operators are not added in basic blocks -// (e.g. see CFG for `bool d = a && (b || c);`). If `

[PATCH] D125821: [clang][dataflow] Fix double visitation of nested logical operators

2022-05-17 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 430152. li.zhe.hua added a comment. Address comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125821/new/ https://reviews.llvm.org/D125821 Files: clang/lib/Analysis/FlowSensitive/Transfer.cpp clang

[PATCH] D125823: [clang][dataflow] Weaken guard to only check for storage location

2022-05-17 Thread Eric Li 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 rG854c273cbb7e: [clang][dataflow] Weaken guard to only check for storage location (authored by li.zhe.hua). Repository: rG LLVM Github Monorepo CHA

[PATCH] D125823: [clang][dataflow] Weaken guard to only check for storage location

2022-05-17 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added subscribers: tschuett, steakhal. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Weaken the guard for whether a sub

[PATCH] D125821: [clang][dataflow] Fix double visitation of nested logical operators

2022-05-17 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added subscribers: tschuett, steakhal. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Sub-expressions that are logical o

[PATCH] D124965: [clang][dataflow] Centralize expression skipping logic

2022-05-05 Thread Eric Li 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 rG45643cfcc12e: [clang][dataflow] Centralize expression skipping logic (authored by li.zhe.hua). Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D124965: [clang][dataflow] Centralize expression skipping logic

2022-05-05 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua marked an inline comment as done. li.zhe.hua added inline comments. Comment at: clang/lib/Analysis/FlowSensitive/Transfer.cpp:38-41 + if (auto *LHSValue = + dyn_cast_or_null(Env.getValue(LHS, SkipPast::Reference))) +if (auto *RHSValue = +dyn_c

[PATCH] D124965: [clang][dataflow] Centralize expression skipping logic

2022-05-05 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added inline comments. Comment at: clang/lib/Analysis/FlowSensitive/Transfer.cpp:38-41 + if (auto *LHSValue = + dyn_cast_or_null(Env.getValue(LHS, SkipPast::Reference))) +if (auto *RHSValue = +dyn_cast_or_null(Env.getValue(RHS, SkipPast::Refe

[PATCH] D124965: [clang][dataflow] Centralize expression skipping logic

2022-05-05 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 427417. li.zhe.hua marked 3 inline comments as done. li.zhe.hua added a comment. Address reviewer comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124965/new/ https://reviews.llvm.org/D124965 Files:

[PATCH] D124943: [clang][dataflow] Add flowConditionIsTautology function

2022-05-04 Thread Eric Li 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 rG58abe36ae765: [clang][dataflow] Add flowConditionIsTautology function (authored by li.zhe.hua). Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D124943: [clang][dataflow] Add flowConditionIsTautology function

2022-05-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua marked 4 inline comments as done. li.zhe.hua added a comment. Ah, good catch regarding the flow condition deps not being tracked. Thanks for the review! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124943/new/ https://reviews.llvm.org/

[PATCH] D124943: [clang][dataflow] Add flowConditionIsTautology function

2022-05-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 427183. li.zhe.hua added a comment. Address reviewer comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124943/new/ https://reviews.llvm.org/D124943 Files: clang/include/clang/Analysis/FlowSensitive/

[PATCH] D124943: [clang][dataflow] Add flowConditionIsTautology function

2022-05-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added a comment. I'm playing around with a tool to take raw pointers and add a non-null annotation or convert them to references, for code that is assumed to be correct. So in this case, "interesting expression" is anything that would be UB if the pointer was null, e.g. dereferencing

[PATCH] D124965: [clang][dataflow] Centralize expression skipping logic

2022-05-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added reviewers: sgatev, ymandel. Herald added subscribers: tschuett, steakhal. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. A follow-up to 62b2a47

[PATCH] D124943: [clang][dataflow] Add flowConditionIsTautology function

2022-05-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added a comment. This allows me to query when an expression is always encountered/executed. Alternatively, if I have a set of interesting expressions, I can note the flow condition at every expression, compute the disjunction of the set of flow conditions, and determine if execution

[PATCH] D124943: [clang][dataflow] Add flowConditionIsTautology function

2022-05-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added reviewers: ymandel, sgatev, xazax.hun. Herald added subscribers: tschuett, steakhal, rnkovacs. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Provid

[PATCH] D124807: [clang][dataflow] Only skip ExprWithCleanups when visiting terminators

2022-05-04 Thread Eric Li via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG62b2a47a9f15: [clang][dataflow] Only skip ExprWithCleanups when visiting terminators (authored by li.zhe.hua). Changed prior to commit: https://reviews.llvm.org/D124807?vs=426987&id=427019#toc Reposito

[PATCH] D124807: [clang][dataflow] Only skip ExprWithCleanups when visiting terminators

2022-05-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 426987. li.zhe.hua added a comment. Forgot to add a file... let's try this again... Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124807/new/ https://reviews.llvm.org/D124807 Files: clang/include/clang/An

[PATCH] D124807: [clang][dataflow] Only skip ExprWithCleanups when visiting terminators

2022-05-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added inline comments. Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:230 + /// + /// Requirements: + /// sgatev wrote: > Why add these as requirements instead of skipping past `ExprWithCleanups` > internally, as we cu

[PATCH] D124807: [clang][dataflow] Only skip ExprWithCleanups when visiting terminators

2022-05-04 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 426985. li.zhe.hua marked 7 inline comments as done. li.zhe.hua added a comment. Add `ExprWithCleanups` requirement to `createStorageLocation`, `setStorageLocation`, and `getStorageLocation`. Remove `ParenExpr` requirement from `getValue`. Remove unnecessa

[PATCH] D124807: [clang][dataflow] Only skip ExprWithCleanups when visiting terminators

2022-05-03 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 426860. li.zhe.hua edited the summary of this revision. li.zhe.hua added a comment. Expand `ignoreExprWithCleanups` comment with more context. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124807/new/ https:

[PATCH] D124807: [clang][dataflow] Avoid assert for invalid cast to BoolValue

2022-05-03 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua marked 4 inline comments as done. li.zhe.hua added inline comments. Comment at: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:78 +/// and integers in the framework. +static const Expr *ignoreParenImpCastsExceptToBool(const Expr *E) { + const Expr *La

[PATCH] D124807: [clang][dataflow] Avoid assert for invalid cast to BoolValue

2022-05-03 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 426823. li.zhe.hua added a comment. Switch from implementing in the trasfer function to skipping `ExprWithCleanups`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124807/new/ https://reviews.llvm.org/D124807

[PATCH] D124807: [clang][dataflow] Avoid assert for invalid cast to BoolValue

2022-05-03 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 426783. li.zhe.hua added a comment. Handle FullExprs in the transfer function. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124807/new/ https://reviews.llvm.org/D124807 Files: clang/lib/Analysis/FlowSens

[PATCH] D124807: [clang][dataflow] Avoid assert for invalid cast to BoolValue

2022-05-03 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua added inline comments. Comment at: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:78 +/// and integers in the framework. +static const Expr *ignoreParenImpCastsExceptToBool(const Expr *E) { + const Expr *LastE = nullptr; sgatev wrote:

[PATCH] D124807: [clang][dataflow] Avoid assert for invalid cast to BoolValue

2022-05-03 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 426711. li.zhe.hua added a comment. Update test to treat the PointerToBool conversion as an opaque boolean expression, and test it as such. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124807/new/ https://

[PATCH] D124807: [clang][dataflow] Avoid assert for invalid cast to BoolValue

2022-05-02 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 426528. li.zhe.hua added a comment. Remove else after return Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124807/new/ https://reviews.llvm.org/D124807 Files: clang/lib/Analysis/FlowSensitive/TypeErasedDa

[PATCH] D124807: [clang][dataflow] Avoid assert for invalid cast to BoolValue

2022-05-02 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua created this revision. li.zhe.hua added a reviewer: ymandel. Herald added subscribers: tschuett, steakhal. Herald added a project: All. li.zhe.hua requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. `IgnoreParenImpCasts` will remove

[PATCH] D122499: [libTooling] Support TransformerResult in consumer callbacks

2022-03-25 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua marked 2 inline comments as done. li.zhe.hua added inline comments. Comment at: clang/include/clang/Tooling/Transformer/Transformer.h:126-128 +template +std::enable_if_t::value, void> +assertMetadataSet(const transformer::RewriteRuleWith &) {} ymandel

[PATCH] D122499: [libTooling] Support TransformerResult in consumer callbacks

2022-03-25 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 418316. li.zhe.hua added a comment. Fix for comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122499/new/ https://reviews.llvm.org/D122499 Files: clang/include/clang/Tooling/Transformer/Transformer.

[PATCH] D122499: [libTooling] Support TransformerResult in consumer callbacks

2022-03-25 Thread Eric Li via Phabricator via cfe-commits
li.zhe.hua updated this revision to Diff 418295. li.zhe.hua added a comment. Fix comment. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122499/new/ https://reviews.llvm.org/D122499 Files: clang/include/clang/Tooling/Transformer/Transformer.h c

  1   2   >