[PATCH] [RFC] Sanitize upcasts and conversion to virtual base
Alexey Samsonov
vonosmas at gmail.com
Tue Oct 7 18:28:23 PDT 2014
================
Comment at: tools/clang/lib/CodeGen/CGClass.cpp:186
@@ +185,3 @@
+ EmitTypeCheck(TCK_Upcast, Loc, Value, DerivedTy, DerivedAlign,
+ !NullCheckValue);
+ }
----------------
rsmith wrote:
> I am not sure that the `SkipNullCheck` behavior here is right. If `NullCheckValue` is false, then I think we should be performing a null check inside `EmitTypeCheck` rather than assuming the pointer is non-null.
That is, just pass "false" here? But in some cases we're calling CodeGenFunction::GetAddressOfBaseClass on values which are guaranteed to be non-null (e.g. on materialized temporaries), as they happen in compiler-generated code. I'm not sure we still want to emit null-check in EmitTypeCheck in this case.
http://reviews.llvm.org/D5635
More information about the cfe-commits
mailing list