Deleted Added
sdiff udiff text old ( 195099 ) new ( 195341 )
full compact
1//===------ SemaDeclCXX.cpp - Semantic Analysis for C++ Declarations ------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 244 unchanged lines hidden (view full) ---

253 Diag(OldParam->getLocation(), diag::note_previous_definition);
254 Invalid = true;
255 } else if (OldParam->getDefaultArg()) {
256 // Merge the old default argument into the new parameter
257 NewParam->setDefaultArg(OldParam->getDefaultArg());
258 }
259 }
260
261 return Invalid;
262}
263
264/// CheckCXXDefaultArguments - Verify that the default arguments for a
265/// function declaration are well-formed according to C++
266/// [dcl.fct.default].
267void Sema::CheckCXXDefaultArguments(FunctionDecl *FD) {
268 unsigned NumParams = FD->getNumParams();

--- 207 unchanged lines hidden (view full) ---

476 } else {
477 // Okay, add this new base class.
478 KnownBaseTypes[NewBaseType] = Bases[idx];
479 Bases[NumGoodBases++] = Bases[idx];
480 }
481 }
482
483 // Attach the remaining base class specifiers to the derived class.
484 Class->setBases(Bases, NumGoodBases);
485
486 // Delete the remaining (good) base class specifiers, since their
487 // data has been copied into the CXXRecordDecl.
488 for (unsigned idx = 0; idx < NumGoodBases; ++idx)
489 delete Bases[idx];
490
491 return Invalid;
492}

--- 148 unchanged lines hidden (view full) ---

641 }
642 return DeclPtrTy::make(Member);
643}
644
645/// ActOnMemInitializer - Handle a C++ member initializer.
646Sema::MemInitResult
647Sema::ActOnMemInitializer(DeclPtrTy ConstructorD,
648 Scope *S,
649 IdentifierInfo *MemberOrBase,
650 SourceLocation IdLoc,
651 SourceLocation LParenLoc,
652 ExprTy **Args, unsigned NumArgs,
653 SourceLocation *CommaLocs,
654 SourceLocation RParenLoc) {
655 if (!ConstructorD)
656 return true;
657

--- 14 unchanged lines hidden (view full) ---

672 // constructor���s class and, if not found in that scope, are looked
673 // up in the scope containing the constructor���s
674 // definition. [Note: if the constructor���s class contains a member
675 // with the same name as a direct or virtual base class of the
676 // class, a mem-initializer-id naming the member or base class and
677 // composed of a single identifier refers to the class member. A
678 // mem-initializer-id for the hidden base class may be specified
679 // using a qualified name. ]
680 // Look for a member, first.
681 FieldDecl *Member = 0;
682 DeclContext::lookup_result Result
683 = ClassDecl->lookup(Context, MemberOrBase);
684 if (Result.first != Result.second)
685 Member = dyn_cast<FieldDecl>(*Result.first);
686
687 // FIXME: Handle members of an anonymous union.
688
689 if (Member) {
690 // FIXME: Perform direct initialization of the member.
691 return new CXXBaseOrMemberInitializer(Member, (Expr **)Args, NumArgs);
692 }
693
694 // It didn't name a member, so see if it names a class.
695 TypeTy *BaseTy = getTypeName(*MemberOrBase, IdLoc, S, 0/*SS*/);
696 if (!BaseTy)
697 return Diag(IdLoc, diag::err_mem_init_not_member_or_class)
698 << MemberOrBase << SourceRange(IdLoc, RParenLoc);
699
700 QualType BaseType = QualType::getFromOpaquePtr(BaseTy);
701 if (!BaseType->isRecordType())
702 return Diag(IdLoc, diag::err_base_init_does_not_name_class)
703 << BaseType << SourceRange(IdLoc, RParenLoc);
704
705 // C++ [class.base.init]p2:
706 // [...] Unless the mem-initializer-id names a nonstatic data
707 // member of the constructor���s class or a direct or virtual base
708 // of that class, the mem-initializer is ill-formed. A
709 // mem-initializer-list can initialize a base class using any

--- 34 unchanged lines hidden (view full) ---

744
745 // C++ [base.class.init]p2:
746 // If a mem-initializer-id is ambiguous because it designates both
747 // a direct non-virtual base class and an inherited virtual base
748 // class, the mem-initializer is ill-formed.
749 if (DirectBaseSpec && VirtualBaseSpec)
750 return Diag(IdLoc, diag::err_base_init_direct_and_virtual)
751 << MemberOrBase << SourceRange(IdLoc, RParenLoc);
752
753 return new CXXBaseOrMemberInitializer(BaseType, (Expr **)Args, NumArgs);
754}
755
756void Sema::ActOnMemInitializers(DeclPtrTy ConstructorDecl,
757 SourceLocation ColonLoc,
758 MemInitTy **MemInits, unsigned NumMemInits) {
759 if (!ConstructorDecl)
760 return;
761
762 CXXConstructorDecl *Constructor
763 = dyn_cast<CXXConstructorDecl>(ConstructorDecl.getAs<Decl>());
764
765 if (!Constructor) {
766 Diag(ColonLoc, diag::err_only_constructors_take_base_inits);
767 return;
768 }
769}
770
771namespace {
772 /// PureVirtualMethodCollector - traverses a class and its superclasses
773 /// and determines if it has any pure virtual methods.
774 class VISIBILITY_HIDDEN PureVirtualMethodCollector {
775 ASTContext &Context;
776

--- 39 unchanged lines hidden (view full) ---

816 }
817
818 // Next, zero out any pure virtual methods that this class overrides.
819 typedef llvm::SmallPtrSet<const CXXMethodDecl*, 4> MethodSetTy;
820
821 MethodSetTy OverriddenMethods;
822 size_t MethodsSize = Methods.size();
823
824 for (RecordDecl::decl_iterator i = RD->decls_begin(Context),
825 e = RD->decls_end(Context);
826 i != e; ++i) {
827 // Traverse the record, looking for methods.
828 if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(*i)) {
829 // If the method is pre virtual, add it to the methods vector.
830 if (MD->isPure()) {
831 Methods.push_back(MD);
832 continue;
833 }

--- 80 unchanged lines hidden (view full) ---

914 class VISIBILITY_HIDDEN AbstractClassUsageDiagnoser
915 : public DeclVisitor<AbstractClassUsageDiagnoser, bool> {
916 Sema &SemaRef;
917 CXXRecordDecl *AbstractClass;
918
919 bool VisitDeclContext(const DeclContext *DC) {
920 bool Invalid = false;
921
922 for (CXXRecordDecl::decl_iterator I = DC->decls_begin(SemaRef.Context),
923 E = DC->decls_end(SemaRef.Context); I != E; ++I)
924 Invalid |= Visit(*I);
925
926 return Invalid;
927 }
928
929 public:
930 AbstractClassUsageDiagnoser(Sema& SemaRef, CXXRecordDecl *ac)
931 : SemaRef(SemaRef), AbstractClass(ac) {

--- 59 unchanged lines hidden (view full) ---

991 if (!Collector.empty())
992 RD->setAbstract(true);
993 }
994
995 if (RD->isAbstract())
996 AbstractClassUsageDiagnoser(*this, RD);
997
998 if (RD->hasTrivialConstructor() || RD->hasTrivialDestructor()) {
999 for (RecordDecl::field_iterator i = RD->field_begin(Context),
1000 e = RD->field_end(Context); i != e; ++i) {
1001 // All the nonstatic data members must have trivial constructors.
1002 QualType FTy = i->getType();
1003 while (const ArrayType *AT = Context.getAsArrayType(FTy))
1004 FTy = AT->getElementType();
1005
1006 if (const RecordType *RT = FTy->getAsRecordType()) {
1007 CXXRecordDecl *FieldRD = cast<CXXRecordDecl>(RT->getDecl());
1008

--- 40 unchanged lines hidden (view full) ---

1049 ClassDecl->getLocation(), Name,
1050 Context.getFunctionType(Context.VoidTy,
1051 0, 0, false, 0),
1052 /*isExplicit=*/false,
1053 /*isInline=*/true,
1054 /*isImplicitlyDeclared=*/true);
1055 DefaultCon->setAccess(AS_public);
1056 DefaultCon->setImplicit();
1057 ClassDecl->addDecl(Context, DefaultCon);
1058 }
1059
1060 if (!ClassDecl->hasUserDeclaredCopyConstructor()) {
1061 // C++ [class.copy]p4:
1062 // If the class definition does not explicitly declare a copy
1063 // constructor, one is declared implicitly.
1064
1065 // C++ [class.copy]p5:

--- 15 unchanged lines hidden (view full) ---

1081 HasConstCopyConstructor
1082 = BaseClassDecl->hasConstCopyConstructor(Context);
1083 }
1084
1085 // -- for all the nonstatic data members of X that are of a
1086 // class type M (or array thereof), each such class type
1087 // has a copy constructor whose first parameter is of type
1088 // const M& or const volatile M&.
1089 for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
1090 HasConstCopyConstructor && Field != ClassDecl->field_end(Context);
1091 ++Field) {
1092 QualType FieldType = (*Field)->getType();
1093 if (const ArrayType *Array = Context.getAsArrayType(FieldType))
1094 FieldType = Array->getElementType();
1095 if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
1096 const CXXRecordDecl *FieldClassDecl
1097 = cast<CXXRecordDecl>(FieldClassType->getDecl());
1098 HasConstCopyConstructor

--- 27 unchanged lines hidden (view full) ---

1126 CopyConstructor->setImplicit();
1127
1128 // Add the parameter to the constructor.
1129 ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyConstructor,
1130 ClassDecl->getLocation(),
1131 /*IdentifierInfo=*/0,
1132 ArgType, VarDecl::None, 0);
1133 CopyConstructor->setParams(Context, &FromParam, 1);
1134 ClassDecl->addDecl(Context, CopyConstructor);
1135 }
1136
1137 if (!ClassDecl->hasUserDeclaredCopyAssignment()) {
1138 // Note: The following rules are largely analoguous to the copy
1139 // constructor rules. Note that virtual bases are not taken into account
1140 // for determining the argument type of the operator. Note also that
1141 // operators taking an object instead of a reference are allowed.
1142 //

--- 17 unchanged lines hidden (view full) ---

1160 = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
1161 HasConstCopyAssignment = BaseClassDecl->hasConstCopyAssignment(Context);
1162 }
1163
1164 // -- for all the nonstatic data members of X that are of a class
1165 // type M (or array thereof), each such class type has a copy
1166 // assignment operator whose parameter is of type const M&,
1167 // const volatile M& or M.
1168 for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
1169 HasConstCopyAssignment && Field != ClassDecl->field_end(Context);
1170 ++Field) {
1171 QualType FieldType = (*Field)->getType();
1172 if (const ArrayType *Array = Context.getAsArrayType(FieldType))
1173 FieldType = Array->getElementType();
1174 if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
1175 const CXXRecordDecl *FieldClassDecl
1176 = cast<CXXRecordDecl>(FieldClassType->getDecl());
1177 HasConstCopyAssignment

--- 27 unchanged lines hidden (view full) ---

1205 ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyAssignment,
1206 ClassDecl->getLocation(),
1207 /*IdentifierInfo=*/0,
1208 ArgType, VarDecl::None, 0);
1209 CopyAssignment->setParams(Context, &FromParam, 1);
1210
1211 // Don't call addedAssignmentOperator. There is no way to distinguish an
1212 // implicit from an explicit assignment operator.
1213 ClassDecl->addDecl(Context, CopyAssignment);
1214 }
1215
1216 if (!ClassDecl->hasUserDeclaredDestructor()) {
1217 // C++ [class.dtor]p2:
1218 // If a class has no user-declared destructor, a destructor is
1219 // declared implicitly. An implicitly-declared destructor is an
1220 // inline public member of its class.
1221 DeclarationName Name
1222 = Context.DeclarationNames.getCXXDestructorName(ClassType);
1223 CXXDestructorDecl *Destructor
1224 = CXXDestructorDecl::Create(Context, ClassDecl,
1225 ClassDecl->getLocation(), Name,
1226 Context.getFunctionType(Context.VoidTy,
1227 0, 0, false, 0),
1228 /*isInline=*/true,
1229 /*isImplicitlyDeclared=*/true);
1230 Destructor->setAccess(AS_public);
1231 Destructor->setImplicit();
1232 ClassDecl->addDecl(Context, Destructor);
1233 }
1234}
1235
1236void Sema::ActOnReenterTemplateScope(Scope *S, DeclPtrTy TemplateD) {
1237 TemplateDecl *Template = TemplateD.getAs<TemplateDecl>();
1238 if (!Template)
1239 return;
1240

--- 526 unchanged lines hidden (view full) ---

1767 return DeclPtrTy::make(UDir);
1768}
1769
1770void Sema::PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir) {
1771 // If scope has associated entity, then using directive is at namespace
1772 // or translation unit scope. We add UsingDirectiveDecls, into
1773 // it's lookup structure.
1774 if (DeclContext *Ctx = static_cast<DeclContext*>(S->getEntity()))
1775 Ctx->addDecl(Context, UDir);
1776 else
1777 // Otherwise it is block-sope. using-directives will affect lookup
1778 // only to the end of scope.
1779 S->PushUsingDirective(DeclPtrTy::make(UDir));
1780}
1781
1782
1783Sema::DeclPtrTy Sema::ActOnUsingDeclaration(Scope *S,

--- 84 unchanged lines hidden (view full) ---

1868 }
1869
1870 NamespaceAliasDecl *AliasDecl =
1871 NamespaceAliasDecl::Create(Context, CurContext, NamespaceLoc, AliasLoc,
1872 Alias, SS.getRange(),
1873 (NestedNameSpecifier *)SS.getScopeRep(),
1874 IdentLoc, R);
1875
1876 CurContext->addDecl(Context, AliasDecl);
1877 return DeclPtrTy::make(AliasDecl);
1878}
1879
1880void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
1881 CXXConstructorDecl *Constructor) {
1882 assert((Constructor->isImplicit() && Constructor->isDefaultConstructor() &&
1883 !Constructor->isUsed()) &&
1884 "DefineImplicitDefaultConstructor - call it for implicit default ctor");
1885
1886 CXXRecordDecl *ClassDecl
1887 = cast<CXXRecordDecl>(Constructor->getDeclContext());
1888 assert(ClassDecl && "DefineImplicitDefaultConstructor - invalid constructor");
1889 // Before the implicitly-declared default constructor for a class is
1890 // implicitly defined, all the implicitly-declared default constructors
1891 // for its base class and its non-static data members shall have been
1892 // implicitly defined.
1893 bool err = false;
1894 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
1895 Base != ClassDecl->bases_end(); ++Base) {
1896 CXXRecordDecl *BaseClassDecl
1897 = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
1898 if (!BaseClassDecl->hasTrivialConstructor()) {
1899 if (CXXConstructorDecl *BaseCtor =
1900 BaseClassDecl->getDefaultConstructor(Context))
1901 MarkDeclarationReferenced(CurrentLocation, BaseCtor);
1902 else {
1903 Diag(CurrentLocation, diag::err_defining_default_ctor)
1904 << Context.getTagDeclType(ClassDecl) << 1
1905 << Context.getTagDeclType(BaseClassDecl);
1906 Diag(BaseClassDecl->getLocation(), diag::note_previous_class_decl)
1907 << Context.getTagDeclType(BaseClassDecl);
1908 err = true;
1909 }
1910 }
1911 }
1912 for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
1913 Field != ClassDecl->field_end(Context);
1914 ++Field) {
1915 QualType FieldType = Context.getCanonicalType((*Field)->getType());
1916 if (const ArrayType *Array = Context.getAsArrayType(FieldType))
1917 FieldType = Array->getElementType();
1918 if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
1919 CXXRecordDecl *FieldClassDecl
1920 = cast<CXXRecordDecl>(FieldClassType->getDecl());
1921 if (!FieldClassDecl->hasTrivialConstructor()) {
1922 if (CXXConstructorDecl *FieldCtor =

--- 36 unchanged lines hidden (view full) ---

1959 CXXRecordDecl *ClassDecl
1960 = cast<CXXRecordDecl>(Destructor->getDeclContext());
1961 assert(ClassDecl && "DefineImplicitDestructor - invalid destructor");
1962 // C++ [class.dtor] p5
1963 // Before the implicitly-declared default destructor for a class is
1964 // implicitly defined, all the implicitly-declared default destructors
1965 // for its base class and its non-static data members shall have been
1966 // implicitly defined.
1967 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
1968 Base != ClassDecl->bases_end(); ++Base) {
1969 CXXRecordDecl *BaseClassDecl
1970 = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
1971 if (!BaseClassDecl->hasTrivialDestructor()) {
1972 if (CXXDestructorDecl *BaseDtor =
1973 const_cast<CXXDestructorDecl*>(BaseClassDecl->getDestructor(Context)))
1974 MarkDeclarationReferenced(CurrentLocation, BaseDtor);
1975 else
1976 assert(false &&
1977 "DefineImplicitDestructor - missing dtor in a base class");
1978 }
1979 }
1980
1981 for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
1982 Field != ClassDecl->field_end(Context);
1983 ++Field) {
1984 QualType FieldType = Context.getCanonicalType((*Field)->getType());
1985 if (const ArrayType *Array = Context.getAsArrayType(FieldType))
1986 FieldType = Array->getElementType();
1987 if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
1988 CXXRecordDecl *FieldClassDecl
1989 = cast<CXXRecordDecl>(FieldClassType->getDecl());
1990 if (!FieldClassDecl->hasTrivialDestructor()) {
1991 if (CXXDestructorDecl *FieldDtor =

--- 13 unchanged lines hidden (view full) ---

2005 CXXMethodDecl *MethodDecl) {
2006 assert((MethodDecl->isImplicit() && MethodDecl->isOverloadedOperator() &&
2007 MethodDecl->getOverloadedOperator() == OO_Equal &&
2008 !MethodDecl->isUsed()) &&
2009 "DefineImplicitOverloadedAssign - call it for implicit assignment op");
2010
2011 CXXRecordDecl *ClassDecl
2012 = cast<CXXRecordDecl>(MethodDecl->getDeclContext());
2013 assert(ClassDecl && "DefineImplicitOverloadedAssign - invalid constructor");
2014
2015 // C++[class.copy] p12
2016 // Before the implicitly-declared copy assignment operator for a class is
2017 // implicitly defined, all implicitly-declared copy assignment operators
2018 // for its direct base classes and its nonstatic data members shall have
2019 // been implicitly defined.
2020 bool err = false;
2021 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
2022 Base != ClassDecl->bases_end(); ++Base) {
2023 CXXRecordDecl *BaseClassDecl
2024 = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
2025 if (CXXMethodDecl *BaseAssignOpMethod =
2026 getAssignOperatorMethod(MethodDecl->getParamDecl(0), BaseClassDecl))
2027 MarkDeclarationReferenced(CurrentLocation, BaseAssignOpMethod);
2028 }
2029 for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
2030 Field != ClassDecl->field_end(Context);
2031 ++Field) {
2032 QualType FieldType = Context.getCanonicalType((*Field)->getType());
2033 if (const ArrayType *Array = Context.getAsArrayType(FieldType))
2034 FieldType = Array->getElementType();
2035 if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
2036 CXXRecordDecl *FieldClassDecl
2037 = cast<CXXRecordDecl>(FieldClassType->getDecl());
2038 if (CXXMethodDecl *FieldAssignOpMethod =
2039 getAssignOperatorMethod(MethodDecl->getParamDecl(0), FieldClassDecl))

--- 68 unchanged lines hidden (view full) ---

2108 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
2109 Base != ClassDecl->bases_end(); ++Base) {
2110 CXXRecordDecl *BaseClassDecl
2111 = cast<CXXRecordDecl>(Base->getType()->getAsRecordType()->getDecl());
2112 if (CXXConstructorDecl *BaseCopyCtor =
2113 BaseClassDecl->getCopyConstructor(Context, TypeQuals))
2114 MarkDeclarationReferenced(CurrentLocation, BaseCopyCtor);
2115 }
2116 for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
2117 Field != ClassDecl->field_end(Context);
2118 ++Field) {
2119 QualType FieldType = Context.getCanonicalType((*Field)->getType());
2120 if (const ArrayType *Array = Context.getAsArrayType(FieldType))
2121 FieldType = Array->getElementType();
2122 if (const RecordType *FieldClassType = FieldType->getAsRecordType()) {
2123 CXXRecordDecl *FieldClassDecl
2124 = cast<CXXRecordDecl>(FieldClassType->getDecl());
2125 if (CXXConstructorDecl *FieldCopyCtor =
2126 FieldClassDecl->getCopyConstructor(Context, TypeQuals))

--- 8 unchanged lines hidden (view full) ---

2135 QualType DeclInitType,
2136 Expr **Exprs, unsigned NumExprs) {
2137 Expr *Temp = CXXConstructExpr::Create(Context, DeclInitType, Constructor,
2138 false, Exprs, NumExprs);
2139 MarkDeclarationReferenced(VD->getLocation(), Constructor);
2140 VD->setInit(Context, Temp);
2141}
2142
2143void Sema::MarcDestructorReferenced(SourceLocation Loc, QualType DeclInitType)
2144{
2145 CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(
2146 DeclInitType->getAsRecordType()->getDecl());
2147 if (!ClassDecl->hasTrivialDestructor())
2148 if (CXXDestructorDecl *Destructor =
2149 const_cast<CXXDestructorDecl*>(ClassDecl->getDestructor(Context)))
2150 MarkDeclarationReferenced(Loc, Destructor);
2151}

--- 61 unchanged lines hidden (view full) ---

2213 if (!Constructor)
2214 RealDecl->setInvalidDecl();
2215 else {
2216 VDecl->setCXXDirectInitializer(true);
2217 InitializeVarWithConstructor(VDecl, Constructor, DeclInitType,
2218 (Expr**)Exprs.release(), NumExprs);
2219 // FIXME. Must do all that is needed to destroy the object
2220 // on scope exit. For now, just mark the destructor as used.
2221 MarcDestructorReferenced(VDecl->getLocation(), DeclInitType);
2222 }
2223 return;
2224 }
2225
2226 if (NumExprs > 1) {
2227 Diag(CommaLocs[0], diag::err_builtin_direct_init_more_than_one_arg)
2228 << SourceRange(VDecl->getLocation(), RParenLoc);
2229 RealDecl->setInvalidDecl();

--- 47 unchanged lines hidden (view full) ---

2277 const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(ClassRec->getDecl());
2278 OverloadCandidateSet CandidateSet;
2279
2280 // Add constructors to the overload set.
2281 DeclarationName ConstructorName
2282 = Context.DeclarationNames.getCXXConstructorName(
2283 Context.getCanonicalType(ClassType.getUnqualifiedType()));
2284 DeclContext::lookup_const_iterator Con, ConEnd;
2285 for (llvm::tie(Con, ConEnd) = ClassDecl->lookup(Context, ConstructorName);
2286 Con != ConEnd; ++Con) {
2287 CXXConstructorDecl *Constructor = cast<CXXConstructorDecl>(*Con);
2288 if ((Kind == IK_Direct) ||
2289 (Kind == IK_Copy && Constructor->isConvertingConstructor()) ||
2290 (Kind == IK_Default && Constructor->isDefaultConstructor()))
2291 AddOverloadCandidate(Constructor, Args, NumArgs, CandidateSet);
2292 }
2293

--- 593 unchanged lines hidden (view full) ---

2887 return DeclPtrTy();
2888 }
2889
2890 // FIXME: Add all the various semantics of linkage specifications
2891
2892 LinkageSpecDecl *D = LinkageSpecDecl::Create(Context, CurContext,
2893 LangLoc, Language,
2894 LBraceLoc.isValid());
2895 CurContext->addDecl(Context, D);
2896 PushDeclContext(S, D);
2897 return DeclPtrTy::make(D);
2898}
2899
2900/// ActOnFinishLinkageSpecification - Completely the definition of
2901/// the C++ linkage specification LinkageSpec. If RBraceLoc is
2902/// valid, it's the position of the closing '}' brace in a linkage
2903/// specification that uses braces.

--- 97 unchanged lines hidden (view full) ---

3001
3002 if (Invalid)
3003 ExDecl->setInvalidDecl();
3004
3005 // Add the exception declaration into this scope.
3006 if (II)
3007 PushOnScopeChains(ExDecl, S);
3008 else
3009 CurContext->addDecl(Context, ExDecl);
3010
3011 ProcessDeclAttributes(S, ExDecl, D);
3012 return DeclPtrTy::make(ExDecl);
3013}
3014
3015Sema::DeclPtrTy Sema::ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
3016 ExprArg assertexpr,
3017 ExprArg assertmessageexpr) {

--- 17 unchanged lines hidden (view full) ---

3035 }
3036 }
3037
3038 assertexpr.release();
3039 assertmessageexpr.release();
3040 Decl *Decl = StaticAssertDecl::Create(Context, CurContext, AssertLoc,
3041 AssertExpr, AssertMessage);
3042
3043 CurContext->addDecl(Context, Decl);
3044 return DeclPtrTy::make(Decl);
3045}
3046
3047bool Sema::ActOnFriendDecl(Scope *S, SourceLocation FriendLoc, DeclPtrTy Dcl) {
3048 if (!(S->getFlags() & Scope::ClassScope)) {
3049 Diag(FriendLoc, diag::err_friend_decl_outside_class);
3050 return true;
3051 }

--- 164 unchanged lines hidden ---