[llvm-branch-commits] [cfe-branch] r118579 - in /cfe/branches/Apple/whitney: lib/Sema/SemaDeclCXX.cpp test/Sema/bitfield.c

Daniel Dunbar daniel at zuster.org
Tue Nov 9 09:32:53 PST 2010


Author: ddunbar
Date: Tue Nov  9 11:32:53 2010
New Revision: 118579

URL: http://llvm.org/viewvc/llvm-project?rev=118579&view=rev
Log:
Merge r118481:
--
Author: Douglas Gregor <dgregor at apple.com>
Date:   Tue Nov 9 03:31:16 2010 +0000

    Fix source locations in unnamed bitfield diagnostic, from Jakub
    Wieczorek! Fixes PR8025.

Modified:
    cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp
    cfe/branches/Apple/whitney/test/Sema/bitfield.c

Modified: cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp?rev=118579&r1=118578&r2=118579&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp Tue Nov  9 11:32:53 2010
@@ -843,6 +843,11 @@
   DeclarationNameInfo NameInfo = GetNameForDeclarator(D);
   DeclarationName Name = NameInfo.getName();
   SourceLocation Loc = NameInfo.getLoc();
+
+  // For anonymous bitfields, the location should point to the type.
+  if (Loc.isInvalid())
+    Loc = D.getSourceRange().getBegin();
+
   Expr *BitWidth = static_cast<Expr*>(BW);
   Expr *Init = static_cast<Expr*>(InitExpr);
 

Modified: cfe/branches/Apple/whitney/test/Sema/bitfield.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/Sema/bitfield.c?rev=118579&r1=118578&r2=118579&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/Sema/bitfield.c (original)
+++ cfe/branches/Apple/whitney/test/Sema/bitfield.c Tue Nov  9 11:32:53 2010
@@ -34,3 +34,7 @@
 __typeof__((x.x+=1)+1) y;
 __typeof__(x.x<<1) y;
 int y;
+
+struct PR8025 {
+  double : 2; // expected-error{{anonymous bit-field has non-integral type 'double'}}
+};





More information about the llvm-branch-commits mailing list