[llvm] r184375 - Make the '==' operator inline.

Bill Wendling isanbard at gmail.com
Wed Jun 19 23:41:47 PDT 2013


On Jun 19, 2013, at 8:28 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> On Wed, Jun 19, 2013 at 3:22 PM, David Blaikie <dblaikie at gmail.com> wrote:
>> On Wed, Jun 19, 2013 at 3:16 PM, Bill Wendling <isanbard at gmail.com> wrote:
>>> Author: void
>>> Date: Wed Jun 19 17:16:11 2013
>>> New Revision: 184375
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=184375&view=rev
>>> Log:
>>> Make the '==' operator inline.
>>> 
>>> Modified:
>>>    llvm/trunk/include/llvm/Target/TargetOptions.h
>>> 
>>> Modified: llvm/trunk/include/llvm/Target/TargetOptions.h
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=184375&r1=184374&r2=184375&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/include/llvm/Target/TargetOptions.h (original)
>>> +++ llvm/trunk/include/llvm/Target/TargetOptions.h Wed Jun 19 17:16:11 2013
>>> @@ -207,9 +207,36 @@ namespace llvm {
>>> 
>>> // Comparison operators:
>>> 
>>> -bool operator==(const TargetOptions &LHS, const TargetOptions &RHS);
>>> 
>>> -static inline bool operator!=(const TargetOptions &LHS, const TargetOptions &RHS) {
>>> +static inline bool operator==(const TargetOptions &LHS,
>>> +                              const TargetOptions &RHS) {
>> 
>> I'm not sure I've ever seen an op overload as a static member - I
>> guess this isn't really any different than the usual (at least what
>> I've seen) way of doing it as an inline 'friend' definition. (I
>> mention this in case someone else knows a reason to prefer one over
>> the other)
> 
> This is not a member. Why is it marked static?

So that there aren't multiple copies in the final binaries.

-bw





More information about the llvm-commits mailing list