This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Use template specialization on Quarantine to avoid zero-length array
ClosedPublic

Authored by ddcc on Mar 25 2022, 4:45 PM.

Diff Detail

Event Timeline

ddcc created this revision.Mar 25 2022, 4:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2022, 4:45 PM
ddcc requested review of this revision.Mar 25 2022, 4:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2022, 4:45 PM
vitalybuka added inline comments.Mar 26 2022, 1:03 AM
compiler-rt/lib/scudo/standalone/secondary.h
378–388
vitalybuka accepted this revision.Mar 26 2022, 1:05 AM

LGTM with suggested change

compiler-rt/lib/scudo/standalone/secondary.h
378–388

UNREACHABLE("Not implemented!");

This revision is now accepted and ready to land.Mar 26 2022, 1:05 AM
This revision was landed with ongoing or failed builds.Mar 28 2022, 4:36 PM
This revision was automatically updated to reflect the committed changes.
mcgrathr reopened this revision.Mar 28 2022, 6:43 PM
mcgrathr added inline comments.
compiler-rt/lib/scudo/standalone/secondary.h
385

Explicit specializations must appear at namespace/top-level scope, not inside the class.
You can still specialize the private class, you just have to do it with the scoped name rather than from inside the scope.
GCC does not accept this. Its code quotes the spec thusly:

/* [temp.expl.spec]                                                           
                                                                               
    An explicit specialization shall be declared in the namespace of           
    which the template is a member, or, for member templates, in the           
    namespace of which the enclosing class or enclosing class                  
    template is a member.  An explicit specialization of a member              
    function, member class or static data member of a class template           
    shall be declared in the namespace of which the class template             
    is a member.  */
This revision is now accepted and ready to land.Mar 28 2022, 6:43 PM
ddcc updated this revision to Diff 418758.Mar 28 2022, 7:11 PM

Move definitions out of class

vitalybuka added inline comments.Mar 28 2022, 7:13 PM
compiler-rt/lib/scudo/standalone/secondary.h
116–136

Maybe this to avoid exposing CachedBlock

ddcc updated this revision to Diff 418760.Mar 28 2022, 7:22 PM

Add another template argument to avoid exposing private struct

vitalybuka accepted this revision.Mar 28 2022, 7:23 PM
This revision was landed with ongoing or failed builds.Mar 28 2022, 9:36 PM
This revision was automatically updated to reflect the committed changes.