[cfe-commits] r142757 - /cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Peter Collingbourne
peter at pcc.me.uk
Sun Oct 23 11:59:37 PDT 2011
Author: pcc
Date: Sun Oct 23 13:59:37 2011
New Revision: 142757
URL: http://llvm.org/viewvc/llvm-project?rev=142757&view=rev
Log:
Clean up duplicated code in Sema::BuildMemInitializer.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=142757&r1=142756&r2=142757&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sun Oct 23 13:59:37 2011
@@ -1778,29 +1778,18 @@
// using a qualified name. ]
if (!SS.getScopeRep() && !TemplateTypeTy) {
// Look for a member, first.
- FieldDecl *Member = 0;
DeclContext::lookup_result Result
= ClassDecl->lookup(MemberOrBase);
if (Result.first != Result.second) {
- Member = dyn_cast<FieldDecl>(*Result.first);
-
- if (Member) {
+ ValueDecl *Member;
+ if ((Member = dyn_cast<FieldDecl>(*Result.first)) ||
+ (Member = dyn_cast<IndirectFieldDecl>(*Result.first))) {
if (EllipsisLoc.isValid())
Diag(EllipsisLoc, diag::err_pack_expansion_member_init)
<< MemberOrBase << SourceRange(IdLoc, Args.getEndLoc());
return BuildMemberInitializer(Member, Args, IdLoc);
}
-
- // Handle anonymous union case.
- if (IndirectFieldDecl* IndirectField
- = dyn_cast<IndirectFieldDecl>(*Result.first)) {
- if (EllipsisLoc.isValid())
- Diag(EllipsisLoc, diag::err_pack_expansion_member_init)
- << MemberOrBase << SourceRange(IdLoc, Args.getEndLoc());
-
- return BuildMemberInitializer(IndirectField, Args, IdLoc);
- }
}
}
// It didn't name a member, so see if it names a class.
More information about the cfe-commits
mailing list