rjmccall added inline comments.

================
Comment at: lib/CodeGen/CGObjC.cpp:385
+        // prefix are identified as OMF_alloc but we only want to call the
+        // runtime for this version.
+        if (Sel.isUnarySelector() && Sel.getNameForSlot(0) == "alloc")
----------------
Actually, I'd suggest just rewriting this comment to look like the next one, it 
conveys the same idea but much more succinctly.


================
Comment at: lib/CodeGen/CGObjC.cpp:390
+        if (Sel.isKeywordSelector() && Sel.getNumArgs() == 1 &&
+            Args.size() == 1 && Args.front().getKnownRValue().isScalar() &&
+            Sel.getNameForSlot(0) == "allocWithZone") {
----------------
You should check `!Args.front().hasLValue()` here before calling 
`getKnownRValue()`.  The test case would be some silly example where 
`-allocWithZone:` is declared with a parameter that's some big `struct` and the 
argument expression just loads it immediately from an l-value.  Or you could 
just check that the parameter type is a pointer type.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55349/new/

https://reviews.llvm.org/D55349



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

Reply via email to