bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

Refactor clang-plugin's allocation analysis logic

RESOLVED FIXED in Firefox 42

Status

Firefox Build System
Source Code Analysis
RESOLVED FIXED
3 years ago
5 months ago

People

(Reporter: Nika, Assigned: Nika)

Tracking

unspecified
mozilla42

Firefox Tracking Flags

(firefox42 fixed)

Details

Attachments

(1 attachment)

Comment hidden (empty)
(Assignee)

Comment 1

3 years ago
Created attachment 8644568 [details] [diff] [review]
Refactor allocation analysis in clang plugin to better allow adding new analyses, and support detecting temporary value allocations

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)
(Assignee)

Updated

3 years ago
Blocks: 885515
(Assignee)

Updated

3 years ago
Assignee: nobody → michael

Comment 2

3 years ago
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
Last Resolved: 3 years ago
status-firefox42: --- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla42

Updated

5 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.