[clang] [llvm] Add macro to suppress -Wunnecessary-virtual-specifier (PR #139614)
via cfe-commits
cfe-commits at lists.llvm.org
Mon May 12 13:02:03 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- clang/include/clang/AST/Decl.h clang/include/clang/AST/DeclCXX.h clang/include/clang/AST/DeclFriend.h clang/include/clang/AST/DeclOpenMP.h clang/include/clang/Driver/Action.h clang/include/clang/Sema/Sema.h clang/lib/AST/ByteCode/InterpFrame.h clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp clang/lib/CodeGen/CGStmtOpenMP.cpp clang/lib/Driver/ToolChains/Hexagon.h llvm/include/llvm/Analysis/InstSimplifyFolder.h llvm/include/llvm/Analysis/TargetFolder.h llvm/include/llvm/IR/ConstantFolder.h llvm/include/llvm/IR/NoFolder.h llvm/include/llvm/Support/Compiler.h llvm/include/llvm/Transforms/Scalar/GVNExpression.h llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp llvm/lib/Target/X86/X86InstrInfo.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h
index 576fa55d8..b8cb77e1a 100644
--- a/llvm/include/llvm/Support/Compiler.h
+++ b/llvm/include/llvm/Support/Compiler.h
@@ -714,10 +714,10 @@ void AnnotateIgnoreWritesEnd(const char *file, int line);
/// This macro is used to adhere to LLVM's policy that each class with a vtable
/// must have at least one out-of-line virtual function. This macro allows us
/// to declare such a function in `final` classes without triggering a warning.
-#define LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION() \
- _Pragma("clang diagnostic push") \
- _Pragma("clang diagnostic ignored \"-Wunnecessary-virtual-specifier\"") \
- virtual void anchor()\
- _Pragma("clang diagnostic pop")
+#define LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION() \
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored " \
+ "\"-Wunnecessary-virtual-specifier\"") virtual void \
+ anchor() _Pragma("clang diagnostic pop")
#endif
``````````
</details>
https://github.com/llvm/llvm-project/pull/139614
More information about the cfe-commits
mailing list