[PATCH] D89212: PR47663: Warn if an entity becomes weak after its first use.
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 11 14:08:53 PDT 2020
rsmith created this revision.
rsmith added reviewers: rjmccall, aaron.ballman.
Herald added a project: clang.
rsmith requested review of this revision.
Such code will not work in general; we might have already used the
non-weakness, for example when constant-evaluating an address comparison
Thisor when generating code for the declaration.
Modern versions of GCC reject some such cases, but silently accept
others (based, it appears, on whether the weakness of the declaration
was already inspected). It doesn't seem feasible for us to exactly
follow their behavior, and it might be problematic to start rejecting
cases that GCC accepts and that work in practice, so only warn on this
rather than rejecting, at least for now.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D89212
Files:
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/AST/DeclBase.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/Sema/attr-weak.c
clang/test/Sema/init.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89212.297487.patch
Type: text/x-patch
Size: 11457 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201011/4865f2e4/attachment-0001.bin>
More information about the cfe-commits
mailing list