[PATCH] D13263: Addition of __attribute__((pass_object_size)) to Clang
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 17 10:06:08 PST 2015
aaron.ballman added inline comments.
================
Comment at: lib/Sema/SemaDeclAttr.cpp:829
@@ +828,3 @@
+ if (Type > 3) {
+ S.Diag(E->getLocStart(), diag::err_attribute_argument_outof_range)
+ << Attr.getName() << 0 << 3 << E->getSourceRange();
----------------
>> I'm wondering why the magic value 3 at all? It seems like this (and the above code) should be replaced by a call to checkFunctionOrMethodParameterIndex().
> Marking this as done because checkFunctionOrMethodParameterIndex doesn't seem to accomplish our goal.
>
>> There should be comments explaining the magic number 3.
> The docs for pass_object_size(N) state that N is passed as the second parameter to __builtin_object_size, which means that N must be in the range [0, 3]. I'll add a comment, but given your other comment, it looks like there may have been a miscommunication about the purpose of pass_object_size's argument. :)
Ah, yes, I was confused. This isn't checking that the number matches a parameter index. :-)
http://reviews.llvm.org/D13263
More information about the cfe-commits
mailing list