summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Fix crash in CFGBuilder involving implicit destructor calls and ↵Ted Kremenek2011-08-121-23/+0
| | | | | | gotos jumping after an object was declared. Fixes PR 10620." llvm-svn: 137459
* De-Unicode-ify.NAKAMURA Takumi2011-08-122-16/+16
| | | | llvm-svn: 137430
* Fix a raw string literal test case to actually use a raw string literal.Craig Topper2011-08-121-1/+1
| | | | llvm-svn: 137427
* Fix crash in CFGBuilder involving implicit destructor calls and gotos ↵Ted Kremenek2011-08-121-0/+23
| | | | | | jumping after an object was declared. Fixes PR 10620. llvm-svn: 137426
* The current warning in -Wnull-arithmetic for comparisons between NULL and ↵Richard Trieu2011-08-111-7/+7
| | | | | | | | | | | | | | | | | 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
* Add support for C++0x raw string literals.Craig Topper2011-08-111-0/+11
| | | | llvm-svn: 137298
* Add the new unit test that I managed to leave out of r136997 :/Kaelyn Uhrain2011-08-101-0/+33
| | | | llvm-svn: 137242
* Change an assert into a check. I'm pretty sure there was a pointJohn McCall2011-08-101-0/+11
| | | | | | | | 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
* Thread Safety: Added basic argument parsing for all new attributes.Caitlin Sadowski2011-08-091-78/+440
| | | | | | | | | | | | 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
* Fix another -Wuninitialized assertion failure (this one involving bit casts) ↵Ted Kremenek2011-08-081-0/+11
| | | | | | resulting from the recent -Wuninitialized changes. llvm-svn: 137068
* Perform array bounds checking in more situations and properly handle specialKaelyn Uhrain2011-08-051-3/+18
| | | | | | | | | | | | | | | | 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
* Flesh out the -Warray-bounds detection of C89 tail-padded one-elementChandler Carruth2011-08-051-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Extend memset/memcpy/memmove checking to include memcmpMatt Beaumont-Gay2011-08-051-0/+13
| | | | llvm-svn: 136950
* Have the typo correction in DiagnoseEmptyLookup properly handle templateKaelyn Uhrain2011-08-051-8/+5
| | | | | | functions when performing function overload resolution. llvm-svn: 136948
* Fix a small bug where DiagnoseEmptyLookup would no longer print any messagesKaelyn Uhrain2011-08-041-0/+19
| | | | | | | | | 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
* Fix assertion failure in -Wuninitialized involving no-op casts. Fixes PR 10577.Ted Kremenek2011-08-041-0/+11
| | | | llvm-svn: 136939
* Match type names and give more info for out-of-line function definition errors.Kaelyn Uhrain2011-08-042-2/+26
| | | | | | | | | | | | | | 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
* Improve overloaded function handling in the typo correction code.Kaelyn Uhrain2011-08-031-2/+2
| | | | | | | | 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
* disable array bounds overflow warning for cases where an array Chris Lattner2011-08-021-6/+17
| | | | | | | | | | | | | 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
* Turn off __has_feature(is_empty) and __has_feature(is_pod) if theDouglas Gregor2011-07-301-0/+4
| | | | | | | libstdc++ hack has reverted these type traits to keywords. Icky, but fixes <rdar://problem/9836262>. llvm-svn: 136560
* Make DiagnosticErrorTrap keep a count of the errors that occurred so multipleArgyrios Kyrtzidis2011-07-291-0/+21
| | | | | | | | DiagnosticErrorTraps can be composed (e.g. a trap inside another trap). Fixes http://llvm.org/PR10462 & rdar://9852007. llvm-svn: 136447
* This patch makes the string/character literal tests run in C,Douglas Gregor2011-07-292-6/+11
| | | | | | C++98/03, and C++0x mode, from Craig Topper! llvm-svn: 136443
* Added basic parsing for all remaining attributes, thread safetyCaitlin Sadowski2011-07-281-0/+575
| | | | | | | analysis. This includes checking that the attributes are applied in the correct contexts and with the correct number of arguments. llvm-svn: 136383
* Added parsing for guarded_var, pt_guarded_var, lockable,Caitlin Sadowski2011-07-281-0/+204
| | | | | | scoped_lockable, and no_thread_safety_analysis attributes, all for thread safety analysis llvm-svn: 136364
* Add support for C++0x unicode string and character literals, from Craig Topper!Douglas Gregor2011-07-271-1/+6
| | | | llvm-svn: 136210
* Re-fix r136172 so it isn't an error; apparently, some people are fond of ↵Eli Friedman2011-07-261-1/+1
| | | | | | their undefined behavior. llvm-svn: 136183
* Diagnose trying to delete a pointer to an abstract class with a non-virtual ↵Eli Friedman2011-07-261-0/+7
| | | | | | | | destructor. PR10504. I'm not completely sure the standard allows us to reject this, but if it doesn't, it should. :) llvm-svn: 136172
* A couple minor issues with Sema for delete:Eli Friedman2011-07-261-0/+12
| | | | | | | | | 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
* Revert r136046 while fixing handling of e.g. &foo[index_one_past_size]Kaelyn Uhrain2011-07-262-40/+6
| | | | llvm-svn: 136113
* Expand array bounds checking to work in the presence of unary & and *,Kaelyn Uhrain2011-07-262-6/+40
| | | | | | | | | 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
* Tests for explicit conversion operators, along with a fix to avoidDouglas Gregor2011-07-231-0/+140
| | | | | | | | | | 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
* Fix a test in warn-sign-conversion.cpp. Removed a part of a directory path ↵Richard Trieu2011-07-211-1/+1
| | | | | | so that the directory seperator, which may change on different platforms, is no longer part of the string checked for. llvm-svn: 135665
* Remove warning for conditional operands of differend signedness from ↵Richard Trieu2011-07-214-80/+106
| | | | | | -Wsign-compare. Cases that previously warn on this will have a different warning emitted from -Wsign-conversion. llvm-svn: 135664
* Fix -Wuninitialized regression involving functions invalidating parameters ↵Ted Kremenek2011-07-201-0/+10
| | | | | | passed by reference. llvm-svn: 135610
* Reduce -Wuninitialized time by 22% (on sqlite) by removing the recursive AST ↵Ted Kremenek2011-07-191-4/+4
| | | | | | | | | | | | | | | 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
* Remove warnings of constant operands of logical operators from template ↵Richard Trieu2011-07-151-0/+22
| | | | | | | | | | | | | | 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 135177 to fix PR10363.Rafael Espindola2011-07-142-41/+8
| | | | | | | | 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
* PR10359: Template declarations which define classes are not permitted to ↵Richard Smith2011-07-141-1/+1
| | | | | | | | | | | | 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
* For C++11, do more checking of initializer lists up-front, enabling some ↵Sebastian Redl2011-07-142-8/+41
| | | | | | | | | | 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
* Fix problems Johannes noticed, and extend test cases further.Sebastian Redl2011-07-141-4/+58
| | | | llvm-svn: 135176
* PR8800: When building a conversion to A& using a member operatorA&(), do not ↵Richard Smith2011-07-131-0/+14
| | | | | | require A to be a complete type. llvm-svn: 135101
* Fix an incorrect namespace typo-correction diagnostic, from KaelynDouglas Gregor2011-07-131-3/+14
| | | | | | Uhrain! Fixes PR10318. llvm-svn: 135086
* Enforce access control for the destructor in a new[] expression and markJohn McCall2011-07-131-0/+8
| | | | | | | 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
* Fix typo correction crash on overloaded functions, pr10283.Hans Wennborg2011-07-121-0/+12
| | | | | | | 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
* Fixed PR10243.Abramo Bagnara2011-07-111-0/+23
| | | | llvm-svn: 134892
* Fixed enum types can be complete without actually being valid to useJohn McCall2011-07-061-1/+13
| | | | | | | as scope specifiers; diagnose the attempt, rather than letting it go to an assert. The rest of PR10264. llvm-svn: 134479
* Properly protect colons when parsing a nested-name-specifier as partJohn McCall2011-07-061-0/+11
| | | | | | | of an enum specifier in dialects which permit fixed underlying types. Fixes the rejects-valid part of PR10264. llvm-svn: 134468
* ActOnCXXConditionDeclaration should take into account thatDouglas Gregor2011-07-051-0/+9
| | | | | | ActOnDeclarator can return NULL. Fixes PR10270, from Hans Wennborg! llvm-svn: 134416
* For code such as:Richard Trieu2011-07-011-8/+10
| | | | | | | | | | | | | | | | | | | | | | | 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
* Fix for PR7410. Allow functions in a derived class that improperly overwrite ↵Richard Trieu2011-07-011-0/+13
| | | | | | 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
OpenPOWER on IntegriCloud