aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclCXX.cpp
AgeCommit message (Collapse)Author
2012-01-14De-virtualize getPreviousDecl() and getMostRecentDecl() when we knowDouglas Gregor
we have a redeclarable type, and only use the new virtual versions (getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have that type information. This keeps us from penalizing users with strict type information (and is the moral equivalent of a "final" method). Plus, settle on the names getPreviousDecl() and getMostRecentDecl() throughout. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148187 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-13PR11754: Reject non-static constexpr member functions in classes with virtualRichard Smith
base classes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148094 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-13constexpr is allowed on static member functions of non-literal classes. Per ↵Eli Friedman
report on cfe-dev. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148090 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-11Fix the caching in CorrectTypo so that other non-keyword identifiersKaelyn Uhrain
are still added if the cached correction fails validation. Also fix a copy-and-paste error in a comment from my previous commit. Finally, add an example of the benefit the typo correction callback adds to TryNamespaceTypoCorrection--which happens to also tickle the above caching problem, as the only way a non-namespace Decl would be added to the possible corrections is if it was cached as the correction for a previous instance of the same typo where the typo was corrected to a non-namespace via a different code path. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147968 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-11Add initial callback object support to Sema::CorrectTypo.Kaelyn Uhrain
Also includes two examples of the callback: a wrapper/replacement for the CorrectTypoContext enum, and a conversion of the two calls to CorrectTypo in SemaDeclCXX.cpp (one of which provides verifiable improvement to the typo correction, as demonstrated in the added test). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147962 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-10When something goes wrong in type-checking a namespace definition, make the ↵Douglas Gregor
namespace declaration invalid git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147882 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-10Remove a set, but unused variable. Found with GCC's warning.Chandler Carruth
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147864 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-10Update C++11 scoped enumeration support to match the final proposal:Richard Smith
- reject definitions of enums within friend declarations - require 'enum', not 'enum class', for non-declaring references to scoped enumerations git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147824 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07Switch NamespaceDecl from its own hand-rolled redeclaration chain overDouglas Gregor
to Redeclarable<NamespaceDecl>, so that we benefit from the improveed redeclaration deserialization and merging logic provided by Redeclarable<T>. Otherwise, no functionality change. As a drive-by fix, collapse the "inline" bit into the low bit of the original namespace/anonymous namespace, saving 8 bytes per NamespaceDecl on x86_64. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147729 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05Tweak the fix to PR8977: an empty expression-list represents value ↵Eli Friedman
initialization, not default initialization. Fixes PR11712. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147620 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05More lambda work. Tweak the Sema interface slightly. Start adding the ↵Eli Friedman
pieces to build the lambda class and its call operator. Create an actual scope for the lambda body. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147595 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-24Always implicitly declare move assignment operations for dynamic classes, inRichard Smith
case they override virtual functions from a base class. Also fix -print-stats counting of move assignment/construction. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147258 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-22PR11614: Mark defaulted special constructors as constexpr if their implicitRichard Smith
definition would satisfy the constexpr requirements. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147128 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-20Unlike in C++03, a constant-expression is not an unevaluated operand in C++11.Richard Smith
Split out a new ExpressionEvaluationContext flag for this case, and don't treat it as unevaluated in C++11. This fixes some crash-on-invalids where we would allow references to class members in potentially-evaluated constant expressions in static member functions, and also fixes half of PR10177. The fix to PR10177 exposed a case where template instantiation failed to provide a source location for a diagnostic, so TreeTransform has been tweaked to supply source locations when transforming a type. The source location is still not very good, but MarkDeclarationsReferencedInType would need to operate on a TypeLoc to improve it further. Also fix MarkDeclarationReferenced in C++98 mode to trigger instantiation for static data members of class templates which are used in constant expressions. This fixes a link-time problem, but we still incorrectly treat the member as non-constant. The rest of the fix for that issue is blocked on PCH support for early-instantiated static data members, which will be added in a subsequent patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146955 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-14Produce more detailed diagnostics when static_assert condition is not an ICE.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146607 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10Make sure that we infer __strong, etc. when we instantiate variablesDouglas Gregor
under ARC. Fixes <rdar://problem/10530209>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146307 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09Provide a separate warning for weak vtables in explicit template ↵David Blaikie
instantiations. There's no (current) way to fix such templates to emit strong symbols/vtables, but perhaps users want to know about the cost being incurred anyway. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146265 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-28When synthesizing an implicitly-defined copy or move constructor, orDouglas Gregor
when computing the exception specification of a copy or move constructor, ignore non-static data member initializers. Fixes PR11418 / <rdar://problem/10478642>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145269 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-17Include named unions in union member init checkingDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144883 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-12Remove unnecessary 'else's after 'return's.David Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144464 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07constexpr: static data members declared constexpr are required to have anRichard Smith
initializer; all other constexpr variables are merely required to be initialized. In particular, a user-provided constexpr default constructor can be used for such initialization. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144028 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-03When we're checking a friend function template in an out-of-line classDouglas Gregor
definition, we may not have a scope corresponding to the namespace where that friend function template actually lives. Work around this issue by faking up a scope with the appropriate DeclContext. This is a bit of a hack, but it fixes <rdar://problem/10204947>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143614 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-02Don't build member initializers for zero-length or incomplete arrays,Douglas Gregor
and don't try to destroy them, either. Fixes <rdar://problem/10228639>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143584 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01When we run into a constructor or destructor that is defined in theDouglas Gregor
wrong class, make sure to drop it immediately; we don't want that constructor to be available within the DeclContext. Fixes <rdar://problem/9677163>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143506 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01Silence a warning in -Asserts buildsMatt Beaumont-Gay
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143471 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01Rework the AST for the initializer of a delegating constructor, soDouglas Gregor
that it retains source location information for the type. Aside from general goodness (being able to walk the types described in that information), we now have a proper representation for dependent delegating constructors. Fixes PR10457 (for real). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143410 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-29Fixed FriendDecl source locations.Abramo Bagnara
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143295 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24Minor refactoring of my last patch. Per Doug's suggestion.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142807 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-23Diagnose unexpanded parameter packs in member initialisers (includingPeter Collingbourne
in-class member initialisers). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142758 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-23Clean up duplicated code in Sema::BuildMemInitializer.Peter Collingbourne
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142757 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21c++: support gcc's application of weak attribute onFariborz Jahanian
class declaration which forces any such class and any class that inherits from such a class to have their typeinfo symbols be marked as weak. // rdar://10246395 A test/CodeGenCXX/weak-extern-typeinfo.cpp M lib/Sema/SemaDeclCXX.cpp M lib/Sema/SemaDeclAttr.cpp M lib/CodeGen/CGRTTI.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142693 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-20There's no point in marking a declaration invalid just because itDouglas Gregor
shadows a template parameter. Complain about the shadowing (or not, under -fms-extensions), but don't invalidate the declaration. Merely forget about the template parameter declaration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142596 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-20When we parse something that looks like a templated friend tag butDouglas Gregor
actually just has an extraneous 'template<>' header, strip off the 'template<>' header and treat it as a normal friend tag. Fixes PR10660 / <rdar://problem/9958322>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142587 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18-Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 2.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142426 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18-Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 1.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142419 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18In C++11, a class's members are allowed to be nominated as friends.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142393 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-13Allow for annotate attributes after access specifiers. When suchErik Verbruggen
attributes are found, propagate them to subsequent declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141861 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11Get rid of ShouldDeleteMoveConstructor.Sean Hunt
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141650 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11Consolidate copy constructor deletion into ShouldDeleteSpecialMember.Sean Hunt
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141645 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11Move some bool flags out of function parameter lists.Kaelyn Uhrain
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141610 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10Constant expression evaluation refactoring:Richard Smith
- 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141561 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10Per C++ [class.bit]p2, unnamed bit-fields are not members. Fixes PR10289.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141549 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10constexpr: Disable checking of constructor member initializer lists forRichard Smith
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141547 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10When adding a direct initializer to a declaration, allow theDouglas Gregor
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141543 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10Parse the initializer for a class member after handling itsDouglas Gregor
declarator, so that the declarator is in scope for the initializer. Fixes PR9989. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141539 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10Begin work consolidating ShouldDelete* functions.Sean Hunt
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141528 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10Implement the restrictions in C++ [class.friend]p6, which disallowDouglas Gregor
defining a friend function with a qualified name or in a local class. Fixes PR9853. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141524 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-09Diagnose attempts to declare a non-static data member with aDouglas Gregor
non-identifier name. Fixes PR10839. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141513 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-06Support for C1x _Atomic specifier (see testcase). This is primarily being ↵Eli Friedman
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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141330 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-05Added a flag to identify resolved overloaded function references.Abramo Bagnara
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141171 91177308-0d34-0410-b5e6-96231b3b80d8