Fix "C++ importer does not recognize 'final' keyword"
Apply final-keyword.patch by Thomas Jansen with modifications: lib/cppparser/lexer.h - In enum Type add Token_final. lib/cppparser/keywords.h - Add INSERT("final", Token_final). lib/cppparser/ast.{h,cpp} - In class ClassSpecifierAST, - add getter final_() returning m_final.get(); - add function setFinal(AST::Node& final_); - add private member m_final of type AST::Node. - In class DeclaratorAST, - rename getter override() to override_() for avoiding incorrect colorization in syntax highlighting editors; - add getter final_() returning m_final.get(); - add function setFinal(AST::Node& final_); - add private member m_final of type AST::Node. lib/cppparser/ast_utils.cpp - In function declaratorToString, - adjust call of declarator->override() to function renaming; - add handling of (declarator->final_() != 0). lib/cppparser/parser.cpp - Remove #include "optionstate.h" and testing of Settings::optionState().codeImportState.supportCPP11. Reason: In the year 2022 there is little use for switching off C++11, in particular in our usecase within a UML tool not compiler frontend. - In functions parseDeclarator and parseAbstractDeclarator, after skipping ')' of parameter declaration clause add loop for handling Token_const, Token_override, Token_final. These are handled in a loop because they may appear in arbitrary order. - In function parseClassSpecifier, - after parsing name set AST::Node final_ if Token_final is present; - call ast->setFinal(final_). umbrello/umlmodel/operation.{h,cpp} - Add public functions setFinal(bool) and bool getFinal(). - Rename private member m_Override to m_bOverride, m_virtual to m_bVirtual, m_inline to m_bInline for symmetry with m_bConst. - Add private member m_bFinal of type bool. umbrello/umlmodel/operation.cpp - In UMLOperation constructor initialize m_bFinal. - In function saveToXMI : - Only write XML attibutes "isQuery", "isOverride", "isVirtual", "isInline" if the corresponding data member is true. This saves space and avoids the non standard attributes when possible. - Write XML attribute "isFinal" if m_bFinal is true. - In function load1 add retrieving of m_bFinal from XML attribute "isFinal". umbrello/codeimport/kdevcppparser/cpptree2uml.cpp - In functions parseFunctionDefinition and parseFunctionDeclaration call m->setFinal(true) if d->final_() returns true. umbrello/version.h - Increase XMI1_FILE_VERSION to "1.7.5" and increase XMI2_FILE_VERSION to "2.0.2" to reflect the added UML Operation attribute "isFinal". These changes were tested by importing the file test/import/cxx/cxx11-explicit-overrides-and-final.h BUG: 397666 FIXED-IN:2.33.80 (KDE releases 22.03.80)