-
Notifications
You must be signed in to change notification settings - Fork 14.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
Merged
Changes from all 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…
Flandini 6bab1c7
Fix bugs in nested_aggregates added testcases
Flandini e590bfc
switch TODO to FIXME
Flandini 6b86a04
add user defined new test cpp
Flandini f6d743d
add commented out enum new expr list initialization test
Flandini 56a90a8
remove stray comma in new test RUN: flag
Flandini de1efa7
Use decltype and using alias instead of typedef,__typeof
Flandini fa6c492
Remove empty unused test struct
Flandini 959866a
Remove unnecessary RUN lines in new-user-defined.cpp
Flandini ea8260b
add escape templated function, guard enum list initialization for >= …
Flandini 740a272
remove stale FIXME
Flandini 0a9bc4c
Add escape to new-user-defined.cpp tests also
Flandini e14945b
Add placement new list initializer argument tests
Flandini c21d6cf
Add xazax-hun's placement new tests
Flandini 2f186c9
Remove unnecessary ::new qualifier
Flandini 35a8d82
Clarify namespace name after moving to initializer.cpp
Flandini 4c3e1ca
Use pointer returned by placement new instead
Flandini 8315352
Merge branch 'main' into flandini/init-list-new-expr-3
Flandini 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,30 @@ | ||
// RUN: %clang_analyze_cc1 -verify %s\ | ||
// RUN: -analyzer-checker=core,debug.ExprInspection | ||
|
||
void clang_analyzer_eval(bool); | ||
|
||
using size_t = decltype(sizeof(int)); | ||
|
||
template <class FirstT, class... Rest> | ||
void escape(FirstT first, Rest... args); | ||
|
||
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}} | ||
|
||
escape(s, s2, s3); | ||
} | ||
} // namespace CustomClassType |
Oops, something went wrong.
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.