[PATCH] Fix ICE in Clang when dealing with attribute(__no_sanitize_*__)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 8 06:53:53 PDT 2015
(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://llvm.org/bugs/show_bug.cgi?id=25067.
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