| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fields in the class. This allows a better checking of member intiailizers and
in class initializers in regards to initialization ordering.
For instance, this code will now produce warnings:
class A {
int x;
int y;
A() : x(y) {} // y is initialized after x, warn here
A(int): y(x) {} // default initialization of leaves x uninitialized, warn here
};
Several test cases were updated with -Wno-uninitialized to silence this warning.
llvm-svn: 191068
|
|
|
|
|
|
|
| |
later in the code so that the expressions will have addition processing first.
This catches a few additional cases of uninitialized uses of class fields.
llvm-svn: 190657
|
|
|
|
|
|
| |
it when visiting such subexpressions.
llvm-svn: 181046
|
|
|
|
|
|
| |
class types.
llvm-svn: 177987
|
|
|
|
| |
llvm-svn: 172888
|
|
|
|
|
|
| |
evaluate to lvalues (in C++).
llvm-svn: 172875
|
|
|
|
|
|
|
| |
each one separately, process a stack of MemberExpr's as a single unit so that
static calls and member access will not be warned on.
llvm-svn: 165074
|
|
|
|
|
|
|
|
|
|
|
| |
-Allow Sema to do more processing on the initial Expr before checking it.
-Remove the special conditions in HandleExpr()
-Move the code so that only one call site is needed.
-Removed the function from Sema and only call it locally.
-Warn on potentially evaluated reference variables, not just casts to r-values.
-Update tests.
llvm-svn: 164951
|
|
|
|
|
|
|
|
|
|
|
| |
This makes the wording more informative, and consistent with the other
warnings about uninitialized variables.
Also, me and David who reviewed this couldn't figure out why we would
need to do a lookup to get the name of the variable; so just print the
name directly.
llvm-svn: 164366
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes Clang warn about self references in in-class initializers,
for example:
struct S {
int a = a + 42;
};
This basically just moves UninitializedFieldVisitor up a bit in
SemaDeclCXX.cpp, and adds a call to it from ActOnCXXInClassMemberInitializer.
llvm-svn: 164131
|
|
|
|
| |
llvm-svn: 162198
|
|
|
|
|
|
|
| |
Initializing a reference with itself, e.g. "int &a = a;" seems like a
very bad idea.
llvm-svn: 162093
|
|
|
|
| |
llvm-svn: 161909
|
|
|
|
|
|
|
| |
in duplicate -Wuninitialized warnings. Change so that only the check in
TryConstructorInitialization() will be used and a single warning be emitted.
llvm-svn: 161345
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
used in a branch, but
instead push the terminator for the branch down into the basic blocks of the subexpressions of '&&' and '||'
respectively. This eliminates some artifical control-flow from the CFG and results in a more
compact CFG.
Note that this patch only alters the branches 'while', 'if' and 'for'. This was complex enough for
one patch. The remaining branches (e.g., do...while) can be handled in a separate patch, but they
weren't immediately tackled because they were less important.
It is possible that this patch introduces some subtle bugs, particularly w.r.t. to destructor placement.
I've tried to audit these changes, but it is also known that the destructor logic needs some refinement
in the area of '||' and '&&' regardless (i.e., their are known bugs).
llvm-svn: 160218
|
|
|
|
| |
llvm-svn: 158477
|
|
|
|
|
|
| |
as it no longer applies.
llvm-svn: 157943
|
|
|
|
|
|
| |
-Wconditional-uninitialized into -Wuninitialized.
llvm-svn: 156512
|
|
|
|
|
|
|
| |
Added support for conditional operators and tightened the exclusion of the
unary operator from all operators to only the address of operator.
llvm-svn: 156450
|
|
|
|
| |
llvm-svn: 154608
|
|
|
|
|
|
| |
with a while loop (PR 12325).
llvm-svn: 153242
|
|
|
|
|
|
| |
to its own member function.
llvm-svn: 152276
|
|
|
|
|
|
|
| |
call is elidable or if the constructor is trivial instead of checking if it
is user declared.
llvm-svn: 147652
|
|
|
|
|
|
|
|
| |
lifetimes have been extended via reference binding. The type of the
reference and the type of the temporary are not necessarily the same,
which could cause a crash. Fixes <rdar://problem/10398199>.
llvm-svn: 144646
|
|
|
|
|
|
|
|
| |
self-reference oninitalization warning of -Wuninitialized) to exclude member variables that can decay into pointers. This will cause it to no longer warn on this code:
struct foo { char a[100], *e; } bar = { .e = bar.a };
llvm-svn: 139213
|
|
|
|
|
|
|
|
|
| |
itself upon initialization, such as using itself within its own copy constructor.
struct S {};
S s(s);
llvm-svn: 138969
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
int x = x;
GCC disables its warnings on this construct as a way of indicating that
the programmer intentionally wants the variable to be uninitialized.
Only the warning on the initializer is turned off in this iteration.
This makes the code a lot more ugly, but starts commenting the
surprising behavior here. This is a WIP, I want to refactor it
substantially for clarity, and to determine whether subsequent warnings
should be suppressed or not.
llvm-svn: 128894
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
numerous CFG and UninitializedValues analysis changes:
1) Change the CFG to include the DeclStmt for conditional variables, instead of using the condition itself as a faux DeclStmt.
2) Update ExprEngine (the static analyzer) to understand (1), so not to regress.
3) Update UninitializedValues.cpp to initialize all tracked variables to Uninitialized at the start of the function/method.
4) Only use the SelfReferenceChecker (SemaDecl.cpp) on global variables, leaving the dataflow analysis to handle other cases.
The combination of (1) and (3) allows the dataflow-based -Wuninitialized to find self-init problems when the initializer
contained control-flow.
llvm-svn: 128858
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
and flesh out the existing uninitialized testing for field initializers.
The tests come from Richard's original patch, but I've cleaned them up
a bit and ordered them more naturally.
Also, I added a test for the most simple base case:
int x = x;
And it turns out we miss this one! =[ That and another bad FIXME on the
field initializer checking are left in the test.
llvm-svn: 128394
|
|
uninitialized field). This was
already fixed, but this serves for detecting regressions.
llvm-svn: 117754
|