Open Bug 1476675 Opened 6 years ago Updated 2 years ago

-Wlarge-by-value-copy warning on nsTextFrame.cpp

Categories

(Core :: Layout: Text and Fonts, defect, P3)

defect

Tracking

()

Tracking Status
firefox63 --- affected

People

(Reporter: Sylvestre, Unassigned)

References

(Blocks 1 open bug)

Details

nsTextFrame.cpp:1768, Clang (LLVM based), Priority: Normal
return value of 'GetFirstFontMetrics' is a large (144 bytes) pass-by-value object; pass it by reference instead ?
Priority: -- → P3
DXR link:
https://dxr.mozilla.org/mozilla-central/rev/085cdfb90903d4985f0de1dc7786522d9fb45596/layout/generic/nsTextFrame.cpp#1766-1774

(We don't benefit from return value optimization here because there are two different possible return values.)
If having two different possible return values is a problem, can we do something like
> gfxFont::Metrics result;
> if (aFontGroup) {
>   result = ...;
> }
> return result;

I guess a better way would probably be making the empty one a static, and return a reference to it. (Although I would really be surprised if compiler cannot optimize this function out.)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.