Closed Bug 1192015 Opened 4 years ago Closed 4 years ago

Refactor clang-plugin's allocation analysis logic

Categories

(Firefox Build System :: Source Code Analysis, defect)

defect
Not set

Tracking

(firefox42 fixed)

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: Nika, Assigned: Nika)

References

Details

Attachments

(1 file)

No description provided.
try in progress: https://treeherder.mozilla.org/#/jobs?repo=try&revision=e58f9985abac

I haven't run the new analylsis on the whole tree yet, so the try may fail and need extra changes.
Attachment #8644568 - Flags: review?(ehsan)
Blocks: 885515
Assignee: nobody → michael
Comment on attachment 8644568 [details] [diff] [review]
Refactor allocation analysis in clang plugin to better allow adding new analyses, and support detecting temporary value allocations

Review of attachment 8644568 [details] [diff] [review]:
-----------------------------------------------------------------

Very nice!

::: build/clang-plugin/clang-plugin.cpp
@@ +930,3 @@
>      return false;
> +  if (const FunctionDecl *Decl = Expr->getOperatorNew()) {
> +    if (MozChecker::hasCustomAnnotation(Decl, "moz_heap_allocator"))

Nit: please use && instead of nested ifs.

@@ +1034,5 @@
> +  astMatcher.addMatcher(varDecl().bind("node"), &scopeChecker);
> +  astMatcher.addMatcher(newExpr().bind("node"), &scopeChecker);
> +  astMatcher.addMatcher(materializeTemporaryExpr().bind("node"), &scopeChecker);
> +  astMatcher.addMatcher(callExpr(callee(functionDecl(heapAllocator()))).bind("node"),
> +                        &scopeChecker);

Do you mind moving this back up to the beginning of DiagnosticsMatcher::DiagnosticsMatcher, please?
Attachment #8644568 - Flags: review?(ehsan) → review+
https://hg.mozilla.org/mozilla-central/rev/0d6871d66dc0
Status: NEW → RESOLVED
Closed: 4 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.