| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
when
their implementations are unavailable. Start by simulating dispatch_sync().
This change is largely a bunch of plumbing around something very simple. We
use AnalysisDeclContext to conjure up a fake function body (using the
current ASTContext) when one does not exist. This is controlled
under the analyzer-config option "faux-bodies", which is off by default.
The plumbing in this patch is largely to pass the necessary machinery
around. CallEvent needs the AnalysisDeclContextManager to get
the function definition, as one may get conjured up lazily.
BugReporter and PathDiagnosticLocation needed to be relaxed to handle
invalid locations, as the conjured body has no real source locations.
We do some primitive recovery in diagnostic generation to generate
some reasonable locations (for arrows and events), but it can be
improved.
llvm-svn: 164339
|
|
|
|
|
|
| |
as exclusive.
llvm-svn: 164332
|
|
|
|
|
|
| |
lock expressions.
llvm-svn: 164324
|
|
|
|
|
|
| |
is placed on a function that has no path to the exit block.
llvm-svn: 164244
|
|
|
|
|
|
|
| |
LOCKS_EXCLUDED is used on a method with a name that is is not a simple
identifier.
llvm-svn: 164242
|
|
|
|
| |
llvm-svn: 163775
|
|
|
|
|
|
| |
<rdar://problem/12061922>
llvm-svn: 163772
|
|
|
|
|
|
|
|
|
| |
These will warn under -Wformat-non-iso, and will still be rejected
outright on other platforms.
<rdar://problem/12061922>
llvm-svn: 163771
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Objective-C related to NSException.
Fixes <rdar://problem/12287498>
I debated whether or not this logic should be sunk into the CFG
itself. It's not clear if we should, as different analyses may
wish to have different policies. We can re-evaluate this in the
future.
llvm-svn: 163760
|
|
|
|
|
|
|
|
|
|
| |
in NSException to a helper object in libAnalysis that can also
be used by Sema. Not sure if the predicate name 'isImplicitNoReturn'
is the best one, but we can massage that later.
No functionality change.
llvm-svn: 163759
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
for halting the propagation of uninitialized value tracking along
a path. Unlike __attribute__((noreturn)), this attribute (which
is used by clients of the static analyzer) can be used to annotate
functions that essentially never return, but in rare cares may be
allowed to return for (special) debugging purposes. This attribute
has been shown in reducing false positives in the static analyzer
by pruning false postives, and is equally applicable here.
Handling this attribute in the CFG itself is another option, but
this is not something all clients (e.g., possibly -Wunreachable-code)
would want to see.
Addresses <rdar://problem/12281583>.
llvm-svn: 163681
|
|
|
|
| |
llvm-svn: 163656
|
|
|
|
| |
llvm-svn: 163546
|
|
|
|
|
|
|
|
|
| |
analysis that may give false positives because it is confused by aliasing, and
a less precise analysis that has fewer false positives, but may have false
negatives. The more precise warnings are enabled by -Wthread-safety-precise.
An additional note clarify the warnings in the precise case.
llvm-svn: 163537
|
|
|
|
|
|
|
| |
As a corollary to the previous commit, even when an extension is
available, we can still offer a fixit to the standard modifier.
llvm-svn: 163453
|
|
|
|
|
|
|
|
|
| |
This seems to be a GNU libc extension; we offer a fixit to %lld on
these platforms.
<rdar://problem/11518237>
llvm-svn: 163452
|
|
|
|
| |
llvm-svn: 163410
|
|
|
|
| |
llvm-svn: 163403
|
|
|
|
|
|
| |
within part of a particular method.
llvm-svn: 163397
|
|
|
|
| |
llvm-svn: 163325
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While destructors will continue to not be inlined (unless the analyzer
config option 'c++-inlining' is set to 'destructors'), leaving them out
of the CFG is an incomplete model of the behavior of an object, and
can cause false positive warnings (like PR13751, now working).
Destructors for temporaries are still not on by default, since
(a) we haven't actually checked this code to be sure it's fully correct
(in particular, we probably need to be very careful with regard to
lifetime-extension when a temporary is bound to a reference,
C++11 [class.temporary]p5), and
(b) ExprEngine doesn't actually do anything when it sees a temporary
destructor in the CFG -- not even invalidate the object region.
To enable temporary destructors, set the 'cfg-temporary-dtors' analyzer
config option to '1'. The old -cfg-add-implicit-dtors cc1 option, which
controlled all implicit destructors, has been removed.
llvm-svn: 163264
|
|
|
|
|
|
| |
expression involving temporaries.
llvm-svn: 163237
|
|
|
|
|
|
| |
latest definition of a function is always used when computing lock expressions.
llvm-svn: 163028
|
|
|
|
|
|
| |
expressions, which should be ignored right now.
llvm-svn: 163026
|
|
|
|
|
|
| |
Fixes <rdar://problem/11005770>.
llvm-svn: 162545
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A CXXDefaultArgExpr wraps an Expr owned by a ParmVarDecl belonging to the
called function. In general, ExprEngine and Environment ought to treat this
like a ParenExpr or other transparent wrapper expression, with the inside
expression evaluated first.
However, if we call the same function twice, we'd produce a CFG that contains
the same wrapped expression twice, and we're not set up to handle that. I've
added a FIXME to the CFG builder to come back to that, but meanwhile we can
at least handle expressions that don't need to be explicitly evaluated:
literals. This probably handles many common uses of default parameters:
true/false, null, etc.
Part of PR13385 / <rdar://problem/12156507>
llvm-svn: 162453
|
|
|
|
| |
llvm-svn: 162412
|
|
|
|
|
|
|
|
|
| |
Also rename 'getCurrentBlockCounter()' to 'blockCount()'.
This ripples a bunch of code simplifications; mostly aesthetic,
but makes the code a bit tighter.
llvm-svn: 162349
|
|
|
|
| |
llvm-svn: 161822
|
|
|
|
|
|
|
| |
expressions. The syntax &MyClass::mutex is interpreted as a
pattern that matches m->mutex for any object m of type MyClass.
llvm-svn: 161691
|
|
|
|
|
|
| |
of expressions, and better error messages.
llvm-svn: 161690
|
|
|
|
|
|
| |
to track locksets. This is in preparation for further changes.
llvm-svn: 161680
|
|
|
|
| |
llvm-svn: 161660
|
|
|
|
| |
llvm-svn: 161408
|
|
|
|
|
|
|
|
| |
This is useful for example for %n in printf, which expects
a pointer to int with the same logic for checking as %d
would have in scanf.
llvm-svn: 161407
|
|
|
|
|
|
| |
Also remove redundant constructors and unused member functions.
llvm-svn: 161403
|
|
|
|
|
|
|
| |
Warn about using pointers to const-qualified types as arguments to
scanf. Ignore the volatile qualifier when checking if types match.
llvm-svn: 161052
|
|
|
|
|
|
|
| |
This makes Clang check that the corresponding argument for "%n" in a
format string is a pointer to int.
llvm-svn: 160966
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clang's -Wformat fix-its currently suggest using "%zu" for values of
type size_t (in C99 or C++11 mode). However, for a type such as
std::vector<T>::size_type, it does not notice that type is actually
typedeffed to size_t, and instead suggests a format for the underlying
type, such as "%lu" or "%u".
This commit makes the format string fix mechanism walk the typedef chain
so that it notices if the type is size_t, even if that isn't "at the
top".
llvm-svn: 160886
|
|
|
|
| |
llvm-svn: 160851
|
|
|
|
| |
llvm-svn: 160850
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
a defaulted special member function until the exception specification is needed
(using the same criteria used for the delayed instantiation of exception
specifications for function temploids).
EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like
EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to
resolve the exception specification.
This is enabled for all C++ modes: it's a little faster in the case where the
exception specification isn't used, allows our C++11-in-C++98 extensions to
work, and is still correct for C++98, since in that mode the computation of the
exception specification can't fail.
The diagnostics here aren't great (in particular, we should include implicit
evaluation of exception specifications for defaulted special members in the
template instantiation backtraces), but they're not much worse than before.
Our approach to the problem of cycles between in-class initializers and the
exception specification for a defaulted default constructor is modified a
little by this change -- we now reject any odr-use of a defaulted default
constructor if that constructor uses an in-class initializer and the use is in
an in-class initialzer which is declared lexically earlier. This is a closer
approximation to the current draft solution in core issue 1351, but isn't an
exact match (but the current draft wording isn't reasonable, so that's to be
expected).
llvm-svn: 160847
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Our BugReporter knows how to deal with implicit statements: it looks in
the ParentMap until it finds a parent with a valid location. However, since
initializers are not in the body of a constructor, their sub-expressions are
not in the ParentMap. That was easy enough to fix in AnalysisDeclContext.
...and then even once THAT was fixed, there's still an extra funny case
of Objective-C object pointer fields under ARC, which are initialized with
a top-level ImplicitValueInitExpr. To catch these cases,
PathDiagnosticLocation will now fall back to the start of the current
function if it can't find any other valid SourceLocations. This isn't great,
but it's miles better than a crash.
(All of this is only relevant when constructors and destructors are being
inlined, i.e. under -cfg-add-initializers and -cfg-add-implicit-dtors.)
llvm-svn: 160810
|
|
|
|
|
|
|
| |
Test case in the next commit, which enables destructors under certain
circumstances.
llvm-svn: 160805
|
|
|
|
|
|
|
|
|
| |
short-circuiting when building the CFG. Also be sure to skip parens before
checking for the && / || special cases. Finally, fix some crashes in CFG
printing in the presence of calls to destructors for array of array of class
type.
llvm-svn: 160691
|
|
|
|
| |
llvm-svn: 160622
|
|
|
|
|
|
|
| |
The CFG creates dummy DeclStmts with one Decl per statement, and it has
to do so from last to first in order to build the graph correctly.
llvm-svn: 160560
|
|
|
|
|
|
|
|
| |
(imprecise) representation
of '&&' and '||' in the CFG. This is no longer needed, and greatly simplifies the code.
llvm-svn: 160494
|
|
|
|
|
|
| |
types. Fixes crash in <rdar://problem/11671507>.
llvm-svn: 160424
|
|
|
|
|
|
|
| |
* Treat compound assignment as a use, at Jordy's request.
* Always add compound assignments into the CFG, so we can correctly diagnose the use in 'return x += 1;'
llvm-svn: 160334
|