summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Don't check whether a friend declaration is correctly formed when instantiating,Nick Lewycky2013-02-061-33/+35
| | | | | | we already checked it when parsing. llvm-svn: 174486
* Add some missing diagnostics for C++11 narrowing conversions.Richard Smith2013-02-051-2/+4
| | | | llvm-svn: 174337
* Don't do delayed exception-specification checking on an invalidDouglas Gregor2013-02-011-0/+8
| | | | | | class. Fixes <rdar://problem/13017229>. llvm-svn: 174145
* Added outer template parameter lists to friend type AST nodes.Enea Zaffanella2013-01-311-3/+4
| | | | llvm-svn: 174050
* Fix unused variable warnings in -asserts buildMatt Beaumont-Gay2013-01-311-2/+2
| | | | llvm-svn: 173996
* Provide a fixit for constexpr non-static data members.David Blaikie2013-01-301-1/+30
| | | | | | | | | | | | | | | | If the member has an initializer, assume it was probably intended to be static and suggest/recover with that. If the member doesn't have an initializer, assume it was probably intended to be const instead of constexpr and suggest that. (if the attempt to apply these changes fails, don't make any suggestion & produce the same diagnostic experience as before. The only case where this can come up that I know of is with a mutable constexpr with an initializer, since mutable is incompatible with static (but it's already incompatible with const anyway)) llvm-svn: 173873
* The standard ARM C++ ABI dictates that inline functions areJohn McCall2013-01-251-1/+1
| | | | | | | | never key functions. We did not implement that rule for the iOS ABI, which was driven by what was implemented in gcc-4.2. However, implement it now for other ARM-based platforms. llvm-svn: 173515
* Remove windows line endings.David Blaikie2013-01-181-6/+6
| | | | llvm-svn: 172865
* Improve -Wreorder to handle cases of anonymous class member orderingDavid Blaikie2013-01-171-26/+11
| | | | llvm-svn: 172707
* ArrayRef-ize some ctor initializer related APIsDavid Blaikie2013-01-171-31/+23
| | | | llvm-svn: 172701
* Remove some unnecessary castsDavid Blaikie2013-01-171-4/+4
| | | | llvm-svn: 172700
* Add -Wunsequenced (with compatibility alias -Wsequence-point) to warn onRichard Smith2013-01-171-1/+1
| | | | | | | expressions which have undefined behavior due to multiple unsequenced modifications or an unsequenced modification and use of a variable. llvm-svn: 172690
* Fixes crash when illegal function definitions are deleted or defaulted. ↵Aaron Ballman2013-01-161-2/+2
| | | | | | Fixes PR14577. llvm-svn: 172676
* Refactor to call ActOnFinishFullExpr on every full expression. TeachRichard Smith2013-01-141-21/+13
| | | | | | | | ActOnFinishFullExpr that some of its checks only apply to discarded-value expressions. This adds missing checks for unexpanded variadic template parameter packs to a handful of constructs. llvm-svn: 172485
* ArrayRef'ize Sema APIs related to format string checkingDmitri Gribenko2013-01-131-1/+3
| | | | llvm-svn: 172367
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-4/+4
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Tighten types a bit. No functionality change.Rafael Espindola2013-01-081-4/+4
| | | | llvm-svn: 171894
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-19/+19
| | | | llvm-svn: 171367
* ArrayRefize a CompoundStmt constructor.Nico Weber2012-12-291-2/+2
| | | | llvm-svn: 171238
* PR13470: Ensure that copy-list-initialization isntantiates asRichard Smith2012-12-191-44/+14
| | | | | | | | | | | | copy-list-initialization (and doesn't add an additional copy step): Fill in the ListInitialization bit when creating a CXXConstructExpr. Use it when instantiating initializers in order to correctly handle instantiation of copy-list-initialization. Teach TreeTransform that function arguments are initializations, and so need this special treatment too. Finally, remove some hacks which were working around SubstInitializer's shortcomings. llvm-svn: 170489
* Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as ↵David Blaikie2012-12-191-21/+22
| | | | | | | | | | | | | | | per review discussion in r170365 This does limit these typedefs to being sequences, but no current usage requires them to be contiguous (we could expand this to a more general iterator pair range concept at some point). Also, it'd be nice if SmallVector were constructible directly from an ArrayRef but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the inverse conversion. (& generalizing over all range-like things, while nice, would require some nontrivial SFINAE I haven't thought about yet) llvm-svn: 170482
* PR14558: Compute triviality of special members (etc) at the end of the classRichard Smith2012-12-111-85/+109
| | | | | | | | | definition, rather than at the end of the definition of the set of nested classes. We still defer checking of the user-specified exception specification to the end of the nesting -- we can't check that until we've parsed the in-class initializers for non-static data members. llvm-svn: 169805
* Virtual method overrides can no longer have mismatched calling conventions. ↵Aaron Ballman2012-12-091-0/+35
| | | | | | This fixes PR14339. llvm-svn: 169705
* PR14550: If a system header contains a bogus constexpr function definition,Richard Smith2012-12-091-2/+3
| | | | | | don't mark the function as invalid, since we suppress the error. llvm-svn: 169689
* Finish implementing 'selected constructor' rules for triviality in C++11. InRichard Smith2012-12-081-49/+81
| | | | | | | | | | | | | | | | | | | | | | | | the cases where we can't determine whether special members would be trivial while building the class, we eagerly declare those special members. The impact of this is bounded, since it does not trigger implicit declarations of special members in classes which merely *use* those classes. In order to determine whether we need to apply this rule, we also need to eagerly declare move operations and destructors in cases where they might be deleted. If a move operation were supposed to be deleted, it would instead be suppressed, and we could need overload resolution to determine if we fall back to a trivial copy operation. If a destructor were implicitly deleted, it would cause the move constructor of any derived classes to be suppressed. As discussed on cxx-abi-dev, C++11's selected constructor rules are also retroactively applied as a defect resolution in C++03 mode, in order to identify that class B has a non-trivial copy constructor (since it calls A's constructor template, not A's copy constructor): struct A { template<typename T> A(T &); }; struct B { mutable A a; }; llvm-svn: 169673
* Remove some remnants of the assumption that there is at most one of eachRichard Smith2012-12-081-2/+18
| | | | | | flavour of special member. llvm-svn: 169670
* Properly compute triviality for explicitly-defaulted or deleted special members.Richard Smith2012-12-081-104/+478
| | | | | | | | | | | | | | Remove pre-standard restriction on explicitly-defaulted copy constructors with 'incorrect' parameter types, and instead just make those special members non-trivial as the standard requires. This required making CXXRecordDecl correctly handle classes which have both a trivial and a non-trivial special member of the same kind. This also fixes PR13217 by reimplementing DiagnoseNontrivial in terms of the new triviality computation technology. llvm-svn: 169667
* Per [dcl.fct.def.default]p1, don't allow variadic special members to be ↵Richard Smith2012-12-071-0/+4
| | | | | | defaulted. llvm-svn: 169574
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-9/+9
| | | | | | | | | | | | | 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. llvm-svn: 169237
* Consistently use 'needsImplicit<special member>' to determine whether we needRichard Smith2012-12-011-5/+9
| | | | | | | an implicit special member, rather than sometimes using '!hasDeclared<special member>'. No functionality change. llvm-svn: 169075
* The declaration of a special member can require overload resolution to beRichard Smith2012-11-291-0/+54
| | | | | | | | | | | performed, to determine whether that special member is deleted or constexpr. That overload resolution process can in turn trigger the instantiation of a template, which can do anything, including triggering the declaration of that very same special member function. When this happens, do not try to recursively declare the special member -- that's impossible. Instead, only try to realise the truth. There is no special member. llvm-svn: 168847
* Store on the CXXRecordDecl whether the class has, or would have, a copyRichard Smith2012-11-281-141/+4
| | | | | | | constructor/assignment operator with a const-qualified parameter type. The prior method for determining this incorrectly used overload resolution. llvm-svn: 168775
* C++ core issue 1344, PR10618: promote "addition of default argument makes thisRichard Smith2012-11-281-9/+16
| | | | | | | | | | | | a special member" diagnostic from warning to error, and fix the cases where it produced diagnostics with incorrect wording. We don't support this as an extension, and we ban it even in C++98 mode. This breaks too much (for instance, the ABI-specified calling convention for a type can change if it acquires a copy constructor through the addition of a default argument). llvm-svn: 168769
* Simplify checking for whether we should implicitly declare special members andRichard Smith2012-11-271-1/+4
| | | | | | add some assertions. No functionality change. llvm-svn: 168725
* A step towards sorting out handling of triviality of special members in C++11.Richard Smith2012-11-161-4/+1
| | | | | | | | | | | | | | Separate out the notions of 'has a trivial special member' and 'has a non-trivial special member', and use them appropriately. These are not opposites of one another (there might be no special member, or in C++11 there might be a trivial one and a non-trivial one). The CXXRecordDecl predicates continue to produce incorrect results, but do so in fewer cases now, and they document the cases where they might be wrong. No functionality changes are intended here (they will come when the predicates start producing the right answers...). llvm-svn: 168119
* Teach the uninitialized field warning about anonymous structs and union members.Nick Lewycky2012-11-151-9/+23
| | | | | | Fixes PR14073! llvm-svn: 168031
* Remove another questionable use of hasTrivial*. The relevant thing for thisRichard Smith2012-11-141-93/+114
| | | | | | | test was whether the /selected/ operator= was trivial, not whether the class had any trivial (or any non-trivial) operator=s. llvm-svn: 167897
* Fix some wrong-code bugs in implicitly-defined assignment operators:Richard Smith2012-11-131-35/+43
| | | | | | | - In C++11, perform overload resolution over all assignment operators, rather than just looking for copy/move assignment operators. - Clean up after temporaries produced by operator= immediately, rather than accumulating them until the end of the function. llvm-svn: 167798
* Factor duplicated implicit memcpy call generation code out of copy/moveRichard Smith2012-11-121-200/+69
| | | | | | | | assignment generation. This incidentally avoids reusing the same Expr* across multiple statements in the same object; that was generating slightly broken ASTs, but I couldn't trigger any observable bad behavior, so no test. llvm-svn: 167779
* Rework my implementation of circular-reference finding to not useDouglas Gregor2012-11-101-7/+34
| | | | | | | CXXRecordDecl::forallBases, which does *not* do what I need. Fixes the failure introduced in r167651. llvm-svn: 167668
* Diagnostic circular inheritance involving dependent base classes. WeDouglas Gregor2012-11-101-4/+31
| | | | | | | would have diagnosed this at instantiation time anyway, if only we didn't hang on all of these test cases. Fixes <rdar://problem/12629723> llvm-svn: 167651
* Put the usage-directive inside the nearest namespace or TU decl. We don't wantNick Lewycky2012-11-041-3/+3
| | | | | | | | to have UsingDirectiveDecl inside anything other than those two. No user-visible functionality change. llvm-svn: 167376
* Rework implementation of DR1492: Apply the resolution to operator delete too,Richard Smith2012-10-201-1/+1
| | | | | | | | | | | | since it also has an implicit exception specification. Downgrade the error to an extwarn, since at least for operator delete, system headers like to declare it as 'noexcept' whereas the implicit definition does not have an explicit exception specification. Move the exception specification for user-declared 'operator delete' functions from the type-as-written into the type, to reflect reality and to allow us to detect whether there was an implicit exception spec or not. llvm-svn: 166372
* Handle diamond inheritance in -Woverloaded-virtual.David Blaikie2012-10-191-13/+29
| | | | llvm-svn: 166254
* Fix Objective-C implicit property synthesis for C++ classes so we use valid Eli Friedman2012-10-181-30/+8
| | | | | | | | | | | source locations in places where it is necessary for diagnostics. By itself, this causes assertions, so while I'm here, also fix property synthesis for properties of C++ class type so we use so we properly set up a scope and mark variable declarations. <rdar://problem/12514189>. llvm-svn: 166219
* Fix -Woverloaded-virtual when the using statement refers to a base ↵David Blaikie2012-10-171-1/+6
| | | | | | | | | | | | | | | declaration of a virtual function. GCC and Clang both do not warn on: struct a { virtual void func(); }; struct b: a { virtual void func(); void func(int); }; struct c: b { void func(int); using b::func; }; but if the "using" was using a::func GCC would still remain silent where Clang would warn. This change makes Clang consistent with GCC's existing behavior. llvm-svn: 166154
* Fix typo correction of one qualified name to another.David Blaikie2012-10-121-1/+2
| | | | | | | | | | | | | | When suggesting "foo::bar" as a correction for "fob::bar" we mistakenly replaced only "bar" with "foo::bar" producing "fob::foo::bar" which was broken. This corrects that replacement in as many places as I could find & provides test cases for all those cases I could find a test case for. There are a couple that don't seem to be reachable (one looks entirely dead, the other just doesn't seem to ever get called with a namespace to namespace change). Review by Richard Smith ( http://llvm-reviews.chandlerc.com/D57 ). llvm-svn: 165817
* Fix stack overflow when trying to create an implicit movingArgyrios Kyrtzidis2012-10-101-1/+1
| | | | | | | | constructor with invalid code. rdar://12240916 llvm-svn: 165623
* Workaround for libstdc++4.6 <atomic> bug: make comment more explicit about ↵Richard Smith2012-10-051-2/+7
| | | | | | what's going on, per Sean Silva's suggestion. llvm-svn: 165286
* Egriegious hack to support libstdc++4.6's broken <atomic> header, which definesRichard Smith2012-10-041-24/+41
| | | | | | | | a non-inline namespace, then reopens it as inline to try to add its symbols to the surrounding namespace. In this one special case, permit the namespace to be reopened as inline, and patch up the name lookup tables to match. llvm-svn: 165263
OpenPOWER on IntegriCloud