Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A14-5-2 do not consider type members declared with using aliases. #746

Merged
merged 7 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions change_notes/2024-10-15-fix-fp-739-a14-5-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `A14-5-2` - `NonTemplateMemberDefinedInTemplate.ql`
- Fixes #739. Omit type members declared with using aliases.
fjatWbyT marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ where
mf = c.getAMemberFunction() and not mf.isCompilerGenerated() and not exists(mf.getBlock())
)
)
)
) and
// Omit using alias (cf. https://github.com/github/codeql-coding-standards/issues/739)
not d instanceof UsingAliasTypedefType
fjatWbyT marked this conversation as resolved.
Show resolved Hide resolved
select d,
"Member " + d.getName() + " template class does not use any of template arguments of its $@.",
d.getDeclaringType(), "declaring type"
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
| test.cpp:10:9:10:10 | T1 | Member T1 template class does not use any of template arguments of its $@. | test.cpp:6:29:6:30 | C1<T> | declaring type |
| test.cpp:11:9:11:10 | T2 | Member T2 template class does not use any of template arguments of its $@. | test.cpp:6:29:6:30 | C1<T> | declaring type |
| test.cpp:28:31:28:33 | C12<N> | Member C12<N> template class does not use any of template arguments of its $@. | test.cpp:6:29:6:30 | C1<T> | declaring type |
| test.cpp:45:7:45:8 | a1 | Member a1 template class does not use any of template arguments of its $@. | test.cpp:37:31:37:33 | C22<N> | declaring type |
| test.cpp:46:9:46:10 | a2 | Member a2 template class does not use any of template arguments of its $@. | test.cpp:37:31:37:33 | C22<N> | declaring type |
Expand Down
6 changes: 3 additions & 3 deletions cpp/autosar/test/rules/A14-5-2/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ template <typename T> class C1 {
public:
enum E1 : T { e1, e2 }; // COMPLIANT

using T1 = typename template_base<T>::type; // COMPLIANT[FALSE_POSITIVE]
using T2 = typename template_base<int>::type; // NON_COMPLIANT
using T1 = typename template_base<T>::type; // COMPLIANT
using T2 = typename template_base<int>::type; // NON_COMPLIANT[FALSE_NEGATIVE]
fjatWbyT marked this conversation as resolved.
Show resolved Hide resolved

class C11 { // COMPLIANT
enum E2 {
Expand Down Expand Up @@ -156,4 +156,4 @@ template <J::Type t> class V {
void f4() {
V<J::Type::A> v;
v.type();
}
}
Loading