ahatanak added a comment.

I didn't think of this case, but no, it isn't a good idea. We shouldn't issue a 
warning unless we know the returned pointer is nullable.


================
Comment at: lib/Sema/SemaDecl.cpp:9739
@@ +9738,3 @@
+      DeducedType = DeducedType.setNullability(
+          Init->getType()->getNullability(Context), Context);
+
----------------
manmanren wrote:
> Do we propagate other attributes for deduced types?
QualType::setNullability can drop attributes on typedefs because it desugars 
the type until all nullability specifiers are stripped. I didn't try very hard 
to make sure QualType::setNullability preserve all the attributes because I 
couldn't come up with a case where dropping an attribute attached to a typedef 
for a pointer type would cause clang to mis-compile or issue a wrong 
diagnostic, so I thought it was safe.


https://reviews.llvm.org/D22794



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to