summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Update comment to refer to core issue number.Richard Smith2013-07-221-4/+2
| | | | llvm-svn: 186848
* Improve clarity/consistency of a few UsingDecl methods and related helpers.Enea Zaffanella2013-07-221-19/+21
| | | | | | | | | | | | No functionality change. In Sema helper functions: * renamed isTypeName as HasTypenameKeyword In UsingDecl: * renamed get/setUsingLocation to get/setUsingLoc * renamed is/setTypeName as has/setTypename llvm-svn: 186816
* Remove superfluous cast.Robert Wilhelm2013-07-221-2/+1
| | | | llvm-svn: 186807
* Implement DR257 / fix PR16659:Richard Smith2013-07-221-7/+36
| | | | | | | | | | | | | | | A constructor for an abstract class does not call constructors for virtual base classes, so it is not an error if no initializer is present for the virtual base and the virtual base cannot be default initialized. Also provide a (disabled by default, for now) warning for the case where a virtual base class's initializer is ignored in an abstract class's constructor, and address a defect in DR257 where it was not carried through to C++11's rules for implicit deletion of special member functions. Based on a patch by Maurice Bos. llvm-svn: 186803
* Convert Sema::MatchTemplateParametersToScopeSpecifier to ArrayRef.Robert Wilhelm2013-07-211-7/+4
| | | | llvm-svn: 186794
* Clean up diagnostics for inheriting constructors.Eli Friedman2013-07-181-3/+1
| | | | | | | No new diagnostics, just better wording and notes pointing at more relevant locations. llvm-svn: 186629
* SemaDeclCXX.cpp: Dissolve a ligature "fi" in comment.NAKAMURA Takumi2013-07-171-1/+1
| | | | llvm-svn: 186523
* Fixed source range of C++03 access declarations.Enea Zaffanella2013-07-171-6/+1
| | | | llvm-svn: 186522
* Fix crash on zero-argument assignment operator.Eli Friedman2013-07-111-1/+2
| | | | | | | Make sure we don't crash when checking whether an assignment operator without any arguments is a special member. <rdar://problem/14397774>. llvm-svn: 186137
* Offer typo suggestions for 'using' declarations.Kaelyn Uhrain2013-07-101-4/+54
| | | | | | Patch courtesy of Luke Zarko <zarko@google.com> llvm-svn: 186019
* Allow typo correction to try removing nested name specifiers.Kaelyn Uhrain2013-07-021-5/+8
| | | | | | | | | | | | | | | | | The removal is tried by retrying the failed lookup of a correction candidate with either the MemberContext or SS (CXXScopeSpecifier) or both set to NULL if they weren't already. If the candidate identifier is then looked up successfully, make a note in the candidate that the SourceRange should include any existing nested name specifier even if the candidate isn't adding a different one (i.e. the candidate has a NULL NestedNameSpecifier). Also tweak the diagnostic messages to differentiate between a suggestion that just replaces the identifer but leaves the existing nested name specifier intact and one that replaces the entire qualified identifier, in cases where the suggested replacement is unqualified. llvm-svn: 185487
* Fix error recovery with in-class initializer.Eli Friedman2013-06-281-1/+6
| | | | | | | | Previously, for a field with an invalid in-class initializer, we would create a CXXDefaultInitExpr referring to a null Expr*. This is not a good idea. llvm-svn: 185216
* Fix line endings.Eli Friedman2013-06-281-20/+20
| | | | llvm-svn: 185215
* This patch fixes PR16395, when HandleMSProperty returns null due to a ↵Aaron Ballman2013-06-261-19/+20
| | | | | | | | declaration with no name. Patch thanks to Robert Wilhelm. llvm-svn: 185022
* Implement DR136David Majnemer2013-06-251-0/+34
| | | | | | | Friend declarations that specify a default argument must be a definition and the only declaration in the translation unit. llvm-svn: 184889
* Revert r184401 which reverted r183462.David Majnemer2013-06-221-25/+34
| | | | | | | | | | | | The problem with r183462 was that we assumed that a diagnostic id of zero would be silent. This small correction to CheckDerivedToBaseConversion changes it's behavior to omit the diagnostic when given a diagnostic id of zero. This fix passes the test case added in r184402. llvm-svn: 184631
* Clean up warning and add a test.Eli Friedman2013-06-201-2/+2
| | | | llvm-svn: 184466
* Temporarily revert r183462: "Implement DR7"Chandler Carruth2013-06-201-12/+5
| | | | | | This fixes PR16370, I'll add the test case in a follow-up commit. llvm-svn: 184401
* C++11: If a class has a user-declared copy operation or destructor, theRichard Smith2013-06-131-1/+67
| | | | | | | | implicit definition of a copy operation is deprecated. Add a warning for this to -Wdeprecated. This warning is disabled by default for now, pending investigation into how common this situation is. llvm-svn: 183884
* In C++11, promote access declaration diagnostic from warning to error. ThereRichard Smith2013-06-131-2/+4
| | | | | | doesn't seem to be any value in even adding a -W flag for this. llvm-svn: 183882
* PR12086, PR15117Richard Smith2013-06-121-9/+0
| | | | | | | | | | | | | | | | | | | Introduce CXXStdInitializerListExpr node, representing the implicit construction of a std::initializer_list<T> object from its underlying array. The AST representation of such an expression goes from an InitListExpr with a flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr). This more detailed representation has several advantages, the most important of which is that the new MaterializeTemporaryExpr allows us to directly model lifetime extension of the underlying temporary array. Using that, this patch *drastically* simplifies the IR generation of this construct, provides IR generation support for nested global initializer_list objects, fixes several bugs where the destructors for the underlying array would accidentally not get invoked, and provides constant expression evaluation support for std::initializer_list objects. llvm-svn: 183872
* Move detection of reference members binding to temporaries from building ofRichard Smith2013-06-121-9/+1
| | | | | | | CXXCtorInitializers to the point where we perform the questionable lifetime extension. This exposed a selection of false negatives in the warning. llvm-svn: 183869
* Reapply r183721, reverted in r183776, with a fix for a bug in the former (weRichard Smith2013-06-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | were lacking ExprWithCleanups nodes in some cases where the new approach to lifetime extension needed them). Original commit message: Rework IR emission for lifetime-extended temporaries. Instead of trying to walk into the expression and dig out a single lifetime-extended entity and manually pull its cleanup outside the expression, instead keep a list of the cleanups which we'll need to emit when we get to the end of the full-expression. Also emit those cleanups early, as EH-only cleanups, to cover the case that the full-expression does not terminate normally. This allows IR generation to properly model temporary lifetime when multiple temporaries are extended by the same declaration. We have a pre-existing bug where an exception thrown from a temporary's destructor does not clean up lifetime-extended temporaries created in the same expression and extended to automatic storage duration; that is not fixed by this patch. llvm-svn: 183859
* When we're synthesizing copy/move-assignment, we can't form a reference to anEli Friedman2013-06-071-1/+11
| | | | | | invalid field; make sure we don't try. Fixes <rdar://problem/14084171>. llvm-svn: 183479
* Implement DR7David Majnemer2013-06-061-5/+12
| | | | | | | | Disallowing deriving from classes that have private virtual base classes except in instances where the deriving class would be able to cast itself to the private virtual base via a different derivation. llvm-svn: 183462
* [ms-cxxabi] Look up operator delete() at every virtual dtor declaration.Peter Collingbourne2013-05-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While the C++ standard requires that this lookup take place only at the definition point of a virtual destructor (C++11 [class.dtor]p12), the Microsoft ABI may require the compiler to emit a deleting destructor for any virtual destructor declared in the TU, including ones without a body, requiring an operator delete() lookup for every virtual destructor declaration. The result of the lookup should be the same no matter which declaration is used (except in weird corner cases). This change will cause us to reject some valid TUs in Microsoft ABI mode, e.g.: struct A { void operator delete(void *); }; struct B { void operator delete(void *); }; struct C : A, B { virtual ~C(); }; As Richard points out, every virtual function declared in a TU (including this virtual destructor) is odr-used, so it must be defined in any program which declares it, or the program is ill formed, no diagnostic required. Because we know that any definition of this destructor will cause the lookup to fail, the compiler can choose to issue a diagnostic here. Differential Revision: http://llvm-reviews.chandlerc.com/D822 llvm-svn: 182270
* Use only explicit bool conversion operatorDavid Blaikie2013-05-151-1/+1
| | | | | | | | | | | | | | | | | | | The most common (non-buggy) case are where such objects are used as return expressions in bool-returning functions or as boolean function arguments. In those cases I've used (& added if necessary) a named function to provide the equivalent (or sometimes negative, depending on convenient wording) test. DiagnosticBuilder kept its implicit conversion operator owing to the prevalent use of it in return statements. One bug was found in ExprConstant.cpp involving a comparison of two PointerUnions (PointerUnion did not previously have an operator==, so instead both operands were converted to bool & then compared). A test is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix (adding operator== to PointerUnion in LLVM). llvm-svn: 181869
* Cleanup handling of UniqueExternalLinkage.Rafael Espindola2013-05-131-1/+1
| | | | | | | | | | | | | This patch renames getLinkage to getLinkageInternal. Only code that needs to handle UniqueExternalLinkage specially should call this. Linkage, as defined in the c++ standard, is provided by getFormalLinkage. It maps UniqueExternalLinkage to ExternalLinkage. Most places in the compiler actually want isExternallyVisible, which handles UniqueExternalLinkage as internal. llvm-svn: 181677
* Add support for __wchar_t in -fms-extensions mode.Hans Wennborg2013-05-101-2/+2
| | | | | | | | | | | | | | | | | MSVC provides __wchar_t. This is the same as the built-in wchar_t type from C++, but it is also available with -fno-wchar and in C. The commit changes ASTContext to have two different types for this: - WCharTy is the built-in type used for wchar_t in C++ and __wchar_t. - WideCharTy is the type of a wide character literal. In C++ this is the same as WCharTy, and in C it is an integer type compatible with the type in <stddef.h>. This fixes PR15815. llvm-svn: 181587
* ArrayRef'ize Sema::ActOnMemInitializerDmitri Gribenko2013-05-091-3/+2
| | | | llvm-svn: 181565
* ArrayRef'ize some SemaOverload methodsDmitri Gribenko2013-05-091-3/+5
| | | | | | Patch by Robert Wilhelm. llvm-svn: 181544
* C++1y: an assignment operator is implicitly 'constexpr' if it would only ↵Richard Smith2013-05-071-22/+46
| | | | | | call 'constexpr' assignment operators for a literal class type. llvm-svn: 181284
* Replace 'MultiExprArg()' with 'None'Dmitri Gribenko2013-05-051-10/+10
| | | | llvm-svn: 181166
* Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef ↵Dmitri Gribenko2013-05-051-13/+6
| | | | | | | | constructor from None Patch by Robert Wilhelm. llvm-svn: 181139
* ArrayRef'ize InitializationSequence constructor and ↵Dmitri Gribenko2013-05-031-48/+28
| | | | | | | | InitializationSequence::Diagnose() Patch by Robert Wilhelm. llvm-svn: 181022
* Move parsing of identifiers in MS-style inline assembly intoJohn McCall2013-05-031-2/+1
| | | | | | | | | | | | | | | | | | | | | the actual parser and support arbitrary id-expressions. We're actually basically set up to do arbitrary expressions here if we wanted to. Assembly operands permit things like A::x to be written regardless of language mode, which forces us to embellish the evaluation context logic somewhat. The logic here under template instantiation is incorrect; we need to preserve the fact that an expression was unevaluated. Of course, template instantiation in general is fishy here because we have no way of delaying semantic analysis in the MC parser. It's all just fishy. I've also fixed the serialization of MS asm statements. This commit depends on an LLVM commit. llvm-svn: 180976
* C++1y: support simple variable assignments in constexpr functions.Richard Smith2013-04-261-5/+6
| | | | llvm-svn: 180603
* Add r180263 back, but fix hasBraces() to be correct during parsing.Rafael Espindola2013-04-261-1/+2
| | | | | | | | Original commit message: Fix a case in linkage computation that should check for single line extern "C". llvm-svn: 180591
* Put friend decls in the correct context.Rafael Espindola2013-04-251-15/+25
| | | | | | | | | | When we find a friend declaration we have to skip transparent contexts for doing lookups, but we should not skip them when inserting the new decl if the lookup found nothing. Fixes PR15841. llvm-svn: 180571
* C++1y constexpr extensions, round 1: Allow most forms of declaration andRichard Smith2013-04-221-48/+200
| | | | | | | | statement in constexpr functions. Everything which doesn't require variable mutation is also allowed as an extension in C++11. 'void' becomes a literal type to support constexpr functions which return 'void'. llvm-svn: 180022
* C++1y: Allow aggregates to have default initializers.Richard Smith2013-04-201-3/+5
| | | | | | | | | | | Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in CXXCtorInitializers and in InitListExprs to represent a default initializer. There's an additional complication here: because the default initializer can refer to the initialized object via its 'this' pointer, we need to make sure that 'this' points to the right thing within the evaluation. llvm-svn: 179958
* PR15755: don't drop parameter packs when dropping parameters with defaultRichard Smith2013-04-171-7/+10
| | | | | | arguments in the formation of a candidate set of inheriting constructors. llvm-svn: 179708
* Sema: Remove unused variable.Benjamin Kramer2013-04-171-4/+0
| | | | llvm-svn: 179701
* DR974: Lambdas can have default arguments.Richard Smith2013-04-171-12/+2
| | | | llvm-svn: 179688
* Basic support for Microsoft property declarations andJohn McCall2013-04-161-2/+108
| | | | | | | | references thereto. Patch by Tong Shen! llvm-svn: 179585
* Parsing support for thread_local and _Thread_local. We give them the sameRichard Smith2013-04-121-22/+16
| | | | | | semantics as __thread for now. llvm-svn: 179424
* Add support for computing the exception specification for an inheritingRichard Smith2013-04-101-4/+69
| | | | | | | | | | | constructor. This isn't quite perfect (as usual, we don't handle default arguments correctly yet, and we don't deal with copy/move constructors for arguments correctly either, but this will be fixed when we implement core issue 1351. This completes our support for inheriting constructors. llvm-svn: 179154
* C++11 inheriting constructors: support for inheriting constructor templates.Richard Smith2013-04-101-192/+288
| | | | llvm-svn: 179151
* When checking for illegal expressions in a default-argumentJohn McCall2013-04-091-0/+18
| | | | | | | | expression, look through pseudo-object expressions. rdar://13602832 llvm-svn: 179080
* When -Woverloaded-virtual is triggered, call HandleFunctionTypeMismatch to addRichard Trieu2013-04-051-1/+3
| | | | | | | more information to the notes. This information is already present on other diagnostic messages that involves overloads. llvm-svn: 178923
OpenPOWER on IntegriCloud