[cfe-commits] r43023 - in /cfe/trunk: Sema/SemaDecl.cpp Sema/SemaExpr.cpp clang.xcodeproj/project.pbxproj

Chris Lattner clattner at apple.com
Wed Oct 17 17:37:23 PDT 2007


> Bad cast...need to use dyn_cast_or_null. Also changed  
> Sema::InitBuiltinVaListType (which had the same bug).

Hi Steve,

Why are these dyn_cast_or_null?  It seems like none of those cases  
allow null pointers?

-Chris

>
> Modified:
>     cfe/trunk/Sema/SemaDecl.cpp
>     cfe/trunk/Sema/SemaExpr.cpp
>     cfe/trunk/clang.xcodeproj/project.pbxproj
>
> Modified: cfe/trunk/Sema/SemaDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/ 
> SemaDecl.cpp?rev=43023&r1=43022&r2=43023&view=diff
>
> ====================================================================== 
> ========
> --- cfe/trunk/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/Sema/SemaDecl.cpp Mon Oct 15 19:00:18 2007
> @@ -154,7 +154,7 @@
>    IdentifierInfo *VaIdent = &Context.Idents.get("__builtin_va_list");
>    ScopedDecl *VaDecl = LookupScopedDecl(VaIdent, Decl::IDNS_Ordinary,
>                                            SourceLocation(), TUScope);
> -  TypedefDecl *VaTypedef = cast<TypedefDecl>(VaDecl);
> +  TypedefDecl *VaTypedef = dyn_cast_or_null<TypedefDecl>(VaDecl);
>    Context.setBuiltinVaListType(Context.getTypedefType(VaTypedef));
>  }
>
>
> Modified: cfe/trunk/Sema/SemaExpr.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/ 
> SemaExpr.cpp?rev=43023&r1=43022&r2=43023&view=diff
>
> ====================================================================== 
> ========
> --- cfe/trunk/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/Sema/SemaExpr.cpp Mon Oct 15 19:00:18 2007
> @@ -1896,9 +1896,9 @@
>      IdentifierInfo *NSIdent = &Context.Idents.get 
> ("NSConstantString");
>      ScopedDecl *IFace = LookupScopedDecl(NSIdent,  
> Decl::IDNS_Ordinary,
>                                           SourceLocation(), TUScope);
> -    ObjcInterfaceDecl *stringInterface = cast<ObjcInterfaceDecl> 
> (IFace);
> -    assert(stringInterface && "missing '@interface  
> NSConstantString'");
> -    Context.setObjcConstantStringInterface(stringInterface);
> +    ObjcInterfaceDecl *strIFace =  
> dyn_cast_or_null<ObjcInterfaceDecl>(IFace);
> +    assert(strIFace && "missing '@interface NSConstantString'");
> +    Context.setObjcConstantStringInterface(strIFace);
>    }
>    QualType t = Context.getObjcConstantStringInterface();
>    t = Context.getPointerType(t);
>
> Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/ 
> project.pbxproj?rev=43023&r1=43022&r2=43023&view=diff
>
> ====================================================================== 
> ========
> --- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
> +++ cfe/trunk/clang.xcodeproj/project.pbxproj Mon Oct 15 19:00:18 2007
> @@ -742,7 +742,6 @@
>  		08FB7793FE84155DC02AAC07 /* Project object */ = {
>  			isa = PBXProject;
>  			buildConfigurationList = 1DEB923508733DC60010E9CD /* Build  
> configuration list for PBXProject "clang" */;
> -			compatibilityVersion = "Xcode 2.4";
>  			hasScannedForEncodings = 1;
>  			mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
>  			projectDirPath = "";
>
>
> _______________________________________________
> 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