summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX
Commit message (Collapse)AuthorAgeFilesLines
* Don't try to get a CXXRecordDecl from a non-class TemplateSpecializationType.Kaelyn Takata2015-10-011-0/+10
| | | | | | | | With -fms-extensions it is possible to have a non-class record that is a template specialization cause an assertion failure via the call to Type::getAsCXXRecordDecl. Fixes PR 24246. llvm-svn: 249090
* Don't correct non-class using declarations to class members.Kaelyn Takata2015-09-301-0/+16
| | | | | | | Such declarations would be invalid anyway, and trying to make the correction will lead to a crash. Fixes PR 24781. llvm-svn: 248928
* Promote a warning on ill-formed code (redeclaration missing an exceptionRichard Smith2015-09-301-0/+7
| | | | | | | | | | | | | | | | | specification) to an error. No compiler other than Clang seems to allow this, and it doesn't seem like a useful thing to accept as an extension in general. The current behavior was added for PR5957, where the problem was specifically related to mismatches of the exception specification on the implicitly-declared global operator new and delete. To retain that workaround, we downgrade the error to an ExtWarn when the declaration is of a replaceable global allocation function. Now that this is an error, stop trying (and failing) to recover from a missing computed noexcept specification. That recovery didn't work, and led to crashes in code like the added testcase. llvm-svn: 248867
* Thread Safety Analysis: allow capability attribute on unions.DeLesley Hutchins2015-09-291-0/+23
| | | | llvm-svn: 248805
* Thread Safety Analysis: fix before/after checks so that they work on globalDeLesley Hutchins2015-09-291-0/+13
| | | | | | variables as well member variables. llvm-svn: 248803
* Make incomplete type errors better with enable_ifGeorge Burgess IV2015-09-251-1/+9
| | | | | | | | | | | | This patch fixes the order in which we evaluate the different ways that a function call could be disallowed. Now, if you call a non-overloaded function with an incomplete type and failing enable_if, we'll prioritize reporting the more obvious error (use of incomplete type) over reporting the failing enable_if. Thanks to Ettore Speziale for the patch! llvm-svn: 248595
* Remove warning on over-wide bit-field of boolean type; there's no risk thatRichard Smith2015-09-232-5/+5
| | | | | | | | | | someone thought all the bits would be value bits in this case. Also fix the wording of the warning -- it claimed that the width of 'bool' is 8, which is not correct; the width is 1 bit, whereas the size is 8 bits in our implementation. llvm-svn: 248435
* [Sema] Don't create an invalid source range for overlong initializer lists.Benjamin Kramer2015-09-231-0/+4
| | | | | | | | | We took both source locations from the end of the initializer list what the code below doesn't expect. This can lead to a crash when rendering the diagnostic (PR24816). Assert that we have more than one element in a scalar initializer with too many elements. llvm-svn: 248391
* [DeclPrinter] Don't crash when printing a using decl with a special nameBenjamin Kramer2015-09-231-0/+8
| | | | | | Fixes PR24872. llvm-svn: 248376
* [Concepts] Moving tests to match the corresponding section of the TSNathan Wilson2015-09-181-41/+0
| | | | llvm-svn: 247966
* MS ABI: Don't allow dllexport/import on lambdasHans Wennborg2015-09-152-0/+20
| | | | | | | This is to follow up on David's comment in http://reviews.llvm.org/D12422#235509 llvm-svn: 247718
* [MS ABI] Restore our warning for overwide bitfields using the MS ABIDavid Majnemer2015-09-151-1/+1
| | | | | | This restores a diagnostic lost in r247651. llvm-svn: 247659
* [MS ABI] Overwide bool bitfields should be permittedDavid Majnemer2015-09-151-2/+2
| | | | | | | | Overwide bool bitfields have eight bits of storage size, make sure we take the padding into account when determining whether or not they are problematic. llvm-svn: 247651
* PR24595: Ignore calling convention modifiers for structors in MS ABI.Andrey Bokhanko2015-09-141-1/+6
| | | | | | | | | | MS compiler ignores calling convention modifiers for structors. This patch makes clang do the same (for MS ABI). This fixes PR24595 and makes vswriter.h header (from Windows SDK 8.1) compilable. Differential Revision: http://reviews.llvm.org/D12402 llvm-svn: 247619
* C11 _Bool bitfield diagnosticRachel Craik2015-09-144-11/+12
| | | | | | | | | | | | Summary: Implement DR262 (for C). This patch will mainly affect bitfields of type _Bool Reviewers: fraggamuffin, rsmith Subscribers: hubert.reinterpretcast, cfe-commits Differential Revision: http://reviews.llvm.org/D10018 llvm-svn: 247618
* [Sema] Reject value-initialization of function typesDavid Majnemer2015-09-141-0/+2
| | | | | | | | | T in the expression T() must be a non-array complete object type or the void type. Function types are neither. This fixes PR24798. llvm-svn: 247535
* Fix access control for lookups using the Microsoft __super extension.John McCall2015-09-091-0/+49
| | | | | | rdar://22464808 llvm-svn: 247207
* Don't allow dllexport/import on static local variablesHans Wennborg2015-09-042-14/+3
| | | | | | | | They might technically have external linkage, but it still doesn't make sense for the user to try and export such variables. This matches MSVC's and MinGW's behaviour. llvm-svn: 246864
* clang/test/SemaCXX/sourceranges.cpp: Fix silly expressions. Sorry for the ↵NAKAMURA Takumi2015-09-041-3/+3
| | | | | | breakage. llvm-svn: 246850
* clang/test/SemaCXX/sourceranges.cpp: Appease win32. Class method is thiscall ↵NAKAMURA Takumi2015-09-041-2/+2
| | | | | | for targeting i686-(msvc|mingw32). llvm-svn: 246849
* Fix the perentheses location when the constructor is called on a class that ↵Olivier Goffart2015-09-041-1/+14
| | | | | | has a destructor llvm-svn: 246844
* Thread safety analysis: the NO_THREAD_SAFETY_ANALYSIS attribute will nowDeLesley Hutchins2015-09-031-0/+55
| | | | | | | disable checking of arguments to the function, which is done by -Wthread-safety-reference. llvm-svn: 246806
* Add a new frontend warning for referencing members from the handler of a ↵Aaron Ballman2015-09-011-0/+97
| | | | | | | | constructor or destructor function-try-block, which is UB in C++. This corresponds to the CERT secure coding rule ERR53-CPP. llvm-svn: 246548
* Allow TLS vars in dllimport/export functions; only inline dllimport ↵Hans Wennborg2015-08-282-0/+21
| | | | | | | | | | | | | | | | | | | | | functions when safe (PR24593) This patch does two things: 1) Don't error about dllimport/export on thread-local static local variables. We put those attributes on static locals in dllimport/export functions implicitly in case the function gets inlined. Now, for TLS variables this is a problem because we can't import such variables, but it's a benign problem becase: 2) Make sure we never inline a dllimport function TLS static locals. In fact, never inline a dllimport function that references a non-imported function or variable (because these are not defined in the importing library). This seems to match MSVC's behaviour. Differential Revision: http://reviews.llvm.org/D12422 llvm-svn: 246338
* PR24597: Fix in-place evaluation of call expressions to provide a proper "this"Richard Smith2015-08-281-0/+12
| | | | | | pointer to an RVO construction of a returned object. llvm-svn: 246263
* [ms-inline-asm] Add field access to MS inline asm identifier lookupReid Kleckner2015-08-261-0/+54
| | | | | | | | | | | | | | Now we can parse code like this: struct A { int field; }; int f(A o) { __asm mov eax, o.field } Fixes PR19117. llvm-svn: 246088
* [Sema] Don't assume CallExpr::getDirectCallee will succeedDavid Majnemer2015-08-261-0/+7
| | | | | | | | | | We tried to provide a very nice diagnostic when diagnosing an assignment to a const int & produced by a function call. However, we cannot always determine what function was called. This fixes PR24568. llvm-svn: 246014
* Modify DeclaratorChuck::getFunction to be passed an Exception Specification ↵Nathan Wilson2015-08-261-1/+7
| | | | | | | | | | | | | | | | | SourceRange Summary: - Store the exception specification range's begin and end SourceLocation in DeclaratorChuck::FunctionTypeInfo. These SourceLocations can be used in a FixItHint Range. - Add diagnostic; function concept having an exception specification. Reviewers: hubert.reinterpretcast, fraggamuffin, faisalv, aaron.ballman, rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D11789 llvm-svn: 246005
* Make sure that we evaluate __attribute__((enable_if)) on a method with no ↵Nick Lewycky2015-08-251-0/+37
| | | | | | overloads. Patch by Ettore Speziale! llvm-svn: 245985
* Clarify the error message when the reason the conversion is not viable is ↵Nick Lewycky2015-08-251-1/+1
| | | | | | because the returned value does not match the function return type. llvm-svn: 245979
* [Sema] Handle leading and trailing __ for GNU attributesDavid Majnemer2015-08-251-0/+3
| | | | | | | | | | GNU attributes can have a leading and trailing __ appended/prepended to the attribute name. While the parser and AttributeList::getKind did the right thing, AttributeList::getAttributeSpellingListIndex did not. This fixes PR24565. llvm-svn: 245953
* [Sema] Don't crash when diagnosing hack in libstdc++David Majnemer2015-08-211-2/+3
| | | | | | | | | | | | While working around a bug in certain standard library implementations, we would try to diagnose the issue so that library implementors would fix their code. However, we assumed an entity being initialized was a non-static data member subobject when other circumstances are possible. This fixes PR24526. llvm-svn: 245675
* Make a test less brittle.Richard Trieu2015-08-171-44/+56
| | | | | | Capture line numbers in a variable for FileCheck instead of hardcoding them. llvm-svn: 245250
* [Sema] Be consistent about diagnostic wording: always use "cannot".Davide Italiano2015-08-153-6/+6
| | | | | | Discussed with Richard Smith. llvm-svn: 245162
* [CONCEPTS] Add diagnostic; invalid tag when concept specifiedNathan Wilson2015-08-141-0/+10
| | | | | | | | | | | | Summary: Adding check to emit diagnostic for invalid tag when concept is specified and associated tests. Reviewers: rsmith, hubert.reinterpretcast, fraggamuffin, faisalv, aaron.ballman Subscribers: aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D11916 llvm-svn: 245123
* [MSVC Compatibility] Classify ext_ms_cast_fn_obj as DefaultErrorDavid Majnemer2015-08-111-1/+1
| | | | | | | | This non-conforming extension was introduced to make it possible for us to correctly compile <atomic> in VS 2013 and 2015. Let's limit its impact to system headers to encourage portable code. llvm-svn: 244650
* [MSVC Compat] Implement __is_destructible, __is_nothrow_destructibleDavid Majnemer2015-08-111-0/+43
| | | | | | | | Our implementations of these type trait intrinsics simply mapped them to __has_trivial_destructor. Instead, flesh these intrinsics out with a full implementation which matches the standard's description. llvm-svn: 244564
* If a variable template is inside a context with template arguments that is ↵Nick Lewycky2015-08-101-0/+11
| | | | | | being instantiated, and that instantiation fails, fail our instantiation instead of crashing. Errors have already been emitted. llvm-svn: 244515
* [Sema] Add a crazy test case for r243987Benjamin Kramer2015-08-041-0/+36
| | | | | | | | | It's not valid code (maybe it can be made valid, but I'm not sure how). To trigger the crash fixed in r243987 requires a friend function with more than four template parameter lists. With this test we have at least some coverage. llvm-svn: 243989
* [CONCEPTS] Add concept to VarDecl and diagnostic for uninitialized variable ↵Nathan Wilson2015-08-031-0/+4
| | | | | | | | | | | | | | concept Summary: Add IsConcept bit to VarDecl::NonParmVarDeclBitfields and associated isConcept/setConcept member functions. Set IsConcept to true when 'concept' specifier is in variable declaration. Create diagnostic when variable concept is not initialized. Reviewers: fraggamuffin, hubert.reinterpretcast, faisalv, aaron.ballman, rsmith Subscribers: aemerson, cfe-commits Differential Revision: http://reviews.llvm.org/D11600 llvm-svn: 243876
* [Concepts] Add diagnostic: non template declarationHubert Tong2015-07-301-0/+4
| | | | | | | | | | | | | | | | Summary: Adding diagnostic for concepts declared as non template (function or variable) Reviewers: faisalv, fraggamuffin, rsmith, hubert.reinterpretcast Subscribers: nwilson, cfe-commits Differential Revision: http://reviews.llvm.org/D11490 Patch by Nathan Wilson! llvm-svn: 243690
* Fix -Wredundant-move warning.Richard Trieu2015-07-292-83/+16
| | | | | | | | | Without DR1579 implemented, the only case for -Wredundant-move is for a parameter being returned with the same type as the function return type. Also include a check to verify that the move constructor will be used by matching nodes in the AST dump. llvm-svn: 243594
* Disable -Wpessimizing-move and -Wredundant-move in template instantiations.Richard Trieu2015-07-292-0/+74
| | | | | | | | | Dependent types can throw off the analysis for these warnings, possibly giving conflicting warnings and fix-its. Disabling the warning in template instantiations will prevent this problem, and will still catch the non-dependent cases in templates. llvm-svn: 243538
* Do not give a -Wredundant-move warning when removing the move will result in anRichard Trieu2015-07-281-1/+37
| | | | | | | | | error. If the object being moved has a move constructor and a deleted copy constructor, std::move is required, otherwise Clang will give a deleted constructor error. llvm-svn: 243463
* Rename -Wmsvc-include to -Wmicrosoft-include, now that -Wmicrosoft is split up.Nico Weber2015-07-281-4/+4
| | | | | | | | | (Keep -Wmsvc-include around as an alias.) While here, also replace the one other mention of "MSVC" in diagnostics with "Microsoft", for consistency. llvm-svn: 243444
* [MS Extensions] Remove support for the i128 integer literal suffixDavid Majnemer2015-07-261-3/+0
| | | | | | | | | | | | | There is currently no support in MSVC for using i128 as an integer literal suffix. In fact, there appears to be no evidence that they have ever supported this feature in any of their compilers. This was an over generalization of their actual feature and is a nasty source of bugs. Why is it a source of bugs? Because most code in clang expects that evaluation of an integer constant expression won't give them something that 'long long' can't represent. Instead of providing a meaningful feature, i128 gives us cute ways of exploding the compiler. llvm-svn: 243243
* [AST] Perform additional canonicalization for DependentSizedArrayTypeDavid Majnemer2015-07-241-0/+11
| | | | | | | | | | We treated DependentSizedArrayTypes with the same element type but differing size expressions as equivalently canonical. This would lead to bizarre behavior during template instantiation. This fixes PR24212. llvm-svn: 243093
* Fix the equal-vector-size rule for reinterpret_casts in C++John McCall2015-07-231-2/+20
| | | | | | | | | | | | | to consider the storage size of the vector instead of its sizeof. In other words, ban <3 x int> to <4 x int> casts, which produced invalid IR anyway. Also, attempt to be a little more rigorous, or at least explicit, about when enums are allowed in these casts. rdar://21901132 llvm-svn: 243069
* Add test to verify we emit warning when the deprecated virtual function is ↵Davide Italiano2015-07-231-0/+6
| | | | | | | | overloaded. Suggested by Richard Smith. llvm-svn: 242980
* [MS Compat] Allow _Atomic(Type) and 'struct _Atomic' to coexistDavid Majnemer2015-07-221-4/+11
| | | | | | | | | | | | | | | | | | | | | | MSVC 2013 ships, as part of its STL implementation, a class named '_Atomic'. This is unfortunate because this keyword is in conflict with the C11 keyword with the same name. Our solution was to disable this keyword when targeting MSVC 2013 and reenable it for 2015. However, this makes it impossible for clang's headers to make use of _Atomic. This is problematic in the case of libc++ as it makes heavy use of this keyword. Let the keywordness of _Atomic float under certain circumstances: the body of a class named _Atomic, or a class with a base specifier named _Atomic, will not have the keyword variant of _Atomic for the duration of the class body. This is sufficient to allow us to correctly handle _Atomic in the STL while permitting us to use _Atomic as a keyword everywhere else. Differential Revision: http://reviews.llvm.org/D11233 llvm-svn: 242970
OpenPOWER on IntegriCloud