[cfe-commits] r157117 - in /cfe/trunk/lib/Sema: SemaDeclCXX.cpp SemaExprObjC.cpp

Fariborz Jahanian fjahanian at apple.com
Sat May 19 09:52:33 PDT 2012


On May 19, 2012, at 9:34 AM, Benjamin Kramer wrote:

> Author: d0k
> Date: Sat May 19 11:34:46 2012
> New Revision: 157117
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=157117&view=rev
> Log:
> Apparently empty names are allowed here.

Please provide a test case if this intends to fix a bug (rather than doing a refactoring).

- Fariborz

> 
> Modified:
>    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
>    cfe/trunk/lib/Sema/SemaExprObjC.cpp
> 
> Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=157117&r1=157116&r2=157117&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sat May 19 11:34:46 2012
> @@ -1504,15 +1504,16 @@
>   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()) {
> 
> Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=157117&r1=157116&r2=157117&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Sat May 19 11:34:46 2012
> @@ -1399,12 +1399,13 @@
>   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();
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list