This is an archive of the discontinued LLVM Phabricator instance.

[demangler] Fix build breakage
ClosedPublic

Authored by urnathan on Feb 16 2022, 8:10 AM.

Details

Summary

D119177 broke some builds.

Let's fix up the header divergence and as algorithm> is a large header, this just open-codes the comparisons.

Also I took the chance to improve the hysteresis. If we needed more than double the buffer, the original code would allocate exactly the amount needed, and thus consequently the next request would also realloc. We're very unlikely to get into wanting more than double, after the first allocation, as it would require the user to have used an identifier larger than the hysteresis. With machine generated code that's possible, but unlikely.

Diff Detail

Event Timeline

urnathan requested review of this revision.Feb 16 2022, 8:10 AM
urnathan created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2022, 8:10 AM
urnathan updated this revision to Diff 409277.Feb 16 2022, 8:13 AM
urnathan edited the summary of this revision. (Show Details)

can we keep build fixes separate from behavior changes? :) please split this into two changes.

urnathan updated this revision to Diff 409285.Feb 16 2022, 8:52 AM

Just the fix,

thakis accepted this revision.Feb 16 2022, 8:56 AM

Thanks! lg with "Also I took the chance…" removed from the commit message :)

This revision is now accepted and ready to land.Feb 16 2022, 8:56 AM

May I ask what's the reason that the previous version would break the build? I am curious since it looks NFC to me.

May I ask what's the reason that the previous version would break the build? I am curious since it looks NFC to me.

I think I flubbed syncing copies after adding <algorithm>, and for some reason that didn;t break my build. As the reporter points out <algorithm>'s rather large for just the one function.