-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[analyzer] Do list initialization for CXXNewExpr with initializer list arg #127702
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
steakhal
merged 18 commits into
llvm:main
from
ashfordium:flandini/init-list-new-expr-3
Feb 28, 2025
Merged
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
12791f2
[analyzer] Do list initialization for CXXNewExpr with initializer lis…
ashfordium 6bab1c7
Fix bugs in nested_aggregates added testcases
ashfordium e590bfc
switch TODO to FIXME
ashfordium 6b86a04
add user defined new test cpp
ashfordium f6d743d
add commented out enum new expr list initialization test
ashfordium 56a90a8
remove stray comma in new test RUN: flag
ashfordium de1efa7
Use decltype and using alias instead of typedef,__typeof
ashfordium fa6c492
Remove empty unused test struct
ashfordium 959866a
Remove unnecessary RUN lines in new-user-defined.cpp
ashfordium ea8260b
add escape templated function, guard enum list initialization for >= …
ashfordium 740a272
remove stale FIXME
ashfordium 0a9bc4c
Add escape to new-user-defined.cpp tests also
ashfordium e14945b
Add placement new list initializer argument tests
ashfordium c21d6cf
Add xazax-hun's placement new tests
ashfordium 2f186c9
Remove unnecessary ::new qualifier
ashfordium 35a8d82
Clarify namespace name after moving to initializer.cpp
ashfordium 4c3e1ca
Use pointer returned by placement new instead
ashfordium 8315352
Merge branch 'main' into flandini/init-list-new-expr-3
ashfordium 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // RUN: %clang_analyze_cc1 -w -verify %s\ | ||
| // RUN: -analyzer-checker=core\ | ||
| // RUN: -analyzer-checker=debug.ExprInspection -std=c++17 | ||
| // RUN: %clang_analyze_cc1 -w -verify %s\ | ||
| // RUN: -analyzer-checker=core\ | ||
| // RUN: -analyzer-checker=debug.ExprInspection -std=c++11\ | ||
| // RUN: -DTEST_INLINABLE_ALLOCATORS | ||
| // RUN: %clang_analyze_cc1 -w -verify %s\ | ||
| // RUN: -analyzer-checker=core\ | ||
| // RUN: -analyzer-checker=debug.ExprInspection -std=c++17\ | ||
| // RUN: -DTEST_INLINABLE_ALLOCATORS | ||
ashfordium marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| void clang_analyzer_eval(bool); | ||
|
|
||
| typedef __typeof(sizeof(int)) size_t; | ||
ashfordium marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| namespace CustomClassType { | ||
| struct S { | ||
| int x; | ||
| static void* operator new(size_t size) { | ||
| return ::operator new(size); | ||
| } | ||
| }; | ||
| void F() { | ||
| S *s = new S; | ||
| clang_analyzer_eval(s->x); // expected-warning{{UNKNOWN}} FIXME: should be an undefined warning | ||
steakhal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| S *s2 = new S{}; | ||
| clang_analyzer_eval(0 == s2->x); // expected-warning{{TRUE}} | ||
|
|
||
| S *s3 = new S{1}; | ||
| clang_analyzer_eval(1 == s3->x); // expected-warning{{TRUE}} | ||
| } | ||
|
|
||
| struct WithPlacementNew { | ||
| }; | ||
ashfordium marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| } // namespace CustomClassType | ||
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.