| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
function more clear and obvious in behavior.
Add some comments documenting the behavior of the primary diagnostic helper.
llvm-svn: 128901
|
| |
|
|
|
|
|
| |
diagnostic emission. The fixit hint, when suggested, typically has
nothing to do with the nature or form of the reference.
llvm-svn: 128899
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
extracts a function to handle the emission of the diagnostic separately
from the walking over the set of uninitialized uses.
Also updates the naming used within this extracted function to be a bit
more consistent with the rest of Clang's naming patterns.
The next step will be breaking this apart so that we can go through
different functions rather than tracking so many boolean variables.
llvm-svn: 128898
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
| |
I think this moves the code in the desired direction of the new style
recommendations (and style conventional in Clang), but if anyone prefers
the previous style, or has other suggestions just chime in and I'll
follow up.
llvm-svn: 128878
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
| |
warnings from the dataflow analysis that include within the initializer of a variable.
llvm-svn: 128843
|
| |
|
|
|
|
| |
already has an initializer.
llvm-svn: 128838
|
| |
|
|
|
|
|
|
|
| |
This rename serves two purposes:
- It reflects the actual functionality of this analysis.
- We will have more than one reachability analysis.
llvm-svn: 127930
|
| |
|
|
|
|
|
|
| |
warnings to be flagged under -Wconditional-uninitialized, this is something we
can improve over time.
llvm-svn: 127802
|
| |
|
|
|
|
| |
and "may-be-initialized" warnings, each controlled by different flags.
llvm-svn: 127669
|
| |
|
|
|
|
| |
and "may-be-initialized" warnings, each controlled by different flags.
llvm-svn: 127666
|
| |
|
|
| |
llvm-svn: 127657
|
| |
|
|
|
|
|
|
|
| |
DiagRuntimeBehavior, don't construct a ParentMap or CFGStmtMap.
Instead, create a small set of Stmt* -> CFGBlock* mappings during CFG construction for only the statements we care about
relating to the diagnostics we want to check for reachability.
llvm-svn: 127396
|
| |
|
|
|
|
| |
destructors.
llvm-svn: 126910
|
| |
|
|
|
|
| |
actually returns. Use this for -Wreturn-type to prune false positives reported in PR 6884.
llvm-svn: 126875
|
| |
|
|
|
|
|
|
|
|
| |
related code is reachable. This suppresses some
diagnostics that occur in unreachable code (e.g., -Warray-bound).
We only pay the cost of doing the reachability analysis when we issue one of these diagnostics.
llvm-svn: 126290
|
| |
|
|
| |
llvm-svn: 126288
|
| |
|
|
|
|
| |
Sema::PopBlockOrFunctionScope(). No real functionality change.
llvm-svn: 126287
|
| |
|
|
| |
llvm-svn: 124924
|
| |
|
|
|
|
| |
refer to the bad use, and the note to the variable declaration.
llvm-svn: 124758
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
that doesn't include implicit dtors.
Implicit dtors confuse the ad hoc path-sensitivity of UninitializedValuesV2.cpp. This isn't
the ideal solution, as it will directly impact compile time, but should significantly reduce
the noise of -Wuninitialized on some code bases.
This immediately "fixes" the false positive reported in PR 9063, although this
isn't the right fix in the long run.
llvm-svn: 124667
|
| |
|
|
|
|
| |
C++ 'bool' types to false.
llvm-svn: 124356
|
| |
|
|
| |
llvm-svn: 124352
|
| |
|
|
|
|
|
|
|
| |
after a 'return' in a CFGBlock. This accidentally
was working before, but the false assumption that
'return' always appeared at the end of the block
was uncovered by a recent change.
llvm-svn: 124280
|
| |
|
|
|
|
|
|
|
|
| |
handling all CFGElement kinds. While writing
the test case, it turned out that return-noreturn.cpp
wasn't actually testing anything since it has the wrong -W
flag. That uncovered another regression with
the handling of destructors marked noreturn. WIP.
llvm-svn: 124238
|
| |
|
|
|
|
| |
about uninitialized variables captured by blocks.
llvm-svn: 124213
|
| |
|
|
|
|
|
| |
for floats, and also check if 'nil' is declared
when suggesting it for initializing ObjC pointers.
llvm-svn: 124004
|
| |
|
|
|
|
|
| |
to suggest initializations for pointer and
ObjC pointer types.
llvm-svn: 123995
|
| |
|
|
|
|
|
|
| |
to issue the warning at an uninitialized variable's
declaration, but to issue notes at possible
uninitialized uses (which could be multiple).
llvm-svn: 123994
|
| |
|
|
|
|
|
|
| |
references by monitoring whether an access to
a variable is solely to compute it's lvalue or
to do an lvalue-to-rvalue conversion (i.e., a load).
llvm-svn: 123777
|
| |
|
|
| |
llvm-svn: 123667
|
| |
|
|
|
|
| |
base or member initializers as noreturn.
llvm-svn: 123603
|
| |
|
|
|
|
| |
-Wuninitialized based on CFG dataflow analysis. WIP.
llvm-svn: 123512
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
temporaries with no-return destructors. The CFG now properly supports
temporaries and implicit destructors which both makes this kludge no
longer work, and conveniently removes the need for it.
Turn on CFG handling of implicit destructors and initializers. Several
ad-hoc benchmarks don't indicate any measurable performance impact from
growing the CFG, and it fixes real correctness problems with warnings.
As a result of turning on these CFG elements, we started to tickle an
inf-loop in the unreachable code logic used for warnings. The fix is
trivial.
llvm-svn: 123056
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state.
Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect
a lot of places, like C++ inline methods, template instantiations, the lexer, etc.
Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location.
Fixes rdar://8365684.
llvm-svn: 121873
|
| |
|
|
|
|
| |
reason this is limited to C++, and it's certainly not limited to temporaries.
llvm-svn: 120996
|
| |
|
|
|
|
| |
and discussions with Ted and Jordy.
llvm-svn: 114056
|
| |
|
|
|
|
|
|
| |
by a switch statement explicitly covering
all the cases for an enum value.
llvm-svn: 113450
|
| |
|
|
|
|
|
| |
Clients of Sema don't need to know (for example) the list of diagnostics we
support.
llvm-svn: 112093
|
| |
|
|
| |
llvm-svn: 112032
|
| |
|
|
| |
llvm-svn: 112027
|
| |
|
|
| |
llvm-svn: 111904
|
| |
|
|
| |
llvm-svn: 110945
|
| |
|
|
| |
llvm-svn: 109440
|
| |
|
|
| |
llvm-svn: 108694
|
| |
|
|
|
|
| |
a temporary with a noreturn destructor has been created. Fixes PR6884 for now.
llvm-svn: 104000
|
| |
|
|
|
|
| |
compute a CFG for a function.
llvm-svn: 103905
|
| |
|
|
|
|
| |
fatal error has occurred.
llvm-svn: 102778
|
| |
|
|
|
|
|
|
|
|
|
| |
if *none* of the successors of the call expression is the exit block.
This matters when a call of bool type is the condition of (say) a while
loop in a function with no statements after the loop. This *can* happen
in C, but it's much more common in C++ because of overloaded operators.
Suppresses some substantial number of spurious -Wmissing-noreturn warnings.
llvm-svn: 102696
|