diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-11-09 03:31:16 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-11-09 03:31:16 +0000 |
commit | 90ba6d5cf790c98231c93a63a5b1f7c6a95bd6b6 (patch) | |
tree | 5c444fb5e0d4a9d1e862209409300a6005bc7143 /lib/Sema/SemaDeclCXX.cpp | |
parent | 4b0104d8e35ebd6ccd32230477131653a8e4a17c (diff) |
Fix source locations in unnamed bitfield diagnostic, from Jakub
Wieczorek! Fixes PR8025.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118481 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index b33261e4ea..cb88225ada 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -843,6 +843,11 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, 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); |