File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -1482,6 +1482,9 @@ class Solution {
1482
1482
// / The fixed score for this solution.
1483
1483
Score FixedScore;
1484
1484
1485
+ // / The total memory used by this solution.
1486
+ std::optional<size_t > TotalMemory;
1487
+
1485
1488
public:
1486
1489
// / Create a solution for the given constraint system.
1487
1490
Solution (ConstraintSystem &cs, const Score &score)
Original file line number Diff line number Diff line change @@ -1863,7 +1863,11 @@ static inline size_t size_in_bytes(const T &x) {
1863
1863
}
1864
1864
1865
1865
size_t Solution::getTotalMemory () const {
1866
- return sizeof (*this ) + typeBindings.getMemorySize () +
1866
+ if (TotalMemory)
1867
+ return *TotalMemory;
1868
+
1869
+ const_cast <Solution *>(this )->TotalMemory
1870
+ = sizeof (*this ) + typeBindings.getMemorySize () +
1867
1871
overloadChoices.getMemorySize () +
1868
1872
ConstraintRestrictions.getMemorySize () +
1869
1873
(Fixes.size () * sizeof (void *)) + DisjunctionChoices.getMemorySize () +
@@ -1887,6 +1891,8 @@ size_t Solution::getTotalMemory() const {
1887
1891
size_in_bytes (argumentLists) +
1888
1892
size_in_bytes (ImplicitCallAsFunctionRoots) +
1889
1893
size_in_bytes (SynthesizedConformances);
1894
+
1895
+ return *TotalMemory;
1890
1896
}
1891
1897
1892
1898
DeclContext *Solution::getDC () const { return constraintSystem->DC ; }
You can’t perform that action at this time.
0 commit comments