llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-analysis

@llvm/pr-subscribers-clang

Author: Samira Bakon (bazuzi)

<details>
<summary>Changes</summary>

`getChild` does not offer this knowledge, and a map lookup is significantly 
cheaper than iteration over `children()`.

---
Full diff: https://github.com/llvm/llvm-project/pull/145520.diff


1 Files Affected:

- (modified) clang/include/clang/Analysis/FlowSensitive/StorageLocation.h (+2) 


``````````diff
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;

``````````

</details>


https://github.com/llvm/llvm-project/pull/145520
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to