-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang][dataflow] Expose simple access to child StorageLocation presence. #145520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…tion is present. `getChild` does not offer this knowledge, and a map lookup is significantly cheaper than iteration over `children()`.
@llvm/pr-subscribers-clang-analysis @llvm/pr-subscribers-clang Author: Samira Bakon (bazuzi) Changes
Full diff: https://github.com/llvm/llvm-project/pull/145520.diff 1 Files Affected:
diff --git a/clang/include/clang/Analysis/FlowSensitive/StorageLocation.h b/clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
index 8fcc6a44027a0..8b263b16d5b1e 100644
--- a/clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
+++ b/clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
@@ -168,6 +168,8 @@ class RecordStorageLocation final : public StorageLocation {
return {Children.begin(), Children.end()};
}
+ bool hasChild(const ValueDecl &D) const { return Children.contains(&D); }
+
private:
FieldToLoc Children;
SyntheticFieldMap SyntheticFields;
|
…nce. (llvm#145520) `getChild` does not offer this knowledge, and a map lookup is significantly cheaper than iteration over `children()`.
Can you explain what this is intended to be used for? I'd like to make sure we don't have an XY problem here. Whether a |
No underlying bug, but I was able to simplify my approach out-of-tree and avoid exposing this function that doesn't capture the intended semantics. I'll revert this. |
…orageLocation presence." (#145710) Reverts llvm/llvm-project#145520 Exposed function is no longer needed and side-stepped the intended contract that the present children are the same set returned by `getModeledFields()` and presence shouldn't need to be queried for arbitrary fields.
…nce. (llvm#145520) `getChild` does not offer this knowledge, and a map lookup is significantly cheaper than iteration over `children()`.
…on presence." (llvm#145710) Reverts llvm#145520 Exposed function is no longer needed and side-stepped the intended contract that the present children are the same set returned by `getModeledFields()` and presence shouldn't need to be queried for arbitrary fields.
getChild
does not offer this knowledge, and a map lookup is significantly cheaper than iteration overchildren()
.