[clang] [clang][dataflow] Remove buggy assertion. (PR #67311)

2023-09-27 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu approved this pull request. Ah- thanks! I just didn't want to loosen the check too much, but looks like this wasn't the only condition. https://github.com/llvm/llvm-project/pull/67311 ___ cfe-commits mailing list cfe-commits@l

[clang] [clang][dataflow] Remove RecordValue.getLog() usage in HTMLLogger (PR #65645)

2023-09-07 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu created https://github.com/llvm/llvm-project/pull/65645: We can dump the same information from RecordStorageLocation. Tested the behavior before and after patch, that generates the field values in the HTML in both cases (and also made sure that removing the relevant code

[clang] [clang][dataflow] Remove RecordValue.getLog() usage in HTMLLogger (PR #65645)

2023-09-07 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu review_requested https://github.com/llvm/llvm-project/pull/65645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Remove RecordValue.getLog() usage in HTMLLogger (PR #65645)

2023-09-07 Thread Kinuko Yasuda via cfe-commits
kinu wrote: @martinboehme @Xazax-hun @ymand if anyone can review this small patch that removes one more dependency on RecordValue.getLoc()... thanks! https://github.com/llvm/llvm-project/pull/65645 ___ cfe-commits mailing list cfe-commits@lists.llvm.o

[clang] [clang][dataflow] Don't crash when BlockToState is called from unreachable path (PR #65732)

2023-09-08 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu created https://github.com/llvm/llvm-project/pull/65732: When we call `getEnvironment`, `BlockToState[BlockId]` for the block can return null even if CFCtx.isBlockReachable(B) returns true if it is called from a particular block that is marked unreachable to the block.

[clang] [clang][dataflow] Don't crash when BlockToState is called from unreachable path (PR #65732)

2023-09-08 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu review_requested https://github.com/llvm/llvm-project/pull/65732 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Don't crash when BlockToState is called from unreachable path (PR #65732)

2023-09-08 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu review_requested https://github.com/llvm/llvm-project/pull/65732 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Don't crash when BlockToState is called from unreachable path (PR #65732)

2023-09-08 Thread Kinuko Yasuda via cfe-commits
@@ -43,7 +43,20 @@ const Environment *StmtToEnvMap::getEnvironment(const Stmt &S) const { if (!CFCtx.isBlockReachable(*BlockIt->getSecond())) return nullptr; const auto &State = BlockToState[BlockIt->getSecond()->getBlockID()]; - assert(State); + if (!(State)) { +

[clang] [clang][dataflow] Don't crash when BlockToState is called from unreachable path (PR #65732)

2023-09-08 Thread Kinuko Yasuda via cfe-commits
kinu wrote: CC @martinboehme @Xazax-hun @ymand https://github.com/llvm/llvm-project/pull/65732 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Merge `RecordValue`s with different locations correctly. (PR #65319)

2023-09-08 Thread Kinuko Yasuda via cfe-commits
@@ -121,18 +121,18 @@ static Value *mergeDistinctValues(QualType Type, Value &Val1, Value *MergedVal = nullptr; if (auto *RecordVal1 = dyn_cast(&Val1)) { -[[maybe_unused]] auto *RecordVal2 = cast(&Val2); - -// Values to be merged are always associated with the sam

[clang] [clang][dataflow] Merge `RecordValue`s with different locations correctly. (PR #65319)

2023-09-08 Thread Kinuko Yasuda via cfe-commits
@@ -121,18 +121,18 @@ static Value *mergeDistinctValues(QualType Type, Value &Val1, Value *MergedVal = nullptr; if (auto *RecordVal1 = dyn_cast(&Val1)) { -[[maybe_unused]] auto *RecordVal2 = cast(&Val2); - -// Values to be merged are always associated with the sam

[clang] [clang][dataflow] Don't crash when BlockToState is called from unreachable path (PR #65732)

2023-09-08 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu updated https://github.com/llvm/llvm-project/pull/65732: >From bc119f4bb478431bf85cda47dbc2a25faa59e85f Mon Sep 17 00:00:00 2001 From: Kinuko Yasuda Date: Fri, 8 Sep 2023 09:03:35 + Subject: [PATCH 1/2] [clang][dataflow] Don't crash when BlockToState doesn't have unr

[clang] [clang][dataflow] Remove unused function: transferBlock() (PR #65932)

2023-09-11 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu created https://github.com/llvm/llvm-project/pull/65932: No one seems to be using transferBlock() in TypeErasedDataflowAnalysis, it is likely a remnant of old code >From dc808e4edccdd8d405660729713dd169c87daf71 Mon Sep 17 00:00:00 2001 From: Kinuko Yasuda Date: Fri, 8

[clang] [clang][dataflow] Remove unused function: transferBlock() (PR #65932)

2023-09-11 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu review_requested https://github.com/llvm/llvm-project/pull/65932 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Remove RecordValue.getLog() usage in HTMLLogger (PR #65645)

2023-09-11 Thread Kinuko Yasuda via cfe-commits
kinu wrote: Here's the screenshot for a simple code snippet ![Btp9XprWFz4w2yQ (1)](https://github.com/llvm/llvm-project/assets/860295/bfd29ab5-ac44-418b-8649-365cfacae2c9) 'Without the patch' image is almost identical You can see some more screenshots here: https://docs.google.com/document/d/1g

[clang] [clang][dataflow] Remove unused function: transferBlock() (PR #65932)

2023-09-11 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu closed https://github.com/llvm/llvm-project/pull/65932 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Remove unused function: transferBlock() (PR #65932)

2023-09-11 Thread Kinuko Yasuda via cfe-commits
kinu wrote: Thanks, closing https://github.com/llvm/llvm-project/pull/65932 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Ignore assignment where base class's operator is used (PR #66364)

2023-09-14 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu created https://github.com/llvm/llvm-project/pull/66364: In C++ it seems it is legit to use base class's operator (e.g. `using Base::operator=`) to perform copy if the base class is the common ancestor of the source and destination object. In such a case we shouldn't try

[clang] [clang][dataflow] Ignore assignment where base class's operator is used (PR #66364)

2023-09-14 Thread Kinuko Yasuda via cfe-commits
kinu wrote: @martinboehme @sam-mccall @ymand appreciated if any of you (or other owners) can review https://github.com/llvm/llvm-project/pull/66364 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [clang][dataflow] Model the fields that are accessed via inline accessors (PR #66368)

2023-09-14 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu created https://github.com/llvm/llvm-project/pull/66368: So that the values that are accessed via such accessors can be analyzed as a limited version of context-sensitive analysis. We can potentially do this only when some option is set, but doing additional modeling lik

[clang] [clang][dataflow] Model the fields that are accessed via inline accessors (PR #66368)

2023-09-14 Thread Kinuko Yasuda via cfe-commits
kinu wrote: /cc @martinboehme @ymand https://github.com/llvm/llvm-project/pull/66368 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Model the fields that are accessed via inline accessors (PR #66368)

2023-09-15 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu updated https://github.com/llvm/llvm-project/pull/66368 >From d311f12fe3ca0d30a40e659236ba7eaccda24a8b Mon Sep 17 00:00:00 2001 From: Kinuko Yasuda Date: Thu, 14 Sep 2023 12:45:04 + Subject: [PATCH 1/4] [clang][dataflow] Model the fields that are accessed via inline

[clang] [clang][dataflow] Model the fields that are accessed via inline accessors (PR #66368)

2023-09-15 Thread Kinuko Yasuda via cfe-commits
@@ -1446,6 +1446,51 @@ TEST(TransferTest, BaseClassInitializer) { llvm::Succeeded()); } +TEST(TransferTest, StructModeledFieldsWithAccessor) { + std::string Code = R"( +class S { + int *P; + int *Q; + int X; + int Y; + int Z; +public: +

[clang] [clang][dataflow] Model the fields that are accessed via inline accessors (PR #66368)

2023-09-15 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu resolved https://github.com/llvm/llvm-project/pull/66368 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Model the fields that are accessed via inline accessors (PR #66368)

2023-09-15 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu resolved https://github.com/llvm/llvm-project/pull/66368 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Model the fields that are accessed via inline accessors (PR #66368)

2023-09-15 Thread Kinuko Yasuda via cfe-commits
@@ -324,6 +336,12 @@ getFieldsGlobalsAndFuncs(const Stmt &S, FieldSet &Fields, } else if (auto *E = dyn_cast(&S)) { insertIfGlobal(*E->getDecl(), Vars); insertIfFunction(*E->getDecl(), Funcs); + } else if (const auto *C = dyn_cast(&S)) { +// If this is a method t

[clang] [clang][dataflow] Model the fields that are accessed via inline accessors (PR #66368)

2023-09-15 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu resolved https://github.com/llvm/llvm-project/pull/66368 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Model the fields that are accessed via inline accessors (PR #66368)

2023-09-15 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu resolved https://github.com/llvm/llvm-project/pull/66368 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Model the fields that are accessed via inline accessors (PR #66368)

2023-09-15 Thread Kinuko Yasuda via cfe-commits
@@ -288,6 +288,18 @@ static void insertIfFunction(const Decl &D, Funcs.insert(FD); } +static Expr *getRetValueFromSingleReturnStmtMethod(const CXXMemberCallExpr &C) { + auto *D = cast_or_null(C.getMethodDecl()->getDefinition()); + if (!D) +return nullptr; + auto *S

[clang] [clang][dataflow] Model the fields that are accessed via inline accessors (PR #66368)

2023-09-15 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu resolved https://github.com/llvm/llvm-project/pull/66368 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Model the fields that are accessed via inline accessors (PR #66368)

2023-09-15 Thread Kinuko Yasuda via cfe-commits
kinu wrote: Thanks! Addressed comments. https://github.com/llvm/llvm-project/pull/66368 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Merge `RecordValue`s with different locations correctly. (PR #65319)

2023-09-05 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu edited https://github.com/llvm/llvm-project/pull/65319 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Merge `RecordValue`s with different locations correctly. (PR #65319)

2023-09-05 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu commented: Thanks, this LGTM (confirmed that it makes it go through with one of the real code I hit this) https://github.com/llvm/llvm-project/pull/65319 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llv

[clang] [clang][dataflow] Merge `RecordValue`s with different locations correctly. (PR #65319)

2023-09-05 Thread Kinuko Yasuda via cfe-commits
@@ -121,18 +121,18 @@ static Value *mergeDistinctValues(QualType Type, Value &Val1, Value *MergedVal = nullptr; if (auto *RecordVal1 = dyn_cast(&Val1)) { -[[maybe_unused]] auto *RecordVal2 = cast(&Val2); - -// Values to be merged are always associated with the sam

[clang] [clang][dataflow] Merge `RecordValue`s with different locations correctly. (PR #65319)

2023-09-05 Thread Kinuko Yasuda via cfe-commits
@@ -121,18 +121,18 @@ static Value *mergeDistinctValues(QualType Type, Value &Val1, Value *MergedVal = nullptr; if (auto *RecordVal1 = dyn_cast(&Val1)) { -[[maybe_unused]] auto *RecordVal2 = cast(&Val2); - -// Values to be merged are always associated with the sam

[clang] [clang][dataflow] Merge `RecordValue`s with different locations correctly. (PR #65319)

2023-09-05 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu edited https://github.com/llvm/llvm-project/pull/65319 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Eliminate `RecordValue::getChild()`. (PR #65586)

2023-09-07 Thread Kinuko Yasuda via cfe-commits
https://github.com/kinu commented: Nice! Actual changes are tests only, LGTM (though I'm not a reviewer) https://github.com/llvm/llvm-project/pull/65586 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang] [WIP][clang]: Implement a conditional lifetimebound_if builtin. (PR #125520)

2025-02-04 Thread Kinuko Yasuda via cfe-commits
kinu wrote: Would the alternative that is discussed here mean we want to forward some attributes only when they are applicable, something like `clang::forwad_lifetimebound`? Regardless, I think it'd be also good to agree on the use cases we want to support in a concrete code snippet (that sho