summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Add FP_CONTRACT support for clang.Lang Hames2012-10-021-1/+1
| | | | | | | | Clang will now honor the FP_CONTRACT pragma and emit LLVM fmuladd intrinsics for expressions of the form A * B + C (when they occur in a single statement). llvm-svn: 164989
* Fix for r163013 regression and further __interface enhancement.John McCall2012-09-251-4/+59
| | | | | | Patch by Andy Gibbs! llvm-svn: 164590
* Don't produce diagnostics for missing ctor-initializers during templateRichard Smith2012-09-251-1/+5
| | | | | | instantiations if we encountered errors parsing some of the initializers. llvm-svn: 164578
* Make warnings about uninitialized fields include the field name.Hans Wennborg2012-09-211-1/+1
| | | | | | | | | | | This makes the wording more informative, and consistent with the other warnings about uninitialized variables. Also, me and David who reviewed this couldn't figure out why we would need to do a lookup to get the name of the variable; so just print the name directly. llvm-svn: 164366
* Doxygen-ify a comment.Craig Topper2012-09-211-4/+4
| | | | llvm-svn: 164360
* PR13890: Warn on abstract final classes.David Blaikie2012-09-211-0/+5
| | | | llvm-svn: 164359
* Per C++11 [class.friend]p3, the 'friend' keyword must appear first in aRichard Smith2012-09-201-10/+14
| | | | | | non-function friend declaration. Patch by Josh Magee! llvm-svn: 164273
* Warn about self references in in-class initializers.Hans Wennborg2012-09-181-94/+101
| | | | | | | | | | | | | | This makes Clang warn about self references in in-class initializers, for example: struct S { int a = a + 42; }; This basically just moves UninitializedFieldVisitor up a bit in SemaDeclCXX.cpp, and adds a call to it from ActOnCXXInClassMemberInitializer. llvm-svn: 164131
* Don't write uninitialized values even if nobody ever asks for it.Axel Naumann2012-09-171-1/+1
| | | | llvm-svn: 164033
* When diagnosing multiple mem-initializers in a delegating ctor, point to the ↵Richard Smith2012-09-141-4/+3
| | | | | | delegating initializer, not to the first initializer. For good measure, also highlight the other initializer. llvm-svn: 163919
* As we do with base and member initializers in a dependent class, delayDouglas Gregor2012-09-141-1/+5
| | | | | | | | | type checking for non-static data member initializers in a dependent class, because our ASTs lose too much information to when type-checking an initializer. Fixes <rdar://problem/11974632>, although the result is still rather unsatisfactory. llvm-svn: 163871
* Remove redundant semicolons which are null statements.Dmitri Gribenko2012-09-101-1/+1
| | | | llvm-svn: 163546
* Don't try to check override control for invalid member functions. Fixes a ↵Richard Smith2012-09-061-0/+3
| | | | | | crash in a corner case. Patch by Olivier Goffart! llvm-svn: 163337
* Changed the remaining dead asserts to llvm_unreachable.Joao Matos2012-09-011-7/+5
| | | | llvm-svn: 163039
* Normalize line endings of r163013 (part 2).Joao Matos2012-08-311-30/+30
| | | | llvm-svn: 163032
* Improved MSVC __interface support by adding first class support for it, ↵Joao Matos2012-08-311-14/+30
| | | | | | instead of aliasing to "struct" which had some incorrect behaviour. Patch by David Robins. llvm-svn: 163013
* Change the representation of builtin functions in the ASTEli Friedman2012-08-311-8/+8
| | | | | | | | | (__builtin_* etc.) so that it isn't possible to take their address. Specifically, introduce a new type to represent a reference to a builtin function, and a new cast kind to convert it to a function pointer in the operand of a call. Fixes PR13195. llvm-svn: 162962
* Push ArrayRef through the Expr hierarchy.Benjamin Kramer2012-08-241-5/+3
| | | | | | No functionality change. llvm-svn: 162552
* Now that ASTMultiPtr is nothing more than a array reference, make it a ↵Benjamin Kramer2012-08-231-16/+13
| | | | | | | | MutableArrayRef. This required changing all get() calls to data() and using the simpler constructors. llvm-svn: 162501
* Remove ASTOwningVector, it doesn't own anything and provides no value over ↵Benjamin Kramer2012-08-231-5/+5
| | | | | | SmallVector. llvm-svn: 162492
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-20/+20
| | | | | | | These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475
* Fix undefined behavior: member function calls where 'this' is a null pointer.Richard Smith2012-08-231-16/+18
| | | | llvm-svn: 162430
* Better wording for reference self-initialization warning.Hans Wennborg2012-08-201-1/+4
| | | | llvm-svn: 162198
* Store SourceManager pointer on PrintingPolicy in the case where we're dumping,Richard Smith2012-08-161-1/+1
| | | | | | | | | and remove ASTContext reference (which was frequently bound to a dereferenced null pointer) from the recursive lump of printPretty functions. In so doing, fix (at least) one case where we intended to use the 'dump' mode, but that failed because a null ASTContext reference had been passed in. llvm-svn: 162011
* Make __is_convertible_to handle abstract types correctly. PR13591.Eli Friedman2012-08-141-0/+1
| | | | llvm-svn: 161828
* Check access to friend declarations. There's a number of differentJohn McCall2012-08-101-2/+4
| | | | | | | | | | | | | | things going on here that were problematic: - We were missing the actual access check, or rather, it was suppressed on account of being a redeclaration lookup. - The access check would naturally happen during delay, which isn't appropriate in this case. - We weren't actually emitting dependent diagnostics associated with class templates, which was unfortunate. - Access was being propagated incorrectly for friend method declarations that couldn't be matched at parse-time. llvm-svn: 161652
* -Wunused-private-fields: Don't try to check unresolved initializer expressionsRichard Smith2012-08-071-43/+24
| | | | | | | | for side-effects. Instead, check for side-effects after performing initialization. Doing so also removes some strange corner cases and differences between in-class initialization and constructor initialization. llvm-svn: 161449
* PR13499: Don't try to check whether 'override' has been validly applied untilRichard Smith2012-08-061-35/+39
| | | | | | | we know whether the function is virtual. But check it as soon as we do know; in some cases we don't need to wait for an instantiation. llvm-svn: 161316
* PR13527: don't assert if a function is explicitly defaulted when it's alreadyRichard Smith2012-08-061-1/+2
| | | | | | been defined. llvm-svn: 161315
* Fix crash if a literal operator template's template parameter pack is not a ↵Richard Smith2012-08-031-1/+1
| | | | | | non-type template parameter pack. Patch by Andy Gibbs! llvm-svn: 161260
* Attaching comments to declarations: handle using-declaration.Dmitri Gribenko2012-08-021-0/+1
| | | | llvm-svn: 161211
* PR13479: If we see the definition of an out-of-line destructor in C++11, beRichard Smith2012-07-301-8/+26
| | | | | | | | sure to update the exception specification on the declaration as well as the definition. If we're building in -fno-exceptions mode, nothing else will trigger it to be updated. llvm-svn: 161008
* Final piece of core issue 1330: delay computing the exception specification ofRichard Smith2012-07-271-228/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a defaulted special member function until the exception specification is needed (using the same criteria used for the delayed instantiation of exception specifications for function temploids). EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to resolve the exception specification. This is enabled for all C++ modes: it's a little faster in the case where the exception specification isn't used, allows our C++11-in-C++98 extensions to work, and is still correct for C++98, since in that mode the computation of the exception specification can't fail. The diagnostics here aren't great (in particular, we should include implicit evaluation of exception specifications for defaulted special members in the template instantiation backtraces), but they're not much worse than before. Our approach to the problem of cycles between in-class initializers and the exception specification for a defaulted default constructor is modified a little by this change -- we now reject any odr-use of a defaulted default constructor if that constructor uses an in-class initializer and the use is in an in-class initialzer which is declared lexically earlier. This is a closer approximation to the current draft solution in core issue 1351, but isn't an exact match (but the current draft wording isn't reasonable, so that's to be expected). llvm-svn: 160847
* Fix a typo (the the => the)Sylvestre Ledru2012-07-231-1/+1
| | | | llvm-svn: 160622
* When we have an Objective-C object with non-trivial lifetime in aDouglas Gregor2012-07-231-1/+1
| | | | | | | | structor class under ARC, that struct/class does not have a trivial move constructor or move assignment operator. Fixes the rest of <rdar://problem/11738725>. llvm-svn: 160615
* PR13381, part 2: when determining if a defaulted special member function shouldRichard Smith2012-07-181-9/+18
| | | | | | | | be defined as deleted, take cv-qualifiers on class members into account when looking up the copy or move constructor or assignment operator which will be used for them. llvm-svn: 160418
* PR13381: consider cv-qualifiers on a class member's type when determining whichRichard Smith2012-07-181-12/+19
| | | | | | | constructor will be used for moving that object, in the computation of its exception specification. llvm-svn: 160417
* Ignore visibility attributes after definitions. This matches newer (4.7) gcc'sRafael Espindola2012-07-121-0/+8
| | | | | | behavior and is the first step in fixing pr13338. llvm-svn: 160104
* Stop instantiating a class if we hit a static_assert failure. Also, if theRichard Smith2012-07-111-11/+23
| | | | | | | static_assert fails when parsing the template, don't diagnose it again on every instantiation. llvm-svn: 160088
* Enable comment parsing and semantic analysis to emit diagnostics. A fewDmitri Gribenko2012-07-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostics implemented -- see testcases. I created a new TableGen file for comment diagnostics, DiagnosticCommentKinds.td, because comment diagnostics don't logically fit into AST diagnostics file. But I don't feel strongly about it. This also implements support for self-closing HTML tags in comment lexer and parser (for example, <br />). In order to issue precise diagnostics CommentSema needs to know the declaration the comment is attached to. There is no easy way to find a decl by comment, so we match comments and decls in lockstep: after parsing one declgroup we check if we have any new, not yet attached comments. If we do -- then we do the usual comment-finding process. It is interesting that this automatically handles trailing comments. We pick up not only comments that precede the declaration, but also comments that *follow* the declaration -- thanks to the lookahead in the lexer: after parsing the declgroup we've consumed the semicolon and looked ahead through comments. Added -Wdocumentation-html flag for semantic HTML errors to allow the user to disable only HTML warnings (but not HTML parse errors, which we emit as warnings in -Wdocumentation). llvm-svn: 160078
* When marking virtual functions as used for a class' vtable, mark all functionsRichard Smith2012-07-071-8/+17
| | | | | | | | | | which will appear in the vtable as used, not just those ones which were declared within the class itself. Fixes an issue reported as comment#3 in PR12763 -- we sometimes assert in codegen if we try to emit a reference to a function declaration which we've not marked as referenced. This also matches gcc's observed behavior. llvm-svn: 159895
* Split out the "empty" case for compound statement into a separate ctor.Benjamin Kramer2012-07-041-4/+3
| | | | | | Move the ASTContext-dependent version out of line. llvm-svn: 159717
* Be more eager about setting the 'Invalid' bit on an invalid classDouglas Gregor2012-07-021-0/+2
| | | | | | | | | template instantiation. I wasn't able to reproduce this down to anything small enough to put in our test suite, but it's "obviously" okay to set the invalid bit earlier and precludes a known-broken-but-not-marked-broken class from being used elsewhere. llvm-svn: 159584
* Avoid redundant error when redefining a function as deleted.David Blaikie2012-06-291-2/+2
| | | | | | Reviewed by Doug Gregor. llvm-svn: 159442
* PR12937: Explicitly deleting an explicit template specialization.David Blaikie2012-06-251-2/+7
| | | | | | | | | | | | | | | This works around a quirk in the way that explicit template specializations are handled in Clang. We generate an implicit declaration from the original template which the explicit specialization is considered to redeclare. This trips up the explicit delete logic. This change only works around that strange representation. At some point it'd be nice to remove those extra declarations to make the AST more accurately reflect the C++ semantics. Review by Doug Gregor. llvm-svn: 159167
* Unrevert r158887, reverted in r158949, along with a fix for the bug whichRichard Smith2012-06-251-9/+3
| | | | | | | | | | | | | | | | | | | | resulted in it being reverted. A test for that bug was added in r158950. Original comment: If an object (such as a std::string) with an appropriate c_str() member function is passed to a variadic function in a position where a format string indicates that c_str()'s return type is desired, provide a note suggesting that the user may have intended to call the c_str() member. Factor the non-POD-vararg checking out of DefaultVariadicArgumentPromotion and move it to SemaChecking in order to facilitate this. Factor the call checking out of function call checking and block call checking, and extend it to cover constructor calls too. Patch by Sam Panzer! llvm-svn: 159159
* Revert r158887. This fixes pr13168.Rafael Espindola2012-06-211-3/+9
| | | | | | | | Revert "If an object (such as a std::string) with an appropriate c_str() member function" This reverts commit 7d96f6106bfbd85b1af06f34fdbf2834aad0e47e. llvm-svn: 158949
OpenPOWER on IntegriCloud