Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Issue 18: exclude uninstantiated templates#61

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mbaluda merged 3 commits intogithub:mainfrommbaluda-org:issue18
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes fromall 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 deletionschange_notes/2022-08-17-fix-reported-fp-for-a7-1-1.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
- `A7-1-1` - `DeclarationUnmodifiedObjectMissingConstSpecifier.ql`:
- Remove findings in uninstantiated Templates.
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,5 +35,6 @@ where
cond = " points to an object"
else cond = " is used for an object"
) and
not exists(LambdaExpression lc | lc.getACapture().getField() = v)
not exists(LambdaExpression lc | lc.getACapture().getField() = v) and
not v.isFromUninstantiatedTemplate(_)
select v, "Non-constant variable " + v.getName() + cond + " and is not modified."
35 changes: 34 additions & 1 deletioncpp/autosar/test/rules/A7-1-1/test.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,9 +39,42 @@ class A7_1_1a final {
m_ = a.m;
}
void Call() {
[this]() { std::cout << m_ << '\n'; }(); // COMPLIANT ignore lambdas
// ignore lambdas
[this]() { std::cout << m_ << '\n'; }(); // COMPLIANT
}

private:
std::string m_;
};

template <typename T> class A7_1_1b final {
public:
explicit A7_1_1b(int i) noexcept {
t_.Init(i);
} // t_ is modified here by Init
private:
// ignore uninstantiated templates
T t_; // COMPLIANT
};

class A7_1_1bHelper {
public:
void Init(int i) {}
};

class Issue18 {
public:
template <typename T> void F(const T &s) {
// ignore uninstantiated templates
std::ostream ostr; // COMPLIANT
ostr << s; // <= Modified here
return;
}
};

/// main
int main(int, char **) noexcept {
new A7_1_1b<A7_1_1bHelper>(0);

(new Issue18)->F(0);
}

[8]ページ先頭

©2009-2025 Movatter.jp