From 5dd957e2cfc93af13c5ebb2ad9094490ce735684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <stefan.graenitz@gmail.com> Date: Thu, 15 Jul 2021 14:01:52 +0000 Subject: [PATCH] Make exhaustive use of C++11 override keyword (NFC) Applied clang-tidy modernize-use-override globally in order to achieve compliance in current code base. Added warning `suggest-override` for CMake target `framaCIRGen` in order to detect future breaches. --- ACSLComment.h | 32 +++++++++++++------------- ACSLComponent.h | 6 ++--- ACSLGlobalAnnotation.h | 6 ++--- ACSLLogicType.h | 2 +- ACSLTermOrPredicate.h | 4 ++-- ACSLToken.h | 42 +++++++++++++++++----------------- CMakeLists.txt | 2 ++ ClangVisitor.h | 24 +++++++++---------- Clang_utils.h | 32 +++++++++++++------------- VisitTable.h | 52 +++++++++++++++++++++--------------------- 10 files changed, 102 insertions(+), 100 deletions(-) diff --git a/ACSLComment.h b/ACSLComment.h index a2f7b81..53ca070 100644 --- a/ACSLComment.h +++ b/ACSLComment.h @@ -58,17 +58,17 @@ public: : AnnotationComment(source), _startOfGhost(source._startOfGhost) {} /*! checks annotation for improper use of preprocessor directives, returns true if errors found */ - virtual bool checkAnnotation(const std::string& text, clang::SourceLocation clangLocation, const clang::Sema* sema, std::string& revised) const; + bool checkAnnotation(const std::string& text, clang::SourceLocation clangLocation, const clang::Sema* sema, std::string& revised) const override; - virtual Kind getAnnotationKind(const std::string& text, clang::SourceLocation clangLocation, const clang::Sema* sema) const; + Kind getAnnotationKind(const std::string& text, clang::SourceLocation clangLocation, const clang::Sema* sema) const override; - virtual void parseGlobal(ForwardReferenceList& globals, + void parseGlobal(ForwardReferenceList& globals, ForwardReferenceList* classContent, const clang::DeclContext* clangContext, clang::ASTContext* astContext, clang::Sema* sema, clang::Scope* scope, Clang_utils* clangUtils, - const RTTITable& rttiTable, location loc); + const RTTITable& rttiTable, location loc) override; - virtual void parseGhostGlobal( + void parseGhostGlobal( // ForwardReferenceList& globals, //ForwardReferenceList* classContent, clang::DeclContext* clangContext, @@ -76,34 +76,34 @@ public: clang::Sema* sema, clang::Scope* scope, clang::CompilerInstance& compilerInstance, - clang::ASTConsumer* consumer); + clang::ASTConsumer* consumer) override; - virtual void parseGhostStatement( + void parseGhostStatement( clang::DeclContext* clangContext, clang::Sema* sema, clang::Scope* scope, clang::CompilerInstance& compilerInstance, - clang::ASTConsumer* consumer); + clang::ASTConsumer* consumer) override; - virtual void parseCodeAnnotation(ForwardReferenceList& codeContainer, + void parseCodeAnnotation(ForwardReferenceList& codeContainer, const clang::DeclContext* clangContext, clang::ASTContext* astContext, clang::Sema* sema, clang::Scope* scope, Clang_utils* clangUtils, - const RTTITable& rttiTable, location loc); + const RTTITable& rttiTable, location loc) override; - virtual /* code_annotation */ list parseLoopAnnotation( + /* code_annotation */ list parseLoopAnnotation( const clang::DeclContext* clangContext, clang::ASTContext* astContext, clang::Sema* sema, clang::Scope* scope, Clang_utils* clangUtils, - const RTTITable& rttiTable, location loc); + const RTTITable& rttiTable, location loc) override; - virtual void parseStatementAnnotation(ForwardReferenceList& codeContainer, + void parseStatementAnnotation(ForwardReferenceList& codeContainer, const clang::DeclContext* clangContext, clang::ASTContext* astContext, clang::Sema* sema, clang::Scope* scope, Clang_utils* clangUtils, - const RTTITable& rttiTable); + const RTTITable& rttiTable) override; - virtual void parseFunctionContract(option& /* function_contract */ contract, + void parseFunctionContract(option& /* function_contract */ contract, const clang::DeclContext* clangContext, clang::ASTContext* astContext, clang::Sema* sema, clang::Scope* scope, Clang_utils* clangUtils, - const RTTITable& rttiTable); + const RTTITable& rttiTable) override; private: void initFrom(const clang::Sema* sema); diff --git a/ACSLComponent.h b/ACSLComponent.h index 0f2f206..2ef54b6 100644 --- a/ACSLComponent.h +++ b/ACSLComponent.h @@ -57,7 +57,7 @@ class Locations: public: ForwardList getResult() { return _locations; } Locations(location loc): _locations(), _loc(loc) { } - ~Locations() { if(_loc) { free(_loc); _loc=NULL; } } + ~Locations() override { if(_loc) { free(_loc); _loc=NULL; } } ReadResult readToken(Parser::State& state, Parser::Arguments& arguments); }; @@ -79,7 +79,7 @@ public: AssignsClause(location loc) : _clause(), _loc(loc), _modified(), _dependencies(), _isNothingDependency(false) {} - ~AssignsClause() { if (_loc) { free(_loc); _loc=NULL;} } + ~AssignsClause() override { if (_loc) { free(_loc); _loc=NULL;} } ReadResult readToken(Parser::State& state, Parser::Arguments& arguments); }; @@ -100,7 +100,7 @@ public: public: ForwardList getResult() { return _clause; } AllocFreeClause(location loc): _clause(), _loc(loc) { } - ~AllocFreeClause() { if(_loc) { free(_loc); _loc=NULL; } } + ~AllocFreeClause() override { if(_loc) { free(_loc); _loc=NULL; } } ReadResult readToken(Parser::State& state, Parser::Arguments& arguments); }; diff --git a/ACSLGlobalAnnotation.h b/ACSLGlobalAnnotation.h index 8ce8141..f87b82e 100644 --- a/ACSLGlobalAnnotation.h +++ b/ACSLGlobalAnnotation.h @@ -83,7 +83,7 @@ private: public: LabelList(): _labels(NULL), _endLabels(NULL) { } - ~LabelList() { + ~LabelList() override { while(_labels) { free(_labels->element.container); list temp = _labels->next; @@ -124,7 +124,7 @@ private: public: Parameters(location loc) : _params(NULL), _endParams(NULL), _loc(copy_loc(loc)) { } - ~Parameters() + ~Parameters() override { if(_loc) { free(_loc); _loc = NULL; } while (_params) { free_logic_arg_decl((logic_arg_decl) _params->element.container); @@ -151,7 +151,7 @@ public: _reads(), _params(NULL), _qualificationId(NULL), _polyIdLabels(NULL), _codeOperator(DLexer::OperatorPunctuatorToken::TUndefined), _typeName(NULL) {} - ~GlobalAnnotation() + ~GlobalAnnotation() override { if (_loc) { free(_loc); _loc = NULL; }; clear(); } diff --git a/ACSLLogicType.h b/ACSLLogicType.h index 82fa7bb..190701b 100644 --- a/ACSLLogicType.h +++ b/ACSLLogicType.h @@ -120,7 +120,7 @@ public: _qualification(NULL), _declContext(NULL), _seenInt(false), _seenSigned(false), _doesStopSuffix(false), _loc(NULL) {} - ~LogicType() + ~LogicType() override { if (_typeResult) free_logic_type(_typeResult); if (_typedefResult) free_logic_type_def(_typedefResult); if (_loc) free_location(_loc); diff --git a/ACSLTermOrPredicate.h b/ACSLTermOrPredicate.h index 7efc9ca..7a68b24 100644 --- a/ACSLTermOrPredicate.h +++ b/ACSLTermOrPredicate.h @@ -630,7 +630,7 @@ public: _startLocation(NULL), _declContext(NULL), _doesRequireValue(true), _doesStopTypeAmbiguity(false), _possibleTypeResults(source._possibleTypeResults) {} - ~TermOrPredicate() + ~TermOrPredicate() override { if (_loc) { free_location(_loc); _loc = NULL; }; if (_startLocation) { free_location(_startLocation); _startLocation = NULL; } @@ -651,7 +651,7 @@ public: { _possibleTypeResults &= (1U << LTRType); return *this; } - virtual RuleResult* clone() const { return new TermOrPredicate(*this); } + RuleResult* clone() const override { return new TermOrPredicate(*this); } /// the only ambiguous states where all results may be possible are Begin /// and AfterLogicIdentifier. /// To conform with LALR(1) rules, the state AfterLogicIdentifier should diff --git a/ACSLToken.h b/ACSLToken.h index f77177e..baadad6 100644 --- a/ACSLToken.h +++ b/ACSLToken.h @@ -176,7 +176,7 @@ private: std::string _content; protected: - virtual void _write(std::ostream& out, PersistentFormat& format) const; + void _write(std::ostream& out, PersistentFormat& format) const override; public: CommentToken() { inherited::setComment(); } @@ -188,7 +188,7 @@ public: std::string& content() { return _content; } bool isSlashSlashComment() const { return _content[0] == '/' && _content[1] == '/'; } - virtual bool isValid() const + bool isValid() const override { return inherited::isValid() && inherited::getType() == TComment; } }; @@ -206,7 +206,7 @@ private: std::string _content; protected: - virtual void _write(std::ostream& out, PersistentFormat& format) const; + void _write(std::ostream& out, PersistentFormat& format) const override; public: IdentifierToken() { inherited::setIdentifier(); } @@ -217,9 +217,9 @@ public: std::string& content() { return _content; } // FIXME - this is assignable - is it good form? const std::string& content() const { return _content; } - virtual bool isValid() const + bool isValid() const override { return inherited::isValid() && inherited::getType() == TIdentifier; } - virtual std::string text() const + std::string text() const override { return _content; } @@ -278,7 +278,7 @@ private: protected: DefineParameters(8, AbstractToken) - virtual void _write(std::ostream& out, PersistentFormat& format) const; + void _write(std::ostream& out, PersistentFormat& format) const override; public: KeywordToken() { setKeyword(); setFull(); } @@ -289,12 +289,12 @@ public: Type getType() const { return (Type) queryOwnField(); } KeywordToken& setType(Type type) { assert(!hasOwnField()); mergeOwnField(type); return *this; } - virtual bool isValid() const + bool isValid() const override { return inherited::isValid() && (inherited::getType() == TKeyword) && hasOwnField() && (queryOwnField() < TEnd); } - virtual std::string text() const; + std::string text() const override; }; @@ -325,7 +325,7 @@ protected: LiteralToken() { inherited::setLiteral(); } LiteralToken(const LiteralToken& source) : inherited(source) {} - virtual void _write(std::ostream& out, PersistentFormat& format) const; + void _write(std::ostream& out, PersistentFormat& format) const override; public: Type getType() const { assert(hasOwnField()); return (Type) queryOwnField(); } @@ -336,7 +336,7 @@ public: bool isFloating() const { return queryOwnField() == TFloating; } bool isString() const { return queryOwnField() == TString; } - virtual bool isValid() const + bool isValid() const override { return inherited::isValid() && (AbstractToken::getType() == TLiteral) && hasOwnField() && (queryOwnField() < TEnd); } @@ -361,7 +361,7 @@ protected: DefineSubParameters(Type, 2, INHERITED) DefineSubParameters(Extension, 3, Type) - virtual void _write(std::ostream& out, PersistentFormat& format) const; + void _write(std::ostream& out, PersistentFormat& format) const override; public: IntegerLiteralToken() : _value() { inherited::setInteger(); } @@ -390,7 +390,7 @@ public: const std::string& getValue() const { return _value; } std::string& value() { return _value; } - virtual bool isValid() const + bool isValid() const override { return inherited::isValid() && LiteralToken::isInteger(); } }; @@ -405,7 +405,7 @@ public: protected: DefineParameters(2, inherited); - virtual void _write(std::ostream& out, PersistentFormat& format) const; + void _write(std::ostream& out, PersistentFormat& format) const override; public: CharacterLiteralToken() { _value.wch = L'\0'; inherited::setCharacter(); } @@ -432,7 +432,7 @@ public: if (queryOwnField() == TChar) _value.ch = c; else _value.wch = c; } - virtual bool isValid() const + bool isValid() const override { return inherited::isValid() && inherited::isCharacter() && hasOwnField(); } @@ -454,7 +454,7 @@ protected: DefineSubParameters(Type, 2, INHERITED) DefineSubParameters(Suffix, 2, Type) - virtual void _write(std::ostream& out, PersistentFormat& format) const; + void _write(std::ostream& out, PersistentFormat& format) const override; public: FloatingLiteralToken() : _real() { inherited::setFloating(); } @@ -467,7 +467,7 @@ public: bool isFloat() const { return querySuffixField() == FSFloat; } bool isLongDouble() const { return querySuffixField() == FSLongDouble; } - virtual bool isValid() const + bool isValid() const override { return inherited::isValid() == inherited::isFloating(); } void setType(Type type) { assert(!hasTypeField()); mergeTypeField(type); } void mergeSuffix(FloatingSuffix suffix) { mergeSuffixField(suffix); } @@ -482,7 +482,7 @@ private: std::string _content; protected: - virtual void _write(std::ostream& out, PersistentFormat& format) const; + void _write(std::ostream& out, PersistentFormat& format) const override; public: StringLiteralToken(const std::string& content) @@ -493,7 +493,7 @@ public: std::string& content() { return _content; } const std::string& content() const { return _content; } - virtual bool isValid() const + bool isValid() const override { return inherited::isValid() && inherited::getType() == TString; } }; @@ -527,7 +527,7 @@ private: protected: DefineParameters(6, AbstractToken) - virtual void _write(std::ostream& out, PersistentFormat& format) const; + void _write(std::ostream& out, PersistentFormat& format) const override; public: OperatorPunctuatorToken() { setOperatorPunctuator(); setFull(); } @@ -540,7 +540,7 @@ public: void clearFull() { clearFullField(); } OperatorPunctuatorToken& setType(Type type) { assert(!hasOwnField()); mergeOwnField(type); return *this; } - virtual bool isValid() const + bool isValid() const override { return inherited::isValid() && (inherited::getType() == TOperatorPunctuator) && hasOwnField() && (queryOwnField() < TEnd); @@ -561,7 +561,7 @@ public: || (type >= TImplies && type <= TColonGT); } - virtual std::string text() const; + std::string text() const override; typedef std::unordered_map<std::string, Type> Map; typedef std::pair<std::string, OperatorPunctuatorToken::Type> Connection; diff --git a/CMakeLists.txt b/CMakeLists.txt index fe52d70..4c850c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,5 +60,7 @@ target_link_libraries(framaCIRGen ) endif() +target_compile_options(framaCIRGen PRIVATE -Wsuggest-override) + install(TARGETS framaCIRGen RUNTIME DESTINATION bin) diff --git a/ClangVisitor.h b/ClangVisitor.h index 663c37a..c2bebe8 100644 --- a/ClangVisitor.h +++ b/ClangVisitor.h @@ -124,13 +124,13 @@ public: exit(2); } } - ~FramaCIRGenAction() + ~FramaCIRGenAction() override { if (fclose(_outFile)==EOF) { std::cerr << "error closing output file.\n"; }; } - virtual std::unique_ptr<clang::ASTConsumer> - CreateASTConsumer(clang::CompilerInstance& CI, clang::StringRef InFile); + std::unique_ptr<clang::ASTConsumer> + CreateASTConsumer(clang::CompilerInstance& CI, clang::StringRef InFile) override; protected: @@ -744,8 +744,8 @@ public: clang::CompilerInstance& compilerInstance() const { return _compilerInstance; } - virtual bool HandleComment(clang::Preprocessor &PP, - clang::SourceRange Comment); + bool HandleComment(clang::Preprocessor &PP, + clang::SourceRange Comment) override; }; /*! @class LoopAnnotationOption @@ -1447,7 +1447,7 @@ public: void setGenerateBareFunctions() { _clangUtils->setGenerateBareFunctions(); } void setVerbose() { _clangUtils->setVerbose(); } - ~FramacVisitor() + ~FramacVisitor() override { free(_clangUtils); free(_intermediateAST); if (_implicitThisStar) free_expression(_implicitThisStar); @@ -1461,9 +1461,9 @@ public: AnnotationComment& comment, clang::DeclContext* clangContext); - bool HandleTopLevelDecl(clang::DeclGroupRef Decls); + bool HandleTopLevelDecl(clang::DeclGroupRef Decls) override; - virtual void HandleTranslationUnit(clang::ASTContext &context); + void HandleTranslationUnit(clang::ASTContext &context) override; void handleLexicalPostVisit(const clang::DeclContext* currentContext); void handleSemanticPostVisit(const clang::DeclContext* currentContext); void handlePostVisit(const clang::DeclContext* lexicalCurrentContext, @@ -1551,7 +1551,7 @@ public: : inherited(source), _visitor(source._visitor), _isExternal(source._isExternal) {} - virtual void registerDecl(const clang::Decl* decl) + void registerDecl(const clang::Decl* decl) override { if (!_visitor._tableForWaitingDeclarations.hasVisited(decl)) { InstanceContexts::UnvisitedDecls::const_iterator iterEnd = _visitor.unvisitedNameDecls().end(); @@ -1598,7 +1598,7 @@ public: UnvisitedRegistration(const UnvisitedRegistration& source) : inherited(source), _unvisitedName(source._unvisitedName) {} - virtual void registerDecl(const clang::Decl* decl) + void registerDecl(const clang::Decl* decl) override { std::vector<const clang::Decl*> alternativeDecls; if (!_unvisitedName.getVisitor()._tableForWaitingDeclarations .hasVisited(decl, &alternativeDecls)) { @@ -1625,7 +1625,7 @@ public: }; } } - virtual VirtualDeclRegistration* getNameRegistration() + VirtualDeclRegistration* getNameRegistration() override { return &_unvisitedName; } }; @@ -1641,7 +1641,7 @@ public: VerifyNameRegistration(const VerifyNameRegistration& source) : inherited(source), _visitor(source._visitor) {} - virtual void registerDecl(const clang::Decl* decl) + void registerDecl(const clang::Decl* decl) override { if (!_visitor._tableForWaitingDeclarations.hasVisited(decl)) { clang::Decl::Kind kindDecl = decl->getKind(); if ((kindDecl >= clang::Decl::firstRecord diff --git a/Clang_utils.h b/Clang_utils.h index e8a4003..f3ff432 100644 --- a/Clang_utils.h +++ b/Clang_utils.h @@ -205,8 +205,8 @@ private: public: LogicVariable(const std::string& name, logic_var variable) : inherited(name), lvVariable(variable) {} - virtual ~LogicVariable() { free_logic_var(lvVariable); } - virtual Type getType() const { return TLogicVariable; } + ~LogicVariable() override { free_logic_var(lvVariable); } + Type getType() const override { return TLogicVariable; } }; class GlobalContext::OverloadedLogicFunctions @@ -224,13 +224,13 @@ public: bool isMethod=false) : inherited(name) { _logicFunctions.push_back(std::make_pair(isMethod, info)); } - virtual ~OverloadedLogicFunctions() + ~OverloadedLogicFunctions() override { Functions::iterator iterEnd = _logicFunctions.end(); for (Functions::iterator iter = _logicFunctions.begin(); iter != iterEnd; ++iter) free_logic_info(iter->second); } - virtual Type getType() const { return TOverloadedLogicFunctions; } + Type getType() const override { return TOverloadedLogicFunctions; } virtual bool isOperator() const { return false; } OverloadedLogicOperators& asOperator(); void addFunction(logic_info info, bool isMethod=false) @@ -248,7 +248,7 @@ public: OverloadedLogicOperators(const std::string& name, int codeOperator, logic_info info, bool isMethod=false) : inherited(name, info, isMethod), _codeOperator(codeOperator) {} - virtual bool isOperator() const { return true; } + bool isOperator() const override { return true; } int getCodeOperator() const { return _codeOperator; } }; @@ -264,8 +264,8 @@ private: public: LogicType(const std::string& name, logic_type_info type) : inherited(name), _type(type) {} - virtual ~LogicType() { free_logic_type_info(_type); } - virtual Type getType() const { return TLogicType; } + ~LogicType() override { free_logic_type_info(_type); } + Type getType() const override { return TLogicType; } logic_type_info type_info() const { return _type; } }; @@ -277,8 +277,8 @@ private: public: LogicConstructor(const std::string& name, logic_ctor_info constructor) : inherited(name), lciConstructor(constructor) {} - virtual ~LogicConstructor() { free_logic_ctor_info(lciConstructor); } - virtual Type getType() const { return TLogicConstructor; } + ~LogicConstructor() override { free_logic_ctor_info(lciConstructor); } + Type getType() const override { return TLogicConstructor; } logic_ctor_info getInfo() const { return lciConstructor; } }; @@ -292,14 +292,14 @@ private: public: Qualification(const std::string& name, tag_qualification t) : inherited(name), tag(t) {} - virtual ~Qualification() + ~Qualification() override { NestedContext::SonsSet::iterator iterEnd = mSons.end(); for (NestedContext::SonsSet::iterator iter = mSons.begin(); iter != iterEnd; ++iter) delete *iter; } - virtual Type getType() const { return TQualification; } - virtual NestedContext::SonsSet* ssons() { return &mSons; } + Type getType() const override { return TQualification; } + NestedContext::SonsSet* ssons() override { return &mSons; } bool hasRecordType() const { return tag == QSTRUCTORCLASS; } bool hasTemplateRecordType() const { return tag == QTEMPLATEINSTANCE; } @@ -342,7 +342,7 @@ public: parameters = parameters->next; }; } - virtual ~TemplateQualification() + ~TemplateQualification() override { while (_parameters) { free_template_parameter((template_parameter) _parameters ->element.container); @@ -368,9 +368,9 @@ public: }; return qualification_QTemplateInstance(name, result); } - virtual int compare(const NestedContext& c) const; - virtual Type getType() const { return TTemplateQualification; } - virtual NestedContext::SonsSet* ssons() { return &mSons; } + int compare(const NestedContext& c) const override; + Type getType() const override { return TTemplateQualification; } + NestedContext::SonsSet* ssons() override { return &mSons; } /* template_parameter */ list getParameters() const { return _parameters; } /* template_parameter */ list extractParameters() { list result = _parameters; _parameters = NULL; return result; } diff --git a/VisitTable.h b/VisitTable.h index 362d66b..f4bd245 100644 --- a/VisitTable.h +++ b/VisitTable.h @@ -99,7 +99,7 @@ public: : KeyInfo(source), _root(source._root), _specificWaitDeclarations(source._specificWaitDeclarations) {} - virtual bool isSubKey() const { return true; } + bool isSubKey() const override { return true; } const clang::Decl* root() const { return _root; } const std::vector<const clang::Decl*>& getSpecificWaitDeclarations() const { return _specificWaitDeclarations; } @@ -141,7 +141,7 @@ public: translation_unit_decl waitingAdditionalDefinition=NULL) : KeyInfo(key), _waitingFunDefinition(waitingDefinition), _waitingAdditionalFunDefinition(waitingAdditionalDefinition) {} - virtual ~MissingFunctionGeneration() + ~MissingFunctionGeneration() override { if (_waitingFunDefinition) { free_translation_unit_decl(_waitingFunDefinition); _waitingFunDefinition = NULL; @@ -154,15 +154,15 @@ public: const std::vector<const clang::Decl*>& waitDeclarations() const { return _waitDeclarations; } - virtual bool isComplete() const + bool isComplete() const override { return !_waitingFunDefinition && _waitDeclarations.empty(); } - virtual void print(std::ostream& out) const; - virtual bool isGenerationMissing() const { return true; } - virtual bool isFunctionGenerationMissing() const { return true; } - virtual bool solve(const clang::Decl* decl, ForwardReferenceList& globals, - VisitTable& table); - virtual bool replaceWaitingBy(const clang::Decl* oldDecl, - const std::vector<const clang::Decl*>& newDecls); + void print(std::ostream& out) const override; + bool isGenerationMissing() const override { return true; } + bool isFunctionGenerationMissing() const override { return true; } + bool solve(const clang::Decl* decl, ForwardReferenceList& globals, + VisitTable& table) override; + bool replaceWaitingBy(const clang::Decl* oldDecl, + const std::vector<const clang::Decl*>& newDecls) override; }; class MissingSubClassGeneration { @@ -302,7 +302,7 @@ public: _subWaitDeclarations.swap(const_cast<MissingClassGeneration&>( source)._subWaitDeclarations); } - virtual ~MissingClassGeneration() + ~MissingClassGeneration() override { if (_waitingClassDeclaration) { free_translation_unit_decl(_waitingClassDeclaration); _waitingClassDeclaration = NULL; @@ -347,17 +347,17 @@ public: return result; } - virtual bool isClassGenerationMissing() const { return true; } - virtual bool isGenerationMissing() const { return true; } - virtual bool isComplete() const + bool isClassGenerationMissing() const override { return true; } + bool isGenerationMissing() const override { return true; } + bool isComplete() const override { return !_waitingClassDeclaration && _waitDeclarations.empty() && _subGenerations.empty() && _subWaitDeclarations.empty(); } - virtual void print(std::ostream& out) const; - virtual bool solve(const clang::Decl* decl, ForwardReferenceList& globals, - VisitTable& table); - virtual bool replaceWaitingBy(const clang::Decl* oldDecl, - const std::vector<const clang::Decl*>& newDecls); + void print(std::ostream& out) const override; + bool solve(const clang::Decl* decl, ForwardReferenceList& globals, + VisitTable& table) override; + bool replaceWaitingBy(const clang::Decl* oldDecl, + const std::vector<const clang::Decl*>& newDecls) override; void removeSubWait(const clang::Decl* decl); /* class_decl */ list& getContent() const { assert(_waitingClassDeclaration->tag_translation_unit_decl==COMPOUND); @@ -379,10 +379,10 @@ public: translation_unit_decl waitingDeclaration) : MissingClassGeneration(key, waitingDeclaration) {} - virtual void print(std::ostream& out) const { assert(false); } - virtual bool isInstanceClass() const { return true; } - virtual bool solve(const clang::Decl* decl, ForwardReferenceList& globals, - VisitTable& table) { assert(false); return false; } + void print(std::ostream& out) const override { assert(false); } + bool isInstanceClass() const override { return true; } + bool solve(const clang::Decl* decl, ForwardReferenceList& globals, + VisitTable& table) override { assert(false); return false; } }; class MissingDecl : public KeyInfo { @@ -395,11 +395,11 @@ public: public: MissingDecl(const clang::Decl* decl) : KeyInfo(decl) {} - virtual bool isMissingDecl() const { return true; } - virtual bool isComplete() const { return false /* _waitingDecls.empty() */;} + bool isMissingDecl() const override { return true; } + bool isComplete() const override { return false /* _waitingDecls.empty() */;} WaitingDecls& waitingDecls() { return _waitingDecls; } - virtual void print(std::ostream& out) const; + void print(std::ostream& out) const override; }; private: -- GitLab