Ignore copy/move constructors for function naming checks (#4134)

* Ignore copy/move constructors for function naming checks

* Also change in namingng

* Add test in naming_test.cpp
This commit is contained in:
Alon Alexander 2022-06-01 07:54:31 +03:00 committed by GitHub
parent e430a11b49
commit ea3bb8b297
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View File

@ -81,7 +81,7 @@ for arg in sys.argv[1:]:
for scope in cfg.scopes:
if scope.type == 'Function':
function = scope.function
if function is not None and function.type in ('Constructor', 'Destructor'):
if function is not None and function.type in ('Constructor', 'Destructor', 'CopyConstructor', 'MoveConstructor'):
continue
res = re.match(RE_FUNCTIONNAME, scope.className)
if not res:

View File

@ -182,7 +182,7 @@ def process(dumpfiles, configfile, debugprint=False):
if "RE_FUNCTIONNAME" in conf and conf["RE_FUNCTIONNAME"]:
for token in cfg.tokenlist:
if token.function:
if token.function.type == 'Constructor' or token.function.type == 'Destructor':
if token.function.type in ('Constructor', 'Destructor', 'CopyConstructor', 'MoveConstructor'):
continue
retval = token.previous.str
prev = token.previous

View File

@ -6,4 +6,6 @@ class TestClass1
{
TestClass1() {}
~TestClass1() {}
TestClass1(const TestClass1 &) {}
TestClass1(TestClass1 &&) {}
};