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 {
246246 explicit operator InputFile () const {
247247 return InputFile (Filename, IsPrimary, Buffer.get ());
248248 }
249+
250+ size_t getMemoryCost () const {
251+ return sizeof (*this ) + Filename.size () + Buffer->getBufferSize ();
252+ }
249253};
250254
251255// / An \c ASTBuildOperations builds an AST. Once the AST is built, it informs
@@ -400,8 +404,12 @@ class ASTBuildOperation
400404 }
401405
402406 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;
405413 }
406414
407415 // / Schedule building this AST on the given \p Queue.
You can’t perform that action at this time.
0 commit comments