This is an archive of the discontinued LLVM Phabricator instance.

[Clang][Fortify] drop inline decls when redeclared
ClosedPublic

Authored by serge-sans-paille on Apr 7 2022, 6:27 AM.

Details

Summary

When an inline builtin declaration is shadowed by an actual declaration, we must
reference the actual declaration, even if it's not the last, following GCC
behavior.

This fixes #54715

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 6:27 AM
serge-sans-paille requested review of this revision.Apr 7 2022, 6:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 6:27 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
nickdesaulniers accepted this revision.Apr 7 2022, 10:21 AM

Thanks for the quick fix!

clang/lib/CodeGen/CGExpr.cpp
4967–4969

If OnlyHasInlineBuiltinDeclaration returning false is unusual, can we get away with switching the order of the checks here, so that CGF.CurFn->getName() != FDInlineName which might be more likely might short circuit the conditional? That might help us avoid walking the redecl list in OnlyHasInlineBuiltinDeclaration occasionally.

This revision is now accepted and ready to land.Apr 7 2022, 10:21 AM
nickdesaulniers added a comment.EditedApr 7 2022, 10:24 AM

Also, for the initial lines of commit messages, please try to make them less ambiguous about which parts of the project they touch. For example [Clang][Fortify] drop inline decls when redeclared is more descriptive should this get bucketed with other commits in a buildbot failure. The oneline helps triagers quickly ascertain whether failures they observe look related to which change or not.

@nickdesaulniers changes taken into account and pushed, thanks for the review!

MaskRay retitled this revision from Handle a subtle hole in inline builtin handling to [Clang][Fortify] drop inline decls when redeclared.Apr 17 2022, 11:07 AM