Skip to content

Commit e4e7a7e

Browse files
committed
Revert "Add macro to suppress -Wunnecessary-virtual-specifier (#139614)"
This reverts commit 0954c9d. It breaks the build when built with gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04).
1 parent cbe9af1 commit e4e7a7e

File tree

19 files changed

+27
-40
lines changed

19 files changed

+27
-40
lines changed

clang/include/clang/AST/Decl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class PragmaCommentDecl final
173173
PragmaMSCommentKind CommentKind)
174174
: Decl(PragmaComment, TU, CommentLoc), CommentKind(CommentKind) {}
175175

176-
LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
176+
virtual void anchor();
177177

178178
public:
179179
static PragmaCommentDecl *Create(const ASTContext &C, TranslationUnitDecl *DC,
@@ -207,7 +207,7 @@ class PragmaDetectMismatchDecl final
207207
size_t ValueStart)
208208
: Decl(PragmaDetectMismatch, TU, Loc), ValueStart(ValueStart) {}
209209

210-
LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
210+
virtual void anchor();
211211

212212
public:
213213
static PragmaDetectMismatchDecl *Create(const ASTContext &C,
@@ -5024,7 +5024,7 @@ class ImportDecl final : public Decl,
50245024
/// export void foo();
50255025
/// \endcode
50265026
class ExportDecl final : public Decl, public DeclContext {
5027-
LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
5027+
virtual void anchor();
50285028

50295029
private:
50305030
friend class ASTDeclReader;

clang/include/clang/AST/DeclCXX.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3297,7 +3297,7 @@ class LifetimeExtendedTemporaryDecl final
32973297

32983298
mutable APValue *Value = nullptr;
32993299

3300-
LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
3300+
virtual void anchor();
33013301

33023302
LifetimeExtendedTemporaryDecl(Expr *Temp, ValueDecl *EDecl, unsigned Mangling)
33033303
: Decl(Decl::LifetimeExtendedTemporary, EDecl->getDeclContext(),

clang/include/clang/AST/DeclFriend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ASTContext;
5252
class FriendDecl final
5353
: public Decl,
5454
private llvm::TrailingObjects<FriendDecl, TemplateParameterList *> {
55-
LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
55+
virtual void anchor();
5656

5757
public:
5858
using FriendUnion = llvm::PointerUnion<NamedDecl *, TypeSourceInfo *>;

clang/include/clang/AST/DeclOpenMP.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ template <typename U> class OMPDeclarativeDirective : public U {
110110
class OMPThreadPrivateDecl final : public OMPDeclarativeDirective<Decl> {
111111
friend class OMPDeclarativeDirective<Decl>;
112112

113-
LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
113+
virtual void anchor();
114114

115115
OMPThreadPrivateDecl(DeclContext *DC = nullptr,
116116
SourceLocation L = SourceLocation())
@@ -418,7 +418,7 @@ class OMPRequiresDecl final : public OMPDeclarativeDirective<Decl> {
418418
friend class OMPDeclarativeDirective<Decl>;
419419
friend class ASTDeclReader;
420420

421-
LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
421+
virtual void anchor();
422422

423423
OMPRequiresDecl(DeclContext *DC, SourceLocation L)
424424
: OMPDeclarativeDirective<Decl>(OMPRequires, DC, L) {}
@@ -475,7 +475,7 @@ class OMPAllocateDecl final : public OMPDeclarativeDirective<Decl> {
475475
friend class OMPDeclarativeDirective<Decl>;
476476
friend class ASTDeclReader;
477477

478-
LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
478+
virtual void anchor();
479479

480480
OMPAllocateDecl(DeclContext *DC, SourceLocation L)
481481
: OMPDeclarativeDirective<Decl>(OMPAllocate, DC, L) {}

clang/include/clang/Driver/Action.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class BindArchAction : public Action {
267267
/// programming model implementation needs and propagates the offloading kind to
268268
/// its dependences.
269269
class OffloadAction final : public Action {
270-
LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
270+
virtual void anchor();
271271

272272
public:
273273
/// Type used to communicate device actions. It associates bound architecture,

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ class Sema final : public SemaBase {
895895
/// with a vtable when the vtable is emitted. Sema is final and not
896896
/// polymorphic, but the debug info size savings are so significant that it is
897897
/// worth adding a vtable just to take advantage of this optimization.
898-
LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
898+
virtual void anchor();
899899

900900
const LangOptions &getLangOpts() const { return LangOpts; }
901901
OpenCLOptions &getOpenCLOptions() { return OpenCLFeatures; }

clang/lib/AST/ByteCode/InterpFrame.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class InterpFrame final : public Frame {
119119
CodePtr getRetPC() const { return RetPC; }
120120

121121
/// Map a location to a source.
122-
SourceInfo getSource(CodePtr PC) const;
122+
virtual SourceInfo getSource(CodePtr PC) const;
123123
const Expr *getExpr(CodePtr PC) const;
124124
SourceLocation getLocation(CodePtr PC) const;
125125
SourceRange getRange(CodePtr PC) const;

clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ class CheckVarsEscapingDeclContext final
323323
CheckVarsEscapingDeclContext(CodeGenFunction &CGF,
324324
ArrayRef<const ValueDecl *> TeamsReductions)
325325
: CGF(CGF), EscapedDecls(llvm::from_range, TeamsReductions) {}
326-
~CheckVarsEscapingDeclContext() = default;
326+
virtual ~CheckVarsEscapingDeclContext() = default;
327327
void VisitDeclStmt(const DeclStmt *S) {
328328
if (!S)
329329
return;

clang/lib/CodeGen/CGStmtOpenMP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4783,7 +4783,7 @@ class CheckVarsEscapingUntiedTaskDeclContext final
47834783

47844784
public:
47854785
explicit CheckVarsEscapingUntiedTaskDeclContext() = default;
4786-
~CheckVarsEscapingUntiedTaskDeclContext() = default;
4786+
virtual ~CheckVarsEscapingUntiedTaskDeclContext() = default;
47874787
void VisitDeclStmt(const DeclStmt *S) {
47884788
if (!S)
47894789
return;

clang/lib/Driver/ToolChains/Hexagon.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
4242
bool hasIntegratedCPP() const override { return false; }
4343
bool isLinkJob() const override { return true; }
4444

45-
void RenderExtraToolArgs(const JobAction &JA,
46-
llvm::opt::ArgStringList &CmdArgs) const;
45+
virtual void RenderExtraToolArgs(const JobAction &JA,
46+
llvm::opt::ArgStringList &CmdArgs) const;
4747
void ConstructJob(Compilation &C, const JobAction &JA,
4848
const InputInfo &Output, const InputInfoList &Inputs,
4949
const llvm::opt::ArgList &TCArgs,

0 commit comments

Comments
 (0)