[PATCH] PR20958 Allow redeclaration of type-generic builtins

Charlie Turner charlie.turner at arm.com
Thu May 21 07:43:19 PDT 2015


This patch allows the user to declare the C99 math builtins that take the generic "real-floating" argument types.
A use case is described in https://llvm.org/bugs/show_bug.cgi?id=20958 

In C++98 and C89, you may redeclare these builtins to take any type, Clang will pretend these don't exist in these languages.
In C++11 and C99 (and derivations thereof), you can only redeclare the builtin with types that are "real-floating". If you try to redeclare with different types, a diagnostic is produced.

I also tweaked the __noop builtin to specify that it's arguments are custom type-checked. This was avoid a semantic error about passing non-POD types through a variadic argument, which is not appropriate for that builtin.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9912

Files:
  include/clang/Basic/Builtins.def
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/AST/ASTContext.cpp
  lib/Sema/SemaDecl.cpp
  test/Sema/builtins-c89-valid.c
  test/Sema/builtins-c99-generic.c
  test/SemaCXX/builtins.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9912.26245.patch
Type: text/x-patch
Size: 13481 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150521/44ba55ee/attachment.bin>


More information about the cfe-commits mailing list