[PATCH] D58091: Customize warnings for missing built-in type

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 11 17:38:28 PST 2019


jdoerfert created this revision.
jdoerfert added reviewers: jyknight, lebedev.ri, aaron.ballman, bcain.
Herald added subscribers: jfb, bollu, krytarowski, emaste.
Herald added a project: clang.

If we detect a built-in declaration for which we cannot derive a type
matching the pattern in the Builtins.def file, we currently emit a
warning that the respective header is needed. However, this is not
necessarily the behavior we want as it has no connection to the location
of the declaration (which can actually be in the header in question).
Instead, this warning is generated

- if we could not build the type for the pattern on file (for some reason). Here we should make the reason explicit. The actual problem is otherwise circumvented as the warning is misleading, see [0] for an example.
- if we could not build the type for the pattern because we do not have a type on record, possible since D55483 <https://reviews.llvm.org/D55483>, we should not emit any warning. See [1] for a legitimate problem.

This patch address both cases. For the "setjmp" family a new warning is
introduced and for built-ins without type on record, so far
"pthread_create", we do not emit the warning anymore.

Also see: PR40692

[0] https://lkml.org/lkml/2019/1/11/718
[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235583


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D58091

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Analysis/retain-release.m
  clang/test/Sema/builtin-setjmp.c
  clang/test/Sema/implicit-builtin-decl.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58091.186380.patch
Type: text/x-patch
Size: 5307 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190212/f95be9b3/attachment.bin>


More information about the cfe-commits mailing list