MSVC warning noise on "LLVM_ATTRIBUTE_ALWAYS_INLINE inline void foo()"

Hi all,
Some functions have “inline” specified twice by use of LLVM_ATTRIBUTE_ALWAYS_INLINE.
For example in StringRef.h:

LLVM_ATTRIBUTE_ALWAYS_INLINE
inline bool operator==(StringRef LHS, StringRef RHS);

This results in warning noise when compiled with MSVC 2015:
\include\llvm/ADT/StringRef.h(567): warning C4141: ‘inline’: used more than once

\include\llvm/ADT/StringRef.h(572): warning C4141: ‘inline’: used more than once

\include\llvm/IR/User.h(43): warning C4141: ‘inline’: used more than once

Thanks very much for a fix.
(I hope that simply removing the “inline” after LLVM_ATTRIBUTE_ALWAYS_INLINE is correct)

Kind regards,
Johan

LLVM_ATTRIBUTE_ALWAYS_INLINE is defined to be __forceinline for MSVC. I wonder why you get that warning.

David

LLVM_ATTRIBUTE_ALWAYS_INLINE is defined to be __forceinline for MSVC. I
wonder why you get that warning.

inline and __forceinline don't mix with MSVC -- I believe they may be
modeled with the same attribute under the hood. I'm not certain of the
best way to solve this aside from suggesting to ignore C4141 locally.

~Aaron

Perhaps LLVM_ATTRIBUTE_ALWAYS_INLINE could be defined to "inline" if the
compiler has no support for always_inline (currently it is set to nothing
in that case) ?
I think this would allow removal of the "inline" after
LLVM_ATTRIBUTE_ALWAYS_INLINE.

> LLVM_ATTRIBUTE_ALWAYS_INLINE is defined to be __forceinline for MSVC. I
> wonder why you get that warning.

inline and __forceinline don't mix with MSVC -- I believe they may be
modeled with the same attribute under the hood. I'm not certain of the
best way to solve this aside from suggesting to ignore C4141 locally.

Perhaps LLVM_ATTRIBUTE_ALWAYS_INLINE could be defined to "inline" if the
compiler has no support for always_inline (currently it is set to nothing in
that case) ?
I think this would allow removal of the "inline" after
LLVM_ATTRIBUTE_ALWAYS_INLINE.

Wouldn't this cause functions with MSVC that are marked
LLVM_ATTRIBUTE_ALWAYS_INLINE but not 'inline' to not be inlined? I
suppose a possible way is to make a #define
LLVM_ATTRIBUTE_INLINE_ALWAYS_INLINE that combines the two when not
compiling with MSVC, and then change all the requisite function
signatures to use this new macro instead. Uncertain of the value of
that, however.

~Aaron