summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/bitfield.c
Commit message (Collapse)AuthorAgeFilesLines
* PR36157: When injecting an implicit function declaration in C89, find the rightRichard Smith2018-02-011-0/+4
| | | | | | | | DeclContext rather than injecting it wherever we happen to be. This avoids creating functions whose DeclContext is a struct or similar. llvm-svn: 323998
* Allow -1 to assign max value to unsigned bitfields.Richard Trieu2016-08-051-1/+1
| | | | | | | | Silence the -Wbitfield-constant-conversion warning for when -1 or other negative values are assigned to unsigned bitfields, provided that the bitfield is wider than the minimum number of bits needed to encode the negative value. llvm-svn: 277796
* Add support for GCC's '__auto_type' extension, per the GCC manual:Richard Smith2015-11-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | https://gcc.gnu.org/onlinedocs/gcc/Typeof.html Differences from the GCC extension: * __auto_type is also permitted in C++ (but only in places where it could appear in C), allowing its use in headers that might be shared across C and C++, or used from C++98 * __auto_type can be combined with a declarator, as with C++ auto (for instance, "__auto_type *p") * multiple variables can be declared in a single __auto_type declaration, with the C++ semantics (the deduced type must be the same in each case) This patch also adds a missing restriction on applying typeof to a bit-field, which GCC has historically rejected in C (due to lack of clarity as to whether the operand should be promoted). The same restriction also applies to __auto_type in C (in both GCC and Clang). This also fixes PR25449. Patch by Nicholas Allegra! llvm-svn: 252690
* [MSVC Compat] Try to treat an implicit, fixed enum as an unfixed enumDavid Majnemer2015-10-081-1/+1
| | | | | | | | | | | | | | | | | | consider the following: enum E *p; enum E { e }; The above snippet is not ANSI C because 'enum E' has not bee defined when we are processing the declaration of 'p'; however, it is a popular extension to make the above work. This would fail using the Microsoft enum semantics because the definition of 'E' would implicitly have a fixed underlying type of 'int' which would trigger diagnostic messages about a mismatch between the declaration and the definition. Instead, treat fixed underlying types as not fixed for the purposes of the diagnostic. llvm-svn: 249674
* Update tests touched by r249656David Majnemer2015-10-081-1/+1
| | | | | | | | | These test updates almost exclusively around the change in behavior around enum: enums without a definition are considered incomplete except when targeting MSVC ABIs. Since these tests are interested in the 'incomplete-enum' behavior, restrict them to %itanium_abi_triple. llvm-svn: 249660
* C11 _Bool bitfield diagnosticRachel Craik2015-09-141-2/+5
| | | | | | | | | | | | Summary: Implement DR262 (for C). This patch will mainly affect bitfields of type _Bool Reviewers: fraggamuffin, rsmith Subscribers: hubert.reinterpretcast, cfe-commits Differential Revision: http://reviews.llvm.org/D10018 llvm-svn: 247618
* [Sema] Don't allow unverified bitfields in FieldDeclsDavid Majnemer2015-04-261-0/+4
| | | | | | | | VerifyBitField must be called if we are to form a bitfield FieldDecl. We will not verify the bitfield if the decl is known to be malformed in other ways; pretend that we don't have a bitfield if this happens. llvm-svn: 235816
* Adding a -Wunused-value warning for expressions with side effects used in an ↵Aaron Ballman2014-12-171-1/+2
| | | | | | unevaluated expression context, such as sizeof(), or decltype(). Also adds a similar warning when the expression passed to typeid() *is* evaluated, since it is equally likely that the user would expect the expression operand to be unevaluated in that case. llvm-svn: 224465
* Fix handling of preincrement on bit-fields. This gives a bit-field in C++, butRichard Smith2014-09-241-1/+20
| | | | | | | | | | | we were failing to find that bit-field when performing integer promotions. This brings us closer to following the standard, and closer to GCC. In C, this change is technically a regression: we get bit-field promotions completely wrong in C, promoting cases that are categorically not bit-field designators. This change makes us do so slightly more consistently, though. llvm-svn: 218428
* Grab-bag of bit-field fixes:John McCall2013-05-061-0/+15
| | | | | | | | | | | | | | - References to ObjC bit-field ivars are bit-field lvalues; fixes rdar://13794269, which got me started down this. - Introduce Expr::refersToBitField, switch a couple users to it where semantically important, and comment the difference between this and the existing API. - Discourage Expr::getBitField by making it a bit longer and less general-sounding. - Lock down on const_casts of bit-field gl-values until we hear back from the committee as to whether they're allowed. llvm-svn: 181252
* Silliness with commas, as reported at http://blog.regehr.org/archives/558 . ↵Eli Friedman2011-07-131-0/+1
| | | | | | As it turns out, this is my fault for not noticing this was an issue when I was looking at this a long time ago. :( llvm-svn: 135026
* Fix source locations in unnamed bitfield diagnostic, from JakubDouglas Gregor2010-11-091-0/+4
| | | | | | Wieczorek! Fixes PR8025. llvm-svn: 118481
* Improve the bit-field too wide error message.Anders Carlsson2010-04-151-2/+2
| | | | llvm-svn: 101384
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Update testsAnders Carlsson2009-09-141-1/+1
| | | | llvm-svn: 81802
* When determining whether an expression refers to a bit-field, lookDouglas Gregor2009-05-021-1/+1
| | | | | | | | | into the left-hand side of an assignment expression. This completes most of PR3500; the only remaining part is to deal with the GCC-specific implementation-defined behavior for "unsigned long" (and other) bit-fields. llvm-svn: 70623
* Fix bitfield promotions in several more cases. We don't seem to work hard ↵Douglas Gregor2009-05-021-0/+5
| | | | | | enough at determining whether an expression is a bitfield or not, yet. llvm-svn: 70613
* Implement bit-field promotion rules for C99. Fixes PR3500.Douglas Gregor2009-05-011-0/+4
| | | | llvm-svn: 70571
* clean up anonymous bitfield diagnostics, PR4017Chris Lattner2009-04-201-1/+5
| | | | llvm-svn: 69608
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Check signedness of bitfield sizes.Anders Carlsson2009-03-161-0/+2
| | | | llvm-svn: 67045
* Partial fix for PR3310, concerning type-checking for tentativeDouglas Gregor2009-03-101-1/+1
| | | | | | | | | | | definitions. We were rejecting tentative definitions of incomplete (which is bad), and now we don't. This fix is partial because we don't do the end-of-translation-unit initialization for tentative definitions that don't ever have any initializers specified. llvm-svn: 66584
* fix PR3607 and a fixme, by checking bitfield constraintsChris Lattner2009-03-051-0/+7
| | | | | | more consistently. llvm-svn: 66210
* Implement rdar://6138816 - [sema] named bitfields cannot have 0 widthChris Lattner2008-12-121-0/+3
| | | | llvm-svn: 60920
* add annotationChris Lattner2008-12-111-0/+3
| | | | llvm-svn: 60907
* Add diagnostics for bitfields.Anders Carlsson2008-12-061-0/+8
llvm-svn: 60628
OpenPOWER on IntegriCloud