aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2022-10-27 14:49:15 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2022-11-24 09:27:03 +0000
commitbfecefabc05717c29f7b4f572314fabf4d031796 (patch)
tree22e814c152617e28afb23f83a5a33b64e6becb9c /tests
parent43b21595e97d0260f811389db9db8d0d9a4d0a41 (diff)
CppEditor: Let users check for unused functions in (sub-)projects
Note that especially in C++, there can be a lot of false positives, especially in template-heavy code bases. We filter out the most notorious offenders, namely: - templates themselves - constructors and destructors - *begin() and *end() - qHash() - main() Since the code model does not know about symbol visibility, the functionality is quite useless for libraries, unless you want to check your test coverage. The procedure is rather slow, but that shouldn't matter so much, as it's something you'll only run "once in a while". Fixes: QTCREATORBUG-6772 Change-Id: If00a537b760a9b0babdda6c848133715c3240155 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/cplusplus/findusages/tst_findusages.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/auto/cplusplus/findusages/tst_findusages.cpp b/tests/auto/cplusplus/findusages/tst_findusages.cpp
index 82dd5564379..1cb09810306 100644
--- a/tests/auto/cplusplus/findusages/tst_findusages.cpp
+++ b/tests/auto/cplusplus/findusages/tst_findusages.cpp
@@ -1180,12 +1180,12 @@ void tst_FindUsages::templateClass_className()
findUsages(classTS);
QCOMPARE(findUsages.usages().size(), 7);
QCOMPARE(findUsages.usages().at(0).tags, Usage::Tag::Declaration);
- QCOMPARE(findUsages.usages().at(1).tags, Usage::Tags());
- QCOMPARE(findUsages.usages().at(2).tags, Usage::Tags());
+ QCOMPARE(findUsages.usages().at(1).tags, Usage::Tag::ConstructorDestructor);
+ QCOMPARE(findUsages.usages().at(2).tags, Usage::Tag::ConstructorDestructor);
QCOMPARE(findUsages.usages().at(3).tags, Usage::Tags());
- QCOMPARE(findUsages.usages().at(4).tags, Usage::Tags());
+ QCOMPARE(findUsages.usages().at(4).tags, Usage::Tag::ConstructorDestructor);
QCOMPARE(findUsages.usages().at(5).tags, Usage::Tags());
- QCOMPARE(findUsages.usages().at(6).tags, Usage::Tags());
+ QCOMPARE(findUsages.usages().at(6).tags, Usage::Tag::ConstructorDestructor);
}
void tst_FindUsages::templateFunctionParameters()
@@ -2324,7 +2324,7 @@ int main()
find(structS);
QCOMPARE(find.usages().size(), 18);
QCOMPARE(find.usages().at(0).tags, Usage::Tag::Declaration);
- QCOMPARE(find.usages().at(1).tags, Usage::Tags());
+ QCOMPARE(find.usages().at(1).tags, Usage::Tag::ConstructorDestructor);
QCOMPARE(find.usages().at(2).tags, Usage::Tags());
QCOMPARE(find.usages().at(3).tags, Usage::Tags());
QCOMPARE(find.usages().at(4).tags, Usage::Tags());