Reapply: Silence false positive diagnostics regarding passing an object of enumeratio...
authorAaron Ballman <aaron@aaronballman.com>
Thu, 15 Sep 2016 18:07:51 +0000 (18:07 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Thu, 15 Sep 2016 18:07:51 +0000 (18:07 +0000)
commita4f597f002e875782cfa1704a81051ba67c9adfd
treecffb31e0a516a1cc89365b4ad1bc20f898cbe634
parent886a542e2382bbc7dbc027740d50c307fce7e105
Reapply: Silence false positive diagnostics regarding passing an object of enumeration type to va_start().

The underlying type for an enumeration in C is either char, signed int, or unsigned int. In the case the underlying type is chosen to be char (such as when passing -fshort-enums or using __attribute__((packed)) on the enum declaration), the enumeration can result in undefined behavior. However, when the underlying type is signed int or unsigned int (or long long as an extension), there is no undefined behavior because the types are compatible. This patch silences diagnostics for the latter while retaining the diagnostics for the former.

This patch addresses PR29140.

llvm-svn: 281632
clang/lib/Sema/SemaChecking.cpp
clang/test/Sema/varargs.c