-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[analyzer] Support parenthesized list initialization (CXXParenListInitExpr) #148988
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5db59d5
[Analyzer] support parenthesized list initialization
a-tarasyuk a2a7346
add additinal tests
a-tarasyuk 8bb56ce
remove redundant vector
a-tarasyuk a2be531
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk 6d3dd39
revert test
a-tarasyuk 64de252
add test relaetd to c++20 only
a-tarasyuk 3dd5402
Merge branch 'main' into fix/148875
a-tarasyuk db6f5d6
share initializer list modeling between VisitInitListExpr and VisitCX…
a-tarasyuk 3756405
Merge branch 'fix/148875' of https://github.com/a-tarasyuk/llvm-proje…
a-tarasyuk 933e590
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk ab541b0
refactor visitors to use common helper
a-tarasyuk 0c9925e
Merge branch 'main' into fix/148875
a-tarasyuk c112e2e
cleanup
a-tarasyuk 65e0a71
Merge branch 'fix/148875' of https://github.com/a-tarasyuk/llvm-proje…
a-tarasyuk e3b105b
update tests
a-tarasyuk 8152e28
cleanup
a-tarasyuk 92024f1
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // RUN: %clang_analyze_cc1 -analyzer-checker=core.DivideZero -std=c++20 -verify %s | ||
|
|
||
| namespace GH148875 { | ||
| struct A { | ||
| int x; | ||
| A(int v) : x(v) {} | ||
| }; | ||
|
|
||
| struct B { | ||
| int x; | ||
| B() : x(0) {} | ||
| }; | ||
|
|
||
| struct C { | ||
| int x, y; | ||
| C(int a, int b) : x(a), y(b) {} | ||
| }; | ||
|
|
||
| struct D { | ||
| int x; | ||
| }; | ||
|
|
||
| struct E { | ||
| D d; | ||
| E(int a) : d(a) {} | ||
| }; | ||
|
|
||
| int t1() { | ||
| A a(42); | ||
| return 1 / (a.x - 42); // expected-warning {{Division by zero}} | ||
| } | ||
|
|
||
| int t2() { | ||
| B b; | ||
| return 1 / b.x; // expected-warning {{Division by zero}} | ||
| } | ||
|
|
||
| int t3() { | ||
| C c1(1, -1); | ||
| return 1 / (c1.x + c1.y); // expected-warning {{Division by zero}} | ||
| } | ||
|
|
||
| int t4() { | ||
| C c2(0, 0); | ||
| return 1 / (c2.x + c2.y); // expected-warning {{Division by zero}} | ||
| } | ||
|
|
||
| int t5() { | ||
| E e = 32; | ||
| return 1 / (e.d.x - 32); // expected-warning {{Division by zero}} | ||
| } | ||
| } // namespace GH148875 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.