From c1aa40cdc8f42c3a5505ebb54aa54f3e5086b7ef Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 19 May 2012 16:34:46 +0000 Subject: [PATCH] Apparently empty names are allowed here. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157117 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDeclCXX.cpp | 5 +++-- lib/Sema/SemaExprObjC.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 3e1899c762..9571a26845 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1504,15 +1504,16 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, Decl *Member; if (isInstField) { CXXScopeSpec &SS = D.getCXXScopeSpec(); - IdentifierInfo *II = Name.getAsIdentifierInfo(); // Data members must have identifiers for names. - if (!II) { + if (!Name.isIdentifier()) { Diag(Loc, diag::err_bad_variable_name) << Name; return 0; } + IdentifierInfo *II = Name.getAsIdentifierInfo(); + // Member field could not be with "template" keyword. // So TemplateParameterLists should be empty in this case. if (TemplateParameterLists.size()) { diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 3a4f3dd883..d3b803ab93 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -1399,12 +1399,13 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, const ObjCInterfaceType *IFaceT = OPT->getInterfaceType(); ObjCInterfaceDecl *IFace = IFaceT->getDecl(); - IdentifierInfo *Member = MemberName.getAsIdentifierInfo(); - if (!Member) { + if (!MemberName.isIdentifier()) { Diag(MemberLoc, diag::err_invalid_property_name) << MemberName << QualType(OPT, 0); return ExprError(); } + + IdentifierInfo *Member = MemberName.getAsIdentifierInfo(); SourceRange BaseRange = Super? SourceRange(SuperLoc) : BaseExpr->getSourceRange(); -- 2.40.0