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 @@ -1474,6 +1474,9 @@ class Solution {
1474
1474
// / The fixed score for this solution.
1475
1475
Score FixedScore;
1476
1476
1477
+ // / The total memory used by this solution.
1478
+ std::optional<size_t > TotalMemory;
1479
+
1477
1480
public:
1478
1481
// / Create a solution for the given constraint system.
1479
1482
Solution (ConstraintSystem &cs, const Score &score)
Original file line number Diff line number Diff line change @@ -1868,7 +1868,11 @@ static inline size_t size_in_bytes(const T &x) {
1868
1868
}
1869
1869
1870
1870
size_t Solution::getTotalMemory () const {
1871
- return sizeof (*this ) + typeBindings.getMemorySize () +
1871
+ if (TotalMemory)
1872
+ return *TotalMemory;
1873
+
1874
+ const_cast <Solution *>(this )->TotalMemory
1875
+ = sizeof (*this ) + typeBindings.getMemorySize () +
1872
1876
overloadChoices.getMemorySize () +
1873
1877
ConstraintRestrictions.getMemorySize () +
1874
1878
(Fixes.size () * sizeof (void *)) + DisjunctionChoices.getMemorySize () +
@@ -1892,6 +1896,8 @@ size_t Solution::getTotalMemory() const {
1892
1896
size_in_bytes (argumentLists) +
1893
1897
size_in_bytes (ImplicitCallAsFunctionRoots) +
1894
1898
size_in_bytes (SynthesizedConformances);
1899
+
1900
+ return *TotalMemory;
1895
1901
}
1896
1902
1897
1903
DeclContext *Solution::getDC () const { return constraintSystem->DC ; }
You can’t perform that action at this time.
0 commit comments