[clang] 09b43a5 - [clang][dataflow] Expose simple access to child StorageLocation presence. (#145520)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 24 10:29:44 PDT 2025
Author: Samira Bakon
Date: 2025-06-24T13:29:40-04:00
New Revision: 09b43a5a862f453aabd95ec01e0b53c46ca3e340
URL: https://github.com/llvm/llvm-project/commit/09b43a5a862f453aabd95ec01e0b53c46ca3e340
DIFF: https://github.com/llvm/llvm-project/commit/09b43a5a862f453aabd95ec01e0b53c46ca3e340.diff
LOG: [clang][dataflow] Expose simple access to child StorageLocation presence. (#145520)
`getChild` does not offer this knowledge, and a map lookup is
significantly cheaper than iteration over `children()`.
Added:
Modified:
clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
Removed:
################################################################################
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;
More information about the cfe-commits
mailing list