[cfe-commits] [PATCH] Simplify isPowerOfTwo signature

Jordan Rose jordan_rose at apple.com
Tue Dec 11 15:31:26 PST 2012


On Dec 11, 2012, at 7:43 , Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:

>>> We can always add it back that day, no?
>> 
>> 
>> Sure, but if there's no real need to remove it why not leave it alone?
>> It seems a rather pointless clean up to me.  That said, I won't object if
>> Saleem goes ahead and removes it.
> 
> Short of some ABI stability (like in the C api) or generalization of
> users (for example, we want a macro to call isPowerOfTwo or other
> functions that do need TargetData), I think we should make the code as
> simple as possible.
> 
> Having the target data makes the function a bit more cumbersome to
> call, and a bit more cumbersome to read. Not having it also makes it
> clear just by looking at the interface that in doesn't do anything
> target dependent.

I think that's Chandler's point—the interface shouldn't imply that it's a target-independent predicate, even though the current implementation is. What about renaming to isKnownPowerOfTwo, to make it clear that the target could affect the answer?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121211/cdad85e8/attachment.html>


More information about the cfe-commits mailing list