History log of /external/clang/lib/Sema/AnalysisBasedWarnings.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e103979ceac63c98873f3307ee897eab559356a0 29-Jun-2013 Benjamin Kramer <benny.kra@googlemail.com> Compress pairs. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185264 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
7348454025693dd20a411c2bcaabd4460cb87559 26-Jun-2013 Joerg Sonnenberger <joerg@bec.de> Don't use unnamed local enums as template arguments.
Fixes -Werror bootstrap.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185023 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
5696884053b4a60dbed01ea8c7e6cd8dcf9b5de9 08-Apr-2013 DeLesley Hutchins <delesley@google.com> Thread safety analysis: turn on checking within lock and unlock functions.
These checks are enabled with the -Wthread-safety-beta flag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179046 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
b0707c9a933b1839fa966e4c72e4dcb9a198f11f 02-Apr-2013 Alexander Kornienko <alexfh@google.com> Fixed "fallthrough annotation does not directly precede switch label" warning in
case when [[clang::fallthrough]]; is used in a method of a local class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178543 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
fc09336a5965040736f9bc63a70416003972364e 01-Mar-2013 Stefanus Du Toit <stefanus.dutoit@rapidmind.com> Fix typos: [Dd]iagnosic -> [Dd]iagnostic

These all appear in comments or (ironically) diagnostics output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176383 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
b07805485c603be3d8011f72611465324c9e664b 23-Feb-2013 David Blaikie <dblaikie@gmail.com> Remove the CFGElement "Invalid" state.

Use Optional<CFG*> where invalid states were needed previously. In the one case
where that's not possible (beginAutomaticObjDtorsInsert) just use a dummy
CFGAutomaticObjDtor.

Thanks for the help from Jordan Rose & discussion/feedback from Ted Kremenek
and Doug Gregor.

Post commit code review feedback on r175796 by Ted Kremenek.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175938 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
fdf6a279c9a75c778eba382d9a156697092982a1 21-Feb-2013 David Blaikie <dblaikie@gmail.com> Replace CFGElement llvm::cast support to be well-defined.

See r175462 for another example/more details.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175796 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
3285c78041f80a26f6a947e2922e15c4af6e00bb 15-Feb-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Fixed diagnostic nondeterministic order bug (pr14901).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175289 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
878d0ad2c9d83ee6485fd16e21c5082acc63a890 07-Feb-2013 Alexander Kornienko <alexfh@google.com> -Wimplicit-fallthrough: fixed two cases where "fallthrough annotation in unreachable code" was issued incorrectly.

Summary:
-Wimplicit-fallthrough: fixed two cases where "fallthrough annotation in unreachable code" was issued incorrectly:

1. In actual unreachable code, but not immediately on a fall-through execution
path "fallthrough annotation does not directly precede switch label" is better;
2. After default: in a switch with covered enum cases. Actually, these shouldn't
be treated as unreachable code for our purpose.

Reviewers: rsmith

Reviewed By: rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D374

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174575 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
0162b832fd6450cd3a23019a3c900382d0e9415c 01-Feb-2013 Alexander Kornienko <alexfh@google.com> Fixed segmentation fault when a CFGBlock has NULL successor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174182 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
4874a8143dc3032205f97527ff619730db3d1f57 30-Jan-2013 Alexander Kornienko <alexfh@google.com> Don't warn on fall-through from unreachable code.

Summary:
A motivating example:
class ClassWithDtor {
public:
~ClassWithDtor() {}
};
void fallthrough3(int n) {
switch (n) {
case 2:
do {
ClassWithDtor temp;
return;
} while (0); // This generates a chain of unreachable CFG blocks.
case 3:
break;
}
}

Reviewers: rsmith, doug.gregor, alexfh

Reviewed By: alexfh

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D330

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173889 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
c6dcea93b499b504da22f9921fc198423ad0b13b 25-Jan-2013 Alexander Kornienko <alexfh@google.com> Silence unintended fallthrough diagnostic on a case label preceded with a normal label.

Summary:
It's unlikely that a fallthrough is unintended in the following code:
switch (n) {
...
label:
case 1:
...
goto label;
...
}

Reviewers: rsmith, doug.gregor

Reviewed By: doug.gregor

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D329

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173486 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
e992ed1a065d857947b3969e6b779c41cc35c234 25-Jan-2013 Alexander Kornienko <alexfh@google.com> Don't suggest to insert [[clang::fallthrough]] before empty cases. Fix for multiple case labels.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173458 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
cd8ab51a44e80625d84126780b0d85a7732e25af 17-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 semantics for [[noreturn]] attribute. This required splitting
it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their
semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as
affecting the function type, whereas [[noreturn]] does not).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172691 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
cfa88f893915ceb8ae4ce2f17c46c24a4d67502f 12-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
80ad52f327b532bded5c5b0ee38779d841c6cd35 02-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> s/CPlusPlus0x/CPlusPlus11/g


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
12f37e411462b8388eb1309357bd62257debacac 07-Dec-2012 DeLesley Hutchins <delesley@google.com> Fix analysis based warnings so that all warnings are emitted when compiling
with -Werror. Previously, compiling with -Werror would emit only the first
warning in a compilation unit, because clang assumes that once an error occurs,
further analysis is unlikely to return valid results. However, warnings that
have been upgraded to errors should not be treated as "errors" in this sense.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169649 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
fb4afc2fc659faff43a6df4c1d0e07df9c90479d 05-Dec-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: Add a new "beta" warning flag: -Wthread-safety-beta.
As the analysis improves, it will continue to add new warnings that are
potentially disruptive to existing users. From now on, such warnings will
first be introduced under the "beta" flag. Such warnings are not turned on by
default; their purpose is to allow users to test their code against future
planned changes, before those changes are actually made. After a suitable
migration period, beta warnings will be folded into the standard
-Wthread-safety.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
55fc873017f10f6f566b182b70f6fc22aefa3464 04-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
3078353fb56772193b9304510048ac075a2c95b5 12-Nov-2012 Ted Kremenek <kremenek@apple.com> Per discussion on cfe-dev, re-enable suppression of -Wimplicit-fallthrough on C, but also include dialects of C++ earlier than C++11.

There was enough consensus that we *can* get a good language solution
to have an annotation outside of C++11, and without this annotation
this warning doesn't quite mean's completeness criteria for this
kind of warning. For now, restrict this warning to C++11 (where an
annotation exists), and make this the behavior for the LLVM 3.2 release.
Afterwards, we will hammer out a language solution that we are all
happy with.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167749 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
3e7735183b00798efccdee82b9b64b00ef3cd684 10-Nov-2012 Ted Kremenek <kremenek@apple.com> Revert "Disable -Wimplicit-fallthrough when not using C++.", pending further discussion on cfe-dev.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167662 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
6e3ceb54a05eb2442625d25fda0b57a2b805ceba 10-Nov-2012 Ted Kremenek <kremenek@apple.com> Disable -Wimplicit-fallthrough when not using C++.

The rationale is that there is no good workflow to silence the warning
for specific cases, other than using pragmas. This is because the
attribute to decorate an explicit fall through is only available
in C++11.

By that argument, this should probably also be disabled unless one
is using C++11, but apparently there is an explicit test case for
this warning when using C++98. This will require further discussion
on cfe-commits.

Fixes: <rdar://problem/12584746>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167655 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
c0e44454bd78b8b4f3d70f08cf1edd5466b0c798 29-Oct-2012 Jordan Rose <jordan_rose@apple.com> -Warc-repeated-use-of-weak: allow single reads in loops from local variables.

Previously, the warning would erroneously fire on this:

for (Test *a in someArray)
use(a.weakProp);

...because it looks like the same property is being accessed over and over.
However, clearly this is not the case. We now ignore loops like this for
local variables, but continue to warn if the base object is a parameter,
global variable, or instance variable, on the assumption that these are
not repeatedly usually assigned to within loops.

Additionally, do-while loops where the condition is 'false' are not really
loops at all; usually they're just used for semicolon-swallowing macros or
using "break" like "goto".

<rdar://problem/12578785&12578849>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166942 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
b5cd1220dd650a358622241237aa595c5d675506 11-Oct-2012 Jordan Rose <jordan_rose@apple.com> -Warc-repeated-use-of-weak: Don't warn on a single read followed by writes.

This is a "safe" pattern, or at least one that cannot be helped by using
a strong local variable. However, if the single read is within a loop,
it should /always/ be treated as potentially dangerous.

<rdar://problem/12437490>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165719 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
0bea86307eb8c16339315a1e261fc490eb505c5b 08-Oct-2012 David Blaikie <dblaikie@gmail.com> StringRef-ify Binary/UnaryOperator::getOpcodeStr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165383 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
1952354bd376062c3ab3d328c0fc6c36530c9309 29-Sep-2012 Dmitri Gribenko <gribozavr@gmail.com> Move the 'find macro by spelling' infrastructure to the Preprocessor class and
use it to suggest appropriate macro for __attribute__((deprecated)) in
-Wdocumentation-deprecated-sync.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164892 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
20441c59a00afb949e53121c55f8a58da17ba79e 29-Sep-2012 Jordan Rose <jordan_rose@apple.com> Fix buildbots by not using a template from another namespace.

No need to specialize BeforeThanCompare for a comparator that's only
going to be used once.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164859 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
66da0abf7ab7cd449bb1d5134b2ef97d9d34d812 29-Sep-2012 Alexander Kornienko <alexfh@google.com> Compatibility macro detection for the -Wimplicit-fallthrough diagnostic.

Summary:
When issuing a diagnostic message for the -Wimplicit-fallthrough diagnostics, always try to find the latest macro, defined at the point of fallthrough, which is immediately expanded to "[[clang::fallthrough]]", and use it's name instead of the actual sequence.

Known issues:
* uses PP.getSpelling() to compare macro definition with a string (anyone can suggest a convenient way to fill a token array, or maybe lex it in runtime?);
* this can be generalized and used in other similar cases, any ideas where it should reside then?

Reviewers: doug.gregor, rsmith

Reviewed By: rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D50

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164858 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
7a2704800943fbb69207e125d28186278712af36 29-Sep-2012 Jordan Rose <jordan_rose@apple.com> -Warc-repeated-use-of-weak: check ivars and variables as well.

Like properties, loading from a weak ivar twice in the same function can
give you inconsistent results if the object is deallocated between the
two loads. It is safer to assign to a strong local variable and use that.

Second half of <rdar://problem/12280249>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
58b6bdcdeb683a3504f2248a409e1f4e85876cee 29-Sep-2012 Jordan Rose <jordan_rose@apple.com> Add a warning (off by default) for repeated use of the same weak property.

The motivating example:

if (self.weakProp)
use(self.weakProp);

As with any non-atomic test-then-use, it is possible a weak property to be
non-nil at the 'if', but be deallocated by the time it is used. The correct
way to write this example is as follows:

id tmp = self.weakProp;
if (tmp)
use(tmp);

The warning is controlled by -Warc-repeated-use-of-receiver, and uses the
property name and base to determine if the same property on the same object
is being accessed multiple times. In cases where the base is more
complicated than just a single Decl (e.g. 'foo.bar.weakProp'), it picks a
Decl for some degree of uniquing and reports the problem under a subflag,
-Warc-maybe-repeated-use-of-receiver. This gives a way to tune the
aggressiveness of the warning for a particular project.

The warning is not on by default because it is not flow-sensitive and thus
may have a higher-than-acceptable rate of false positives, though it is
less noisy than -Wreceiver-is-weak. On the other hand, it will not warn
about some cases that may be legitimate issues that -Wreceiver-is-weak
will catch, and it does not attempt to reason about methods returning weak
values.

Even though this is not a real "analysis-based" check I've put the bug
emission code in AnalysisBasedWarnings for two reasons: (1) to run on
every kind of code body (function, method, block, or lambda), and (2) to
suggest that it may be enhanced by flow-sensitive analysis in the future.

The second (smaller) half of this work is to extend it to weak locals
and weak ivars. This should use most of the same infrastructure.

Part of <rdar://problem/12280249>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164854 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
f3477c13eeaf11b32a41f181398fb5deffd0dd73 27-Sep-2012 Sylvestre Ledru <sylvestre@debian.org> Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164766

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164769 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
94ff8e1f57c6382d91d0de981a4f311509d83e37 27-Sep-2012 Sylvestre Ledru <sylvestre@debian.org> Fix a typo 'iff' => 'if'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164766 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
5b280f28351bbdc103cc50d3b0f52f92d286fa0a 19-Sep-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: fix ICE when EXCLUSIVE_LOCKS_REQUIRED or
LOCKS_EXCLUDED is used on a method with a name that is is not a simple
identifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164242 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
3f0ec5209726641782468bd4c7597e79dda78b15 10-Sep-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: differentiate between two forms of analysis; a precise
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
faadf48443f8c2fc53d267485d7e0e1bd382fc75 06-Sep-2012 Jordan Rose <jordan_rose@apple.com> Continue including temporary destructors in the CFG used for warnings.

...and hopefully unbreak buildbots. My apologies!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163267 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
df4ee102aa909e2f40c294701bfeffac63e8d29b 20-Aug-2012 Chad Rosier <mcrosier@apple.com> [ms-inline asm] Remove old cruft now that MS-style asms their own code path.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162210 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
6cfa78f6bd4e7d5e23366a0907f8f8792366bc4c 17-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> Uninitialized variables: two little changes:
* 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;'


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
879a4334e4c4cab0c22ba91492ffc2838bbc21fc 03-Jul-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: fixed incorrect error message at the end of a locks_required function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159607 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
c2f51cfefd77e9b25f201ecf879343d6d9a45158 15-Jun-2012 Sean Hunt <scshunt@csclub.uwaterloo.ca> Stop referring to functions as methods in per-function fallthrough-checking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158545 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
8cd64b4c5553fa6284d248336cb7c82dc960a394 11-Jun-2012 Chad Rosier <mcrosier@apple.com> Etch out the code path for MS-style inline assembly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158325 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
1973634e445d4f1abdeedc2809f2d281929253b6 02-Jun-2012 Alexander Kornienko <alexfh@google.com> Implementation of a "soft opt-in" option for -Wimplicit-fallthrough diagnostics: -Wimplicit-fallthrough-per-method


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157871 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
bdb97ff687ce85e45cc728b87612ed546f48c1e7 26-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> In response to some discussions on IRC, tweak the wording of the new
-Wsometimes-uninitialized diagnostics to make it clearer that the cause
of the issue may be a condition which must always evaluate to true or
false, rather than an uninitialized variable.

To emphasize this, add a new note with a fixit which removes the
impossible condition or replaces it with a constant.

Also, downgrade the diagnostic from -Wsometimes-uninitialized to
-Wconditional-uninitialized when it applies to a range-based for loop,
since the condition is not written explicitly in the code in that case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157511 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
a189d8976f1193b788508a1a29b2e9d0aca06aca 26-May-2012 Alexander Kornienko <alexfh@gmail.com> Don't offer '[[clang::fallthrough]];' fix-it when a fall-through occurs to a
switch label immediately followed by a 'break;'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157508 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
2815e1a075c74143a0b60a632090ece1dffa5c7c 25-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Split a chunk of -Wconditional-uninitialized warnings out into a separate flag,
-Wsometimes-uninitialized. This detects cases where an explicitly-written branch
inevitably leads to an uninitialized variable use (so either the branch is dead
code or there is an uninitialized use bug).

This chunk of warnings tentatively lives within -Wuninitialized, in order to
give it more visibility to existing Clang users.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157458 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
818918855d84e3db1af5a0807070d4995ca2cf75 25-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Some cleanups around the uninitialized variables warning, and a FIXME. No functional change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157440 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
f6278e545d9bc09fb5d7579d1123f0a455352627 09-May-2012 Richard Trieu <rtrieu@google.com> Pull some cases of initialization with self-reference warnings out of
-Wconditional-uninitialized into -Wuninitialized.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156512 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
3bb2994a7de3679fb825f3a36f3dc11ea1daf6a6 03-May-2012 Kaelyn Uhrain <rikka@google.com> Silence unused-variable warning when assertions are disabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156091 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
e0d3b4cd2b66f1cef26cacbed5820ab7c22ad5b3 03-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wimplicit-fallthrough warning flag, which warns on fallthrough between
cases in switch statements. Also add a [[clang::fallthrough]] attribute, which
can be used to suppress the warning in the case of intentional fallthrough.

Patch by Alexander Kornienko!

The handling of C++11 attribute namespaces in this patch is temporary, and will
be replaced with a cleaner mechanism in a subsequent patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156086 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
7b0a3e378c441cec60f929d13bd48846c267a008 03-May-2012 Richard Trieu <rtrieu@google.com> Fix a note without a SourceLocation.

#define TEST int y; int x = y;
void foo() {
TEST
}

-Wuninitialized gives this warning:
invalid-loc.cc:4:3: warning: variable 'y' is uninitialized when used here
[-Wuninitialized]
TEST
^~~~
invalid-loc.cc:2:29: note: expanded from macro 'TEST'
#define TEST int y; int x = y;
^
note: initialize the variable 'y' to silence this warning
1 warning generated.

The second note lacks filename, line number, and code snippet. This change
will remove the fixit and only point to variable declaration.

invalid-loc.cc:4:3: warning: variable 'y' is uninitialized when used here
[-Wuninitialized]
TEST
^~~~
invalid-loc.cc:2:29: note: expanded from macro 'TEST'
#define TEST int y; int x = y;
^
invalid-loc.cc:4:3: note: variable 'y' is declared here
TEST
^
invalid-loc.cc:2:14: note: expanded from macro 'TEST'
#define TEST int y; int x = y;
^
1 warning generated.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
2c0abf4ae33ab2ba690ccae724b8d6f196e7cfda 30-Apr-2012 David Blaikie <dblaikie@gmail.com> Add FixItHint for -Wnull-conversion to initialize with an appropriate literal.

Reviewed by Doug Gregor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155839 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
d200187bd27f9ad68699693a6e57f9ee3ff260fa 28-Apr-2012 Jordy Rose <jediknil@belkadan.com> [analyzer] Remove references to idx::TranslationUnit. Index is dead, cross-TU inlining never panned out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155751 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
ecafd309b3ed2ffc6f8ae7eecd1e7eae84b26f81 26-Mar-2012 Benjamin Kramer <benny.kra@googlemail.com> ThreadSafetyReporter: Manage diagnostics in a std::list.

std::list is expensive, but so is std::sorting a SmallVector of SmallVectors of
heavyweight PartialDiagnostics.

Saves ~30k in a i386-linux-Release+Asserts clang build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153437 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
a34194f035096dd8dce10574e3a186da968aa211 08-Mar-2012 Fariborz Jahanian <fjahanian@apple.com> improve on diagnostic and provide a fixit hint when
an uninitialized block variable is being called inside the
block literal. // rdar://10817031


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152271 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
e4e68d45f89ff4899d30cbd196603d09b7fbc150 15-Feb-2012 Douglas Gregor <dgregor@apple.com> When overload resolution picks an implicitly-deleted special member
function, provide a specialized diagnostic that indicates the kind of
special member function (default constructor, copy assignment
operator, etc.) and that it was implicitly deleted. Add a hook where
we can provide more detailed information later.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150611 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
793cd1c4cdfaafc52e2c2ad9dae959befe4bb166 15-Feb-2012 Douglas Gregor <dgregor@apple.com> Specialize noreturn diagnostics for lambda expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150586 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
d7a3e2c5f61cd4893f95b69a424fe4def3aa0f69 07-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Revert my patches which removed Diagnostic.h includes by moving some operator overloads out of line.

This seems to negatively affect compile time onsome ObjC tests
(which use a lot of partial diagnostics I assume). I have to come
up with a way to keep them inline without including Diagnostic.h
everywhere. Now adding a new diagnostic requires a full rebuild
of e.g. the static analyzer which doesn't even use those diagnostics.

This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99.
This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789.
This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7.
This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f.
This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
00bd44d5677783527d7517c1ffe45e4d75a0f56f 04-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Move various diagnostic operator<< overloads out of line and remove includes of Diagnostic.h.

Fix all the files that depended on transitive includes of Diagnostic.h.
With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
2e5156274b8051217565b557bfa14c80f7990e9c 03-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Thread safety analysis:
* When we detect that a CFG block has inconsistent lock sets, point the
diagnostic at the location where we found the inconsistency, and point a note
at somewhere the inconsistently-locked mutex was locked.
* Fix the wording of the normal (non-loop, non-end-of-function) case of this
diagnostic to not suggest that the mutex is going out of scope.
* Fix the diagnostic emission code to keep a warning and its note together when
sorting the diagnostics into source location order.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149669 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
23661d3e348c5f44ae89b6848bbc331829bb46f2 24-Jan-2012 David Blaikie <dblaikie@gmail.com> Revert various template unreachability code I committed accidentally.

r148774, r148775, r148776, r148777

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148780 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
36b7c63664bea8e9aa85a024c515877be2ff92fa 24-Jan-2012 David Blaikie <dblaikie@gmail.com> Simple hack to do unreachable code analysis on template patterns.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148774 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
71b8fb5d4233420d2ed2f150a54ea61431bd8684 21-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Make clang's AST model sizeof and typeof with potentially-evaluated operands correctly, similar to what we already do with typeid.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148610 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
7984de35644701c0d94336da7f2215d4c26d9f5b 13-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Improve 0-argument -Wvexing-parse diagnostic by adding notes with fix-its:

- If the declarator is at the start of a line, and the previous line contained
another declarator and ended with a comma, then that comma was probably a
typo for a semicolon:

int n = 0, m = 1, l = 2, // k = 5;
myImportantFunctionCall(); // oops!

- If removing the parentheses would correctly initialize the object, then
produce a note suggesting that fix.

- Otherwise, if there is a simple initializer we can suggest which performs
value-initialization, then provide a note suggesting a correction to that
initializer.

Sema::Declarator now tracks the location of the comma prior to the declarator in
the declaration, if there is one, to facilitate providing the note. The code to
determine an appropriate initializer from the -Wuninitialized warning has been
factored out to allow use in both that and -Wvexing-parse.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148072 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
99ba9e3bd70671f3441fb974895f226a83ce0e66 20-Dec-2011 David Blaikie <dblaikie@gmail.com> Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146959 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
1fa3c0682a52c45c4ad0be3a82d0c85f26657072 08-Dec-2011 DeLesley Hutchins <delesley@google.com> This patch extends thread safety analysis with support for the scoped_lockable attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146174 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
75df4eeede7b91c22c1d63fafd4dd4142844e3b9 01-Dec-2011 Ted Kremenek <kremenek@apple.com> Further tweak -Wurneachable-code and templates by allowing the warning to run on
explicit template specializations (which represent actual functions somebody wrote).

Along the way, refactor some other code which similarly cares about whether or
not they are looking at a template instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145547 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
5dfee06daa359bbe0f3c9de055b8a02d61a05173 30-Nov-2011 Ted Kremenek <kremenek@apple.com> Don't run -Wunreachable-code on template instantiations. Different instantiations may produce different unreachable code results, and it is very difficult for us to prove that ALL instantiations of a template have specific unreachable code. If we come up with a better solution, then we can revisit this, but this approach will at least greatly reduce the noise of this warning for code that makes use of templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145520 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
1d26f48dc2eea1c07431ca1519d7034a21b9bcff 24-Oct-2011 Ted Kremenek <kremenek@apple.com> Rename AnalysisContext to AnalysisDeclContext. Not only is this name more accurate, but it frees up the name AnalysisContext for other uses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142782 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
b1b5daf30d2597e066936772bd206500232d7d65 23-Oct-2011 Ted Kremenek <kremenek@apple.com> [analyzer] Remove LocationContext creation methods from AnalysisManager, and change clients to use AnalysisContext instead.

WIP to remove/reduce ExprEngine's usage of AnalysisManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142739 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
f1ac63702143d84db778d32eb185a77fc97db5f5 21-Oct-2011 DeLesley Hutchins <delesley@google.com> Thread safety analysis refactoring: invalid lock expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142666 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
0d381810da19dd7677b9a79fca516d298fa5addb 19-Oct-2011 Matt Beaumont-Gay <matthewbg@google.com> Only warn at self-initialization if some later use is always uninitialized.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142538 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
9e7617220135a6f6226cf09cb242cc1b905aedb4 13-Oct-2011 Ted Kremenek <kremenek@apple.com> Tweak -Wuninitialized's handling of 'int x = x' to report that as the root cause of an uninitialized variable IFF there are other uses of that uninitialized variable. Fixes <rdar://problem/9259237>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141881 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
fcdd2cb2fdf35f806dd800b369fe0772a1c8c26c 10-Oct-2011 Douglas Gregor <dgregor@apple.com> Don't suggest 'noreturn' for function template instantiations, because
it might be wrong for other instantiations of the same function
template. Fixes PR10801.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
d6471f7c1921c7802804ce3ff6fe9768310f72b9 26-Sep-2011 David Blaikie <dblaikie@gmail.com> Rename Diagnostic to DiagnosticsEngine as per issue 5397


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140478 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
4e4bc75d3570835e13183c66ac08974cdc016007 15-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: refactoring various out of scope warnings to use the same inteface. This eliminates a lot of unnecessary duplicated code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139801 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
df8327c28d293cf7c6952b86dba26863235dcc0f 14-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: reverting to use separate warning for requirement to hold any lock

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139723 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
e87158dfbca01577810f301543c3cdcfc955d8b0 13-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: Initializing var before exhaustive switch statement to deal with extraneous warning produced by gcc but not clang

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139611 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
e05ee6df356c25e792b0334d7a4dec3fe4f79f07 13-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Switch -Wreturn-type to completely rely on the CFG model of no-return.
This deletes a bunch of crufty code, and allows more logic sharing
between the analyzer and the warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139594 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
4f4f349208b2b2307454e169ac7b039e989f003f 10-Sep-2011 David Blaikie <dblaikie@gmail.com> Show either a location or a fixit note, not both, for uninitialized variable warnings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
b3321093f6ead084427eb4a6621832fc4ee2f5de 10-Sep-2011 Douglas Gregor <dgregor@apple.com> Fix a diagnostics crasher with -Wmissing-noreturn in Objective-C
methods, and improve the diagnostic slightly along the way. Fixes
<rdar://problem/10098695>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139446 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
99107ebc0a5aea953b736e12757e0919d5249d43 09-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: This patch deals with previously unhandled cases when building lock expressions. We now resolve this expressions, avoid crashing when encountering cast expressions, and have a diagnostic for unresolved lock expressions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139370 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
402aa0698fec81e574818a0a6c2000fac0b2c4c6 09-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread Safety: Moving the analysis to a new file

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139369 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
a49d1d8a34381802040c3d7fa218e93b457d2b1d 09-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: refactoring test cases

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139368 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
75f23aeb1c820b49f9faebed63b1cbef76c2c907 09-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: refactoring to use an error handler

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
179b920a8bca0811cf4ae32910925c3f98cca4cc 09-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: small edit to unused variation on warning left in by accident from earlier commit

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
8bccabeac6b98650dfd88bd1fc84e841eb42af4b 08-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread Safety: In C++0x Mutexes are the objects that control access to shared variables, while Locks are the objects that acquire and release Mutexes. We switch to this new terminology.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139321 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
af37061fea31f3f1d0638edb5486e8d72c701522 08-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread Safety: adding basic no thread safety analysis option

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139310 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
978191e0906606e32965cebcf81627d8e8711b13 08-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: Adding basic support for locks required and excluded attributes

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139308 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
a53257c94a4d871e64070f72edb687dcfb08c15d 08-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: shared vs. exclusive locks

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139307 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
eff98fc3561f6b717f6348f04b3f4fe03e934466 08-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread Safety: Patch to implement delayed parsing of attributes within a
class scope.

This patch was also written by DeLesley Hutchins.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139301 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
b0656ec72e25e5c8e463c2dc39914636f0cb06d1 31-Aug-2011 Chandler Carruth <chandlerc@gmail.com> Improve the diagnostic text for -Wmissing-noreturn to include the name
of the function in question when applicable (that is, not for blocks).
Patch by Joerg Sonnenberger with some stylistic tweaks by me.

When discussing this weth Joerg, streaming the decl directly into the
diagnostic didn't work because we have a pointer-to-const, and the
overload doesn't accept such. In order to make my style tweaks to the
patch, I first changed the overload to accept a pointer-to-const, and
then changed the diagnostic printing layer to also use
a pointer-to-const, cleaning up a gross line of code along the way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138854 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
05b436ef550837e2141c55c590fb16010b8658d8 30-Aug-2011 Caitlin Sadowski <supertri@google.com> Thread safety: added basic handling for pt_guarded_by/var and guarded_by/var annotations. We identify situations where we are accessing (reading or writing) guarded variables, and report an error if the appropriate locks are not held.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138774 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
b4d0a9678f8c592990593233e64c59247f40a74a 29-Aug-2011 Caitlin Sadowski <supertri@google.com> Thread safety: various minor bugfixes, with test cases

This patch is by DeLesley Hutchins.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138738 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
cc68c9bb2b827fa1b2e758e8e77eb121ffa0ad0a 27-Aug-2011 Douglas Gregor <dgregor@apple.com> In C++0x mode, suggest nullptr as the initializer for an uninitialized
pointer variable. Patch by David Blaikie!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138687 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
940b97f524bfc9e43f9c27a7eb97816bbc5e9bf5 24-Aug-2011 Caitlin Sadowski <supertri@google.com> Thread safety: Fix a few typos in last commit -- use LockID instead of Lock in comments and start a couple methods with a lowercase letter

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138460 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
0f3b4ca1764cd6d457f511d340fba504f41763c3 24-Aug-2011 Ted Kremenek <kremenek@apple.com> Start reworking -Wunreachable-code. The original analysis had serious flaws with how it
handled SCC's of dead code, or simply having false negatives by overly suppressing warnings.

WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138410 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
f1d10d939739f1a4544926d807e4f0f9fb64be61 24-Aug-2011 Ted Kremenek <kremenek@apple.com> Constify the result of CFGStmt::getStmt().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138408 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
3ac1fbc303d22af2e11a14023ecee7bd7b7d0bfd 23-Aug-2011 Caitlin Sadowski <supertri@google.com> Thread-safety analysis: adding in a basic lockset tracking system. This
system flags an error when unlocking a lock which was not held, locking
the same lock twice, having a different lockset on each iteration of a
loop, or going out of scope while still holding a lock. In order to
successfully use the lockset, this patch also makes sure that attribute
arguments are attached correctly for later parsing.

This patch was also worked on by DeLesley Hutchins.

Note: This patch has been reviewed by Chandler Carruth and Jeffrey
Yasskin. Feel free to provide post-commit review comments for a
subsequent patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138350 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
5f9e272e632e951b1efe824cd16acb4d96077930 23-Jul-2011 Chris Lattner <sabre@nondot.org> remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
d837c0dc361a000b951593eaaa80c46b73d15b1d 22-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Move duplicate uninitialized warning suppression into the
AnalysisBasedWarnings Sema layer and out of the Analysis library itself.
This returns the uninitialized values analysis to a more pure form,
allowing its original logic to correctly detect some categories of
definitely uninitialized values. Fixes PR10358 (again).

Thanks to Ted for reviewing and updating this patch after his rewrite of
several portions of this analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135748 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
bc5cb8a5fe2b88f917d47ceb58b53696a121e57e 21-Jul-2011 Ted Kremenek <kremenek@apple.com> Simplify passing of CFGBuildOptions around for AnalysisContext. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135666 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
0c8e5a0f70cbdb800d939c1807d05f380b2854d4 19-Jul-2011 Ted Kremenek <kremenek@apple.com> Reduce -Wuninitialized time by 22% (on sqlite) by removing the recursive AST crawl.

This is accomplished by forcing the needed expressions for -Wuninitialized to always be CFGElements in the CFG.
This allows us to remove a fair amount of the code for -Wuninitialized.

Some fallout:
- AnalysisBasedWarnings.cpp now specifically toggles the CFGBuilder to create a CFG that is suitable for -Wuninitialized. This
is a layering violation, since the logic for -Wuninitialized is in libAnalysis. This can be fixed with the proper refactoring.
- Some of the source locations for -Wunreachable-code warnings have shifted. While not ideal, this is okay because that analysis
already needs some serious reworking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135480 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
12efd57ee474c06880a7434ece21a39ac3f34e24 16-Jul-2011 Benjamin Kramer <benny.kra@googlemail.com> Zero this struct in a way that neither depends on the size of the struct nor triggers warnings from GCC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
57080fbac1ccce702255423335d52e81bcf17b6b 16-Jul-2011 Fariborz Jahanian <fjahanian@apple.com> Remove a gcc warning.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135348 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
54cf341bd4145e5e31f91c5777fcdaf3f2400537 08-Jul-2011 Benjamin Kramer <benny.kra@googlemail.com> Initialize all the AnalysisBasedWarnings statistics to zero.

Found by valgrind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134733 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
3ea4c49709c5bba5f8b16c6ceb725d9b9a1c48c6 07-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Based on comments from Chris, switch to using CFG::getNumBlockIDs()
rather than a computed std::distance(). At some point I had convinced
myself that these two were different; but as far as I can tell on
re-exampination they aren't, and the number of block IDs is actually
just a count of the blocks in the CFG.

While this removes the primary motivation for guarding all of this with
CollectStats, I have a patch coming up that will almost certainly make
it important again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134552 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
5d98994c7749312a43ce6adf45537979a98e7afd 06-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Build up statistics about the work done for analysis based warnings.
Special detail is added for uninitialized variable analysis as this has
serious performance problems than need to be tracked.

Computing some of this data is expensive, for example walking the CFG to
determine its size. To avoid doing that unless the stats data is going
to be used, we thread a bit into the Sema object to track whether
detailed stats should be collected or not. This bit is used to avoid
computations whereever the computations are likely to be more expensive
than checking the state of the flag. Thus, counters are in some cases
unconditionally updated, but the more expensive (and less frequent)
aggregation steps are skipped.

With this patch, we're able to see that for 'gcc.c':
*** Analysis Based Warnings Stats:
232 functions analyzed (0 w/o CFGs).
7151 CFG blocks built.
30 average CFG blocks per function.
1167 max CFG blocks per function.
163 functions analyzed for uninitialiazed variables
640 variables analyzed.
3 average variables per function.
94 max variables per function.
96409 block visits.
591 average block visits per function.
61546 max block visits per function.

And for the reduced testcase in PR10183:
*** Analysis Based Warnings Stats:
98 functions analyzed (0 w/o CFGs).
8526 CFG blocks built.
87 average CFG blocks per function.
7277 max CFG blocks per function.
68 functions analyzed for uninitialiazed variables
1359 variables analyzed.
19 average variables per function.
1196 max variables per function.
2540494 block visits.
37360 average block visits per function.
2536495 max block visits per function.

That last number is the somewhat scary one that indicates the problem in
PR10183.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134494 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
8ba44264e05fe0012ecfb7bac28b171b5a50dde3 02-Jul-2011 Douglas Gregor <dgregor@apple.com> When producing -Wuninitialized Fix-Its for pointers, prefer " = NULL"
over "= 0". Fixes <rdar://problem/9714386>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134302 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
1de85338543dd6228eb518185e385d94d377f4cb 11-May-2011 John McCall <rjmccall@apple.com> Teach CFG building how to deal with CXXMemberCallExprs and BoundMemberTy,
then teach -Wreturn-type to handle the same. Net effect: we now correctly
handle noreturn attributes on member calls in the CFG.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131178 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
262d50e1dcf529317da193ad585c11c16281a7ac 05-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Simplify the tracking of when to issue a fixit hint, making the helper
function more clear and obvious in behavior.

Add some comments documenting the behavior of the primary diagnostic helper.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128901 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
64fb959beb3a0ecb84a58e6ff82660a7a669f7b8 05-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Separate the logic for issuing the initialization fixit hint from the
diagnostic emission. The fixit hint, when suggested, typically has
nothing to do with the nature or form of the reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128899 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
4c4983bbd2904670a25c840b07600f14efbafd7f 05-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Begin refactoring the uninitialized warning code that I uglied up. This
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128898 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
b414c4fae51c5792d3074b4b78fc8737b1d8387c 05-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Fix PR9624 by explicitly disabling uninitialized warnings for direct self-init:

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128894 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
9f6494687c05fe1d334af76408ee056b5f80e027 05-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Cleanup the style of some of this code prior to functional changes.
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128878 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
d40066b0fb883839a9100e5455e33190b9b8abac 05-Apr-2011 Ted Kremenek <kremenek@apple.com> Fix PR 9626 (duplicated self-init warnings under -Wuninitialized) with 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128858 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
6f41715df2c6a31c0c3ab3088b8cd18a3c8321b8 04-Apr-2011 Ted Kremenek <kremenek@apple.com> -Wuninitialized: use "self-init" warning when issue uninitialized values warnings from the dataflow analysis that include within the initializer of a variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128843 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
5360c921a91dc43b442f069ba86d7b9df66362fc 04-Apr-2011 Ted Kremenek <kremenek@apple.com> -Wuninitialized: don't issue fixit for initializer if a variable declaration already has an initializer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128838 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
af13d5b25b360e698cc1cf1055ad7d14e008e505 19-Mar-2011 Ted Kremenek <kremenek@apple.com> Rename class 'CFGReachabilityAnalysis' to 'CFGReverseBlockReachabilityAnalysis'.

This rename serves two purposes:

- It reflects the actual functionality of this analysis.
- We will have more than one reachability analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127930 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
c5e43c19ddb40b8a1371291f73ae66fe54951ca5 17-Mar-2011 Ted Kremenek <kremenek@apple.com> Don't construct two CFGs just to run -Wuninitialized. While this causes new warnings to be flagged under -Wconditional-uninitialized, this is something we
can improve over time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127802 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
76709bf816e5e1b70b859bb607cf3ee91db12b76 15-Mar-2011 Ted Kremenek <kremenek@apple.com> Split warnings from -Wuninitialized-experimental into "must-be-initialized" and "may-be-initialized" warnings, each controlled by different flags.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127669 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
f7bafc77ba12bb1beb665243a0334cd81e024728 15-Mar-2011 Ted Kremenek <kremenek@apple.com> Split warnings from -Wuninitialized-experimental into "must-be-initialized" and "may-be-initialized" warnings, each controlled by different flags.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127666 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
6f34213f8d6ae8c77685b53664527e39bfaaca3b 15-Mar-2011 Ted Kremenek <kremenek@apple.com> Rename UninitializedValuesV2 to UninitializedValues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127657 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
0d28d360b5559abda755e50b855ba5e59727d9cd 10-Mar-2011 Ted Kremenek <kremenek@apple.com> When doing reachability analysis for warnings issued under 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127396 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
c5aff4497e5bfd7523e00b87560c1a5aa65136cc 03-Mar-2011 Ted Kremenek <kremenek@apple.com> Teach CFGImplicitDtor::getDestructorDecl() about arrays of objects with destructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126910 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
c9f8f5a726bbb562e4b2d4b19d66e6202dcb2657 02-Mar-2011 Ted Kremenek <kremenek@apple.com> Introduce CFGImplicitDtor::isNoReturn() to query whether a destructor actually returns. Use this for -Wreturn-type to prune false positives reported in PR 6884.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126875 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
351ba91eaa6d30e523587b2d7ed676a5172c6e56 23-Feb-2011 Ted Kremenek <kremenek@apple.com> Enhance Sema::DiagRuntimeBehavior() to delay some diagnostics to see if the 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126290 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
283a358aecb75e30fcd486f2206f6c03c5e7f11d 23-Feb-2011 Ted Kremenek <kremenek@apple.com> Have IdempotentOperationsChecker pull its CFGStmtMap from AnalysisContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126288 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
3ed6fc08a9cd293d012fa49ab2a615e618d7c3fa 23-Feb-2011 Ted Kremenek <kremenek@apple.com> Issue AnalysisBasedWarnings as part of calling Sema::PopBlockOrFunctionScope(). No real functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126287 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
09f57b966c2a6c0a1c8d2e0be9862f6b2c89f9f4 05-Feb-2011 Ted Kremenek <kremenek@apple.com> Don't suggest -Wuninitialized fixits for uninitialized enum types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
609e3170841dac81c3b7b6b9eccb9c520e42c9b2 03-Feb-2011 Ted Kremenek <kremenek@apple.com> Based on user feedback, swap -Wuninitialized diagnostics to have the warning refer to the bad use, and the note to the variable declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124758 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
63b54104700873dc4a5b95b3108052580b5370e7 01-Feb-2011 Ted Kremenek <kremenek@apple.com> Add temporary hack to -Wuninitialize to create a separate CFG (for C++ code) 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
eb7a779365c08f8f363e679a9f9fa389f22c7982 27-Jan-2011 Ted Kremenek <kremenek@apple.com> Tweak -Wuninitialized fixit for '_Bool' types to be initialized to 0, and C++ 'bool' types to false.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124356 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
2c3af5c0db9ac169dcf464276178a3172a1a5cf4 27-Jan-2011 Ted Kremenek <kremenek@apple.com> Teach -Wuninitialized to suggest "= false" for initializing bool variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124352 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
5811f5978feaa7b89bd89e174fa7ad077b48413e 26-Jan-2011 Ted Kremenek <kremenek@apple.com> Teach -Wreturn-type that destructors can appear
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124280 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
f39e6a388aaa2f155b46c61e655784b2473218eb 25-Jan-2011 Ted Kremenek <kremenek@apple.com> Fix regression in -Wreturn-type caused by not
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124238 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
a8c17a5babab35f2db26bf218e7571d1af4afedf 25-Jan-2011 Ted Kremenek <kremenek@apple.com> Teach -Wuninitialized-experimental to also warn
about uninitialized variables captured by blocks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124213 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
dcfb360f6e1aaab0754a98e1e245c2607c46058a 21-Jan-2011 Ted Kremenek <kremenek@apple.com> Provide -Wuninitialized-experimental fixits
for floats, and also check if 'nil' is declared
when suggesting it for initializing ObjC pointers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
fbb178a0b47fca1b0fb78c5d41198614cf52aa70 21-Jan-2011 Ted Kremenek <kremenek@apple.com> Add basic fixits for -Wuninitialized-experimental
to suggest initializations for pointer and
ObjC pointer types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123995 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
94b1b4d785bc0f09f6af4be394e59d51f35dda60 21-Jan-2011 Ted Kremenek <kremenek@apple.com> Enhance -Wuninitialized-experimental diagnostics
to issue the warning at an uninitialized variable's
declaration, but to issue notes at possible
uninitialized uses (which could be multiple).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
c21fed361c11f13db345cba69101578578d8fb79 18-Jan-2011 Ted Kremenek <kremenek@apple.com> Teach UninitializedValuesV2 to implicitly reason about C++
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123777 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
22c412060e82dbe577dd8374677219dc68baec87 17-Jan-2011 Anders Carlsson <andersca@mac.com> Handle base and member destructors in CheckFallThrough.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
0dc5f9aea3597f2ed400dd0c1bf45ebbb4a051f3 16-Jan-2011 Anders Carlsson <andersca@mac.com> Fix a bug where the -Wmissing-noreturn would always treat constructors with base or member initializers as noreturn.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123603 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
610068c8cd2321f90e147b12cf794e1f840b6405 15-Jan-2011 Ted Kremenek <kremenek@apple.com> Add initial prototype for implementation of
-Wuninitialized based on CFG dataflow analysis. WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123512 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
eeef924c4fcb79a3bcc8782afce343e641bbcb83 08-Jan-2011 Chandler Carruth <chandlerc@gmail.com> Remove a kludge from analysis based warnings that used to detect
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123056 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
0827408865e32789e0ec4b8113a302ccdc531423 15-Dec-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix diagnostic pragmas.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121873 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
4765fa05b5652fcc4356371c2f481d0ea9a1b007 06-Dec-2010 John McCall <rjmccall@apple.com> Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoretical
reason this is limited to C++, and it's certainly not limited to temporaries.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
b36cd3e1757fb4fcd9509f35558c847b04bef35f 16-Sep-2010 Zhongxing Xu <xuzhongxing@gmail.com> Introduce new CFGElement hierarchy to support C++ CFG, based on Marcin's patch
and discussions with Ted and Jordy.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114056 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
90b828aa279542559f655d1af666580288cb1841 09-Sep-2010 Ted Kremenek <kremenek@apple.com> Enhance -Wreturn-type to not warn when control-flow is most likely limited by a switch statement explicitly covering
all the cases for an enum value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113450 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
2d88708cbe4e4ec5e04e4acb6bd7f5be68557379 26-Aug-2010 John McCall <rjmccall@apple.com> Split out a header to hold APIs meant for the Sema implementation from Sema.h.
Clients of Sema don't need to know (for example) the list of diagnostics we
support.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112093 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
384aff8b94bb0d1ad6c5667b90621e5699815bb2 25-Aug-2010 John McCall <rjmccall@apple.com> Remove Sema.h's dependency on DeclCXX.h.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112032 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
e0054f61fd84133eb0d19c19ae9afaf117933274 25-Aug-2010 John McCall <rjmccall@apple.com> Remove AnalysisBasedWarnings.h's dependency on Type.h



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112027 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
7cd088e519d7e6caa4c4c12db52e0e4ae35d25c2 24-Aug-2010 John McCall <rjmccall@apple.com> Struggle mightily against header inclusion in Sema.h.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
e737f5041a36d0befb39ffeed8d50ba15916d3da 12-Aug-2010 Douglas Gregor <dgregor@apple.com> Move Sema's headers into include/clang/Sema, renaming a few along the way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110945 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
3c46e8db99196179b30e7ac5c20c4efd5f3926d7 26-Jul-2010 Dan Gohman <gohman@apple.com> Fix namespace polution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109440 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
7a42054b18b48ee0d09c7ecc65aaf283e5be78ec 19-Jul-2010 Zhongxing Xu <xuzhongxing@gmail.com> Fix construction of AnalysisContext. Thanks Daniel.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108694 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
00e9cbb13d3e5deb8ee27288e0ed816266ec9e5b 18-May-2010 Chandler Carruth <chandlerc@gmail.com> Add a hack to silence warnings about failing to return from functions after
a temporary with a noreturn destructor has been created. Fixes PR6884 for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104000 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
16565aa95b086fb239baf82335dccc1b1ec93942 16-May-2010 John McCall <rjmccall@apple.com> Don't emit any fallthrough / missing-noreturn warnings if we can't
compute a CFG for a function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103905 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
99e8192c4c8f1f596f9969e5f2cdafcee64ddaac 30-Apr-2010 Ted Kremenek <kremenek@apple.com> Don't perform AnalysisBasedWarnings in Sema or run the static analyzer when a
fatal error has occurred.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102778 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
259d48e1486044093131c8c078f70a28b1503e70 30-Apr-2010 John McCall <rjmccall@apple.com> An edge from a call expression to the exit block is only an abnormal edge
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102696 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
ca7eaeeed817001dc7cee4852a7e41f0982da1ef 17-Apr-2010 Douglas Gregor <dgregor@apple.com> If a non-noreturn virtual member function is guaranteed not to return,
do *not* suggest that the function could be attribute 'noreturn';
overridden functions may end up returning.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
b7e5f145f47b6ec1db1ba6fe9db9c0ed2fe38db3 08-Apr-2010 Ted Kremenek <kremenek@apple.com> Remove micro-optimization for not issueing CFG-based warnings for 'static inline' functions
unless they are used. I discussed this with Daniel Dunbar, and we agreed that this
provides an inconsistent warnings experience for the user and that there were
genuine cases where we wouldn't want to do this optimization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100800 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
2b60513052e81f66f852b21226ab488f9ed88f1d 08-Apr-2010 Ted Kremenek <kremenek@apple.com> Removed unused object.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100750 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
d75fa6e1c034bf8a335fa8ce1eaf4f08065b3331 08-Apr-2010 Ted Kremenek <kremenek@apple.com> Use SmallVector instead of an std::queue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100730 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
264ba48dc98f3f843935a485d5b086f7e0fdc4f1 30-Mar-2010 Rafael Espindola <rafael.espindola@gmail.com> the big refactoring bits of PR3782.

This introduces FunctionType::ExtInfo to hold the calling convention and the
noreturn attribute. The next patch will extend it to include the regparm
attribute and fix the bug.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99920 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
802c66edc5073991f2315ea84ecace1867c6027f 29-Mar-2010 Rafael Espindola <rafael.espindola@gmail.com> Be a bit more consistent in using operator->

This patch moves some methods from QualType to Type and changes the users to
use -> instead of .



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99805 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
c263704cb007eb95b79f37b12a8092c47146d452 23-Mar-2010 Ted Kremenek <kremenek@apple.com> For forward-declared static inline functions, delay CFG-based warnings until we
encounter a definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99243 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
d064fdc4b7b64ca55b40b70490c79d6f569df78e 23-Mar-2010 Ted Kremenek <kremenek@apple.com> Only perform CFG-based warnings on 'static inline' functions that
are called (transitively) by regular functions/blocks within a
translation untion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99233 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
d068aabc484c4009282122c6ef26e66e68cfa044 20-Mar-2010 Ted Kremenek <kremenek@apple.com> Don't bother running the analysis for CFG-based warnings if the
declaration is in a system header.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99087 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp
dbdbaaf34f798fa5cabec273c4b9397b3fd6a98c 20-Mar-2010 Ted Kremenek <kremenek@apple.com> Refactor CFG-based warnings in Sema to be run by a worked object called AnalysisBasedWarnings.
This object controls when the warnings are executed, allowing the client code
in Sema to selectively disable warnings as needed.

Centralizing the logic for analysis-based warnings allows us to optimize
when and how they are run.

Along the way, remove the redundant logic for the 'check fall-through' warning
for blocks; now the same logic is used for both blocks and functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99085 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/AnalysisBasedWarnings.cpp