summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Allow for annotate attributes after access specifiers. When suchErik Verbruggen2011-10-131-4/+5
| | | | | | attributes are found, propagate them to subsequent declarations. llvm-svn: 141861
* Get rid of ShouldDeleteMoveConstructor.Alexis Hunt2011-10-111-177/+31
| | | | llvm-svn: 141650
* Consolidate copy constructor deletion into ShouldDeleteSpecialMember.Alexis Hunt2011-10-111-181/+69
| | | | llvm-svn: 141645
* Move some bool flags out of function parameter lists.Kaelyn Uhrain2011-10-111-16/+12
| | | | llvm-svn: 141610
* Constant expression evaluation refactoring:Richard Smith2011-10-101-9/+6
| | | | | | | | | | | - Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions, and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert behaviour. - Factor out evaluation of bitfield bit widths. - Fix a few places which would evaluate an expression twice: once to determine whether it is a constant expression, then again to get the value. llvm-svn: 141561
* Per C++ [class.bit]p2, unnamed bit-fields are not members. Fixes PR10289.Douglas Gregor2011-10-101-4/+36
| | | | llvm-svn: 141549
* constexpr: Disable checking of constructor member initializer lists forRichard Smith2011-10-101-1/+2
| | | | | | | | | | constexpr constructor templates. Such checking is optional, and currently hard to get right since clang doesn't generate implicit member initializers until instantiation (even for non-dependent members). This is needed for clang to accept libstdc++ from g++4.6 in c++0x mode. llvm-svn: 141547
* When adding a direct initializer to a declaration, allow theDouglas Gregor2011-10-101-1/+7
| | | | | | | | initializer to update the type of the declaration. For example, this allows us to determine the size of an incomplete array from its initializer. Fixes PR10288. llvm-svn: 141543
* Parse the initializer for a class member after handling itsDouglas Gregor2011-10-101-11/+1
| | | | | | | declarator, so that the declarator is in scope for the initializer. Fixes PR9989. llvm-svn: 141539
* Begin work consolidating ShouldDelete* functions.Alexis Hunt2011-10-101-89/+131
| | | | | | | | | | | Begin with just default constructors. One note is that as a side effect of this, a conformance test was removed on the basis that this is almost certainly a defect as with most of union initialization. As it is, clang does not implement union initialization close to the standard as it's quite broken as written. I hope to write a paper addressing the issues eventually. llvm-svn: 141528
* Implement the restrictions in C++ [class.friend]p6, which disallowDouglas Gregor2011-10-101-2/+33
| | | | | | | defining a friend function with a qualified name or in a local class. Fixes PR9853. llvm-svn: 141524
* Diagnose attempts to declare a non-static data member with aDouglas Gregor2011-10-091-1/+7
| | | | | | non-identifier name. Fixes PR10839. llvm-svn: 141513
* Support for C1x _Atomic specifier (see testcase). This is primarily being ↵Eli Friedman2011-10-061-0/+1
| | | | | | | | committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic. Thanks to Jeffrey Yasskin for the thorough review! llvm-svn: 141330
* Added a flag to identify resolved overloaded function references.Abramo Bagnara2011-10-051-7/+10
| | | | llvm-svn: 141171
* CUDA: diagnose invalid calls across targetsPeter Collingbourne2011-10-021-0/+41
| | | | llvm-svn: 140978
* constexpr: semantic checking for constexpr functions and constructors. Based inRichard Smith2011-10-011-0/+408
| | | | | | | | | | | | | part on patches by Peter Collingbourne. We diverge from the C++11 standard in a few areas, mostly related to checking constexpr function declarations, and not just definitions. See WG21 paper N3308=11-0078 for details. Function invocation substitution is not available in this patch; constexpr functions cannot yet be used from within constant expressions. llvm-svn: 140926
* constexpr: semantic checking for constexpr variables.Richard Smith2011-09-291-11/+16
| | | | | | We had an extension which allowed const static class members of floating-point type to have in-class initializers, 'as a C++0x extension'. However, C++0x does not allow this. The extension has been kept, and extended to all literal types in C++0x mode (with a fixit to add the 'constexpr' specifier). llvm-svn: 140801
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-2/+2
| | | | llvm-svn: 140478
* Correctly parse braced member initializers (even in delayed parsing) and ↵Sebastian Redl2011-09-241-103/+97
| | | | | | | | | | | correctly pass the information on to Sema. There's still an incorrectness in the way template instantiation works now, but that is due to a far larger underlying representational problem. Also add a test case for various list initialization cases of scalars, which test this commit as well as the previous one. llvm-svn: 140460
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-1/+0
| | | | llvm-svn: 140407
* When checking for weak vtables, check whether the actual definition ofDouglas Gregor2011-09-231-1/+4
| | | | | | | | the key function is inline, rather than the original declaration. Perhaps FunctionDecl::isInlined() is poorly named. Fixes <rdar://problem/9979458>. llvm-svn: 140400
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-1/+1
| | | | llvm-svn: 140367
* Don't finalize checking of base and member initializers for aDouglas Gregor2011-09-221-1/+1
| | | | | | constructor template. Fixes PR10457. llvm-svn: 140350
* Only trigger the initialize-an-array-via-elementwise-copy/move codeDouglas Gregor2011-09-221-2/+3
| | | | | | | | generation when we're dealing with an implicitly-defined copy or move constructor. And, actually set the implicitly-defined bit for implicitly-defined constructors and destructors. Should fix self-host. llvm-svn: 140334
* ArrayRef-ifying the fields passed to Sema::ActOnFieldsDavid Blaikie2011-09-221-2/+2
| | | | llvm-svn: 140293
* ArrayRef-ifying Function/BlockDecl's setParamsDavid Blaikie2011-09-211-5/+5
| | | | llvm-svn: 140268
* Diagnose attempts to write a templated data member, from StepanDouglas Gregor2011-09-211-3/+25
| | | | | | Dyatkovskiy! Fixes PR10896. llvm-svn: 140250
* Fix a pretty nasty bug in noreturn destructors that cascaded into lotsChandler Carruth2011-09-201-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | of false positive warnings that depend on noreturn destructors pruning the CFGs, but only in C++0x mode! This was really surprising as the debugger quickly reveals that the attributes are parsed correctly (and using the same code) in both modes. The warning fires in the same way in both modes. But between parsing and building the destructor declaration with the noreturn attribute and the warning, it magically disappears. The key? The 'noexcept' appears! When we were rebuilding the destructor type with the computed implicit noexcept we completely dropped the old type on the floor. This almost makes sense (as the arguments and return type to a destructor aren't exactly unpredictable), but lost any function type attributes as well. The fix is simple, we build the new type off of the old one rather than starting fresh. Testing this is a bit awkward. I've done it by running the noreturn-sensitive tests in both modes, which previous failed and now passes, but if anyone has ideas about how to more specifically and thoroughly test that the extended info on a destructor is preserved when adding noexcept, I'm all ears. llvm-svn: 140138
* Removed an unused field and its accessors methods.Erik Verbruggen2011-09-191-1/+0
| | | | llvm-svn: 140017
* In constructors, don't generate implicit initializers for members of ↵Richard Smith2011-09-191-1/+15
| | | | | | anonymous structs contained within anonymous unions. llvm-svn: 140015
* Remove function which is unused as of r139996. Thanks to David Blaikie for ↵Richard Smith2011-09-191-13/+0
| | | | | | bringing this to my attention. llvm-svn: 140013
* PR10304: Do not call destructors for data members from union destructors. ↵Richard Smith2011-09-181-2/+3
| | | | | | | | | Prior to C++11, this has no effect since any such destructors must be trivial, and in C++11 such destructors must not be called. llvm-svn: 139997
* PR10954: variant members should not be implicitly initialized in ↵Richard Smith2011-09-181-11/+5
| | | | | | | | constructors if no mem-initializer is specified for them, unless an in-class initializer is specified. llvm-svn: 139996
* Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear ↵Francois Pichet2011-09-171-1/+1
| | | | | | | | that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag. Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag. llvm-svn: 139987
* __module_private__ is inherited by redeclarations of an entity, andDouglas Gregor2011-09-091-1/+1
| | | | | | must also be present of the first declaration of that entity. llvm-svn: 139384
* Changed references of BaseTy, MemInitTy, CXXScopeTy, TemplateParamsTy to ↵Richard Trieu2011-09-091-2/+3
| | | | | | CXXBaseSpecifier, CXXCtorInitializer, NestedNameSpecifier, TemplateParameterList and removed their typedefs. llvm-svn: 139350
* Modules: introduce the __module_private__ declaration specifier, whichDouglas Gregor2011-09-091-0/+1
| | | | | | | indicates that a declaration is only visible within the module it is declared in. llvm-svn: 139348
* Change all references of type ExprTy to Expr and get rid of the typedefs.Richard Trieu2011-09-091-3/+3
| | | | llvm-svn: 139347
* When performing a derived-to-base cast on the right-hand side of theDouglas Gregor2011-09-061-1/+1
| | | | | | | | | | | | | | | | synthesized move assignment within an implicitly-defined move assignment operator, be sure to treat the derived-to-base cast as an xvalue (rather than an lvalue). Otherwise, we'll end up getting the wrong constructor. Optimize a direct call to a trivial move assignment operator to an aggregate copy, as we do for trivial copy assignment operators, and update the the assertion in CodeGenFunction::EmitAggregateCopy() to cope with this optimization. Fixes PR10860. llvm-svn: 139143
* Add test case for defaulted copy and move structure validation.Sebastian Redl2011-09-041-14/+13
| | | | | | | | Fix bug this uncovered. Address minor comments from Doug. Enable cxx_implicit_moves feature. llvm-svn: 139101
* Teach -Wdangling-field to warn about temporaries bound to references asChandler Carruth2011-09-031-9/+17
| | | | | | | | | | | | | well. Also, clean up the flow of the code a bit, and factor things more nicely. Finally, add the test case that was missing from my previous commit (sorry), with new tests added to cover temporaries and other fun cases. llvm-svn: 139077
* Add a simple new warning to catch blatantly dangling pointer andChandler Carruth2011-09-031-2/+51
| | | | | | | | | | | | | | | | | reference members of classes. We've had several bugs reported because of this, and there's no reason not to flag it right away in the compiler. Comments especially welcome on the strategy for implementing this warning (IE, what should trigger this?) and on the text of the warning itself. I'm going to extend this to cover obvious cases with temporaries and beef up the test cases some in subsequent patches. I'll then run it over a large codebase and make sure its not misbehaving before I add it to -Wall or turn it on by default. I think this one might be a good candidate for on by default. llvm-svn: 139075
* When defining the implicit move assignment operator, don't performDouglas Gregor2011-09-011-3/+9
| | | | | | | | semantic analysis when taking the address of an xvalue. Instead, just build the unary operator directly, since it's safe to do so (from the IRgen and AST perspectives) for any glvalue. Fixes PR10822. llvm-svn: 138935
* Allow C99 hexfloats in C++0x mode. This change resolves the standardsDouglas Gregor2011-08-301-0/+24
| | | | | | | | | collision between C99 hexfloats and C++0x user-defined literals by giving C99 hexfloats precedence. Also, warning about user-defined literals that conflict with hexfloats and those that have names that are reserved by the implementation. Fixes <rdar://problem/9940194>. llvm-svn: 138839
* Declare and define implicit move constructor and assignment operator.Sebastian Redl2011-08-301-51/+1130
| | | | | | | | | This makes the code duplication of implicit special member handling even worse, but the cleanup will have to come later. For now, this works. Follow-up with tests for explicit defaulting and enabling the __has_feature flag to come. llvm-svn: 138821
* Track in the AST whether a function is constexpr.Richard Smith2011-08-151-5/+12
| | | | llvm-svn: 137653
* Implement function template specialization at class scope extension in ↵Francois Pichet2011-08-141-1/+2
| | | | | | | | | | | | | | | | | Microsoft mode. A new AST node is introduced: ClassScopeFunctionSpecialization. This node holds a FunctionDecl that is not yet specialized; then during the class template instantiation the ClassScopeFunctionSpecialization will spawn the actual function specialization. Example: template <class T> class A { public: template <class U> void f(U p) { } template <> void f(int p) { } // <== class scope specialization }; This extension is necessary to parse MSVC standard C++ headers, MFC and ATL code. BTW, with this feature in, clang can parse (-fsyntax-only) all the MSVC 2010 standard header files without any error. llvm-svn: 137573
* When adding the base and member initializers for an implicitly-definedDouglas Gregor2011-08-101-1/+2
| | | | | | | special member function, make sure to classify an explicitly-defaulted copy constructor as a "copy" operation. Fixes PR10622. llvm-svn: 137219
* Rewrite default initialization of anonymous structs/unions within aDouglas Gregor2011-08-101-69/+111
| | | | | | | | | | | | | constructor. Previously, we did some bogus recursion into the fields of anonymous structs (recursively), which ended up building invalid ASTs that would cause CodeGen to crash due to invalid GEPs. Now, we instead build the default initializations based on the indirect field declarations at the top level, which properly generates the sequence of GEPs needed to initialize the proper member. Fixes PR10512 and <rdar://problem/9924046>. llvm-svn: 137212
* Don't emit memcpy for copying fields of arrays of volatile elements.Fariborz Jahanian2011-08-091-2/+2
| | | | | | | Use the the path that generates a loop. This fixes bogus error that clang puts out. // rdar://9894548 llvm-svn: 137080
OpenPOWER on IntegriCloud