Skip to content

Commit eb30884

Browse files
committed
Avoid unknown pragma for non-clang compilers
1 parent 65fcb50 commit eb30884

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/include/llvm/Support/Compiler.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,11 +716,16 @@ void AnnotateIgnoreWritesEnd(const char *file, int line);
716716
/// to declare such a function in `final` classes without triggering a warning.
717717
// clang-format off
718718
// Autoformatting makes this look awful.
719+
#if defined(__clang__)
719720
#define LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION() \
720721
_Pragma("clang diagnostic push") \
721722
_Pragma("clang diagnostic ignored \"-Wunnecessary-virtual-specifier\"") \
722723
virtual void anchor() \
723724
_Pragma("clang diagnostic pop")
725+
#else
726+
#define LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION() \
727+
virtual void anchor()
728+
#endif
724729
// clang-format on
725730

726731
#endif

0 commit comments

Comments
 (0)