| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
gotos jumping after an object was declared. Fixes PR 10620."
llvm-svn: 137459
|
|
|
|
| |
llvm-svn: 137430
|
|
|
|
| |
llvm-svn: 137427
|
|
|
|
|
|
| |
jumping after an object was declared. Fixes PR 10620.
llvm-svn: 137426
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
non-pointers is not very helpful. This patch will update the wording to be more helpful to users.
Old warning:
warning: use of NULL in arithmetic operation [-Wnull-arithmetic]
return 10 <= NULL;
^ ~~~~
New warning:
warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
return 10 <= NULL;
~~ ^ ~~~~
llvm-svn: 137377
|
|
|
|
| |
llvm-svn: 137298
|
|
|
|
| |
llvm-svn: 137242
|
|
|
|
|
|
|
|
| |
in time when this assert was valid, but it's not valid now.
Also teach this code to correctly introduce function-to-pointer
decay.
llvm-svn: 137201
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch special cases the parser for thread safety attributes so that all
attribute arguments are put in the argument list (instead of a special
parameter) since arguments may not otherwise resolve correctly without two-token
lookahead.
This patch also adds checks to make sure that attribute arguments are
lockable objects.
llvm-svn: 137130
|
|
|
|
|
|
| |
resulting from the recent -Wuninitialized changes.
llvm-svn: 137068
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
case situations with the unary operators & and *. Also extend the array bounds
checking to work with pointer arithmetic; the pointer arithemtic checking can
be turned on using -Warray-bounds-pointer-arithmetic.
The changes to where CheckArrayAccess gets called is based on some trial &
error and a bunch of digging through source code and gdb backtraces in order
to have the check performed under as many situations as possible (such as for
variable initializers, arguments to function calls, and within conditional in
addition to the simpler cases of the operands to binary and unary operator)
while not being called--and triggering warnings--more than once for a given
ArraySubscriptExpr.
llvm-svn: 136997
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
arrays. This now suppresses the warning only in the case of
a one-element array as the last field in a struct where the array size
is a literal '1' rather than any macro expansion or template parameter.
This doesn't distinguish between the language standard in use to allow
code which dates from C89 era to compile without the warning even in C99
and C++ builds. We could add a separate warning (under a different flag)
with fixit hints to switch to a flexible array, but its not clear that
this would be desirable. Much of the code using this idiom is striving
for maximum portability.
Tests were also fleshed out a bit, and the diagnostic itself tweaked to
be more pretty w.r.t. single elment arrays. This is more ugly than
I would like due to APInt's not being supported by the diagnostic
rendering engine.
A pseudo-patch for this was proposed by Nicola Gigante, but I reworked
it both for several correctness issues and for code style.
Sorry this was so long in coming.
llvm-svn: 136965
|
|
|
|
| |
llvm-svn: 136950
|
|
|
|
|
|
| |
functions when performing function overload resolution.
llvm-svn: 136948
|
|
|
|
|
|
|
|
|
| |
when performing typo correction involving any overloaded template functions.
The added test cases, while currently demontrating sub-optimal behavior, will
not trigger any messages without the 1-line change to SemaExpr.cpp.
llvm-svn: 136943
|
|
|
|
| |
llvm-svn: 136939
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Having a function declaration and definition with different types for a
parameter where the types have same (textual) name can occur when an unqualified
type name resolves to types in different namespaces in each location.
The error messages have been extended by adding notes that point to the first
parameter of the function definition that doesn't match the declaration, instead
of a generic "member declaration nearly matches". The generic message is still
used in cases where the mismatch is not in the paramenter list, such as
mismatched cv qualifiers on the member function itself.
llvm-svn: 136891
|
|
|
|
|
|
|
|
| |
Change TypoCorrection to store a set of NamedDecls instead of a single
NamedDecl. Also add initial support for performing function overload
resolution to Sema::DiagnoseEmptyLookup.
llvm-svn: 136807
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
has a single element. This disables the warning in cases where
there is a clear bug, but this is really rare (who uses arrays
with one element?) and it also silences a large class of false
positive issues with C89 code that is using tail padding in structs.
A better version of this patch would detect when an array is in
a tail position in a struct, but at least patch fixes the huge
false positives that are hitting postgres and other code.
llvm-svn: 136724
|
|
|
|
|
|
|
| |
libstdc++ hack has reverted these type traits to keywords. Icky, but
fixes <rdar://problem/9836262>.
llvm-svn: 136560
|
|
|
|
|
|
|
|
| |
DiagnosticErrorTraps can be composed (e.g. a trap inside another trap).
Fixes http://llvm.org/PR10462 & rdar://9852007.
llvm-svn: 136447
|
|
|
|
|
|
| |
C++98/03, and C++0x mode, from Craig Topper!
llvm-svn: 136443
|
|
|
|
|
|
|
| |
analysis. This includes checking that the attributes are applied in the
correct contexts and with the correct number of arguments.
llvm-svn: 136383
|
|
|
|
|
|
| |
scoped_lockable, and no_thread_safety_analysis attributes, all for thread safety analysis
llvm-svn: 136364
|
|
|
|
| |
llvm-svn: 136210
|
|
|
|
|
|
| |
their undefined behavior.
llvm-svn: 136183
|
|
|
|
|
|
|
|
| |
destructor. PR10504.
I'm not completely sure the standard allows us to reject this, but if it doesn't, it should. :)
llvm-svn: 136172
|
|
|
|
|
|
|
|
|
| |
1. Attempting to delete an expression of incomplete class type should be an error, not a warning.
2. If someone tries to delete a pointer to an incomplete class type, make sure we actually emit
the delete expression after we warn.
llvm-svn: 136161
|
|
|
|
| |
llvm-svn: 136113
|
|
|
|
|
|
|
|
|
| |
and to work with pointer arithmetic in addition to array indexing.
The new pointer arithmetic porition of the array bounds checking can be
turned on by -Warray-bounds-pointer-arithmetic (and is off by default).
llvm-svn: 136046
|
|
|
|
|
|
|
|
|
|
| |
considering explicit conversion operators when determining surrogate
functions. Fixes PR10453. Note that there are a few test cases where
Clang is still wrong because it does not implement DR899; see PR10456.
Patch by Jonathan Sauer!
llvm-svn: 135857
|
|
|
|
|
|
| |
so that the directory seperator, which may change on different platforms, is no longer part of the string checked for.
llvm-svn: 135665
|
|
|
|
|
|
| |
-Wsign-compare. Cases that previously warn on this will have a different warning emitted from -Wsign-conversion.
llvm-svn: 135664
|
|
|
|
|
|
| |
passed by reference.
llvm-svn: 135610
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
llvm-svn: 135480
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
instantiations. Upon instantiation of template, value-dependent parameters are replaced by equivalent literals, so code like:
template<unsigned int A, unsigned int B> struct S {
int foo() {
int x = A && B;
}
}
will not warn on A && B on every instantiation. This will still warn on other cases inside templates, which will be caught on checking the template definition.
llvm-svn: 135222
|
|
|
|
|
|
|
|
| |
Revert "For C++11, do more checking of initializer lists up-front, enabling some subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either."
This reverts commit ac420c5053d6aa41d59f782caad9e46e5baaf2c2.
llvm-svn: 135210
|
|
|
|
|
|
|
|
|
|
|
|
| |
also contain declarators. Previously we would accept code like this:
template<typename T> struct S { } f() { return 0; }
This case now produces a missing ';' diagnostic, since that seems like a much more likely error than an attempt to declare a function or variable in addition to the class template.
Treat this
llvm-svn: 135195
|
|
|
|
|
|
|
|
|
|
| |
subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either.
This is a first baby step towards supporting generalized initializer lists. This also removes an aggregate
test case that was just plain wrong, assuming that non-aggregates couldn't be initialized with initializer lists
in C++11 mode.
llvm-svn: 135177
|
|
|
|
| |
llvm-svn: 135176
|
|
|
|
|
|
| |
require A to be a complete type.
llvm-svn: 135101
|
|
|
|
|
|
| |
Uhrain! Fixes PR10318.
llvm-svn: 135086
|
|
|
|
|
|
|
| |
it as used. Otherwise, we can fail to instantiate or validate the destructor,
which can lead to crashes in IR gen like PR10351.
llvm-svn: 135073
|
|
|
|
|
|
|
| |
It would be cool if we could do overload resolution to suggest
the right function, but at least this fixes the crashing.
llvm-svn: 134976
|
|
|
|
| |
llvm-svn: 134892
|
|
|
|
|
|
|
| |
as scope specifiers; diagnose the attempt, rather than letting it go
to an assert. The rest of PR10264.
llvm-svn: 134479
|
|
|
|
|
|
|
| |
of an enum specifier in dialects which permit fixed underlying types.
Fixes the rejects-valid part of PR10264.
llvm-svn: 134468
|
|
|
|
|
|
| |
ActOnDeclarator can return NULL. Fixes PR10270, from Hans Wennborg!
llvm-svn: 134416
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
int f(int x) {
if (int foo = f(bar)) {}
return 0;
}
Clang produces the following error messages:
paren_imbalance.cc:2:19: error: use of undeclared identifier 'bar'
if (int foo = f(bar)) {}
^
paren_imbalance.cc:2:26: error: expected ')'
if (int foo = f(bar)) {}
^
paren_imbalance.cc:2:6: note: to match this '('
if (int foo = f(bar)) {}
^
The second error is incorrect. This patch will stop Clang from producing an error on parenthesis imbalance during error recovery when there isn't one.
llvm-svn: 134258
|
|
|
|
|
|
| |
a virtual function in the base class to be inserted into the derived class function list to prevent extra errors every time the derived class is used.
llvm-svn: 134251
|