Commit Graph

20 Commits

Author SHA1 Message Date
David Majnemer 8702b5215e [Sema] Don't allow unverified bitfields in FieldDecls
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
2015-04-26 04:58:18 +00:00
Aaron Ballman 6c93b3e29c Adding a -Wunused-value warning for expressions with side effects used in an 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
2014-12-17 21:57:17 +00:00
Richard Smith 5b57167285 Fix handling of preincrement on bit-fields. This gives a bit-field in C++, but
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
2014-09-24 23:55:00 +00:00
John McCall d25db7ed0f Grab-bag of bit-field fixes:
- 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
2013-05-06 21:39:12 +00:00
Eli Friedman 609ada27ce Silliness with commas, as reported at http://blog.regehr.org/archives/558 . 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
2011-07-13 02:05:57 +00:00
Douglas Gregor 23ab745e79 Fix source locations in unnamed bitfield diagnostic, from Jakub
Wieczorek! Fixes PR8025.

llvm-svn: 118481
2010-11-09 03:31:16 +00:00
Anders Carlsson 7a4a25de1e Improve the bit-field too wide error message.
llvm-svn: 101384
2010-04-15 18:47:32 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- 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
2009-12-15 20:14:24 +00:00
Anders Carlsson 2898af59dc Update tests
llvm-svn: 81802
2009-09-14 22:00:20 +00:00
Douglas Gregor 71235ecb7f When determining whether an expression refers to a bit-field, look
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
2009-05-02 02:18:30 +00:00
Douglas Gregor d2c2d172da Fix bitfield promotions in several more cases. We don't seem to work hard enough at determining whether an expression is a bitfield or not, yet.
llvm-svn: 70613
2009-05-02 00:36:19 +00:00
Douglas Gregor 8d9c509975 Implement bit-field promotion rules for C99. Fixes PR3500.
llvm-svn: 70571
2009-05-01 20:41:21 +00:00
Chris Lattner f9b00eb7dc clean up anonymous bitfield diagnostics, PR4017
llvm-svn: 69608
2009-04-20 17:29:38 +00:00
Daniel Dunbar a45cf5b6b0 Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602
2009-03-24 02:24:46 +00:00
Anders Carlsson 6caa9dd693 Check signedness of bitfield sizes.
llvm-svn: 67045
2009-03-16 18:19:21 +00:00
Douglas Gregor 8145742349 Partial fix for PR3310, concerning type-checking for tentative
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
2009-03-10 21:58:27 +00:00
Chris Lattner 73bf7b42b6 fix PR3607 and a fixme, by checking bitfield constraints
more consistently.

llvm-svn: 66210
2009-03-05 22:45:59 +00:00
Chris Lattner 81ed6805db Implement rdar://6138816 - [sema] named bitfields cannot have 0 width
llvm-svn: 60920
2008-12-12 04:56:04 +00:00
Chris Lattner ece9ae718b add annotation
llvm-svn: 60907
2008-12-11 23:11:52 +00:00
Anders Carlsson 5df391e5c7 Add diagnostics for bitfields.
llvm-svn: 60628
2008-12-06 20:33:04 +00:00