File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
tools/SourceKit/lib/SwiftLang Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,10 @@ struct FileContent {
246
246
explicit operator InputFile () const {
247
247
return InputFile (Filename, IsPrimary, Buffer.get ());
248
248
}
249
+
250
+ size_t getMemoryCost () const {
251
+ return sizeof (*this ) + Filename.size () + Buffer->getBufferSize ();
252
+ }
249
253
};
250
254
251
255
// / An \c ASTBuildOperations builds an AST. Once the AST is built, it informs
@@ -400,8 +404,12 @@ class ASTBuildOperation
400
404
}
401
405
402
406
size_t getMemoryCost () {
403
- return sizeof (*this ) + getVectorMemoryCost (FileContents) +
404
- Result.getMemoryCost ();
407
+ size_t Cost = sizeof (*this ) + getVectorMemoryCost (FileContents) +
408
+ Result.getMemoryCost ();
409
+ for (const FileContent &File : FileContents) {
410
+ Cost += File.getMemoryCost ();
411
+ }
412
+ return Cost;
405
413
}
406
414
407
415
// / Schedule building this AST on the given \p Queue.
You can’t perform that action at this time.
0 commit comments