[PATCH] D58531: [clang] Specify type of pthread_create builtin

James Clarke via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 21 16:13:35 PST 2019


jrtc27 created this revision.
Herald added subscribers: cfe-commits, jfb.
Herald added a project: clang.

Currently, pthread_create's type string is empty, so GetBuiltinType
fails and any header declaring it gives a -Wbuiltin-requires-header
warning, which gives a false-positive when including pthread.h itself
with -Wsystem-headers. By specifying its type, this false-positive goes
away and it behaves like every other builtin declared in system headers,
only warning when the declaration does not match the expected type.

This requires introducing a way to declare function pointer types in
builtin type strings, which requires refactoring GetBuiltinType to allow
recursive parsing of function types, expressed as a type string within
parentheses.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D58531

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Serialization/ASTBitCodes.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/Analysis/retain-release.m
  clang/test/Sema/implicit-builtin-decl.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58531.187885.patch
Type: text/x-patch
Size: 13792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190222/9671aefa/attachment-0001.bin>


More information about the cfe-commits mailing list