[PATCH] Fix ICE in Clang when dealing with attribute(__no_sanitize_*__)

Adrian Zgorzalek via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 8 09:20:46 PDT 2015


Great! I did not notice, that we already have exactly the same logic in SemaDeclAttr.cpp.
Maybe it would be possible even to refactor it in such a way that this code is written only once.

Adrian
> On Oct 8, 2015, at 6:53 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> 
> (Removing llvm-commits, adding cfe-commits)
> 
> On Wed, Oct 7, 2015 at 8:07 PM, Adrian Zgorzalek via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>> Hey,
>> 
>> Here is an attempt to fix https://urldefense.proofpoint.com/v1/url?u=https://llvm.org/bugs/show_bug.cgi?id%3D25067&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=ZpIyPFH5RmN0EBF%2B6Om2Hg%3D%3D%0A&m=8P8ApMVHowVMPUxNPT7LA63ve6JJvA38Hc1rN4zEYvw%3D%0A&s=129aedfc04dd18acb23e1369c5712b619076e282e0a4e07452ac187e4d37d43a.
> 
> Thank you for working on this!
> 
>> 
>> Summary:
>> 
>> After introducing no_sanitize, we try to map no_sanitize_* into a
>> no_sanitize(“*”), the switch in code, however doesn’t handle cases when
>> attribute is surrounded by two underscores on each of the ends. In this
>> patch I am trying to utilize existing normalizeAttrName function, by
>> exposing it to outside world and using it before feeding input to the
>> switch.
>> 
>> Added unit tests for the crashes I encountered and patched.
> 
> I am hesitant to expose a normalized attribute name API like that
> because very little should ever care about the actual spelling string
> of the attribute; instead, it should be looking at the semantic
> spelling or the (parsed) attribute kind. However, the no sanitize
> attributes are a bit strange in that they don't have different
> semantic spellings, but instead use the list of sanitizers, so that
> approach won't work.
> 
> I think the better way to handle this is to refactor SemaDeclAttr.cpp
> to have a helper function named normalizeName() and use it in
> handleOwnershipAttr, handleFormatAttr, handleModeAttr, and
> handleNoSanitizeSpecificAttr. It can be used for normalizing attribute
> names as well as attribute argument names.
> 
> ~Aaron



More information about the cfe-commits mailing list