summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Save a copy expression for non-trivial copy constructions of catch variables.John McCall2011-02-161-12/+26
| | | | llvm-svn: 125661
* Return a declaration to the parser when creating a field in C++ so thatJohn McCall2011-02-151-3/+1
| | | | | | | | | the parser will complete the declarator with a valid decl and thus trigger delayed diagnostics for it. It certainly looks like we were intentionally returning null here, but I couldn't find any good reason for it, and there wasn't a comment, so farewell to all that. llvm-svn: 125556
* When parsing an out-of-line member function declaration, we must delayJohn McCall2011-02-141-4/+6
| | | | | | | | | | | | | | | | | | | | | | access-control diagnostics which arise from the portion of the declarator following the scope specifier, just in case access is granted by friending the individual method. This can also happen with in-line member function declarations of class templates due to templated-scope friend declarations. We were really playing fast-and-loose before with this sort of thing, and it turned out to work because *most* friend functions are in file scope. Making us delay regardless of context exposed several bugs with how we were manipulating delay. I ended up needing a concept of a context that's independent of the declarations in which it appears, and then I actually had to make some things save contexts correctly, but delay should be much cleaner now. I also encapsulated all the delayed-diagnostics machinery in a single subobject of Sema; this is a pattern we might want to consider rolling out to other components of Sema. llvm-svn: 125485
* Give some convenient idiomatic accessors to Stmt::child_range andJohn McCall2011-02-131-6/+3
| | | | | | | Stmt::const_child_range, then make a bunch of places use them instead of the individual iterator accessors. llvm-svn: 125450
* For -Woverloaded-virtual take into account canonical methods. Fixes ↵Argyrios Kyrtzidis2011-02-101-2/+3
| | | | | | rdar://8979966 & http://llvm.org/PR9182. llvm-svn: 125296
* Basic implementation of inherited constructors. Only generates declarations, ↵Sebastian Redl2011-02-051-4/+228
| | | | | | and probably only works for very basic use cases. llvm-svn: 124970
* Re-land r124768, with a fix for PR9130.Anders Carlsson2011-02-051-7/+0
| | | | | | We now emit everything except unused implicit virtual member functions when building the vtable. llvm-svn: 124935
* Implement -Woverloaded-virtual.Argyrios Kyrtzidis2011-02-031-0/+102
| | | | | | | | | | | | The difference with gcc is that it warns if you overload virtual methods only if the method doesn't also override any method. This is to cut down on the number of warnings and make it more useful like reported here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20423. If we want to warn that not all overloads are overriden we can have an additional warning like -Wpartial-override. -Woverloaded-virtual, unlike gcc, is added to -Wmost. Addresses rdar://8757630. llvm-svn: 124805
* Revert 124768.Rafael Espindola2011-02-031-0/+7
| | | | | | | This reopens PR99114, but that one at least can be avoided with an #include. PR9130 cannot. llvm-svn: 124780
* Don't try to mark virtual members referenced for classes where the key functionAnders Carlsson2011-02-031-7/+0
| | | | | | | | | | | is not defined in the current translation unit. Doing so lead to compile errors such as PR9114. Instead, when CodeGen is building the vtable, don't try to emit a definition for functions that aren't marked used in the current translation unit. Fixes PR9114. llvm-svn: 124768
* Don't warn for -Wnon-virtual-dtor for dependent classes.Argyrios Kyrtzidis2011-02-021-1/+1
| | | | llvm-svn: 124735
* Only warn for -Wnon-virtual-dtor for public destructors. Thanks to Benjamin ↵Argyrios Kyrtzidis2011-01-311-2/+2
| | | | | | Kramer for the hint! llvm-svn: 124585
* Warn if the class has virtual methods but non-virtual destructor. Addresses ↵Argyrios Kyrtzidis2011-01-311-0/+8
| | | | | | rdar://8756445. llvm-svn: 124582
* When building with optimizations, emit vtables where the key is not in the Anders Carlsson2011-01-301-0/+7
| | | | | | | | | | | | | | | | | | | | | | | current translation unit as available_externally. This helps devirtualize the second example in PR3100, comment 18: struct S { S() {}; virtual void xyzzy(); }; inline void foo(S *s) { s->xyzzy(); } void bar() { S s; foo(&s); } This involved four major changes: 1. In DefineUsedVTables, always mark virtual member functions as referenced for non-template classes and class template specializations. 2. In CodeGenVTables::ShouldEmitVTableInThisTU return true if optimizations are enabled, even if the key function is not implemented in this translation unit. We don't ever do this for code compiled with -fapple-kext, because we don't ever want to devirtualize virtual member function calls in that case. 3. Give the correct linkage for vtables where the key function is not defined. 4. Update the linkage for RTTI structures when necessary. llvm-svn: 124565
* Allow elision of invocations of move constructors from temporary objects.Douglas Gregor2011-01-271-1/+1
| | | | llvm-svn: 124455
* Rvalue references for *this: Douglas Gregor2011-01-261-1/+21
| | | | | | | | | | | | - Add ref-qualifiers to the type system; they are part of the canonical type. Print & profile ref-qualifiers - Translate the ref-qualifier from the Declarator chunk for functions to the function type. - Diagnose mis-uses of ref-qualifiers w.r.t. static member functions, free functions, constructors, destructors, etc. - Add serialization and deserialization of ref-qualifiers. llvm-svn: 124281
* Don't insert class templates into the DynamicClasses vector.Anders Carlsson2011-01-251-1/+1
| | | | llvm-svn: 124201
* Use attributes for all the override control specifiers.Anders Carlsson2011-01-241-7/+7
| | | | llvm-svn: 124122
* Get rid of the [[final]] C++0x attribute.Anders Carlsson2011-01-231-18/+7
| | | | llvm-svn: 124083
* Implement [class.derived]p8.Anders Carlsson2011-01-221-0/+20
| | | | llvm-svn: 124047
* Mark classes as final or explicit. Diagnose when a class marked 'final' is ↵Anders Carlsson2011-01-221-0/+13
| | | | | | used as a base. llvm-svn: 124039
* Diagnose when a virtual member function marked final is overridden.Anders Carlsson2011-01-201-13/+16
| | | | llvm-svn: 123916
* When checking for functions marked override, ignore dependent contexts.Anders Carlsson2011-01-201-0/+3
| | | | llvm-svn: 123894
* Make CheckOverrideControl a member of Sema.Anders Carlsson2011-01-201-4/+3
| | | | llvm-svn: 123893
* Diagnose virtual member functions marked override but not overriding any ↵Anders Carlsson2011-01-201-2/+28
| | | | | | virtual member functions. llvm-svn: 123888
* Only allow virtual member functions to be marked 'override' and 'final'.Anders Carlsson2011-01-201-0/+16
| | | | llvm-svn: 123882
* Pass the VirtSpecifiers along to Sema::ActOnCXXMemberDeclarator.Anders Carlsson2011-01-201-1/+2
| | | | llvm-svn: 123878
* Implement support for non-type template parameter packs whose type isDouglas Gregor2011-01-191-2/+0
| | | | | | | | | | | | | | | | | | | | | a pack expansion, e.g., the parameter pack Values in: template<typename ...Types> struct Outer { template<Types ...Values> struct Inner; }; This new implementation approach introduces the notion of an "expanded" non-type template parameter pack, for which we have already expanded the types of the parameter pack (to, say, "int*, float*", for Outer<int*, float*>) but have not yet expanded the values. Aside from creating these expanded non-type template parameter packs, this patch updates template argument checking and non-type template parameter pack instantiation to make use of the appropriate types in the parameter pack. llvm-svn: 123845
* When building the copy expression for a __block variable, make sureJohn McCall2011-01-191-10/+1
| | | | | | | there's a respectable point of instantiation. Also, make sure we do this operation even when instantiating a dependently-typed variable. llvm-svn: 123818
* Change QualType::getTypePtr() to return a const pointer, then change aJohn McCall2011-01-191-2/+2
| | | | | | thousand other things which were (generally inadvertantly) relying on that. llvm-svn: 123814
* Fix warnings found by gcc-4.6, from -Wunused-but-set-variable andJeffrey Yasskin2011-01-181-6/+1
| | | | | | -Wint-to-pointer-cast. llvm-svn: 123719
* Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,Alexis Hunt2011-01-081-56/+55
| | | | | | | more accurate, and makes it make sense for it to hold a delegating constructor call. llvm-svn: 123084
* Check for delegating constructors and (currently) return an error about them.Alexis Hunt2011-01-081-0/+22
| | | | llvm-svn: 123076
* Implement pack expansion of base initializers, so that we canDouglas Gregor2011-01-041-8/+43
| | | | | | | initialize those lovely mixins that come from pack expansions of base specifiers. llvm-svn: 122793
* Implement pack expansions whose pattern is a base-specifier.Douglas Gregor2011-01-031-7/+18
| | | | llvm-svn: 122782
* When checking a using declaration, make sure that the context we'reDouglas Gregor2010-12-211-0/+4
| | | | | | looking in is complete. Fixes PR8756. llvm-svn: 122323
* Add tests checking for unexpanded parameter packs in declarations thatDouglas Gregor2010-12-161-1/+10
| | | | | | | occur within statements. Teach Sema::ActOnExceptionDeclarator() to check for unexpanded parameter packs in the exception type. llvm-svn: 121984
* Check for unexpanded parameter packs in default arguments.Douglas Gregor2010-12-161-0/+6
| | | | llvm-svn: 121962
* Check for unexpanded parameter packs within variable initializers.Douglas Gregor2010-12-161-2/+12
| | | | llvm-svn: 121938
* Check for unexpanded parameter packs in friend declarations.Douglas Gregor2010-12-161-0/+9
| | | | llvm-svn: 121934
* Check for unexpanded parameter packs in using declarations. As aDouglas Gregor2010-12-161-0/+5
| | | | | | | drive-by, make sure to check for unexpanded parameter packs within the name of a declaration. llvm-svn: 121930
* Check for unexpanded parameter packs in static assertion expressions.Douglas Gregor2010-12-151-0/+3
| | | | llvm-svn: 121922
* Fix diagnostic pragmas.Argyrios Kyrtzidis2010-12-151-2/+13
| | | | | | | | | | | | Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state. Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect a lot of places, like C++ inline methods, template instantiations, the lexer, etc. Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location. Fixes rdar://8365684. llvm-svn: 121873
* Restore r121752 without modification.John McCall2010-12-141-53/+42
| | | | llvm-svn: 121763
* Pull out r121752 in case it's causing the selfhost breakage.John McCall2010-12-141-42/+53
| | | | llvm-svn: 121759
* Factor out most of the extra state in a FunctionProtoType into a separateJohn McCall2010-12-141-53/+42
| | | | | | | class to be passed around. The line between argument and return types and everything else is kindof vague, but I think it's justifiable. llvm-svn: 121752
* Variadic templates: extend Type, NestedNameSpecifier, TemplateName,Douglas Gregor2010-12-131-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | and TemplateArgument with an operation that determines whether there are any unexpanded parameter packs within that construct. Use this information to diagnose the appearance of the names of parameter packs that have not been expanded (C++ [temp.variadic]p5). Since this property is checked often (every declaration, ever expression statement, etc.), we extend Type and Expr with a bit storing the result of this computation, rather than walking the AST each time to determine whether any unexpanded parameter packs occur. This commit is deficient in several ways, which will be remedied with future commits: - Expr has a bit to store the presence of an unexpanded parameter pack, but it is never set. - The error messages don't point out where the unexpanded parameter packs were named in the type/expression, but they should. - We don't check for unexpanded parameter packs in all of the places where we should. - Testing is sparse, pending the resolution of the above three issues. llvm-svn: 121724
* Move the functionality to mark all vtables of key functions as used withinChandler Carruth2010-12-121-13/+1
| | | | | | | | | | | | | | a translation unit to the ActOnEndOfTranslationUnit function instead of doing it at the start of DefineUsedVTables. The latter is now called *recursively* during template instantiation, which causes an absolutely insane number of walks of every record decl in the translation unit. After this patch, an extremely template instantiation heavy test case's compile time drops by 10x, and we see between 15% and 20% improvement in average compile times across a project. This is just recovering a regression, it doesn't make anything faster than it was several weeks ago. llvm-svn: 121644
* Added ParenType type node.Abramo Bagnara2010-12-101-3/+3
| | | | llvm-svn: 121488
* Treat visibility on an enclosing namespace as a non-explicit source ofJohn McCall2010-12-101-2/+2
| | | | | | | | | | | visibility. Fixes PR8713. I've disabled a test which was testing that you can #pragma pop visibility to get out of a namespace's visibility attribute. We should probably just diagnose that as an error unless it's instrumental to someone's system headers. llvm-svn: 121459
OpenPOWER on IntegriCloud