We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b8e81ee commit 1131e67Copy full SHA for 1131e67
clang/test/Analysis/Checkers/WebKit/uncounted-local-vars.cpp
@@ -302,6 +302,8 @@ struct TreeNode {
302
}
303
304
int recursiveCost();
305
+ int recursiveWeight();
306
+ int weight();
307
308
int cost { 0 };
309
mutable unsigned refCount { 0 };
@@ -317,4 +319,12 @@ int TreeNode::recursiveCost() {
317
319
return totalCost;
318
320
321
322
+int TreeNode::recursiveWeight() {
323
+ unsigned totalCost = weight();
324
+ for (TreeNode* node = firstChild; node; node = node->nextSibling)
325
+ // expected-warning@-1{{Local variable 'node' is uncounted and unsafe [alpha.webkit.UncountedLocalVarsChecker]}}
326
+ totalCost += recursiveWeight();
327
+ return totalCost;
328
+}
329
+
330
} // namespace local_var_in_recursive_function
0 commit comments