40 #include "llvm/ADT/STLExtras.h"
41 #include "llvm/ADT/SmallString.h"
45 using namespace clang;
57 class CheckDefaultArgumentVisitor
58 :
public StmtVisitor<CheckDefaultArgumentVisitor, bool> {
63 CheckDefaultArgumentVisitor(
Expr *defarg,
Sema *s)
64 : DefaultArg(defarg),
S(s) {}
74 bool CheckDefaultArgumentVisitor::VisitExpr(
Expr *
Node) {
75 bool IsInvalid =
false;
76 for (
Stmt *SubStmt : Node->children())
77 IsInvalid |= Visit(SubStmt);
84 bool CheckDefaultArgumentVisitor::VisitDeclRefExpr(
DeclRefExpr *DRE) {
86 if (
ParmVarDecl *Param = dyn_cast<ParmVarDecl>(Decl)) {
96 diag::err_param_default_argument_references_param)
97 << Param->getDeclName() << DefaultArg->getSourceRange();
98 }
else if (
VarDecl *VDecl = dyn_cast<VarDecl>(Decl)) {
102 if (VDecl->isLocalVarDecl())
104 diag::err_param_default_argument_references_local)
105 << VDecl->getDeclName() << DefaultArg->getSourceRange();
112 bool CheckDefaultArgumentVisitor::VisitCXXThisExpr(
CXXThisExpr *ThisE) {
117 diag::err_param_default_argument_references_this)
118 << ThisE->getSourceRange();
121 bool CheckDefaultArgumentVisitor::VisitPseudoObjectExpr(
PseudoObjectExpr *POE) {
129 E = OVE->getSourceExpr();
130 assert(E &&
"pseudo-object binding without source expression?");
138 bool CheckDefaultArgumentVisitor::VisitLambdaExpr(
LambdaExpr *Lambda) {
146 diag::err_lambda_capture_default_arg);
193 "Must have noexcept result for EST_ComputedNoexcept.");
195 "Should not generate implicit declarations for dependent cases, "
196 "and don't know how to handle them anyway.");
208 assert(EST ==
EST_Dynamic &&
"EST case not considered earlier.");
210 "Shouldn't collect exceptions when throw-all is guaranteed.");
215 Exceptions.push_back(E);
243 if (Self->canThrow(E))
251 diag::err_typecheck_decl_incomplete_type)) {
272 CheckCompletedExpr(Arg, EqualLoc);
283 for (
unsigned I = 0, N = InstPos->second.size();
I != N; ++
I)
284 InstPos->second[
I]->setUninstantiatedDefaultArg(Arg);
299 if (!param || !DefaultArg)
307 Diag(EqualLoc, diag::err_param_default_argument)
308 << DefaultArg->getSourceRange();
323 Diag(EqualLoc, diag::err_param_default_argument_on_parameter_pack)
324 << DefaultArg->getSourceRange();
329 CheckDefaultArgumentVisitor DefaultArgChecker(DefaultArg,
this);
330 if (DefaultArgChecker.Visit(DefaultArg)) {
386 if (MightBeFunction) {
390 MightBeFunction =
false;
393 for (
unsigned argIdx = 0, e = chunk.
Fun.
NumParams; argIdx != e;
399 if (Toks->size() > 1)
401 Toks->back().getLocation());
415 MightBeFunction =
false;
421 for (
unsigned NumParams = FD->
getNumParams(); NumParams > 0; --NumParams) {
437 bool Invalid =
false;
448 for (; PrevForDefaultArgs;
496 for (
unsigned p = 0, NumParams = PrevForDefaultArgs
499 p < NumParams; ++
p) {
503 bool OldParamHasDfl = OldParam ? OldParam->
hasDefaultArg() :
false;
506 if (OldParamHasDfl && NewParamHasDfl) {
507 unsigned DiagDefaultParamID =
508 diag::err_param_default_argument_redefinition;
523 DiagDefaultParamID = diag::ext_param_default_argument_redefinition;
541 for (
auto Older = PrevForDefaultArgs;
543 Older = Older->getPreviousDecl();
544 OldParam = Older->getParamDecl(
p);
549 }
else if (OldParamHasDfl) {
561 }
else if (NewParamHasDfl) {
565 diag::err_param_default_argument_template_redecl)
568 diag::note_template_prev_declaration)
599 if (Record->getDescribedClassTemplate())
601 else if (isa<ClassTemplatePartialSpecializationDecl>(Record))
608 diag::err_param_default_argument_member_template_redecl)
618 if (isa<CXXConstructorDecl>(New) &&
622 if (NewSM != OldSM) {
625 Diag(NewParam->
getLocation(), diag::err_default_arg_makes_ctor_special)
656 Diag(New->
getLocation(), diag::err_friend_decl_with_def_arg_redeclared);
678 "Should only be called if types are otherwise the same.");
689 NewType =
P->getPointeeType();
717 for (p = 0; p < NumParams; ++
p) {
729 unsigned LastMissingDefaultArg = 0;
730 for (; p < NumParams; ++
p) {
737 diag::err_param_default_argument_missing_name)
741 diag::err_param_default_argument_missing);
743 LastMissingDefaultArg =
p;
747 if (LastMissingDefaultArg > 0) {
752 for (p = 0; p <= LastMissingDefaultArg; ++
p) {
766 unsigned ArgIndex = 0;
770 i != e; ++i, ++ArgIndex) {
773 if (!(*i)->isDependentType() &&
775 diag::err_constexpr_non_literal_param,
777 isa<CXXConstructorDecl>(FD)))
793 default: llvm_unreachable(
"Invalid tag kind for record diagnostic!");
813 << isa<CXXConstructorDecl>(NewFD)
815 for (
const auto &
I : RD->
vbases())
816 Diag(
I.getLocStart(),
817 diag::note_constexpr_virtual_base_here) <<
I.getSourceRange();
822 if (!isa<CXXConstructorDecl>(NewFD)) {
835 while (!WrittenVirtual->isVirtualAsWritten())
837 if (WrittenVirtual != Method)
838 Diag(WrittenVirtual->getLocation(),
839 diag::note_overridden_virtual_function);
847 diag::err_constexpr_non_literal_return))
868 for (
const auto *DclIt : DS->
decls()) {
869 switch (DclIt->getKind()) {
870 case Decl::StaticAssert:
872 case Decl::UsingShadow:
873 case Decl::UsingDirective:
874 case Decl::UnresolvedUsingTypename:
875 case Decl::UnresolvedUsingValue:
885 const auto *TN = cast<TypedefNameDecl>(DclIt);
886 if (TN->getUnderlyingType()->isVariablyModifiedType()) {
888 TypeLoc TL = TN->getTypeSourceInfo()->getTypeLoc();
891 << isa<CXXConstructorDecl>(Dcl);
898 case Decl::CXXRecord:
900 if (cast<TagDecl>(DclIt)->isThisDeclarationADefinition())
903 ? diag::warn_cxx11_compat_constexpr_type_definition
904 : diag::ext_constexpr_type_definition)
905 << isa<CXXConstructorDecl>(Dcl);
908 case Decl::EnumConstant:
909 case Decl::IndirectField:
919 const auto *VD = cast<VarDecl>(DclIt);
920 if (VD->isThisDeclarationADefinition()) {
921 if (VD->isStaticLocal()) {
922 SemaRef.
Diag(VD->getLocation(),
923 diag::err_constexpr_local_var_static)
924 << isa<CXXConstructorDecl>(Dcl)
928 if (!VD->getType()->isDependentType() &&
930 VD->getLocation(), VD->getType(),
931 diag::err_constexpr_local_var_non_literal_type,
932 isa<CXXConstructorDecl>(Dcl)))
934 if (!VD->getType()->isDependentType() &&
935 !VD->hasInit() && !VD->isCXXForRangeDecl()) {
936 SemaRef.
Diag(VD->getLocation(),
937 diag::err_constexpr_local_var_no_init)
938 << isa<CXXConstructorDecl>(Dcl);
942 SemaRef.
Diag(VD->getLocation(),
944 ? diag::warn_cxx11_compat_constexpr_local_var
945 : diag::ext_constexpr_local_var)
946 << isa<CXXConstructorDecl>(Dcl);
950 case Decl::NamespaceAlias:
960 << isa<CXXConstructorDecl>(Dcl);
979 llvm::SmallSet<Decl*, 16> &
Inits,
996 if (!Inits.count(Field)) {
998 SemaRef.
Diag(Dcl->
getLocation(), diag::err_constexpr_ctor_missing_init);
1001 SemaRef.
Diag(Field->
getLocation(), diag::note_constexpr_ctor_missing_init);
1007 if (!RD->
isUnion() || Inits.count(
I))
1019 switch (S->getStmtClass()) {
1020 case Stmt::NullStmtClass:
1024 case Stmt::DeclStmtClass:
1034 case Stmt::ReturnStmtClass:
1036 if (isa<CXXConstructorDecl>(Dcl)) {
1039 Cxx1yLoc = S->getLocStart();
1043 ReturnStmts.push_back(S->getLocStart());
1046 case Stmt::CompoundStmtClass: {
1049 Cxx1yLoc = S->getLocStart();
1052 for (
auto *BodyIt : CompStmt->
body()) {
1060 case Stmt::AttributedStmtClass:
1062 Cxx1yLoc = S->getLocStart();
1065 case Stmt::IfStmtClass: {
1068 Cxx1yLoc = S->getLocStart();
1081 case Stmt::WhileStmtClass:
1082 case Stmt::DoStmtClass:
1083 case Stmt::ForStmtClass:
1084 case Stmt::CXXForRangeStmtClass:
1085 case Stmt::ContinueStmtClass:
1091 Cxx1yLoc = S->getLocStart();
1092 for (
Stmt *SubStmt : S->children())
1099 case Stmt::SwitchStmtClass:
1100 case Stmt::CaseStmtClass:
1101 case Stmt::DefaultStmtClass:
1102 case Stmt::BreakStmtClass:
1106 Cxx1yLoc = S->getLocStart();
1107 for (
Stmt *SubStmt : S->children())
1120 Cxx1yLoc = S->getLocStart();
1124 SemaRef.
Diag(S->getLocStart(), diag::err_constexpr_body_invalid_stmt)
1125 << isa<CXXConstructorDecl>(Dcl);
1134 if (isa<CXXTryStmt>(Body)) {
1144 Diag(Body->getLocStart(), diag::err_constexpr_function_try_block)
1145 << isa<CXXConstructorDecl>(Dcl);
1155 for (
auto *BodyIt : CompBody->
body()) {
1160 if (Cxx1yLoc.isValid())
1163 ? diag::warn_cxx11_compat_constexpr_body_invalid_stmt
1164 : diag::ext_constexpr_body_invalid_stmt)
1165 << isa<CXXConstructorDecl>(Dcl);
1168 = dyn_cast<CXXConstructorDecl>(Dcl)) {
1177 if (Constructor->getNumCtorInitializers() == 0 &&
1182 }
else if (!Constructor->isDependentContext() &&
1183 !Constructor->isDelegatingConstructor()) {
1184 assert(RD->
getNumVBases() == 0 &&
"constexpr ctor with virtual bases");
1188 bool AnyAnonStructUnionMembers =
false;
1189 unsigned Fields = 0;
1192 if (
I->isAnonymousStructOrUnion()) {
1193 AnyAnonStructUnionMembers =
true;
1201 if (AnyAnonStructUnionMembers ||
1202 Constructor->getNumCtorInitializers() != RD->
getNumBases() + Fields) {
1206 llvm::SmallSet<Decl*, 16>
Inits;
1207 for (
const auto *
I: Constructor->inits()) {
1211 Inits.insert(
ID->chain_begin(),
ID->chain_end());
1214 bool Diagnosed =
false;
1222 if (ReturnStmts.empty()) {
1231 OK ? diag::warn_cxx11_compat_constexpr_body_no_return
1232 : diag::err_constexpr_body_no_return);
1235 }
else if (ReturnStmts.size() > 1) {
1236 Diag(ReturnStmts.back(),
1238 ? diag::warn_cxx11_compat_constexpr_body_multiple_return
1239 : diag::ext_constexpr_body_multiple_return);
1240 for (
unsigned I = 0;
I < ReturnStmts.size() - 1; ++
I)
1241 Diag(ReturnStmts[
I], diag::note_constexpr_body_previous_return);
1257 Diag(Dcl->
getLocation(), diag::ext_constexpr_function_never_constant_expr)
1258 << isa<CXXConstructorDecl>(Dcl);
1259 for (
size_t I = 0, N = Diags.size();
I != N; ++
I)
1260 Diag(Diags[
I].first, Diags[
I].second);
1279 CurDecl = dyn_cast_or_null<CXXRecordDecl>(DC);
1281 CurDecl = dyn_cast_or_null<CXXRecordDecl>(
CurContext);
1300 CurDecl = dyn_cast_or_null<CXXRecordDecl>(DC);
1302 CurDecl = dyn_cast_or_null<CXXRecordDecl>(
CurContext);
1322 for (
const auto &
I : Current->
bases()) {
1334 Queue.push_back(Base);
1340 Current = Queue.pop_back_val();
1368 Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
1381 ((BaseDecl = BaseDecl->getDefinition()) &&
1383 Diag(BaseLoc, diag::err_circular_inheritance)
1387 Diag(BaseDecl->getLocation(), diag::note_previous_decl)
1396 Access, TInfo, EllipsisLoc);
1401 Diag(BaseLoc, diag::err_base_must_be_class) << SpecifierRange;
1408 Diag(BaseLoc, diag::err_union_as_base_class) << SpecifierRange;
1415 if (
auto *BaseTemplate = dyn_cast_or_null<ClassTemplateSpecializationDecl>(
1427 diag::err_incomplete_base_class, SpecifierRange)) {
1434 assert(BaseDecl &&
"Record type has no declaration");
1436 assert(BaseDecl &&
"Base type is not incomplete, but has no definition");
1438 assert(CXXBaseDecl &&
"Base type is not a C++ type");
1447 Diag(BaseLoc, diag::err_base_class_has_flexible_array_member)
1455 if (FinalAttr *FA = CXXBaseDecl->
getAttr<FinalAttr>()) {
1456 Diag(BaseLoc, diag::err_class_marked_final_used_as_base)
1458 << FA->isSpelledAsSealed();
1470 Access, TInfo, EllipsisLoc);
1497 if (!Attributes.
empty()) {
1500 if (
Attr->isInvalid() ||
1505 ? diag::warn_unknown_attribute_ignored
1506 : diag::err_base_specifier_attribute)
1520 Virtual, Access, TInfo,
1541 auto Decl = Rec->getAsCXXRecordDecl();
1544 for (
const auto &BaseSpec : Decl->bases()) {
1546 .getUnqualifiedType();
1547 if (Set.insert(Base).second)
1565 std::map<QualType, CXXBaseSpecifier*, QualTypeOrdering> KnownBaseTypes;
1572 unsigned NumGoodBases = 0;
1573 bool Invalid =
false;
1574 for (
unsigned idx = 0; idx < Bases.size(); ++idx) {
1584 Diag(Bases[idx]->getLocStart(),
1585 diag::err_duplicate_base_class)
1587 << Bases[idx]->getSourceRange();
1596 KnownBase = Bases[idx];
1597 Bases[NumGoodBases++] = Bases[idx];
1600 if (Bases.size() > 1)
1604 const CXXRecordDecl *RD = cast<CXXRecordDecl>(Record->getDecl());
1622 Class->
setBases(Bases.data(), NumGoodBases);
1624 for (
unsigned idx = 0; idx < NumGoodBases; ++idx) {
1626 QualType BaseType = Bases[idx]->getType();
1630 if (IndirectBaseTypes.count(CanonicalBase)) {
1634 = Class->
isDerivedFrom(CanonicalBase->getAsCXXRecordDecl(), Paths);
1639 Diag(Bases[idx]->getLocStart (), diag::warn_inaccessible_base_class)
1641 << Bases[idx]->getSourceRange();
1643 assert(Bases[idx]->isVirtual());
1659 if (!ClassDecl || Bases.empty())
1716 assert(BasePathArray.empty() &&
"Base path array must be empty!");
1725 for (
unsigned I = Path.size();
I != 0; --
I) {
1726 if (Path[
I - 1].
Base->isVirtual()) {
1733 for (
unsigned I = Start, E = Path.size();
I !=
E; ++
I)
1734 BasePathArray.push_back(const_cast<CXXBaseSpecifier*>(Path[
I].Base));
1751 unsigned InaccessibleBaseID,
1752 unsigned AmbigiousBaseConvID,
1756 bool IgnoreAccess) {
1763 bool DerivationOkay =
IsDerivedFrom(Loc, Derived, Base, Paths);
1764 assert(DerivationOkay &&
1765 "Can only be used with a derived-to-base conversion");
1766 (void)DerivationOkay;
1769 if (!IgnoreAccess) {
1772 InaccessibleBaseID)) {
1788 if (AmbigiousBaseConvID) {
1798 assert(StillOkay &&
"Can only be used with a derived-to-base conversion");
1807 Diag(Loc, AmbigiousBaseConvID)
1808 << Derived << Base << PathDisplayStr << Range <<
Name;
1817 bool IgnoreAccess) {
1819 Derived, Base, diag::err_upcast_to_inaccessible_base,
1820 diag::err_ambiguous_derived_to_base_conv, Loc, Range,
DeclarationName(),
1821 BasePath, IgnoreAccess);
1838 std::string PathDisplayStr;
1839 std::set<unsigned> DisplayedPaths;
1841 Path != Paths.
end(); ++Path) {
1842 if (DisplayedPaths.insert(Path->back().SubobjectNumber).second) {
1845 PathDisplayStr +=
"\n ";
1847 for (CXXBasePath::const_iterator Element = Path->begin();
1848 Element != Path->end(); ++Element)
1849 PathDisplayStr +=
" -> " + Element->Base->getType().getAsString();
1853 return PathDisplayStr;
1865 assert(Access !=
AS_none &&
"Invalid kind for syntactic access specifier!");
1895 if (!OverloadedMethods.empty()) {
1896 if (OverrideAttr *OA = D->
getAttr<OverrideAttr>()) {
1897 Diag(OA->getLocation(),
1898 diag::override_keyword_hides_virtual_member_function)
1899 <<
"override" << (OverloadedMethods.size() > 1);
1900 }
else if (FinalAttr *FA = D->
getAttr<FinalAttr>()) {
1901 Diag(FA->getLocation(),
1902 diag::override_keyword_hides_virtual_member_function)
1903 << (FA->isSpelledAsSealed() ?
"sealed" :
"final")
1904 << (OverloadedMethods.size() > 1);
1915 if (OverrideAttr *OA = D->
getAttr<OverrideAttr>()) {
1916 Diag(OA->getLocation(),
1917 diag::override_keyword_only_allowed_on_virtual_member_functions)
1921 if (FinalAttr *FA = D->
getAttr<FinalAttr>()) {
1922 Diag(FA->getLocation(),
1923 diag::override_keyword_only_allowed_on_virtual_member_functions)
1924 << (FA->isSpelledAsSealed() ?
"sealed" :
"final")
1935 bool HasOverriddenMethods =
1937 if (MD->
hasAttr<OverrideAttr>() && !HasOverriddenMethods)
1938 Diag(MD->
getLocation(), diag::err_function_marked_override_not_overriding)
1947 isa<CXXDestructorDecl>(MD))
1959 Diag(MD->
getLocation(), diag::warn_function_marked_not_override_overriding)
1971 FinalAttr *FA = Old->
getAttr<FinalAttr>();
1977 << FA->isSpelledAsSealed();
1986 return !RD->isCompleteDefinition() ||
1987 !RD->hasTrivialDefaultConstructor() ||
1988 !RD->hasTrivialDestructor();
1994 if (it->isDeclspecPropertyAttribute())
2018 Expr *BitWidth =
static_cast<Expr*
>(BW);
2025 if (cast<CXXRecordDecl>(
CurContext)->isInterface()) {
2029 unsigned InvalidDecl;
2030 bool ShowDeclName =
true;
2040 ShowDeclName =
false;
2045 ShowDeclName =
false;
2060 Diag(Loc, diag::err_invalid_member_in_interface)
2061 << (InvalidDecl-1) << Name;
2063 Diag(Loc, diag::err_invalid_member_in_interface)
2064 << (InvalidDecl-1) <<
"";
2090 diag::err_storageclass_invalid_for_member);
2110 const char *PrevSpec;
2115 assert(!Failed &&
"Making a constexpr member const shouldn't fail");
2119 const char *PrevSpec;
2125 "This is the only DeclSpec that should fail to be applied");
2129 isInstField =
false;
2140 Diag(Loc, diag::err_bad_variable_name)
2149 if (TemplateParameterLists.size()) {
2151 if (TemplateParams->
size()) {
2160 diag::err_template_member_noparams)
2186 if (MSPropertyAttr) {
2188 BitWidth, InitStyle, AS, MSPropertyAttr);
2191 isInstField =
false;
2194 BitWidth, InitStyle, AS);
2195 assert(Member &&
"HandleField never returns null");
2206 }
else if (isa<VarDecl>(Member) || isa<VarTemplateDecl>(Member)) {
2209 Diag(Loc, diag::err_static_not_bitfield)
2210 << Name << BitWidth->getSourceRange();
2211 }
else if (isa<TypedefDecl>(Member)) {
2213 Diag(Loc, diag::err_typedef_not_bitfield)
2214 << Name << BitWidth->getSourceRange();
2218 Diag(Loc, diag::err_not_integral_type_bitfield)
2219 << Name << cast<ValueDecl>(Member)->getType()
2220 << BitWidth->getSourceRange();
2232 FunTmpl->getTemplatedDecl()->setAccess(AS);
2233 else if (
VarTemplateDecl *VarTmpl = dyn_cast<VarTemplateDecl>(Member))
2234 VarTmpl->getTemplatedDecl()->setAccess(AS);
2245 if (
CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(Member))
2251 assert((Name || isInstField) &&
"No identifier for non-field ?");
2254 FieldDecl *FD = cast<FieldDecl>(Member);
2273 class UninitializedFieldVisitor
2278 llvm::SmallPtrSetImpl<ValueDecl*> &Decls;
2281 llvm::SmallPtrSetImpl<QualType> &BaseClasses;
2296 UninitializedFieldVisitor(
Sema &
S,
2297 llvm::SmallPtrSetImpl<ValueDecl*> &Decls,
2298 llvm::SmallPtrSetImpl<QualType> &BaseClasses)
2299 : Inherited(S.
Context), S(S), Decls(Decls), BaseClasses(BaseClasses),
2300 Constructor(nullptr), InitList(
false), InitListFieldDecl(nullptr) {}
2303 bool IsInitListMemberExprInitialized(
MemberExpr *ME,
2304 bool CheckReferenceOnly) {
2306 bool ReferenceField =
false;
2311 Fields.push_back(FD);
2313 ReferenceField =
true;
2319 if (CheckReferenceOnly && !ReferenceField)
2325 for (
auto I = Fields.rbegin() + 1, E = Fields.rend();
I !=
E; ++
I) {
2326 UsedFieldIndex.push_back((*I)->getFieldIndex());
2329 for (
auto UsedIter = UsedFieldIndex.begin(),
2330 UsedEnd = UsedFieldIndex.end(),
2331 OrigIter = InitFieldIndex.begin(),
2332 OrigEnd = InitFieldIndex.end();
2333 UsedIter != UsedEnd && OrigIter != OrigEnd; ++UsedIter, ++OrigIter) {
2334 if (*UsedIter < *OrigIter)
2336 if (*UsedIter > *OrigIter)
2343 void HandleMemberExpr(
MemberExpr *ME,
bool CheckReferenceOnly,
2358 if (isa<VarDecl>(SubME->getMemberDecl()))
2361 if (
FieldDecl *FD = dyn_cast<FieldDecl>(SubME->getMemberDecl()))
2366 AllPODFields =
false;
2368 Base = SubME->getBase();
2374 if (AddressOf && AllPODFields)
2380 while (isa<ImplicitCastExpr>(BaseCast->getSubExpr())) {
2381 BaseCast = cast<ImplicitCastExpr>(BaseCast->getSubExpr());
2394 if (!Decls.count(FoundVD))
2399 if (InitList && !AddressOf && FoundVD == InitListFieldDecl) {
2401 if (IsInitListMemberExprInitialized(ME, CheckReferenceOnly)) {
2406 if (CheckReferenceOnly && !IsReference)
2410 unsigned diag = IsReference
2411 ? diag::warn_reference_field_is_uninit
2412 : diag::warn_field_is_uninit;
2415 S.
Diag(Constructor->getLocation(),
2416 diag::note_uninit_in_this_constructor)
2417 << (Constructor->isDefaultConstructor() && Constructor->isImplicit());
2421 void HandleValue(
Expr *E,
bool AddressOf) {
2424 if (
MemberExpr *ME = dyn_cast<MemberExpr>(E)) {
2425 HandleMemberExpr(ME,
false ,
2431 Visit(CO->getCond());
2432 HandleValue(CO->getTrueExpr(), AddressOf);
2433 HandleValue(CO->getFalseExpr(), AddressOf);
2438 dyn_cast<BinaryConditionalOperator>(E)) {
2439 Visit(BCO->getCond());
2440 HandleValue(BCO->getFalseExpr(), AddressOf);
2445 HandleValue(OVE->getSourceExpr(), AddressOf);
2450 switch (BO->getOpcode()) {
2455 HandleValue(BO->getLHS(), AddressOf);
2456 Visit(BO->getRHS());
2459 Visit(BO->getLHS());
2460 HandleValue(BO->getRHS(), AddressOf);
2469 InitFieldIndex.push_back(0);
2470 for (
auto Child : ILE->
children()) {
2471 if (
InitListExpr *SubList = dyn_cast<InitListExpr>(Child)) {
2472 CheckInitListExpr(SubList);
2476 ++InitFieldIndex.back();
2478 InitFieldIndex.pop_back();
2487 DeclsToRemove.clear();
2489 Constructor = FieldConstructor;
2494 InitListFieldDecl = Field;
2495 InitFieldIndex.clear();
2496 CheckInitListExpr(ILE);
2510 HandleMemberExpr(ME,
true ,
false );
2519 Inherited::VisitImplicitCastExpr(E);
2525 if (
InitListExpr *ILE = dyn_cast<InitListExpr>(ArgExpr))
2529 if (ICE->getCastKind() ==
CK_NoOp)
2530 ArgExpr = ICE->getSubExpr();
2531 HandleValue(ArgExpr,
false );
2534 Inherited::VisitCXXConstructExpr(E);
2539 if (isa<MemberExpr>(Callee)) {
2540 HandleValue(Callee,
false );
2546 Inherited::VisitCXXMemberCallExpr(E);
2555 HandleValue(E->
getArg(0),
false );
2561 Inherited::VisitCallExpr(E);
2567 if (isa<UnresolvedLookupExpr>(Callee))
2568 return Inherited::VisitCXXOperatorCallExpr(E);
2572 HandleValue(Arg->IgnoreParenImpCasts(),
false );
2582 DeclsToRemove.push_back(FD);
2585 HandleValue(E->
getLHS(),
false );
2590 Inherited::VisitBinaryOperator(E);
2600 HandleValue(ME->
getBase(),
true );
2605 Inherited::VisitUnaryOperator(E);
2615 static void DiagnoseUninitializedFields(
2632 llvm::SmallPtrSet<ValueDecl*, 4> UninitializedFields;
2635 for (
auto *
I : RD->
decls()) {
2636 if (
auto *FD = dyn_cast<FieldDecl>(
I)) {
2637 UninitializedFields.insert(FD);
2638 }
else if (
auto *IFD = dyn_cast<IndirectFieldDecl>(
I)) {
2639 UninitializedFields.insert(IFD->getAnonField());
2643 llvm::SmallPtrSet<QualType, 4> UninitializedBaseClasses;
2644 for (
auto I : RD->
bases())
2645 UninitializedBaseClasses.insert(
I.getType().getCanonicalType());
2647 if (UninitializedFields.empty() && UninitializedBaseClasses.empty())
2650 UninitializedFieldVisitor UninitializedChecker(SemaRef,
2651 UninitializedFields,
2652 UninitializedBaseClasses);
2654 for (
const auto *FieldInit : Constructor->
inits()) {
2655 if (UninitializedFields.empty() && UninitializedBaseClasses.empty())
2658 Expr *InitExpr = FieldInit->getInit();
2663 dyn_cast<CXXDefaultInitExpr>(InitExpr)) {
2664 InitExpr = Default->getExpr();
2668 UninitializedChecker.CheckInitializer(InitExpr, Constructor,
2669 FieldInit->getAnyMember(),
2670 FieldInit->getBaseClass());
2672 UninitializedChecker.CheckInitializer(InitExpr,
nullptr,
2673 FieldInit->getAnyMember(),
2674 FieldInit->getBaseClass());
2700 "must set init style when field is created");
2722 Init = Seq.Perform(*
this, Entity, Kind, InitExpr);
2738 InitExpr = Init.
get();
2752 DirectBaseSpec =
nullptr;
2753 for (
const auto &Base : ClassDecl->
bases()) {
2757 DirectBaseSpec = &Base;
2765 VirtualBaseSpec =
nullptr;
2766 if (!DirectBaseSpec || !DirectBaseSpec->
isVirtual()) {
2775 Path != Paths.
end(); ++Path) {
2776 if (Path->back().Base->isVirtual()) {
2777 VirtualBaseSpec = Path->back().Base;
2784 return DirectBaseSpec || VirtualBaseSpec;
2799 DS, IdLoc, InitList,
2819 DS, IdLoc, List, EllipsisLoc);
2828 explicit MemInitializerValidatorCCC(
CXXRecordDecl *ClassDecl)
2829 : ClassDecl(ClassDecl) {}
2831 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
2833 if (
FieldDecl *Member = dyn_cast<FieldDecl>(ND))
2835 return isa<TypeDecl>(ND);
2892 if (!Result.
empty()) {
2894 if ((Member = dyn_cast<FieldDecl>(Result.
front())) ||
2897 Diag(EllipsisLoc, diag::err_pack_expansion_member_init)
2899 <<
SourceRange(IdLoc, Init->getSourceRange().getEnd());
2909 if (TemplateTypeTy) {
2925 bool NotUnknownSpecialization =
false;
2927 if (
CXXRecordDecl *Record = dyn_cast_or_null<CXXRecordDecl>(DC))
2928 NotUnknownSpecialization = !Record->hasAnyDependentBases();
2930 if (!NotUnknownSpecialization) {
2935 *MemberOrBase, IdLoc);
2949 llvm::make_unique<MemInitializerValidatorCCC>(ClassDecl),
2956 PDiag(diag::err_mem_init_not_member_or_class_suggest)
2957 << MemberOrBase <<
true);
2964 DirectBaseSpec, VirtualBaseSpec)) {
2969 PDiag(diag::err_mem_init_not_member_or_class_suggest)
2970 << MemberOrBase <<
false,
2976 diag::note_base_class_specified_here)
2985 if (!TyD && BaseType.
isNull()) {
2986 Diag(IdLoc, diag::err_mem_init_not_member_or_class)
2987 << MemberOrBase <<
SourceRange(IdLoc,Init->getSourceRange().getEnd());
3034 Init = Op->getSubExpr();
3048 IsPointer ? diag::warn_init_ptr_member_to_parameter_addr
3049 : diag::warn_bind_ref_member_to_parameter)
3050 << Member << Parameter << Init->getSourceRange();
3056 S.
Diag(Member->
getLocation(), diag::note_ref_or_ptr_member_declared_here)
3057 << (
unsigned)IsPointer;
3065 assert((DirectMember || IndirectMember) &&
3066 "Member must be a FieldDecl or IndirectFieldDecl");
3075 if (
ParenListExpr *ParenList = dyn_cast<ParenListExpr>(Init)) {
3076 Args =
MultiExprArg(ParenList->getExprs(), ParenList->getNumExprs());
3077 }
else if (
InitListExpr *InitList = dyn_cast<InitListExpr>(Init)) {
3078 Args =
MultiExprArg(InitList->getInits(), InitList->getNumInits());
3091 bool InitList =
false;
3092 if (isa<InitListExpr>(Init)) {
3108 ExprResult MemberInit = InitSeq.Perform(*
this, MemberEntity, Kind, Args,
3119 if (MemberInit.isInvalid())
3122 Init = MemberInit.get();
3141 return Diag(NameLoc, diag::err_delegating_ctor)
3143 Diag(NameLoc, diag::warn_cxx98_compat_delegating_ctor);
3145 bool InitList =
true;
3147 if (
ParenListExpr *ParenList = dyn_cast<ParenListExpr>(Init)) {
3149 Args =
MultiExprArg(ParenList->getExprs(), ParenList->getNumExprs());
3161 ExprResult DelegationInit = InitSeq.Perform(*
this, DelegationEntity, Kind,
3166 assert(cast<CXXConstructExpr>(DelegationInit.
get())->getConstructor() &&
3167 "Delegating constructor with no target?");
3174 if (DelegationInit.isInvalid())
3185 DelegationInit = Init;
3188 DelegationInit.getAs<
Expr>(),
3200 return Diag(BaseLoc, diag::err_base_init_does_not_name_class)
3215 Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
3244 if (!DirectBaseSpec && !VirtualBaseSpec) {
3253 return Diag(BaseLoc, diag::err_not_direct_base_or_virtual)
3265 InitRange.
getEnd(), EllipsisLoc);
3272 if (DirectBaseSpec && VirtualBaseSpec)
3273 return Diag(BaseLoc, diag::err_base_init_direct_and_virtual)
3278 BaseSpec = VirtualBaseSpec;
3281 bool InitList =
true;
3283 if (
ParenListExpr *ParenList = dyn_cast<ParenListExpr>(Init)) {
3285 Args =
MultiExprArg(ParenList->getExprs(), ParenList->getNumExprs());
3295 ExprResult BaseInit = InitSeq.Perform(*
this, BaseEntity, Kind, Args,
nullptr);
3320 InitRange.
getEnd(), EllipsisLoc);
3330 TargetType, ExprLoc);
3334 E->getSourceRange()).
get();
3350 bool IsInheritedVirtualBase,
3354 IsInheritedVirtualBase);
3358 switch (ImplicitInitKind) {
3382 BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, Args);
3391 BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind,
None);
3397 bool Moving = ImplicitInitKind ==
IIK_Move;
3419 BasePath.push_back(BaseSpec);
3429 BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, CopyCtorArg);
3452 ValueDecl *Referenced = cast<MemberExpr>(MemRef)->getMemberDecl();
3467 bool Moving = ImplicitInitKind ==
IIK_Move;
3475 Expr *MemberExprBase =
3490 MemberLookup.
addDecl(Indirect ? cast<ValueDecl>(Indirect)
3492 MemberLookup.resolveKind();
3520 bool InitializingArray =
false;
3523 InitializingArray =
true;
3528 llvm::raw_svector_ostream OS(Str);
3529 OS <<
"__i" << IndexVariables.size();
3534 IterationVarName, SizeType,
3537 IndexVariables.push_back(IterationVar);
3543 "Reference to invented variable cannot fail!");
3545 assert(!IterationVarRef.isInvalid() &&
3546 "Conversion of invented variable cannot fail!");
3550 IterationVarRef.get(),
3552 if (CtorArg.isInvalid())
3555 BaseType = Array->getElementType();
3559 if (Moving && InitializingArray)
3566 Entities.reserve(1 + IndexVariables.size());
3571 for (
unsigned I = 0, N = IndexVariables.size();
I != N; ++
I)
3585 = InitSeq.Perform(SemaRef, Entities.back(), InitKind,
3588 if (MemberInit.isInvalid())
3592 assert(IndexVariables.size() == 0 &&
3593 "Indirect field improperly initialized");
3597 MemberInit.getAs<
Expr>(),
3601 Loc, MemberInit.getAs<
Expr>(),
3603 IndexVariables.data(),
3604 IndexVariables.size());
3609 "Unhandled implicit init kind!");
3623 InitSeq.
Perform(SemaRef, InitEntity, InitKind,
None);
3646 diag::err_uninitialized_member_in_ctor)
3656 diag::err_uninitialized_member_in_ctor)
3680 CXXMemberInit =
nullptr;
3685 struct BaseAndFieldInfo {
3688 bool AnyErrorsInInits;
3690 llvm::DenseMap<const void *, CXXCtorInitializer*> AllBaseFields;
3692 llvm::DenseMap<TagDecl*, FieldDecl*> ActiveUnionMember;
3695 : S(S), Ctor(Ctor), AnyErrorsInInits(ErrorsInInits) {
3707 bool isImplicitCopyOrMove()
const {
3718 llvm_unreachable(
"Invalid ImplicitInitializerKind!");
3722 AllToInit.push_back(Init);
3731 bool isInactiveUnionMember(
FieldDecl *Field) {
3741 if (isImplicitCopyOrMove())
3759 bool isWithinInactiveUnionMember(
FieldDecl *Field,
3762 return isInactiveUnionMember(Field);
3764 for (
auto *
C : Indirect->
chain()) {
3766 if (Field && isInactiveUnionMember(Field))
3781 if (!ArrayT->getSize())
3784 T = ArrayT->getElementType();
3799 return Info.addFieldInitializer(Init);
3813 if (Info.isWithinInactiveUnionMember(Field, Indirect))
3830 return Info.addFieldInitializer(Init);
3840 if (Info.AnyErrorsInInits)
3851 return Info.addFieldInitializer(Init);
3871 DiagnoseUninitializedFields(*
this, Constructor);
3881 if (!Initializers.empty()) {
3885 memcpy(baseOrMemberInitializers, Initializers.data(),
3897 BaseAndFieldInfo Info(*
this, Constructor, AnyErrors);
3905 bool HadError =
false;
3907 for (
unsigned i = 0; i < Initializers.size(); i++) {
3916 for (
auto *
C : F->chain()) {
3919 Info.ActiveUnionMember.insert(std::make_pair(
3924 Info.ActiveUnionMember.insert(std::make_pair(
3931 llvm::SmallPtrSet<CXXBaseSpecifier *, 16> DirectVBases;
3932 for (
auto &
I : ClassDecl->
bases()) {
3934 DirectVBases.insert(&
I);
3938 for (
auto &VBase : ClassDecl->
vbases()) {
3940 = Info.AllBaseFields.lookup(VBase.getType()->getAs<
RecordType>())) {
3948 Diag(
Value->getSourceLocation(), diag::warn_abstract_vbase_init_ignored)
3949 << VBase.getType() << ClassDecl;
3953 Info.AllToInit.push_back(
Value);
3954 }
else if (!AnyErrors && !ClassDecl->
isAbstract()) {
3959 bool IsInheritedVirtualBase = !DirectVBases.count(&VBase);
3962 &VBase, IsInheritedVirtualBase,
3968 Info.AllToInit.push_back(CXXBaseInit);
3973 for (
auto &Base : ClassDecl->
bases()) {
3975 if (Base.isVirtual())
3980 Info.AllToInit.push_back(
Value);
3981 }
else if (!AnyErrors) {
3990 Info.AllToInit.push_back(CXXBaseInit);
3995 for (
auto *Mem : ClassDecl->
decls()) {
3996 if (
auto *F = dyn_cast<FieldDecl>(Mem)) {
4001 if (F->isUnnamedBitfield())
4007 if (F->isAnonymousStructOrUnion() && !Info.isImplicitCopyOrMove())
4016 if (Info.isImplicitCopyOrMove())
4019 if (
auto *F = dyn_cast<IndirectFieldDecl>(Mem)) {
4020 if (F->getType()->isIncompleteArrayType()) {
4022 "Incomplete array type is not valid");
4034 unsigned NumInitializers = Info.AllToInit.size();
4035 if (NumInitializers > 0) {
4039 memcpy(baseOrMemberInitializers, Info.AllToInit.data(),
4056 for (
auto *Field : RD->
fields())
4084 bool ShouldCheckOrder =
false;
4085 for (
unsigned InitIndex = 0; InitIndex != Inits.size(); ++InitIndex) {
4087 if (!SemaRef.
Diags.
isIgnored(diag::warn_initializer_out_of_order,
4089 ShouldCheckOrder =
true;
4093 if (!ShouldCheckOrder)
4104 for (
const auto &VBase : ClassDecl->
vbases())
4108 for (
const auto &Base : ClassDecl->
bases()) {
4109 if (Base.isVirtual())
4115 for (
auto *Field : ClassDecl->
fields()) {
4122 unsigned NumIdealInits = IdealInitKeys.size();
4123 unsigned IdealIndex = 0;
4126 for (
unsigned InitIndex = 0; InitIndex != Inits.size(); ++InitIndex) {
4132 for (; IdealIndex != NumIdealInits; ++IdealIndex)
4133 if (InitKey == IdealInitKeys[IdealIndex])
4139 if (IdealIndex == NumIdealInits && PrevInit) {
4142 diag::warn_initializer_out_of_order);
4155 for (IdealIndex = 0; IdealIndex != NumIdealInits; ++IdealIndex)
4156 if (InitKey == IdealInitKeys[IdealIndex])
4159 assert(IdealIndex < NumIdealInits &&
4160 "initializer not found in initializer list");
4168 bool CheckRedundantInit(
Sema &S,
4178 diag::err_multiple_mem_initialization)
4183 assert(BaseClass &&
"neither field nor base");
4185 diag::err_multiple_base_initialization)
4195 typedef std::pair<NamedDecl *, CXXCtorInitializer *> UnionEntry;
4196 typedef llvm::DenseMap<RecordDecl*, UnionEntry> RedundantUnionMap;
4198 bool CheckRedundantUnionInit(
Sema &S,
4200 RedundantUnionMap &Unions) {
4207 UnionEntry &En = Unions[Parent];
4208 if (En.first && En.first != Child) {
4210 diag::err_multiple_mem_union_initialization)
4213 S.
Diag(En.second->getSourceLocation(), diag::note_previous_initializer)
4214 << 0 << En.second->getSourceRange();
4238 if (!ConstructorDecl)
4247 Diag(ColonLoc, diag::err_only_constructors_take_base_inits);
4254 llvm::DenseMap<const void *, CXXCtorInitializer *> Members;
4257 RedundantUnionMap MemberUnions;
4259 bool HadError =
false;
4260 for (
unsigned i = 0; i < MemInits.size(); i++) {
4268 if (CheckRedundantInit(*
this, Init, Members[Key]) ||
4269 CheckRedundantUnionInit(*
this, Init, MemberUnions))
4273 if (CheckRedundantInit(*
this, Init, Members[Key]))
4278 if (MemInits.size() != 1) {
4280 diag::err_delegating_initializer_alone)
4281 << Init->
getSourceRange() << MemInits[i ? 0 : 1]->getSourceRange();
4297 DiagnoseUninitializedFields(*
this, Constructor);
4314 for (
auto *Field : ClassDecl->
fields()) {
4338 assert(Dtor &&
"No dtor found for FieldClassDecl!");
4340 PDiag(diag::err_access_dtor_field)
4348 llvm::SmallPtrSet<const RecordType *, 8> DirectVirtualBases;
4351 for (
const auto &Base : ClassDecl->
bases()) {
4356 if (Base.isVirtual())
4357 DirectVirtualBases.insert(RT);
4367 assert(Dtor &&
"No dtor found for BaseClassDecl!");
4371 PDiag(diag::err_access_dtor_base)
4373 << Base.getSourceRange(),
4381 for (
const auto &VBase : ClassDecl->
vbases()) {
4386 if (DirectVirtualBases.count(RT))
4397 assert(Dtor &&
"No dtor found for BaseClassDecl!");
4400 PDiag(diag::err_access_dtor_vbase)
4406 diag::err_access_dtor_vbase, 0, ClassDecl->
getLocation(),
4420 = dyn_cast<CXXConstructorDecl>(CDtorDecl)) {
4422 DiagnoseUninitializedFields(*
this, Constructor);
4475 llvm::SmallPtrSet<const CXXMethodDecl *, 8> SeenPureMethods;
4478 MEnd = FinalOverriders.end();
4482 SOEnd = M->second.end();
4483 SO != SOEnd; ++SO) {
4490 if (SO->second.size() != 1)
4493 if (!SO->second.front().Method->isPure())
4496 if (!SeenPureMethods.insert(SO->second.front().Method).second)
4499 Diag(SO->second.front().Method->getLocation(),
4500 diag::note_pure_virtual_function)
4501 << SO->second.front().Method->getDeclName() << RD->
getDeclName();
4511 struct AbstractUsageInfo {
4518 : S(S), Record(Record),
4519 AbstractType(S.
Context.getCanonicalType(
4520 S.
Context.getTypeDeclType(Record))),
4524 if (Invalid)
return;
4532 struct CheckAbstractUsage {
4533 AbstractUsageInfo &Info;
4536 CheckAbstractUsage(AbstractUsageInfo &Info,
const NamedDecl *Ctx)
4537 : Info(Info), Ctx(Ctx) {}
4541 #define ABSTRACT_TYPELOC(CLASS, PARENT)
4542 #define TYPELOC(CLASS, PARENT) \
4543 case TypeLoc::CLASS: Check(TL.castAs<CLASS##TypeLoc>(), Sel); break;
4544 #include "clang/AST/TypeLocNodes.def"
4575 #define CheckPolymorphic(Type) \
4576 void Check(Type TL, Sema::AbstractDiagSelID Sel) { \
4577 Visit(TL.getNextTypeLoc(), Sema::AbstractNone); \
4592 return Visit(
Next, Sel);
4602 T = Info.S.Context.getBaseElementType(T);
4605 if (CT != Info.AbstractType)
return;
4609 Info.S.Diag(Ctx->getLocation(), diag::err_array_of_abstract_type)
4610 << T << TL.getSourceRange();
4612 Info.S.Diag(Ctx->getLocation(), diag::err_abstract_type_in_decl)
4613 << Sel << T << TL.getSourceRange();
4615 Info.DiagnoseAbstractType();
4621 CheckAbstractUsage(*
this, D).Visit(TL, Sel);
4644 for (
auto *D : RD->
decls()) {
4645 if (D->isImplicit())
continue;
4648 if (isa<CXXMethodDecl>(D)) {
4650 }
else if (isa<FunctionTemplateDecl>(D)) {
4651 FunctionDecl *FD = cast<FunctionTemplateDecl>(D)->getTemplatedDecl();
4655 }
else if (isa<FieldDecl>(D)) {
4659 }
else if (isa<VarDecl>(D)) {
4660 VarDecl *VD = cast<VarDecl>(D);
4665 }
else if (isa<CXXRecordDecl>(D)) {
4667 }
else if (isa<ClassTemplateDecl>(D)) {
4669 cast<ClassTemplateDecl>(D)->getTemplatedDecl());
4679 assert(ClassAttr->
getKind() == attr::DLLExport);
4688 for (Decl *Member : Class->
decls()) {
4693 if (Member->getAttr<DLLExportAttr>()) {
4694 if (MD->isUserProvided()) {
4705 }
else if (!MD->isTrivial() || MD->isExplicitlyDefaulted() ||
4706 MD->isCopyAssignmentOperator() ||
4707 MD->isMoveAssignmentOperator()) {
4734 if (
auto *Spec = dyn_cast<ClassTemplatePartialSpecializationDecl>(Class)) {
4735 if (
Attr *TemplateAttr =
4736 getDLLAttr(Spec->getSpecializedTemplate()->getTemplatedDecl())) {
4737 auto *A = cast<InheritableAttr>(TemplateAttr->clone(
getASTContext()));
4738 A->setInherited(
true);
4749 << Class << ClassAttr;
4756 for (Decl *Member : Class->
decls()) {
4757 if (!isa<VarDecl>(Member) && !isa<CXXMethodDecl>(Member))
4760 if (!MemberAttr || MemberAttr->
isInherited() || Member->isInvalidDecl())
4764 diag::err_attribute_dll_member_of_dll_class)
4765 << MemberAttr << ClassAttr;
4767 Member->setInvalidDecl();
4776 const bool ClassExported = ClassAttr->
getKind() == attr::DLLExport;
4777 const bool ClassImported = !ClassExported;
4794 for (Decl *Member : Class->
decls()) {
4804 if (MD->isDeleted())
4807 if (MD->isInlined()) {
4814 if (ClassImported && MD->isMoveAssignmentOperator() &&
4820 if (!cast<NamedDecl>(Member)->isExternallyVisible())
4826 NewAttr->setInherited(
true);
4854 NewAttr->setInherited(
true);
4855 BaseTemplateSpec->
addAttr(NewAttr);
4876 Diag(BaseLoc, diag::warn_attribute_dll_instantiated_base_class)
4881 diag::note_template_class_explicit_specialization_was_here)
4882 << BaseTemplateSpec;
4885 diag::note_template_class_instantiation_was_here)
4886 << BaseTemplateSpec;
4898 AbstractUsageInfo Info(*
this, Record);
4908 bool Complained =
false;
4909 for (
const auto *F : Record->
fields()) {
4910 if (F->hasInClassInitializer() || F->isUnnamedBitfield())
4913 if (F->getType()->isReferenceType() ||
4914 (F->getType().isConstQualified() && F->getType()->isScalarType())) {
4921 Diag(F->getLocation(), diag::note_refconst_member_not_initialized)
4922 << F->getType()->isReferenceType()
4923 << F->getDeclName();
4942 isa<IndirectFieldDecl>(D)) {
4954 !Record->
hasAttr<FinalAttr>())
4960 if (FinalAttr *FA = Record->
getAttr<FinalAttr>()) {
4962 << FA->isSpelledAsSealed();
4967 bool HasMethodWithOverrideControl =
false,
4968 HasOverridingMethodWithoutOverrideControl =
false;
4970 for (
auto *M : Record->
methods()) {
4975 if (M->hasAttr<OverrideAttr>())
4976 HasMethodWithOverrideControl =
true;
4977 else if (M->size_overridden_methods() > 0)
4978 HasOverridingMethodWithoutOverrideControl =
true;
4980 if (!M->isInvalidDecl() && M->isExplicitlyDefaulted())
4985 if (!M->isImplicit() && !M->isUserProvided()) {
4997 if (HasMethodWithOverrideControl &&
4998 HasOverridingMethodWithoutOverrideControl) {
5001 for (
auto *M : Record->
methods())
5042 unsigned FieldQuals,
bool ConstRHS) {
5043 unsigned LHSQuals = 0;
5045 LHSQuals = FieldQuals;
5047 unsigned RHSQuals = FieldQuals;
5057 LHSQuals & Qualifiers::Const,
5058 LHSQuals & Qualifiers::Volatile);
5065 unsigned Quals,
bool ConstRHS) {
5121 if (Ctor && ClassDecl->
isUnion())
5137 for (
const auto &B : ClassDecl->
bases()) {
5139 if (!BaseType)
continue;
5153 for (
const auto *F : ClassDecl->
fields()) {
5154 if (F->isInvalidDecl())
5158 CXXRecordDecl *FieldRecDecl = cast<CXXRecordDecl>(RecordTy->getDecl());
5161 ConstArg && !F->isMutable()))
5188 assert(cast<CXXConstructorDecl>(MD)->getInheritedConstructor() &&
5189 "only special members have implicit exception specs");
5233 "not an explicitly-defaulted special member");
5239 bool HadError =
false;
5248 unsigned ExpectedParams = 1;
5266 bool CanHaveConstParam =
false;
5279 Diag(MD->
getLocation(), diag::err_defaulted_special_member_return_type)
5294 bool HasConstParam =
false;
5302 diag::err_defaulted_special_member_volatile_param) << CSM;
5306 if (HasConstParam && !CanHaveConstParam) {
5309 diag::err_defaulted_special_member_copy_const_param)
5314 diag::err_defaulted_special_member_move_const_param)
5319 }
else if (ExpectedParams) {
5337 : isa<CXXConstructorDecl>(MD)) &&
5340 Diag(MD->
getLocStart(), diag::err_incorrect_defaulted_constexpr) << CSM;
5374 llvm::makeArrayRef(&ArgType,
5386 Diag(MD->
getLocation(), diag::err_out_of_line_default_deletes) << CSM;
5413 .getExceptionSpec();
5419 PDiag(diag::err_incorrect_defaulted_exception_spec)
5434 for (
auto &Check : Checks)
5439 for (
auto &Spec : Specs)
5444 struct SpecialMemberDeletionInfo {
5451 bool IsConstructor, IsAssignment, IsMove, ConstArg;
5454 bool AllFieldsAreConst;
5458 : S(S), MD(MD), CSM(CSM), Diagnose(Diagnose),
5460 ConstArg(
false), Loc(MD->getLocation()),
5461 AllFieldsAreConst(
true) {
5465 IsConstructor =
true;
5468 IsConstructor =
true;
5472 IsAssignment =
true;
5475 IsAssignment =
true;
5481 llvm_unreachable(
"invalid special member kind");
5487 ConstArg = RT->getPointeeType().isConstQualified();
5495 unsigned Quals,
bool IsMutable) {
5497 ConstArg && !IsMutable);
5500 typedef llvm::PointerUnion<CXXBaseSpecifier*, FieldDecl*> Subobject;
5503 bool shouldDeleteForField(
FieldDecl *FD);
5504 bool shouldDeleteForAllConstMembers();
5506 bool shouldDeleteForClassSubobject(
CXXRecordDecl *Class, Subobject Subobj,
5508 bool shouldDeleteForSubobjectCall(Subobject Subobj,
5510 bool IsDtorCallInCtor);
5518 bool SpecialMemberDeletionInfo::isAccessible(Subobject Subobj,
5538 bool SpecialMemberDeletionInfo::shouldDeleteForSubobjectCall(
5540 bool IsDtorCallInCtor) {
5547 DiagKind = !Decl ? 0 : 1;
5550 else if (!isAccessible(Subobj, Decl))
5568 diag::note_deleted_special_member_class_subobject)
5570 << Field << DiagKind << IsDtorCallInCtor;
5574 diag::note_deleted_special_member_class_subobject)
5576 << Base->
getType() << DiagKind << IsDtorCallInCtor;
5589 bool SpecialMemberDeletionInfo::shouldDeleteForClassSubobject(
5592 bool IsMutable = Field && Field->
isMutable();
5610 shouldDeleteForSubobjectCall(Subobj, lookupIn(Class, Quals, IsMutable),
5617 if (IsConstructor) {
5620 false,
false,
false,
false,
false);
5621 if (shouldDeleteForSubobjectCall(Subobj, SMOR,
true))
5630 bool SpecialMemberDeletionInfo::shouldDeleteForBase(
CXXBaseSpecifier *Base) {
5634 return BaseClass && shouldDeleteForClassSubobject(BaseClass, Base, 0);
5639 bool SpecialMemberDeletionInfo::shouldDeleteForField(
FieldDecl *FD) {
5648 S.
Diag(FD->
getLocation(), diag::note_deleted_default_ctor_uninit_field)
5649 << MD->
getParent() << FD << FieldType << 0;
5660 S.
Diag(FD->
getLocation(), diag::note_deleted_default_ctor_uninit_field)
5666 AllFieldsAreConst =
false;
5672 S.
Diag(FD->
getLocation(), diag::note_deleted_copy_ctor_rvalue_reference)
5676 }
else if (IsAssignment) {
5681 << IsMove << MD->
getParent() << FD << FieldType << 0;
5696 if (!inUnion() && FieldRecord->
isUnion() &&
5698 bool AllVariantFieldsAreConst =
true;
5701 for (
auto *UI : FieldRecord->
fields()) {
5705 AllVariantFieldsAreConst =
false;
5708 if (UnionFieldRecord &&
5709 shouldDeleteForClassSubobject(UnionFieldRecord, UI,
5719 diag::note_deleted_default_ctor_all_const)
5729 if (shouldDeleteForClassSubobject(FieldRecord, FD,
5740 bool SpecialMemberDeletionInfo::shouldDeleteForAllConstMembers() {
5747 diag::note_deleted_default_ctor_all_const)
5796 if (!Diagnose)
return true;
5799 for (
auto *
I : RD->
ctors()) {
5800 if (
I->isMoveConstructor()) {
5801 UserDeclaredMove =
I;
5805 assert(UserDeclaredMove);
5808 if (!Diagnose)
return true;
5812 if (
I->isMoveAssignmentOperator()) {
5813 UserDeclaredMove =
I;
5817 assert(UserDeclaredMove);
5820 if (UserDeclaredMove) {
5822 diag::note_deleted_copy_user_declared_move)
5840 OperatorDelete,
false)) {
5847 SpecialMemberDeletionInfo SMI(*
this, MD, CSM, Diagnose);
5849 for (
auto &BI : RD->
bases())
5850 if (!BI.isVirtual() &&
5851 SMI.shouldDeleteForBase(&BI))
5856 if (!RD->
isAbstract() || !SMI.IsConstructor) {
5857 for (
auto &BI : RD->
vbases())
5858 if (SMI.shouldDeleteForBase(&BI))
5862 for (
auto *FI : RD->
fields())
5863 if (!FI->isInvalidDecl() && !FI->isUnnamedBitfield() &&
5864 SMI.shouldDeleteForField(FI))
5867 if (SMI.shouldDeleteForAllConstMembers())
5892 *Selected =
nullptr;
5896 llvm_unreachable(
"not a special member");
5914 for (
auto *CI : RD->
ctors()) {
5915 if (!CI->isDefaultConstructor())
5922 *Selected = DefCtor;
5951 }
else if (!Selected) {
5959 goto NeedOverloadResolution;
5969 }
else if (!Selected) {
5974 goto NeedOverloadResolution;
5978 NeedOverloadResolution:
6002 llvm_unreachable(
"unknown special method kind");
6006 for (
auto *CI : RD->
ctors())
6007 if (!CI->isImplicit())
6011 typedef CXXRecordDecl::specific_decl_iterator<FunctionTemplateDecl> tmpl_iter;
6014 dyn_cast<CXXConstructorDecl>(TI->getTemplatedDecl()))
6044 ConstRHS, Diagnose ? &Selected :
nullptr))
6052 S.
Diag(SubobjLoc, diag::note_nontrivial_no_def_ctor)
6055 S.
Diag(CD->getLocation(), diag::note_user_declared_ctor);
6056 }
else if (!Selected)
6057 S.
Diag(SubobjLoc, diag::note_nontrivial_no_copy)
6062 << Kind << SubType.getUnqualifiedType() << CSM;
6064 S.
Diag(SubobjLoc, diag::note_nontrivial_user_provided)
6065 << Kind << SubType.getUnqualifiedType() << CSM;
6070 S.
Diag(SubobjLoc, diag::note_nontrivial_subobject)
6071 << Kind << SubType.getUnqualifiedType() << CSM;
6085 bool ConstArg,
bool Diagnose) {
6086 for (
const auto *FI : RD->
fields()) {
6087 if (FI->isInvalidDecl() || FI->isUnnamedBitfield())
6093 if (FI->isAnonymousStructOrUnion()) {
6095 CSM, ConstArg, Diagnose))
6106 S.
Diag(FI->getLocation(), diag::note_nontrivial_in_class_init) << FI;
6117 S.
Diag(FI->getLocation(), diag::note_nontrivial_objc_ownership)
6122 bool ConstRHS = ConstArg && !FI->isMutable();
6150 bool ConstArg =
false;
6195 llvm_unreachable(
"not a special member");
6201 diag::note_nontrivial_default_arg)
6220 for (
const auto &BI : RD->bases())
6256 if (RD->getNumVBases()) {
6266 for (
const auto *MI : RD->methods()) {
6267 if (MI->isVirtual()) {
6269 Diag(MLoc, diag::note_nontrivial_has_virtual) << RD << 0;
6274 llvm_unreachable(
"dynamic class with no vbases and no virtual functions");
6282 struct FindHiddenVirtualMethod {
6285 llvm::SmallPtrSet<const CXXMethodDecl *, 8> OverridenAndUsingBaseMethods;
6290 static bool CheckMostOverridenMethods(
6292 const llvm::SmallPtrSetImpl<const CXXMethodDecl *> &Methods) {
6298 if (CheckMostOverridenMethods(*
I, Methods))
6314 bool foundSameNameMethod =
false;
6321 foundSameNameMethod =
true;
6338 if (!CheckMostOverridenMethods(MD, OverridenAndUsingBaseMethods))
6339 overloadedMethods.push_back(MD);
6343 if (foundSameNameMethod)
6344 OverloadedMethods.append(overloadedMethods.begin(),
6345 overloadedMethods.end());
6346 return foundSameNameMethod;
6353 llvm::SmallPtrSetImpl<const CXXMethodDecl *>& Methods) {
6372 FindHiddenVirtualMethod FHVM;
6383 ND = shad->getTargetDecl();
6389 OverloadedMethods = FHVM.OverloadedMethods;
6394 for (
unsigned i = 0, e = OverloadedMethods.size(); i != e; ++i) {
6397 diag::note_hidden_overloaded_virtual_declared_here) << overloadedMD;
6414 if (!OverloadedMethods.empty()) {
6416 << MD << (OverloadedMethods.size() > 1);
6433 if (l->getKind() != AttributeList::AT_Visibility)
6436 Diag(l->getLoc(), diag::warn_attribute_after_definition_ignored) <<
6446 dyn_cast_or_null<CXXRecordDecl>(TagDecl));
6518 D = TD->getTemplatedDecl();
6520 if (
auto *PSD = dyn_cast<ClassTemplatePartialSpecializationDecl>(D))
6521 ParameterLists.push_back(PSD->getTemplateParameters());
6524 for (
unsigned i = 0; i < DD->getNumTemplateParameterLists(); ++i)
6525 ParameterLists.push_back(DD->getTemplateParameterList(i));
6529 ParameterLists.push_back(FTD->getTemplateParameters());
6533 if (
TagDecl *TD = dyn_cast<TagDecl>(D)) {
6534 for (
unsigned i = 0; i < TD->getNumTemplateParameterLists(); ++i)
6535 ParameterLists.push_back(TD->getTemplateParameterList(i));
6539 ParameterLists.push_back(CTD->getTemplateParameters());
6545 if (Params->size() > 0)
6550 if (Param->getDeclName()) {
6561 if (!RecordD)
return;
6568 if (!RecordD)
return;
6743 const char *ConstRef
6746 Diag(ParamLoc, diag::err_constructor_byvalue_arg)
6778 if (!OperatorDelete)
6805 << DeclaratorType << isa<TypeAliasDecl>(TT->getDecl());
6808 if (TST->isTypeAlias())
6810 << DeclaratorType << 1;
6979 bool NeedsTypedef =
false;
6983 bool PastFunctionChunk =
false;
6985 switch (Chunk.Kind) {
6987 if (!PastFunctionChunk) {
6988 if (Chunk.Fun.HasTrailingReturnType) {
6993 PastFunctionChunk =
true;
6998 NeedsTypedef =
true;
7020 auto &&DB =
Diag(Loc, diag::err_conv_function_with_complex_decl);
7021 DB << Before <<
After;
7023 if (!NeedsTypedef) {
7027 if (After.isInvalid() && ConvTSI) {
7075 diag::warn_cxx98_compat_explicit_conversion_functions :
7076 diag::ext_explicit_conversion_functions)
7085 assert(Conversion &&
"Expected to receive a conversion function declaration");
7103 ConvType = ConvTypeRef->getPointeeType();
7107 else if (ConvType->isRecordType()) {
7109 if (ConvType == ClassType)
7114 << ClassType << ConvType;
7115 }
else if (ConvType->isVoidType()) {
7117 << ClassType << ConvType;
7122 return ConversionTemplate;
7137 assert(*IsInline != PrevNS->
isInline());
7145 if (*IsInline && II && II->
getName().startswith(
"__atomic") &&
7150 NS->setInline(*IsInline);
7153 for (
auto *
I : PrevNS->
decls())
7154 if (
auto *ND = dyn_cast<NamedDecl>(
I))
7162 S.
Diag(Loc, diag::warn_inline_namespace_reopened_noninline)
7165 S.
Diag(Loc, diag::err_inline_namespace_mismatch) << *IsInline;
7184 bool IsInline = InlineLoc.
isValid();
7185 bool IsInvalid =
false;
7187 bool AddToKnown =
false;
7207 PrevNS = dyn_cast_or_null<NamespaceDecl>(PrevDecl);
7211 if (IsInline != PrevNS->
isInline())
7214 }
else if (PrevDecl) {
7216 Diag(Loc, diag::err_redefinition_different_kind)
7218 Diag(PrevDecl->getLocation(), diag::note_previous_definition);
7221 }
else if (II->
isStr(
"std") &&
7227 AddToKnown = !IsInline;
7230 AddToKnown = !IsInline;
7244 if (PrevNS && IsInline != PrevNS->
isInline())
7250 StartLoc, Loc, II, PrevNS);
7257 if (
const VisibilityAttr *
Attr = Namespc->
getAttr<VisibilityAttr>())
7263 KnownNamespaces[Namespc] =
false;
7271 TU->setAnonymousNamespace(Namespc);
7273 cast<NamespaceDecl>(Parent)->setAnonymousNamespace(Namespc);
7322 return AD->getNamespace();
7323 return dyn_cast_or_null<NamespaceDecl>(D);
7329 NamespaceDecl *Namespc = dyn_cast_or_null<NamespaceDecl>(Dcl);
7330 assert(Namespc &&
"Invalid parameter, expected NamespaceDecl");
7333 if (Namespc->
hasAttr<VisibilityAttr>())
7338 return cast_or_null<CXXRecordDecl>(
7343 return cast_or_null<NamespaceDecl>(
7366 "Looking for std::initializer_list outside of C++.");
7381 if (!Specialization)
7388 Template = dyn_cast_or_null<ClassTemplateDecl>(
7389 TST->getTemplateName().getAsTemplateDecl());
7390 Arguments = TST->getArgs();
7408 if (!isa<TemplateTypeParmDecl>(Params->
getParam(0)))
7427 S.
Diag(Loc, diag::err_implied_std_initializer_list_not_found);
7434 S.
Diag(Loc, diag::err_implied_std_initializer_list_not_found);
7439 Result.suppressDiagnostics();
7442 S.
Diag(Found->
getLocation(), diag::err_malformed_std_initializer_list);
7450 !isa<TemplateTypeParmDecl>(Params->
getParam(0))) {
7451 S.
Diag(Template->
getLocation(), diag::err_malformed_std_initializer_list);
7494 case Decl::TranslationUnit:
7496 case Decl::LinkageSpec:
7508 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
7510 return isa<NamespaceDecl>(ND) || isa<NamespaceAliasDecl>(ND);
7524 llvm::make_unique<NamespaceValidatorCCC>(),
7527 std::string CorrectedStr(Corrected.getAsString(S.
getLangOpts()));
7528 bool DroppedSpecifier = Corrected.WillReplaceSpecifier() &&
7529 Ident->
getName().equals(CorrectedStr);
7531 S.
PDiag(diag::err_using_directive_member_suggest)
7532 << Ident << DC << DroppedSpecifier << SS.getRange(),
7533 S.
PDiag(diag::note_namespace_defined_here));
7536 S.
PDiag(diag::err_using_directive_suggest) << Ident,
7537 S.
PDiag(diag::note_namespace_defined_here));
7539 R.
addDecl(Corrected.getFoundDecl());
7552 assert(!SS.
isInvalid() &&
"Invalid CXXScopeSpec.");
7553 assert(NamespcName &&
"Invalid NamespcName.");
7554 assert(IdentLoc.
isValid() &&
"Invalid NamespceName location.");
7577 NamespcName->
isStr(
"std")) {
7578 Diag(IdentLoc, diag::ext_using_undefined_std);
7589 assert(NS &&
"expected namespace decl");
7606 DeclContext *CommonAncestor = cast<DeclContext>(NS);
7608 CommonAncestor = CommonAncestor->
getParent();
7612 IdentLoc, Named, CommonAncestor);
7616 Diag(IdentLoc, diag::warn_using_directive_in_header);
7621 Diag(IdentLoc, diag::err_expected_namespace_name) << SS.
getRange();
7646 bool HasUsingKeyword,
7651 bool HasTypenameKeyword,
7668 diag::warn_cxx98_compat_using_decl_constructor :
7669 diag::err_using_decl_constructor)
7693 if (!HasUsingKeyword) {
7696 : diag::warn_access_decl_deprecated)
7705 TargetNameInfo, AttrList,
7707 HasTypenameKeyword, TypenameLoc);
7724 return Context.
hasSameType(TD1->getUnderlyingType(),
7725 TD2->getUnderlyingType());
7759 if (isa<EnumDecl>(OrigDC)) OrigDC = OrigDC->
getParent();
7764 if (cast<CXXRecordDecl>(
CurContext)->isProvablyNotDerivedFrom(OrigRec)) {
7767 diag::err_using_decl_nested_name_specifier_is_current_class)
7774 diag::err_using_decl_nested_name_specifier_is_not_base_class)
7783 if (Previous.
empty())
return false;
7786 if (isa<UsingShadowDecl>(Target))
7787 Target = cast<UsingShadowDecl>(Target)->getTargetDecl();
7794 NamedDecl *NonTag =
nullptr, *Tag =
nullptr;
7795 bool FoundEquivalentDecl =
false;
7801 PrevShadow = Shadow;
7802 FoundEquivalentDecl =
true;
7806 FoundEquivalentDecl =
true;
7810 (isa<TagDecl>(D) ? Tag : NonTag) = D;
7813 if (FoundEquivalentDecl)
7847 if (isa<TagDecl>(Target)) {
7849 if (!Tag)
return false;
7853 Diag(Tag->getLocation(), diag::note_using_decl_conflict);
7858 if (!NonTag)
return false;
7874 if (isa<UsingShadowDecl>(Target)) {
7875 Target = cast<UsingShadowDecl>(Target)->getTargetDecl();
7876 assert(!isa<UsingShadowDecl>(Target) &&
"nested shadow declaration");
7929 cast<CXXRecordDecl>(Shadow->
getDeclContext())->removeConversion(Shadow);
7950 bool &AnyDependentBases) {
7953 for (
auto &Base : Derived->
bases()) {
7955 if (CanonicalDesiredBase == BaseType)
7957 if (BaseType->isDependentType())
7958 AnyDependentBases =
true;
7966 UsingValidatorCCC(
bool HasTypenameKeyword,
bool IsInstantiation,
7968 : HasTypenameKeyword(HasTypenameKeyword),
7969 IsInstantiation(IsInstantiation), OldNNS(NNS),
7970 RequireMemberOf(RequireMemberOf) {}
7972 bool ValidateCandidate(
const TypoCorrection &Candidate)
override {
7976 if (!ND || isa<NamespaceDecl>(ND))
7983 if (RequireMemberOf) {
7985 if (FoundRecord && FoundRecord->isInjectedClassName()) {
8006 bool AnyDependentBases =
false;
8009 AnyDependentBases) &&
8021 if (FoundRecord && FoundRecord->isInjectedClassName())
8025 if (isa<TypeDecl>(ND))
8026 return HasTypenameKeyword || !IsInstantiation;
8028 return !HasTypenameKeyword;
8032 bool HasTypenameKeyword;
8033 bool IsInstantiation;
8049 bool IsInstantiation,
8050 bool HasTypenameKeyword,
8052 assert(!SS.
isInvalid() &&
"Invalid CXXScopeSpec.");
8054 assert(IdentLoc.isValid() &&
"Invalid TargetName location.");
8059 Diag(IdentLoc, diag::err_using_requires_qualname);
8086 assert(IsInstantiation &&
"no scope in non-instantiation");
8093 SS, IdentLoc, Previous))
8103 if (!LookupContext) {
8104 if (HasTypenameKeyword) {
8107 UsingLoc, TypenameLoc,
8109 IdentLoc, NameInfo.
getName());
8112 QualifierLoc, NameInfo);
8119 auto Build = [&](
bool Invalid) {
8122 HasTypenameKeyword);
8128 auto BuildInvalid = [&]{
return Build(
true); };
8129 auto BuildValid = [&]{
return Build(
false); };
8132 return BuildInvalid();
8141 if (!IsInstantiation)
8161 llvm::make_unique<UsingValidatorCCC>(
8162 HasTypenameKeyword, IsInstantiation, SS.getScopeRep(),
8166 NamedDecl *ND = Corrected.getCorrectionDecl();
8171 << NameInfo.
getName() << LookupContext << 0
8176 if (RD && RD->isInjectedClassName()) {
8178 if (Corrected.WillReplaceSpecifier()) {
8195 Diag(IdentLoc, diag::err_no_member)
8196 << NameInfo.
getName() << LookupContext << SS.getRange();
8197 return BuildInvalid();
8202 return BuildInvalid();
8204 if (HasTypenameKeyword) {
8207 Diag(IdentLoc, diag::err_using_typename_non_type);
8209 Diag((*I)->getUnderlyingDecl()->getLocation(),
8210 diag::note_using_decl_target);
8211 return BuildInvalid();
8218 Diag(IdentLoc, diag::err_using_dependent_value_is_type);
8220 return BuildInvalid();
8227 Diag(IdentLoc, diag::err_using_decl_can_not_refer_to_namespace)
8229 return BuildInvalid();
8256 assert(!UD->
hasTypename() &&
"expecting a constructor name");
8259 assert(SourceType &&
8260 "Using decl naming constructor doesn't have type in scope spec.");
8264 bool AnyDependentBases =
false;
8267 if (!Base && !AnyDependentBases) {
8269 diag::err_using_decl_constructor_not_in_direct_base)
8271 <<
QualType(SourceType, 0) << TargetClass;
8286 bool HasTypenameKeyword,
8307 if (
UsingDecl *UD = dyn_cast<UsingDecl>(D)) {
8308 DTypename = UD->hasTypename();
8309 DQual = UD->getQualifier();
8311 = dyn_cast<UnresolvedUsingValueDecl>(D)) {
8313 DQual = UD->getQualifier();
8315 = dyn_cast<UnresolvedUsingTypenameDecl>(D)) {
8317 DQual = UD->getQualifier();
8322 if (HasTypenameKeyword != DTypename)
continue;
8331 Diag(NameLoc, diag::err_using_decl_redeclaration) << SS.
getRange();
8356 if (!NamedContext || NamedContext->
isRecord()) {
8357 auto *RD = dyn_cast_or_null<CXXRecordDecl>(NamedContext);
8361 Diag(NameLoc, diag::err_using_decl_can_not_refer_to_class_member)
8387 Diag(InsertLoc, diag::note_using_decl_class_member_workaround)
8403 Diag(UsingLoc, diag::note_using_decl_class_member_workaround)
8417 if (!NamedContext) {
8431 diag::err_using_decl_nested_name_specifier_is_not_class)
8446 if (cast<CXXRecordDecl>(
CurContext)->isProvablyNotDerivedFrom(
8447 cast<CXXRecordDecl>(NamedContext))) {
8450 diag::err_using_decl_nested_name_specifier_is_current_class)
8456 diag::err_using_decl_nested_name_specifier_is_not_base_class)
8479 llvm::SmallPtrSet<const CXXRecordDecl *, 4> Bases;
8486 if (!cast<CXXRecordDecl>(
CurContext)->forallBases(Collect))
8492 return !Bases.count(Base);
8497 if (Bases.count(cast<CXXRecordDecl>(NamedContext)) ||
8498 !cast<CXXRecordDecl>(NamedContext)->forallBases(IsNotBase))
8502 diag::err_using_decl_nested_name_specifier_is_not_base_class)
8517 Decl *DeclFromDeclSpec) {
8522 "got alias-declaration outside of declaration scope");
8527 bool Invalid =
false;
8553 "name in alias declaration must be an identifier");
8568 bool Redeclaration =
false;
8571 if (TemplateParamLists.size()) {
8575 if (TemplateParamLists.size() != 1) {
8576 Diag(UsingLoc, diag::err_alias_template_extra_headers)
8577 <<
SourceRange(TemplateParamLists[1]->getTemplateLoc(),
8578 TemplateParamLists[TemplateParamLists.size()-1]->getRAngleLoc());
8585 if (!Previous.
empty()) {
8586 Redeclaration =
true;
8589 if (!OldDecl && !Invalid) {
8590 Diag(UsingLoc, diag::err_redefinition_different_kind)
8645 if (
auto *TD = dyn_cast_or_null<TagDecl>(DeclFromDeclSpec)) {
8675 Diag(IdentLoc, diag::err_expected_namespace_name) << SS.
getRange();
8707 Diag(AliasLoc, diag::err_redefinition_different_namespace_alias)
8709 Diag(AD->getLocation(), diag::note_previous_namespace_alias)
8710 << AD->getNamespace();
8715 ? diag::err_redefinition
8716 : diag::err_redefinition_different_kind;
8717 Diag(AliasLoc, DiagID) << Alias;
8750 for (
const auto &B : ClassDecl->
bases()) {
8755 CXXRecordDecl *BaseClassDecl = cast<CXXRecordDecl>(BaseType->getDecl());
8760 ExceptSpec.
CalledDecl(B.getLocStart(), Constructor);
8765 for (
const auto &B : ClassDecl->
vbases()) {
8767 CXXRecordDecl *BaseClassDecl = cast<CXXRecordDecl>(BaseType->getDecl());
8772 ExceptSpec.
CalledDecl(B.getLocStart(), Constructor);
8777 for (
const auto *F : ClassDecl->
fields()) {
8778 if (F->hasInClassInitializer()) {
8779 if (
Expr *E = F->getInClassInitializer())
8783 CXXRecordDecl *FieldRecDecl = cast<CXXRecordDecl>(RecordTy->getDecl());
8791 ExceptSpec.
CalledDecl(F->getLocation(), Constructor);
8817 for (
const auto &B : ClassDecl->
bases()) {
8822 CXXRecordDecl *BaseClassDecl = cast<CXXRecordDecl>(BaseType->getDecl());
8823 if (BaseClassDecl == InheritedDecl)
8827 ExceptSpec.
CalledDecl(B.getLocStart(), Constructor);
8832 for (
const auto &B : ClassDecl->
vbases()) {
8834 CXXRecordDecl *BaseClassDecl = cast<CXXRecordDecl>(BaseType->getDecl());
8835 if (BaseClassDecl == InheritedDecl)
8839 ExceptSpec.
CalledDecl(B.getLocStart(), Constructor);
8844 for (
const auto *F : ClassDecl->
fields()) {
8845 if (F->hasInClassInitializer()) {
8846 if (
Expr *E = F->getInClassInitializer())
8850 CXXRecordDecl *FieldRecDecl = cast<CXXRecordDecl>(RecordTy->getDecl());
8853 ExceptSpec.
CalledDecl(F->getLocation(), Constructor);
8862 struct DeclaringSpecialMember {
8865 bool WasAlreadyBeingDeclared;
8868 : S(S), D(RD, CSM) {
8870 if (WasAlreadyBeingDeclared)
8878 ~DeclaringSpecialMember() {
8879 if (!WasAlreadyBeingDeclared)
8884 bool isAlreadyBeingDeclared()
const {
8885 return WasAlreadyBeingDeclared;
8899 "Should not build implicit default constructor!");
8902 if (DSM.isAlreadyBeingDeclared())
8918 nullptr,
false,
true,
8946 ClassDecl->
addDecl(DefaultCon);
8956 "DefineImplicitDefaultConstructor - call it for implicit default ctor");
8959 assert(ClassDecl &&
"DefineImplicitDefaultConstructor - invalid constructor");
8965 Diag(CurrentLocation, diag::note_member_synthesized_at)
8985 L->CompletedImplicitDefinition(Constructor);
8988 DiagnoseUninitializedFields(*
this, Constructor);
8998 class InheritingConstructorInfo {
9001 : SemaRef(SemaRef), Derived(Derived) {
9007 visitAll(Derived, &InheritingConstructorInfo::noteDeclaredInDerived);
9011 visitAll(RD, &InheritingConstructorInfo::inherit);
9016 struct InheritingConstructor {
9017 InheritingConstructor()
9018 : DeclaredInDerived(
false), BaseCtor(nullptr), DerivedCtor(nullptr) {}
9022 bool DeclaredInDerived;
9034 struct InheritingConstructorsForType {
9035 InheritingConstructor NonTemplate;
9042 for (
unsigned I = 0, N = Templates.size();
I != N; ++
I)
9045 return Templates[I].second;
9046 Templates.push_back(std::make_pair(ParamList, InheritingConstructor()));
9047 return Templates.back().second;
9058 .getEntry(SemaRef, Ctor);
9065 for (
const auto *Ctor : RD->
ctors())
9066 (this->*Callback)(Ctor);
9067 for (CXXRecordDecl::specific_decl_iterator<FunctionTemplateDecl>
9078 getEntry(Ctor, Ctor->
getType()).DeclaredInDerived =
true;
9092 SemaRef.
Diag(UsingLoc, diag::warn_using_decl_constructor_ellipsis);
9094 diag::note_using_decl_constructor_ellipsis);
9107 unsigned MinParams = minParamsToInherit(Ctor);
9109 if (Params >= MinParams) {
9111 declareCtor(UsingLoc, Ctor,
9114 while (Params > MinParams &&
9128 return Decls.
empty() ? Derived->getLocation() : Decls[0]->getLocation();
9158 InheritingConstructor &Entry = getEntry(BaseCtor, DerivedType);
9164 if (Entry.DeclaredInDerived)
9170 if (Entry.DerivedCtor) {
9171 if (BaseCtor->
getParent() != Entry.BaseCtor->getParent()) {
9173 if (Entry.DerivedCtor->isInvalidDecl())
9175 Entry.DerivedCtor->setInvalidDecl();
9177 SemaRef.
Diag(UsingLoc, diag::err_using_decl_constructor_conflict);
9179 diag::note_using_decl_constructor_conflict_current_ctor);
9180 SemaRef.
Diag(Entry.BaseCtor->getLocation(),
9181 diag::note_using_decl_constructor_conflict_previous_ctor);
9182 SemaRef.
Diag(Entry.DerivedCtor->getLocation(),
9183 diag::note_using_decl_constructor_conflict_previous_using);
9202 TemplateParams = FTD->getTemplateParameters();
9218 Context, Derived, UsingLoc, NameInfo, DerivedType,
9226 EPI.ExceptionSpec.SourceDecl = DerivedCtor;
9228 FPT->getParamTypes(), EPI));
9232 for (
unsigned I = 0, N = FPT->getNumParams(); I != N; ++
I) {
9236 Context, DerivedCtor, UsingLoc, UsingLoc,
nullptr,
9237 FPT->getParamType(I), TInfo,
SC_None,
nullptr);
9240 ParamDecls.push_back(PD);
9245 DerivedCtor->setAccess(BaseCtor->
getAccess());
9246 DerivedCtor->setParams(ParamDecls);
9247 DerivedCtor->setInheritedConstructor(BaseCtor);
9252 if (TemplateParams) {
9255 TemplateParams, DerivedCtor);
9257 DerivedCtor->setDescribedFunctionTemplate(DerivedTemplate);
9258 Derived->addDecl(DerivedTemplate);
9260 Derived->addDecl(DerivedCtor);
9263 Entry.BaseCtor = BaseCtor;
9264 Entry.DerivedCtor = DerivedCtor;
9269 typedef llvm::DenseMap<const Type *, InheritingConstructorsForType> MapType;
9282 for (
const auto &BaseIt : ClassDecl->
bases())
9283 if (BaseIt.getInheritConstructors())
9284 InheritedBases.push_back(BaseIt.getType()->getAsCXXRecordDecl());
9287 if (InheritedBases.empty())
9291 InheritingConstructorInfo ICI(*
this, ClassDecl);
9292 for (
unsigned I = 0, N = InheritedBases.size(); I != N; ++
I)
9293 ICI.inheritAll(InheritedBases[I]);
9307 Diag(CurrentLocation, diag::note_inhctor_synthesized_at)
9320 L->CompletedImplicitDefinition(Constructor);
9337 for (
const auto &B : ClassDecl->
bases()) {
9347 for (
const auto &B : ClassDecl->
vbases()) {
9354 for (
const auto *F : ClassDecl->
fields()) {
9371 DeclaringSpecialMember DSM(*
this, ClassDecl,
CXXDestructor);
9372 if (DSM.isAlreadyBeingDeclared())
9415 ClassDecl->
addDecl(Destructor);
9425 "DefineImplicitDestructor - call it for implicit default dtor");
9427 assert(ClassDecl &&
"DefineImplicitDestructor - invalid destructor");
9439 Diag(CurrentLocation, diag::note_member_synthesized_at)
9459 L->CompletedImplicitDefinition(Destructor);
9485 for (Decl *Member : Class->
decls()) {
9489 if (
auto *NestedRD = dyn_cast<CXXRecordDecl>(Member))
9492 }
else if (!CD->isDefaultConstructor() || !CD->hasAttr<DLLExportAttr>()) {
9501 unsigned NumParams = CD->getNumParams();
9502 if (ExpectedCallingConv == ActualCallingConv && NumParams == 0)
9505 if (LastExportedDefaultCtor) {
9507 diag::err_attribute_dll_ambiguous_default_ctor) << Class;
9508 S.
Diag(CD->getLocation(), diag::note_entity_declared_at)
9509 << CD->getDeclName();
9512 LastExportedDefaultCtor = CD;
9514 for (
unsigned I = 0; I != NumParams; ++
I) {
9520 CD->getParamDecl(I)).
get();
9549 "adjusting dtor exception specs was introduced in c++11");
9556 getAs<FunctionProtoType>();
9580 ExprBuilder(
const ExprBuilder&) =
delete;
9581 ExprBuilder &operator=(
const ExprBuilder&) =
delete;
9584 static Expr *assertNotNull(
Expr *E) {
9585 assert(E &&
"Expression construction must not fail.");
9591 virtual ~ExprBuilder() {}
9596 class RefBuilder:
public ExprBuilder {
9606 : Var(Var), VarType(VarType) {}
9609 class ThisBuilder:
public ExprBuilder {
9616 class CastBuilder:
public ExprBuilder {
9631 : Builder(Builder), Type(Type), Kind(Kind), Path(Path) {}
9634 class DerefBuilder:
public ExprBuilder {
9639 return assertNotNull(
9643 DerefBuilder(
const ExprBuilder &
Builder) : Builder(Builder) {}
9646 class MemberBuilder:
public ExprBuilder {
9657 nullptr, MemberLookup,
nullptr,
nullptr).
get());
9662 : Builder(Builder), Type(Type), IsArrow(IsArrow),
9663 MemberLookup(MemberLookup) {}
9666 class MoveCastBuilder:
public ExprBuilder {
9674 MoveCastBuilder(
const ExprBuilder &
Builder) : Builder(Builder) {}
9677 class LvalueConvBuilder:
public ExprBuilder {
9682 return assertNotNull(
9686 LvalueConvBuilder(
const ExprBuilder &
Builder) : Builder(Builder) {}
9689 class SubscriptBuilder:
public ExprBuilder {
9690 const ExprBuilder &Base;
9691 const ExprBuilder &Index;
9696 Base.build(S, Loc), Loc, Index.build(S, Loc), Loc).
get());
9699 SubscriptBuilder(
const ExprBuilder &Base,
const ExprBuilder &Index)
9700 : Base(Base), Index(Index) {}
9711 const ExprBuilder &ToB,
const ExprBuilder &FromB) {
9720 Expr *From = FromB.build(S, Loc);
9724 Expr *To = ToB.build(S, Loc);
9730 bool NeedsCollectableMemCpy =
9734 StringRef MemCpyName = NeedsCollectableMemCpy ?
9735 "__builtin_objc_memmove_collectable" :
9749 assert(MemCpyRef.
isUsable() &&
"Builtin reference cannot fail");
9751 Expr *CallArgs[] = {
9755 Loc, CallArgs, Loc);
9757 assert(!Call.
isInvalid() &&
"Call to __builtin_memcpy cannot fail!");
9790 const ExprBuilder &To,
const ExprBuilder &From,
9791 bool CopyingBaseSubobject,
bool Copying,
9792 unsigned Depth = 0) {
9808 CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(RecordTy->getDecl());
9823 if (Method->isCopyAssignmentOperator() ||
9824 (!Copying && Method->isMoveAssignmentOperator()))
9843 if (CopyingBaseSubobject) {
9874 Expr *FromInst = From.build(S, Loc);
9877 Loc, FromInst, Loc);
9897 Loc,
BO_Assign, To.build(S, Loc), From.build(S, Loc));
9917 llvm::raw_svector_ostream OS(Str);
9918 OS <<
"__i" <<
Depth;
9922 IterationVarName, SizeType,
9931 RefBuilder IterationVarRef(IterationVar, SizeType);
9932 LvalueConvBuilder IterationVarRefRVal(IterationVarRef);
9938 SubscriptBuilder FromIndexCopy(From, IterationVarRefRVal);
9939 MoveCastBuilder FromIndexMove(FromIndexCopy);
9940 const ExprBuilder *FromIndex;
9942 FromIndex = &FromIndexCopy;
9944 FromIndex = &FromIndexMove;
9946 SubscriptBuilder ToIndex(To, IterationVarRefRVal);
9951 ToIndex, *FromIndex, CopyingBaseSubobject,
9952 Copying,
Depth + 1);
9954 if (Copy.isInvalid() || !Copy.get())
9980 const ExprBuilder &To,
const ExprBuilder &From,
9981 bool CopyingBaseSubobject,
bool Copying) {
9988 CopyingBaseSubobject,
9993 if (!Result.isInvalid() && !Result.get())
10008 assert(T->
getNumParams() == 1 &&
"not a copy assignment op");
10009 unsigned ArgQuals =
10022 for (
const auto &Base : ClassDecl->
bases()) {
10023 if (Base.isVirtual())
10027 = cast<CXXRecordDecl>(Base.getType()->getAs<
RecordType>()->getDecl());
10029 ArgQuals,
false, 0))
10033 for (
const auto &Base : ClassDecl->
vbases()) {
10035 = cast<CXXRecordDecl>(Base.getType()->getAs<
RecordType>()->getDecl());
10037 ArgQuals,
false, 0))
10041 for (
const auto *Field : ClassDecl->
fields()) {
10063 if (DSM.isAlreadyBeingDeclared())
10104 ClassLoc, ClassLoc,
10125 ClassDecl->
addDecl(CopyAssignment);
10127 return CopyAssignment;
10142 if (RD->hasUserDeclaredDestructor()) {
10143 UserDeclaredOperation = RD->getDestructor();
10144 }
else if (!isa<CXXConstructorDecl>(CopyOp) &&
10145 RD->hasUserDeclaredCopyConstructor() &&
10148 for (
auto *I : RD->ctors()) {
10149 if (I->isCopyConstructor()) {
10150 UserDeclaredOperation =
I;
10154 assert(UserDeclaredOperation);
10155 }
else if (isa<CXXConstructorDecl>(CopyOp) &&
10156 RD->hasUserDeclaredCopyAssignment() &&
10159 for (
auto *I : RD->methods()) {
10160 if (I->isCopyAssignmentOperator()) {
10161 UserDeclaredOperation =
I;
10165 assert(UserDeclaredOperation);
10168 if (UserDeclaredOperation) {
10170 diag::warn_deprecated_copy_operation)
10171 << RD << !isa<CXXConstructorDecl>(CopyOp)
10172 << isa<CXXDestructorDecl>(UserDeclaredOperation);
10173 S.
Diag(UseLoc, diag::note_member_synthesized_at)
10187 "DefineImplicitCopyAssignment called for wrong function");
10203 CopyAssignOperator->
markUsed(Context);
10235 RefBuilder OtherRef(Other, OtherRefType);
10241 bool Invalid =
false;
10242 for (
auto &Base : ClassDecl->
bases()) {
10245 QualType BaseType = Base.getType().getUnqualifiedType();
10252 BasePath.push_back(&Base);
10256 CastBuilder From(OtherRef, Context.
getQualifiedType(BaseType, OtherQuals),
10260 DerefBuilder DerefThis(This);
10261 CastBuilder To(DerefThis,
10272 Diag(CurrentLocation, diag::note_member_synthesized_at)
10279 Statements.push_back(Copy.
getAs<
Expr>());
10283 for (
auto *Field : ClassDecl->
fields()) {
10296 Diag(ClassDecl->
getLocation(), diag::err_uninitialized_member_for_assign)
10299 Diag(CurrentLocation, diag::note_member_synthesized_at)
10308 Diag(ClassDecl->
getLocation(), diag::err_uninitialized_member_for_assign)
10311 Diag(CurrentLocation, diag::note_member_synthesized_at)
10324 "Incomplete array type is not valid");
10333 MemberLookup.resolveKind();
10335 MemberBuilder From(OtherRef, OtherRefType,
false, MemberLookup);
10345 Diag(CurrentLocation, diag::note_member_synthesized_at)
10352 Statements.push_back(Copy.
getAs<
Stmt>());
10360 if (Return.isInvalid())
10363 Statements.push_back(Return.getAs<
Stmt>());
10366 Diag(CurrentLocation, diag::note_member_synthesized_at)
10388 assert(!Body.
isInvalid() &&
"Compound statement creation cannot fail");
10393 L->CompletedImplicitDefinition(CopyAssignOperator);
10417 for (
const auto &Base : ClassDecl->
bases()) {
10418 if (Base.isVirtual())
10422 = cast<CXXRecordDecl>(Base.getType()->getAs<
RecordType>()->getDecl());
10428 for (
const auto &Base : ClassDecl->
vbases()) {
10430 = cast<CXXRecordDecl>(Base.getType()->getAs<
RecordType>()->getDecl());
10436 for (
const auto *Field : ClassDecl->
fields()) {
10454 if (DSM.isAlreadyBeingDeclared())
10495 ClassLoc, ClassLoc,
10518 ClassDecl->
addDecl(MoveAssignment);
10520 return MoveAssignment;
10539 typedef llvm::DenseMap<CXXRecordDecl*, CXXBaseSpecifier*> VBaseMap;
10542 for (
auto &BI : Class->
bases()) {
10543 Worklist.push_back(&BI);
10544 while (!Worklist.empty()) {
10577 if (Existing && Existing != &BI) {
10578 S.
Diag(CurrentLocation, diag::warn_vbase_moved_multiple_times)
10581 << (Base->getCanonicalDecl() ==
10584 S.
Diag(BI.getLocStart(), diag::note_vbase_moved_here)
10585 << (Base->getCanonicalDecl() ==
10586 BI.getType()->getAsCXXRecordDecl()->getCanonicalDecl())
10590 Existing =
nullptr;
10600 for (
auto &BI : Base->
bases())
10601 Worklist.push_back(&BI);
10614 "DefineImplicitMoveAssignment called for wrong function");
10623 MoveAssignOperator->
markUsed(Context);
10646 getAs<RValueReferenceType>()->getPointeeType();
10648 "Bad argument type of defaulted move assignment");
10656 RefBuilder OtherRef(Other, OtherRefType);
10658 MoveCastBuilder MoveOther(OtherRef);
10664 bool Invalid =
false;
10665 for (
auto &Base : ClassDecl->
bases()) {
10676 QualType BaseType = Base.getType().getUnqualifiedType();
10683 BasePath.push_back(&Base);
10687 CastBuilder From(OtherRef, BaseType,
VK_XValue, BasePath);
10690 DerefBuilder DerefThis(This);
10693 CastBuilder To(DerefThis,
10704 Diag(CurrentLocation, diag::note_member_synthesized_at)
10711 Statements.push_back(Move.
getAs<
Expr>());
10715 for (
auto *Field : ClassDecl->
fields()) {
10728 Diag(ClassDecl->
getLocation(), diag::err_uninitialized_member_for_assign)
10731 Diag(CurrentLocation, diag::note_member_synthesized_at)
10740 Diag(ClassDecl->
getLocation(), diag::err_uninitialized_member_for_assign)
10743 Diag(CurrentLocation, diag::note_member_synthesized_at)
10756 "Incomplete array type is not valid");
10764 MemberLookup.resolveKind();
10765 MemberBuilder From(MoveOther, OtherRefType,
10766 false, MemberLookup);
10768 true, MemberLookup);
10770 assert(!From.build(*
this, Loc)->isLValue() &&
10771 "Member reference with rvalue base must be rvalue except for reference "
10772 "members, which aren't allowed for move assignment.");
10779 if (Move.isInvalid()) {
10780 Diag(CurrentLocation, diag::note_member_synthesized_at)
10787 Statements.push_back(Move.getAs<
Stmt>());
10796 if (Return.isInvalid())
10799 Statements.push_back(Return.getAs<
Stmt>());
10802 Diag(CurrentLocation, diag::note_member_synthesized_at)
10824 assert(!Body.
isInvalid() &&
"Compound statement creation cannot fail");
10829 L->CompletedImplicitDefinition(MoveAssignOperator);
10848 for (
const auto &Base : ClassDecl->
bases()) {
10850 if (Base.isVirtual())
10854 = cast<CXXRecordDecl>(Base.getType()->getAs<
RecordType>()->getDecl());
10859 for (
const auto &Base : ClassDecl->
vbases()) {
10861 = cast<CXXRecordDecl>(Base.getType()->getAs<
RecordType>()->getDecl());
10866 for (
const auto *Field : ClassDecl->
fields()) {
10887 if (DSM.isAlreadyBeingDeclared())
10910 Context, ClassDecl, ClassLoc, NameInfo,
QualType(),
nullptr,
10931 ClassLoc, ClassLoc,
10950 ClassDecl->
addDecl(CopyConstructor);
10952 return CopyConstructor;
10961 "DefineImplicitCopyConstructor - call it for implicit copy ctor");
10964 assert(ClassDecl &&
"DefineImplicitCopyConstructor - invalid constructor");
10978 Diag(CurrentLocation, diag::note_member_synthesized_at)
10995 CopyConstructor->
markUsed(Context);
10999 L->CompletedImplicitDefinition(CopyConstructor);
11015 for (
const auto &B : ClassDecl->
bases()) {
11020 CXXRecordDecl *BaseClassDecl = cast<CXXRecordDecl>(BaseType->getDecl());
11026 ExceptSpec.
CalledDecl(B.getLocStart(), Constructor);
11031 for (
const auto &B : ClassDecl->
vbases()) {
11033 CXXRecordDecl *BaseClassDecl = cast<CXXRecordDecl>(BaseType->getDecl());
11039 ExceptSpec.
CalledDecl(B.getLocStart(), Constructor);
11044 for (
const auto *F : ClassDecl->
fields()) {
11055 ExceptSpec.
CalledDecl(F->getLocation(), Constructor);
11067 if (DSM.isAlreadyBeingDeclared())
11087 Context, ClassDecl, ClassLoc, NameInfo,
QualType(),
nullptr,
11108 ClassLoc, ClassLoc,
11129 ClassDecl->
addDecl(MoveConstructor);
11131 return MoveConstructor;
11140 "DefineImplicitMoveConstructor - call it for implicit move ctor");
11143 assert(ClassDecl &&
"DefineImplicitMoveConstructor - invalid constructor");
11150 Diag(CurrentLocation, diag::note_member_synthesized_at)
11159 Loc, Loc,
None,
false).getAs<Stmt>());
11167 MoveConstructor->
markUsed(Context);
11171 L->CompletedImplicitDefinition(MoveConstructor);
11196 void *InsertPos =
nullptr;
11197 FunctionDecl *CallOpSpec = CallOpTemplate->findSpecialization(
11198 DeducedTemplateArgs->
asArray(),
11200 assert(CallOpSpec &&
11201 "Conversion operator must have a corresponding call operator");
11202 CallOp = cast<CXXMethodDecl>(CallOpSpec);
11218 assert(DeducedTemplateArgs &&
11219 "Must have deduced template arguments from Conversion Operator");
11222 void *InsertPos =
nullptr;
11224 DeducedTemplateArgs->
asArray(),
11226 assert(InvokeSpec &&
11227 "Must have a corresponding static invoker specialization");
11228 Invoker = cast<CXXMethodDecl>(InvokeSpec);
11233 assert(FunctionRef &&
"Can't refer to __invoke function?");
11249 L->CompletedImplicitDefinition(Conv);
11250 L->CompletedImplicitDefinition(Invoker);
11285 Diag(CurrentLocation, diag::note_lambda_to_block_conv);
11294 Diag(CurrentLocation, diag::note_lambda_to_block_conv);
11300 Stmt *ReturnS = Return.
get();
11307 L->CompletedImplicitDefinition(Conv);
11314 switch (Args.size()) {
11319 if (!Args[1]->isDefaultArgument())
11324 return !Args[0]->isDefaultArgument();
11334 bool HadMultipleCandidates,
11335 bool IsListInitialization,
11336 bool IsStdInitListInitialization,
11337 bool RequiresZeroInit,
11338 unsigned ConstructKind,
11340 bool Elidable =
false;
11354 Expr *SubExpr = ExprArgs[0];
11359 Elidable, ExprArgs, HadMultipleCandidates,
11360 IsListInitialization,
11361 IsStdInitListInitialization, RequiresZeroInit,
11362 ConstructKind, ParenRange);
11371 bool HadMultipleCandidates,
11372 bool IsListInitialization,
11373 bool IsStdInitListInitialization,
11374 bool RequiresZeroInit,
11375 unsigned ConstructKind,
11379 Context, DeclInitType, ConstructLoc, Constructor, Elidable, ExprArgs,
11380 HadMultipleCandidates, IsListInitialization, IsStdInitListInitialization,
11382 static_cast<CXXConstructExpr::ConstructionKind>(ConstructKind),
11401 assert(Lookup.
size() == 1);
11402 FieldDecl *Pattern = cast<FieldDecl>(Lookup[0]);
11424 if (OutermostClass == ParentRD) {
11425 Diag(Field->
getLocEnd(), diag::err_in_class_initializer_not_yet_parsed)
11426 << ParentRD << Field;
11429 diag::err_in_class_initializer_not_yet_parsed_outer_class)
11430 << ParentRD << OutermostClass << Field;
11447 PDiag(diag::err_access_dtor_var)
11474 bool AllowExplicit,
11475 bool IsListInitialization) {
11477 unsigned NumArgs = ArgsPtr.size();
11478 Expr **Args = ArgsPtr.data();
11482 assert(Proto &&
"Constructor without a prototype?");
11486 if (NumArgs < NumParams)
11487 ConvertedArgs.reserve(NumParams);
11489 ConvertedArgs.reserve(NumArgs);
11496 llvm::makeArrayRef(Args, NumArgs),
11498 CallType, AllowExplicit,
11499 IsListInitialization);
11500 ConvertedArgs.append(AllArgs.begin(), AllArgs.end());
11504 CheckConstructorCall(Constructor,
11505 llvm::makeArrayRef(AllArgs.data(), AllArgs.size()),
11515 if (isa<NamespaceDecl>(DC)) {
11517 diag::err_operator_new_delete_declared_in_namespace)
11521 if (isa<TranslationUnitDecl>(DC) &&
11524 diag::err_operator_new_delete_declared_static)
11535 unsigned DependentParamTypeDiag,
11536 unsigned InvalidParamTypeDiag) {
11543 diag::err_operator_new_delete_dependent_result_type)
11549 diag::err_operator_new_delete_invalid_result_type)
11555 diag::err_operator_new_delete_template_too_few_parameters)
11561 diag::err_operator_new_delete_too_few_parameters)
11568 << FnDecl->
getDeclName() << ExpectedFirstParamType;
11572 ExpectedFirstParamType)
11574 << FnDecl->
getDeclName() << ExpectedFirstParamType;
11596 diag::err_operator_new_dependent_param_type,
11597 diag::err_operator_new_param_type))
11604 diag::err_operator_new_default_arg)
11624 diag::err_operator_delete_dependent_param_type,
11625 diag::err_operator_delete_param_type))
11636 "Expected an overloaded operator declaration");
11646 if (Op == OO_Delete || Op == OO_Array_Delete)
11649 if (Op == OO_New || Op == OO_Array_New)
11657 if (
CXXMethodDecl *MethodDecl = dyn_cast<CXXMethodDecl>(FnDecl)) {
11658 if (MethodDecl->isStatic())
11660 diag::err_operator_overload_static) << FnDecl->
getDeclName();
11662 bool ClassOrEnumParam =
false;
11663 for (
auto Param : FnDecl->
params()) {
11664 QualType ParamType = Param->getType().getNonReferenceType();
11667 ClassOrEnumParam =
true;
11672 if (!ClassOrEnumParam)
11674 diag::err_operator_overload_needs_class_or_enum)
11684 if (Op != OO_Call) {
11685 for (
auto Param : FnDecl->
params()) {
11686 if (Param->hasDefaultArg())
11687 return Diag(Param->getLocation(),
11688 diag::err_operator_overload_default_arg)
11689 << FnDecl->
getDeclName() << Param->getDefaultArgRange();
11694 {
false,
false,
false }
11695 #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
11696 , { Unary, Binary, MemberOnly }
11697 #include "clang/Basic/OperatorKinds.def"
11700 bool CanBeUnaryOperator = OperatorUses[Op][0];
11701 bool CanBeBinaryOperator = OperatorUses[Op][1];
11702 bool MustBeMemberOperator = OperatorUses[Op][2];
11709 + (isa<CXXMethodDecl>(FnDecl)? 1 : 0);
11710 if (Op != OO_Call &&
11711 ((NumParams == 1 && !CanBeUnaryOperator) ||
11712 (NumParams == 2 && !CanBeBinaryOperator) ||
11713 (NumParams < 1) || (NumParams > 2))) {
11716 if (CanBeUnaryOperator && CanBeBinaryOperator) {
11718 }
else if (CanBeUnaryOperator) {
11721 assert(CanBeBinaryOperator &&
11722 "All non-call overloaded operators are unary or binary!");
11726 return Diag(FnDecl->
getLocation(), diag::err_operator_overload_must_be)
11731 if (Op != OO_Call &&
11733 return Diag(FnDecl->
getLocation(), diag::err_operator_overload_variadic)
11738 if (MustBeMemberOperator && !isa<CXXMethodDecl>(FnDecl)) {
11740 diag::err_operator_overload_must_be_member)
11754 if ((Op == OO_PlusPlus || Op == OO_MinusMinus) && NumParams == 2) {
11761 diag::err_operator_overload_post_incdec_must_be_int)
11762 << LastParam->
getType() << (Op == OO_MinusMinus);
11772 if (isa<CXXMethodDecl>(FnDecl)) {
11773 Diag(FnDecl->
getLocation(), diag::err_literal_operator_outside_namespace)
11783 bool Valid =
false;
11798 if (Params->
size() == 1) {
11806 }
else if (Params->
size() == 2) {
11814 if (PmType && PmArgs &&
11816 PmArgs->isTemplateParameterPack()) {
11824 diag::ext_string_literal_operator_template);
11833 QualType T = (*Param)->getType().getUnqualifiedType();
11845 goto FinishedParams;
11851 goto FinishedParams;
11854 goto FinishedParams;
11864 goto FinishedParams;
11873 goto FinishedParams;
11876 T = (*Param)->getType().getUnqualifiedType();
11892 for (
auto Param : FnDecl->
params()) {
11893 if (Param->hasDefaultArg()) {
11894 Diag(Param->getDefaultArgRange().getBegin(),
11895 diag::err_literal_operator_default_argument)
11896 << Param->getDefaultArgRange();
11901 StringRef LiteralName
11903 if (LiteralName[0] !=
'_') {
11925 Diag(LangStr->
getExprLoc(), diag::err_language_linkage_spec_not_ascii)
11926 << LangStr->getSourceRange();
11934 else if (Lang ==
"C++")
11937 Diag(LangStr->
getExprLoc(), diag::err_language_linkage_spec_unknown)
11938 << LangStr->getSourceRange();
11964 return LinkageSpec;
11988 bool Invalid =
false;
12002 Diag(Loc, diag::err_catch_rvalue_ref);
12008 unsigned DK = diag::err_catch_incomplete;
12012 DK = diag::err_catch_incomplete_ptr;
12017 DK = diag::err_catch_incomplete_ref;
12019 if (!Invalid && (Mode == 0 || !BaseType->
isVoidType()) &&
12025 diag::err_abstract_type_in_decl,
12037 Diag(Loc, diag::err_objc_object_catch);
12042 Diag(Loc, diag::warn_objc_pointer_cxx_catch_fragile);
12047 ExDeclType, TInfo, SC_None);
12075 Expr *opaqueValue =
12127 Diag(PrevDecl->getLocation(), diag::note_previous_definition);
12129 }
else if (PrevDecl->isTemplateParameter())
12159 Expr *AssertMessageExpr,
12162 AssertMessageExpr ? cast<StringLiteral>(AssertMessageExpr) :
nullptr;
12168 AssertMessage, RParenLoc,
false);
12176 assert(AssertExpr !=
nullptr &&
"Expected non-null condition");
12187 diag::err_static_assert_expression_is_not_constant,
12191 if (!Failed && !Cond) {
12193 llvm::raw_svector_ostream Msg(MsgBuffer);
12196 Diag(StaticAssertLoc, diag::err_static_assert_failed)
12197 << !AssertMessage << Msg.str() << AssertExpr->getSourceRange();
12203 AssertExpr, AssertMessage, RParenLoc,
12216 assert(TSInfo &&
"NULL TypeSourceInfo for friend type declaration");
12242 diag::warn_cxx98_compat_unelaborated_friend_type :
12243 diag::ext_unelaborated_friend_type)
12251 diag::warn_cxx98_compat_nonclass_type_friend :
12252 diag::ext_nonclass_type_friend)
12259 diag::warn_cxx98_compat_enum_friend :
12260 diag::ext_enum_friend)
12272 Diag(FriendLoc, diag::err_friend_not_first_in_declaration) << T;
12294 bool isExplicitSpecialization =
false;
12295 bool Invalid =
false;
12299 TagLoc, NameLoc, SS,
nullptr, TempParamLists,
true,
12300 isExplicitSpecialization, Invalid)) {
12301 if (TemplateParams->
size() > 0) {
12307 NameLoc, Attr, TemplateParams,
AS_public,
12309 FriendLoc, TempParamLists.size() - 1,
12310 TempParamLists.data()).
get();
12315 isExplicitSpecialization =
true;
12319 if (Invalid)
return nullptr;
12321 bool isAllExplicitSpecializations =
true;
12322 for (
unsigned I = TempParamLists.size(); I-- > 0; ) {
12323 if (TempParamLists[I]->size()) {
12324 isAllExplicitSpecializations =
false;
12334 if (isAllExplicitSpecializations) {
12336 bool Owned =
false;
12337 bool IsDependent =
false;
12357 if (isa<DependentNameType>(T)) {
12371 TSI, FriendLoc, TempParamLists);
12377 assert(SS.
isNotEmpty() &&
"valid templated tag with no SS and no direct?");
12384 Diag(NameLoc, diag::warn_template_qualified_friend_unsupported)
12395 TSI, FriendLoc, TempParamLists);
12433 if (TheDeclarator.isInvalidType())
12454 Diag(Loc, diag::err_tagless_friend_type_template)
12471 if (
unsigned NumTempParamLists = TempParams.size())
12510 Diag(Loc, diag::err_unexpected_friend);
12556 (FunctionContainingLocalClass =
12557 cast<CXXRecordDecl>(
CurContext)->isLocalClass())) {
12575 if (!Previous.
empty()) {
12583 DC = FunctionContainingLocalClass;
12627 if (!Previous.
empty()) {
12632 if (isTemplateId) {
12633 if (isa<TranslationUnitDecl>(LookupDC))
break;
12647 if (!DC)
return nullptr;
12665 if (Previous.
empty()) {
12667 Diag(Loc, diag::err_qualified_friend_not_found)
12677 diag::warn_cxx98_compat_friend_is_member :
12678 diag::err_friend_is_member);
12710 assert(isa<CXXRecordDecl>(DC) &&
"friend declaration not in class?");
12734 if (DiagArg >= 0) {
12735 Diag(Loc, diag::err_introducing_special_friend) << DiagArg;
12746 DCScope = &FakeDCScope;
12749 bool AddToScope =
true;
12751 TemplateParams, AddToScope);
12752 if (!ND)
return nullptr;
12786 FD = FTD->getTemplatedDecl();
12788 FD = cast<FunctionDecl>(ND);
12796 Diag(FD->
getLocation(), diag::err_friend_decl_with_def_arg_redeclared);
12797 Diag(OldFD->getLocation(), diag::note_previous_declaration);
12799 Diag(FD->
getLocation(), diag::err_friend_decl_with_def_arg_must_be_def);
12804 Diag(FD->
getLocation(), diag::warn_template_qualified_friend_unsupported)
12817 FunctionDecl *Fn = dyn_cast_or_null<FunctionDecl>(Dcl);
12819 Diag(DelLoc, diag::err_deleted_non_function);
12827 Prev->getPreviousDecl()) &&
12828 !Prev->isDefined()) {
12829 Diag(DelLoc, diag::err_deleted_decl_not_first);
12830 Diag(Prev->getLocation().isInvalid() ? DelLoc : Prev->getLocation(),
12831 Prev->isImplicit() ? diag::note_previous_implicit_declaration
12832 : diag::note_previous_declaration);
12850 if (
const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(Fn)) {
12851 bool IssuedDiagnostic =
false;
12856 if (!IssuedDiagnostic) {
12858 IssuedDiagnostic =
true;
12860 Diag((*I)->getLocation(), diag::note_overridden_virtual_function);
12868 Diag(DelLoc, diag::err_deleted_main);
12886 Diag(DefaultLoc, diag::err_default_special_members);
12915 cast<CXXConstructorDecl>(MD));
12933 llvm_unreachable(
"Invalid special member.");
12936 Diag(DefaultLoc, diag::err_default_special_members);
12941 for (
Stmt *SubStmt : S->children()) {
12944 if (isa<ReturnStmt>(SubStmt))
12945 Self.
Diag(SubStmt->getLocStart(),
12946 diag::err_return_in_constructor_handler);
12947 if (!isa<Expr>(SubStmt))
12967 if (NewCC == OldCC)
12978 diag::err_conflicting_overriding_cc_attributes)
13004 if (NewRT->getTypeClass() == OldRT->getTypeClass()) {
13012 if (NewClassTy.
isNull()) {
13014 diag::err_different_return_type_for_overriding_virtual_function)
13028 if (!RT->isBeingDefined() &&
13030 diag::err_covariant_return_incomplete,
13048 NewClassTy, OldClassTy,
13049 diag::err_covariant_return_inaccessible_base,
13050 diag::err_covariant_return_ambiguous_derived_to_base_conv,
13066 diag::err_covariant_return_type_different_qualifications)
13078 diag::err_covariant_return_type_class_type_more_qualified)
13113 else if (
auto *M = dyn_cast<CXXMethodDecl>(D))
13121 if (
const VarDecl *Var = dyn_cast_or_null<VarDecl>(D))
13122 return Var->isStaticDataMember();
13176 "Parser allowed 'typedef' as storage class of condition decl.");
13182 if (isa<FunctionDecl>(Dcl)) {
13183 Diag(Dcl->getLocation(), diag::err_invalid_use_of_function_type)
13192 if (!ExternalSource)
13198 for (
unsigned I = 0, N = VTables.size(); I != N; ++
I) {
13203 if (!Pos->second && VTables[I].DefinitionRequired)
13204 Pos->second =
true;
13208 VTablesUsed[VTables[
I].Record] = VTables[
I].DefinitionRequired;
13209 NewUses.push_back(
VTableUse(VTables[I].Record, VTables[I].Location));
13216 bool DefinitionRequired) {
13227 Pos =
VTablesUsed.insert(std::make_pair(Class, DefinitionRequired));
13232 if (DefinitionRequired && !Pos.first->second) {
13233 Pos.first->second =
true;
13260 VTableUses.push_back(std::make_pair(Class, Loc));
13272 bool DefinedAnything =
false;
13273 for (
unsigned I = 0; I !=
VTableUses.size(); ++
I) {
13280 bool DefineVTable =
true;
13286 if (KeyFunction && !KeyFunction->
hasBody()) {
13288 DefineVTable =
false;
13293 "Instantiations don't have key functions");
13295 }
else if (!KeyFunction) {
13300 bool IsExplicitInstantiationDeclaration
13303 for (
auto R : Class->
redecls()) {
13307 IsExplicitInstantiationDeclaration =
true;
13309 IsExplicitInstantiationDeclaration =
false;
13314 if (IsExplicitInstantiationDeclaration)
13315 DefineVTable =
false;
13321 if (!DefineVTable) {
13329 DefinedAnything =
true;
13339 if (!KeyFunction ||
13340 (KeyFunction->
hasBody(KeyFunctionDef) &&
13344 ? diag::warn_weak_template_vtable : diag::warn_weak_vtable)
13350 return DefinedAnything;
13355 for (
const auto *I : RD->
methods())
13356 if (I->isVirtual() && !I->isPure())
13365 for (CXXFinalOverriderMap::const_iterator I = FinalOverriders.begin(),
13366 E = FinalOverriders.end();
13369 OE = I->second.end();
13371 assert(OI->second.size() > 0 &&
"no final overrider");
13376 if (!Overrider->isPure())
13385 for (
const auto &I : RD->
bases()) {
13387 cast<CXXRecordDecl>(I.getType()->getAs<
RecordType>()->getDecl());
13405 for (
unsigned i = 0; i < ivars.size(); i++) {
13417 InitSeq.Perform(*
this, InitEntity, InitKind,
None);
13429 AllToInit.push_back(Member);
13434 ->getAs<RecordType>()) {
13435 CXXRecordDecl *RD = cast<CXXRecordDecl>(RecordTy->getDecl());
13439 PDiag(diag::err_access_dtor_ivar)
13445 AllToInit.data(), AllToInit.size());
13451 llvm::SmallSet<CXXConstructorDecl*, 4> &Valid,
13452 llvm::SmallSet<CXXConstructorDecl*, 4> &Invalid,
13453 llvm::SmallSet<CXXConstructorDecl*, 4> &
Current,
13464 (void)Target->
hasBody(FNTarget);
13466 cast_or_null<CXXConstructorDecl>(FNTarget));
13473 if (!Current.insert(Canonical).second)
13479 Valid.insert(Current.begin(), Current.end());
13482 }
else if (TCanonical == Canonical || Invalid.count(TCanonical) ||
13483 Current.count(TCanonical)) {
13485 if (!Invalid.count(TCanonical)) {
13487 diag::warn_delegating_ctor_cycle)
13491 if (TCanonical != Canonical)
13498 assert(FNTarget &&
"Ctor cycle through bodiless function");
13501 cast<CXXConstructorDecl>(FNTarget));
13506 Invalid.insert(Current.begin(), Current.end());
13515 llvm::SmallSet<CXXConstructorDecl*, 4> Valid, Invalid,
Current;
13524 CE = Invalid.end();
13526 (*CI)->setInvalidDecl();
13535 explicit FindCXXThisExpr(
Sema &S) : S(S) { }
13563 FindCXXThisExpr
Finder(*
this);
13588 FindCXXThisExpr
Finder(*
this);
13606 if (!Finder.TraverseType(E))
13616 FindCXXThisExpr
Finder(*
this);
13619 for (
const auto *A : Method->
attrs()) {
13621 Expr *Arg =
nullptr;
13623 if (
const auto *G = dyn_cast<GuardedByAttr>(A))
13625 else if (
const auto *G = dyn_cast<PtGuardedByAttr>(A))
13627 else if (
const auto *AA = dyn_cast<AcquiredAfterAttr>(A))
13628 Args = llvm::makeArrayRef(AA->args_begin(), AA->args_size());
13629 else if (
const auto *AB = dyn_cast<AcquiredBeforeAttr>(A))
13630 Args = llvm::makeArrayRef(AB->args_begin(), AB->args_size());
13631 else if (
const auto *ETLF = dyn_cast<ExclusiveTrylockFunctionAttr>(A)) {
13632 Arg = ETLF->getSuccessValue();
13633 Args = llvm::makeArrayRef(ETLF->args_begin(), ETLF->args_size());
13634 }
else if (
const auto *STLF = dyn_cast<SharedTrylockFunctionAttr>(A)) {
13635 Arg = STLF->getSuccessValue();
13636 Args = llvm::makeArrayRef(STLF->args_begin(), STLF->args_size());
13637 }
else if (
const auto *LR = dyn_cast<LockReturnedAttr>(A))
13638 Arg = LR->getArg();
13639 else if (
const auto *LE = dyn_cast<LocksExcludedAttr>(A))
13640 Args = llvm::makeArrayRef(LE->args_begin(), LE->args_size());
13641 else if (
const auto *RC = dyn_cast<RequiresCapabilityAttr>(A))
13642 Args = llvm::makeArrayRef(RC->args_begin(), RC->args_size());
13643 else if (
const auto *AC = dyn_cast<AcquireCapabilityAttr>(A))
13644 Args = llvm::makeArrayRef(AC->args_begin(), AC->args_size());
13645 else if (
const auto *AC = dyn_cast<TryAcquireCapabilityAttr>(A))
13646 Args = llvm::makeArrayRef(AC->args_begin(), AC->args_size());
13647 else if (
const auto *RC = dyn_cast<ReleaseCapabilityAttr>(A))
13648 Args = llvm::makeArrayRef(RC->args_begin(), RC->args_size());
13650 if (Arg && !Finder.TraverseStmt(Arg))
13653 for (
unsigned I = 0, N = Args.size(); I != N; ++
I) {
13654 if (!Finder.TraverseStmt(Args[I]))
13668 Exceptions.clear();
13671 Exceptions.reserve(DynamicExceptions.size());
13672 for (
unsigned ei = 0, ee = DynamicExceptions.size(); ei != ee; ++ei) {
13679 if (!Unexpanded.empty()) {
13690 Exceptions.push_back(ET);
13698 if (NoexceptExpr) {
13702 "Parser should have made sure that the expression is boolean");
13703 if (IsTopLevel && NoexceptExpr &&
13711 diag::err_noexcept_needs_constant_expression,
13724 Expr *NoexceptExpr) {
13730 MethodD = FunTmpl->getTemplatedDecl();
13740 DynamicExceptionRanges, NoexceptExpr, Exceptions,
13768 Diag(DeclStart, diag::err_anonymous_property);
13790 diag::err_invalid_thread)
13817 PrevDecl =
nullptr;
13821 PrevDecl =
nullptr;
QualType BuildStdInitializerList(QualType Element, SourceLocation Loc)
Looks for the std::initializer_list template and instantiates it with Element, or emits an error if i...
Abstract class used to diagnose incomplete types.
MutableArrayRef< TemplateParameterList * > MultiTemplateParamsArg
unsigned getFlags() const
getFlags - Return the flags for this scope.
A call to an overloaded operator written using operator syntax.
SourceLocation getThreadStorageClassSpecLoc() const
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl)
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType) const
Defines the clang::ASTContext interface.
void ActOnFinishDelayedMemberInitializers(Decl *Record)
unsigned getNumInits() const
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
SourceLocation getEnd() const
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
CastKind getCastKind() const
IdKind getKind() const
Determine what kind of name we have.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
void setImplicit(bool I=true)
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
static StmtResult buildSingleCopyAssignRecursively(Sema &S, SourceLocation Loc, QualType T, const ExprBuilder &To, const ExprBuilder &From, bool CopyingBaseSubobject, bool Copying, unsigned Depth=0)
Builds a statement that copies/moves the given entity from From to To.
CK_LValueToRValue - A conversion which causes the extraction of an r-value from the operand gl-value...
static void CheckForDanglingReferenceOrPointer(Sema &S, ValueDecl *Member, Expr *Init, SourceLocation IdLoc)
Checks a member initializer expression for cases where reference (or pointer) members are bound to by...
bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, DeclarationName Name, FunctionDecl *&Operator, bool Diagnose=true)
bool isDerivedFrom(const CXXRecordDecl *Base) const
Determine whether this class is derived from the class Base.
Name lookup found a set of overloaded functions that met the criteria.
DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo()
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
bool isTransparentContext() const
isTransparentContext - Determines whether this context is a "transparent" context, meaning that the members declared in this context are semantically declared in the nearest enclosing non-transparent (opaque) context but are lexically declared in this context.
bool AttachBaseSpecifiers(CXXRecordDecl *Class, MutableArrayRef< CXXBaseSpecifier * > Bases)
Performs the actual work of attaching the given base class specifiers to a C++ class.
bool needsImplicitMoveConstructor() const
Determine whether this class should get an implicit move constructor or if any existing special membe...
bool isTemplateParameter() const
isTemplateParameter - Determines whether this declaration is a template parameter.
unsigned RefQualifierIsLValueRef
Whether the ref-qualifier (if any) is an lvalue reference.
unsigned getDepth() const
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
void CheckConstructor(CXXConstructorDecl *Constructor)
CheckConstructor - Checks a fully-formed constructor for well-formedness, issuing any diagnostics req...
static bool specialMemberIsConstexpr(Sema &S, CXXRecordDecl *ClassDecl, Sema::CXXSpecialMember CSM, unsigned Quals, bool ConstRHS)
Is the special member function which would be selected to perform the specified operation on the spec...
no exception specification
bool needsOverloadResolutionForDestructor() const
Determine whether we need to eagerly declare a destructor for this class.
bool TemplateParameterListsAreEqual(TemplateParameterList *New, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Determine whether the given template parameter lists are equivalent.
PointerType - C99 6.7.5.1 - Pointer Declarators.
EvaluatedExprVisitor - This class visits 'Expr *'s.
SourceLocation getRestrictSpecLoc() const
A (possibly-)qualified type.
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
Simple class containing the result of Sema::CorrectTypo.
bool CheckTemplateParameterList(TemplateParameterList *NewParams, TemplateParameterList *OldParams, TemplateParamListContext TPC)
Checks the validity of a template parameter list, possibly considering the template parameter list fr...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
SourceLocation getConstSpecLoc() const
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
bool isEquivalentInternalLinkageDeclaration(const NamedDecl *A, const NamedDecl *B)
Determine if A and B are equivalent internal linkage declarations from different modules, and thus an ambiguity error can be downgraded to an extension warning.
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
SourceLocation getExplicitSpecLoc() const
ExtInfo withCallingConv(CallingConv cc) const
QualType getConversionType() const
Returns the type that this conversion function is converting to.
static bool checkTrivialClassMembers(Sema &S, CXXRecordDecl *RD, Sema::CXXSpecialMember CSM, bool ConstArg, bool Diagnose)
Check whether the members of a class type allow a special member to be trivial.
SourceRange getSourceRange() const LLVM_READONLY
Return the source range that covers this unqualified-id.
bool isBitField() const
Determines whether this field is a bitfield.
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace)
ActOnFinishNamespaceDef - This callback is called after a namespace is exited.
void CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *D)
QualType getType() const
Retrieves the type of the base class.
SourceLocation StartLocation
The location of the first token that describes this unqualified-id, which will be the location of the...
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
static unsigned NumImplicitMoveAssignmentOperatorsDeclared
The number of implicitly-declared move assignment operators for which declarations were built...
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
static TypeAliasTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
std::unique_ptr< RecordDeclSetTy > PureVirtualClassDiagSet
PureVirtualClassDiagSet - a set of class declarations which we have emitted a list of pure virtual fu...
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc...
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
method_range methods() const
The subobject is a base class.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
const LangOptions & getLangOpts() const
static CXXConstructExpr * Create(const ASTContext &C, QualType T, SourceLocation Loc, CXXConstructorDecl *D, bool Elidable, ArrayRef< Expr * > Args, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization, ConstructionKind ConstructKind, SourceRange ParenOrBraceRange)
void setLookupName(DeclarationName Name)
Sets the name to look up.
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false)
Perform unqualified name lookup starting from a given scope.
const Scope * getFnParent() const
getFnParent - Return the closest scope that is a function body.
static unsigned NumImplicitDefaultConstructors
The number of implicitly-declared default constructors.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
DeclClass * getAsSingle() const
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration...
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID. ...
bool hasDefaultArg() const
hasDefaultArg - Determines whether this parameter has a default argument, either parsed or not...
Expr *const * semantics_iterator
static ClassTemplateDecl * LookupStdInitializerList(Sema &S, SourceLocation Loc)
IdentifierInfo * Identifier
When Kind == IK_Identifier, the parsed identifier, or when Kind == IK_UserLiteralId, the identifier suffix.
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
Filter makeFilter()
Create a filter for this result set.
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
We are matching the template parameter lists of two templates that might be redeclarations.
CXXMethodDecl * LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the moving assignment operator for the given class.
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
FunctionType - C99 6.7.5.3 - Function Declarators.
CXXCatchStmt * getHandler(unsigned i)
FullExprArg MakeFullExpr(Expr *Arg)
TypeLoc getNamedTypeLoc() const
bool isMain() const
Determines whether this function is "main", which is the entry point into an executable program...
IfStmt - This represents an if/then/else.
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
IdentifierInfo * getCXXLiteralIdentifier() const
getCXXLiteralIdentifier - If this name is the name of a literal operator, retrieve the identifier ass...
CachedTokens * DefaultArgTokens
DefaultArgTokens - When the parameter's default argument cannot be parsed immediately (because it occ...
StmtResult ActOnExprStmt(ExprResult Arg)
const Scope * getParent() const
getParent - Return the scope that this is nested in.
void ActOnStartDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnStartDelayedCXXMethodDeclaration - We have completed parsing a top-level (non-nested) C++ class...
static CharSourceRange getTokenRange(SourceRange R)
void ActOnDocumentableDecl(Decl *D)
Should be called on all declarations that might have attached documentation comments.
void addConst()
Add the const type qualifier to this QualType.
ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating the default expr if needed...
The current expression is potentially evaluated at run time, which means that code may be generated t...
static unsigned NumImplicitMoveAssignmentOperators
The number of implicitly-declared move assignment operators.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
bool needsOverloadResolutionForCopyConstructor() const
Determine whether we need to eagerly declare a defaulted copy constructor for this class...
void ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class)
Force the declaration of any implicitly-declared members of this class.
A conversion function name, e.g., operator int.
DeclResult ActOnCXXConditionDeclaration(Scope *S, Declarator &D)
ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a C++ if/switch/while/for statem...
void erase()
Erase the last element returned from this iterator.
static TemplateSpecializationKind getTemplateSpecializationKind(Decl *D)
Determine what kind of template specialization the given declaration is.
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
bool isRecordType() const
QualType getUnderlyingType() const
void MarkVirtualMemberExceptionSpecsNeeded(SourceLocation Loc, const CXXRecordDecl *RD)
Mark the exception specifications of all virtual member functions in the given class as needed...
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Decl - This represents one declaration (or definition), e.g.
void setRangeEnd(SourceLocation E)
bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, const FunctionProtoType *Proto, unsigned FirstParam, ArrayRef< Expr * > Args, SmallVectorImpl< Expr * > &AllArgs, VariadicCallType CallType=VariadicDoesNotApply, bool AllowExplicit=false, bool IsListInitialization=false)
GatherArgumentsForCall - Collector argument expressions for various form of call prototypes.
chain_range chain() const
ExprResult BuildCallToMemberFunction(Scope *S, Expr *MemExpr, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc)
BuildCallToMemberFunction - Build a call to a member function.
static bool FindBaseInitializer(Sema &SemaRef, CXXRecordDecl *ClassDecl, QualType BaseType, const CXXBaseSpecifier *&DirectBaseSpec, const CXXBaseSpecifier *&VirtualBaseSpec)
Find the direct and/or virtual base specifiers that correspond to the given base type, for use in base initialization within a constructor.
void addDefaultArgExprForConstructor(const CXXConstructorDecl *CD, unsigned ParmIdx, Expr *DAE)
void DiagnoseFunctionSpecifiers(const DeclSpec &DS)
Diagnose function specifiers on a declaration of an identifier that does not identify a function...
void setModulePrivate(bool MP=true)
Specify whether this declaration was marked as being private to the module in which it was defined...
bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, bool AllowBuiltinCreation=false, bool EnteringContext=false)
Performs name lookup for a name that was parsed in the source code, and may contain a C++ scope speci...
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
void setPure(bool P=true)
ExprResult BuildBlockForLambdaConversion(SourceLocation CurrentLocation, SourceLocation ConvLocation, CXXConversionDecl *Conv, Expr *Src)
bool hasFlexibleArrayMember() const
void MarkVirtualMembersReferenced(SourceLocation Loc, const CXXRecordDecl *RD)
MarkVirtualMembersReferenced - Will mark all members of the given CXXRecordDecl referenced.
bool isEnumeralType() const
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
SCS getStorageClassSpec() const
void FindHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
Check if a method overloads virtual methods in a base class without overriding any.
void ActOnBaseSpecifiers(Decl *ClassDecl, MutableArrayRef< CXXBaseSpecifier * > Bases)
ActOnBaseSpecifiers - Attach the given base specifiers to the class, after checking whether there are...
void EvaluateImplicitExceptionSpec(SourceLocation Loc, CXXMethodDecl *MD)
Evaluate the implicit exception specification for a defaulted special member function.
ExprResult CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
static InitializationKind CreateDirect(SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
Create a direct initialization.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
TemplateSpecializationType(TemplateName T, const TemplateArgument *Args, unsigned NumArgs, QualType Canon, QualType Aliased)
static ElaboratedTypeKeyword getKeywordForTagTypeKind(TagTypeKind Tag)
Converts a TagTypeKind into an elaborated type keyword.
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier.
The base class of the type hierarchy.
bool isInStdNamespace() const
bool isElaboratedTypeSpecifier() const
Determine wither this type is a C++ elaborated-type-specifier.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
const FunctionDecl * isLocalClass() const
If the class is a local class [class.local], returns the enclosing function declaration.
void ActOnFinishDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnFinishDelayedCXXMethodDeclaration - We have finished processing the delayed method declaration f...
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
unsigned getLength() const
Efficiently return the length of this identifier info.
MapType::iterator iterator
QualType getRecordType(const RecordDecl *Decl) const
One instance of this struct is used for each type in a declarator that is parsed. ...
bool isCopyConstructor(unsigned &TypeQuals) const
Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the cla...
Declaration of a variable template.
const Expr * getInit() const
void MarkDeclRefReferenced(DeclRefExpr *E)
Perform reference-marking and odr-use handling for a DeclRefExpr.
static InitializationKind CreateDefault(SourceLocation InitLoc)
Create a default initialization.
NamespaceDecl - Represent a C++ namespace.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
Represents a call to a C++ constructor.
static FixItHint CreateInsertionFromRange(SourceLocation InsertionLoc, CharSourceRange FromRange, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code from FromRange at a specific location...
static const char * getSpecifierName(DeclSpec::TST T, const PrintingPolicy &Policy)
Turn a type-specifier-type into a string like "_Bool" or "union".
NamedDecl * getParam(unsigned Idx)
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
RefQualifierKind RefQualifier
A container of type source information.
bool defaultedDefaultConstructorIsConstexpr() const
Determine whether a defaulted default constructor for this class would be constexpr.
unsigned getIndex() const
const Stmt * getElse() const
bool inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl, CXXSpecialMember CSM, CXXMethodDecl *MemberDecl, bool ConstRHS, bool Diagnose)
Given a implicit special member, infer its CUDA target from the calls it needs to make to underlying ...
SourceLocation getLocEnd() const LLVM_READONLY
bool needsImplicitDestructor() const
Determine whether this class needs an implicit destructor to be lazily declared.
static FriendDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_, SourceLocation FriendL, ArrayRef< TemplateParameterList * > FriendTypeTPLists=None)
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
bool hasUserDeclaredCopyAssignment() const
Determine whether this class has a user-declared copy assignment operator.
Represents a C++ constructor within a class.
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
bool hasErrorOccurred() const
Determine whether any errors have occurred since this object instance was created.
Expr * getInClassInitializer() const
getInClassInitializer - Get the C++11 in-class initializer for this member, or null if one has not be...
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
InClassInitStyle getInClassInitStyle() const
getInClassInitStyle - Get the kind of (C++11) in-class initializer which this field has...
bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S)
MergeCXXFunctionDecl - Merge two declarations of the same C++ function, once we already know that the...
const llvm::APInt & getSize() const
void CheckCXXDefaultArguments(FunctionDecl *FD)
CheckCXXDefaultArguments - Verify that the default arguments for a function declaration are well-form...
RAII object to handle the state changes required to synthesize a function body.
Look up a namespace name within a C++ using directive or namespace alias definition, ignoring non-namespace names (C++ [basic.lookup.udir]p1).
CXXMethodDecl * DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit move assignment operator for the given class.
void ActOnFinishCXXNonNestedClass(Decl *D)
static void DiagnoseBaseOrMemInitializerOrder(Sema &SemaRef, const CXXConstructorDecl *Constructor, ArrayRef< CXXCtorInitializer * > Inits)
This file provides some common utility functions for processing Lambda related AST Constructs...
CXXConstructorDecl * LookupMovingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the moving constructor for the given class.
bool DiagnoseClassNameShadow(DeclContext *DC, DeclarationNameInfo Info)
DiagnoseClassNameShadow - Implement C++ [class.mem]p13: If T is the name of a class, then each of the following shall have a name different from T:
void ActOnDefaultCtorInitializers(Decl *CDtorDecl)
DeclContext::lookup_result Decls
The set of declarations found inside this base class subobject.
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
RAII object that enters a new expression evaluation context.
void ActOnStartDelayedMemberDeclarations(Scope *S, Decl *Record)
VarDecl - An instance of this class is created to represent a variable declaration or definition...
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
CXXMethodDecl * LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the copying assignment operator for the given class.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
std::pair< CXXRecordDecl *, CXXSpecialMember > SpecialMemberDecl
Expr * getInit() const
Get the initializer.
Information about one declarator, including the parsed type information and the identifier.
DiagnosticsEngine & Diags
Wrapper for source info for member pointers.
const Expr * getCallee() const
void finishedDefaultedOrDeletedMember(CXXMethodDecl *MD)
Indicates that the declaration of a defaulted or deleted special member function is now complete...
OverloadKind CheckOverload(Scope *S, FunctionDecl *New, const LookupResult &OldDecls, NamedDecl *&OldDecl, bool IsForUsingDecl)
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
Extra information about a function prototype.
AccessSpecifier getAccess() const
void clear()
Clear the base-paths results.
CallingConv getCallConv() const
AccessResult CheckDestructorAccess(SourceLocation Loc, CXXDestructorDecl *Dtor, const PartialDiagnostic &PDiag, QualType objectType=QualType())
field_iterator field_begin() const
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
MapType::const_iterator const_iterator
The "__interface" keyword.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
RAII class that determines when any errors have occurred between the time the instance was created an...
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
SmallVector< CXXRecordDecl *, 4 > DelayedDllExportClasses
bool hasGlobalStorage() const
Returns true for all variables that do not have local storage.
bool isCopyOrMoveConstructor(unsigned &TypeQuals) const
Determine whether this is a copy or move constructor.
Like System, but searched after the system directories.
bool AddOverriddenMethods(CXXRecordDecl *DC, CXXMethodDecl *MD)
AddOverriddenMethods - See if a method overrides any in the base classes, and if so, check that it's a valid override and remember it.
SpecialMemberOverloadResult * LookupSpecialMember(CXXRecordDecl *D, CXXSpecialMember SM, bool ConstArg, bool VolatileArg, bool RValueThis, bool ConstThis, bool VolatileThis)
static StmtResult buildMemcpyForAssignmentOp(Sema &S, SourceLocation Loc, QualType T, const ExprBuilder &ToB, const ExprBuilder &FromB)
When generating a defaulted copy or move assignment operator, if a field should be copied with __buil...
Stores a list of template parameters for a TemplateDecl and its derived classes.
void setBegin(SourceLocation b)
static StringRef getTagTypeKindName(TagTypeKind Kind)
static InitializationKind CreateDirectList(SourceLocation InitLoc)
decl_iterator decls_end() const
NamedDecl * ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope)
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class.copy]p25)
void DefineImplicitLambdaToFunctionPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a function pointer.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
Decl * ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, MultiTemplateParamsArg TemplateParams)
Handle a friend type declaration.
bool SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM, bool Diagnose=false)
Determine whether a defaulted or deleted special member function is trivial, as specified in C++11 [c...
static AccessSpecDecl * Create(ASTContext &C, AccessSpecifier AS, DeclContext *DC, SourceLocation ASLoc, SourceLocation ColonLoc)
ParmVarDecl - Represents a parameter to a function.
bool isObjCRetainableType() const
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
type_object_range type_objects() const
Returns the range of type objects, from the identifier outwards.
Defines the clang::Expr interface and subclasses for C++ expressions.
Parse and apply any fixits to the source.
const CXXRecordDecl * getTemplateInstantiationPattern() const
Retrieve the record declaration from which this record could be instantiated.
void removeDecl(Decl *D)
Removes a declaration from this context.
bool isEmpty() const
No scope specifier.
iterator begin(Source *source, bool LocalOnly=false)
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec, TypedefNameDecl *NewTD)
void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old)
Merge the exception specifications of two variable declarations.
A reasonable base class for TypeLocs that correspond to types that are written as a type-specifier...
The collection of all-type qualifiers we support.
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
void DefineImplicitMoveConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitMoveConstructor - Checks for feasibility of defining this constructor as the move const...
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
FieldDecl * HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, InClassInitStyle InitStyle, AccessSpecifier AS)
HandleField - Analyze a field of a C struct or a C++ data member.
bool hasTrivialCopyConstructor() const
Determine whether this class has a trivial copy constructor (C++ [class.copy]p6, C++11 [class...
bool FTIHasNonVoidParameters(const DeclaratorChunk::FunctionTypeInfo &FTI)
QualType CheckConstructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckConstructorDeclarator - Called by ActOnDeclarator to check the well-formedness of the constructo...
static bool isIncompleteOrZeroLengthArrayType(ASTContext &Context, QualType T)
Determine whether the given type is an incomplete or zero-lenfgth array type.
void CheckDelayedMemberExceptionSpecs()
Base wrapper for a particular "section" of type source info.
void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool OdrUse)
Perform marking for a reference to an arbitrary declaration.
unsigned getNumParams() const
AccessResult CheckFriendAccess(NamedDecl *D)
Checks access to the target of a friend declaration.
RecordDecl - Represents a struct/union/class.
Decl * ActOnAliasDeclaration(Scope *CurScope, AccessSpecifier AS, MultiTemplateParamsArg TemplateParams, SourceLocation UsingLoc, UnqualifiedId &Name, AttributeList *AttrList, TypeResult Type, Decl *DeclFromDeclSpec)
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body (definition).
void LoadExternalVTableUses()
Load any externally-stored vtable uses.
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
bool hasUninstantiatedDefaultArg() const
bool isExternC() const
Determines whether this function is a function with external, C linkage.
static bool IsEquivalentForUsingDecl(ASTContext &Context, NamedDecl *D1, NamedDecl *D2)
Determine whether a using declaration considers the given declarations as "equivalent", e.g., if they are redeclarations of the same entity or are both typedefs of the same type.
TemplateIdAnnotation * TemplateId
When Kind == IK_TemplateId or IK_ConstructorTemplateId, the template-id annotation that contains the ...
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
DeclarationName getName() const
getName - Returns the embedded declaration name.
FunctionType::ExtInfo ExtInfo
Represents a class template specialization, which refers to a class template with a given set of temp...
One of these records is kept for each identifier that is lexed.
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
static bool IsUsingDirectiveInToplevelContext(DeclContext *CurContext)
Determine whether a using statement is in a context where it will be apply in all contexts...
Decl * ActOnNamespaceAliasDef(Scope *CurScope, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident)
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name)
Retrieves the declaration name from a parsed unqualified-id.
void setRecordingPaths(bool RP)
Specify whether we should be recording paths or not.
method_iterator end_overridden_methods() const
FieldDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this field.
void DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl)
DiagnoseTemplateParameterShadow - Produce a diagnostic complaining that the template parameter 'PrevD...
Decl * ActOnUsingDeclaration(Scope *CurScope, AccessSpecifier AS, bool HasUsingKeyword, SourceLocation UsingLoc, CXXScopeSpec &SS, UnqualifiedId &Name, AttributeList *AttrList, bool HasTypenameKeyword, SourceLocation TypenameLoc)
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
UnionParsedType ConversionFunctionId
When Kind == IK_ConversionFunctionId, the type that the conversion function names.
AttributeList * getList() const
void setUninstantiatedDefaultArg(Expr *arg)
const TemplateArgumentList * getTemplateSpecializationArgs() const
Retrieve the template arguments used to produce this function template specialization from the primar...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
static unsigned NumImplicitMoveConstructorsDeclared
The number of implicitly-declared move constructors for which declarations were built.
A C++ nested-name-specifier augmented with source location information.
The results of name lookup within a DeclContext.
unsigned getNumArgs() const
ArrayRef< QualType > getParamTypes() const
bool isDelegatingConstructor() const
Determine whether this constructor is a delegating constructor.
bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors, ArrayRef< CXXCtorInitializer * > Initializers=None)
ImplicitInitializerKind
ImplicitInitializerKind - How an implicit base or member initializer should initialize its base or me...
const CXXScopeSpec & getCXXScopeSpec() const
getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part...
bool isIdentifier() const
Predicate functions for querying what type of name this is.
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
static void AddMostOverridenMethods(const CXXMethodDecl *MD, llvm::SmallPtrSetImpl< const CXXMethodDecl * > &Methods)
Add the most overriden methods from MD to Methods.
SourceLocation getLocStart() const LLVM_READONLY
bool isRecordingPaths() const
Whether we are recording paths.
bool isReferenceType() const
BaseResult ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange, ParsedAttributes &Attrs, bool Virtual, AccessSpecifier Access, ParsedType basetype, SourceLocation BaseLoc, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
static bool CollectFieldInitializer(Sema &SemaRef, BaseAndFieldInfo &Info, FieldDecl *Field, IndirectFieldDecl *Indirect=nullptr)
QualType getReturnType() const
void checkExceptionSpecification(bool IsTopLevel, ExceptionSpecificationType EST, ArrayRef< ParsedType > DynamicExceptions, ArrayRef< SourceRange > DynamicExceptionRanges, Expr *NoexceptExpr, SmallVectorImpl< QualType > &Exceptions, FunctionProtoType::ExceptionSpecInfo &ESI)
Check the given exception-specification and update the exception specification information with the r...
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause...
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
CXXConstructorDecl * getTargetConstructor() const
When this constructor delegates to another, retrieve the target.
bool needsOverloadResolutionForMoveConstructor() const
Determine whether we need to eagerly declare a defaulted move constructor for this class...
NoexceptResult
Result type of getNoexceptSpec().
bool isAbstractType(SourceLocation Loc, QualType T)
static bool isIncrementDecrementOp(Opcode Op)
unsigned TypeQuals
The type qualifiers: const/volatile/restrict.
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, FullExprArg Second, Decl *SecondVar, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
void Deallocate(void *Ptr) const
ParmVarDecl * getParam(unsigned i) const
unsigned getIdentifierNamespace() const
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
SourceLocation getExprLoc() const LLVM_READONLY
const CXXRecordDecl * getPointeeCXXRecordDecl() const
If this is a pointer or reference to a RecordType, return the CXXRecordDecl that that type refers to...
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
This is not an overload because the signature exactly matches an existing declaration.
CXXRecordDecl * getDefinition() const
static CXXCtorInitializer * Create(ASTContext &Context, FieldDecl *Member, SourceLocation MemberLoc, SourceLocation L, Expr *Init, SourceLocation R, VarDecl **Indices, unsigned NumIndices)
Creates a new member initializer that optionally contains array indices used to describe an elementwi...
bool isTranslationUnit() const
void setElaboratedKeywordLoc(SourceLocation Loc)
TagKind getTagKind() const
The iterator over UnresolvedSets.
SourceRange getLocalSourceRange() const
Get the local source range.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
static void extendLeft(SourceRange &R, SourceRange Before)
static DeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *D, bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc, QualType T, ExprValueKind VK, NamedDecl *FoundD=nullptr, const TemplateArgumentListInfo *TemplateArgs=nullptr)
bool isMoveConstructor(unsigned &TypeQuals) const
Determine whether this constructor is a move constructor (C++11 [class.copy]p3), which can be used to...
bool hasInClassInitializer() const
Whether this class has any in-class initializers for non-static data members (including those in anon...
SourceLocation getTypeSpecTypeLoc() const
SourceLocation getLocStart() const LLVM_READONLY
static bool CheckConstexprFunctionStmt(Sema &SemaRef, const FunctionDecl *Dcl, Stmt *S, SmallVectorImpl< SourceLocation > &ReturnStmts, SourceLocation &Cxx1yLoc)
Check the provided statement is allowed in a constexpr function definition.
bool DefineUsedVTables()
Define all of the vtables that have been used in this translation unit and reference any virtual memb...
Represents an access specifier followed by colon ':'.
void ClearStorageClassSpecs()
bool needsImplicitCopyAssignment() const
Determine whether this class needs an implicit copy assignment operator to be lazily declared...
void addShadowDecl(UsingShadowDecl *S)
i32 captured_struct **param SharedsTy A type which contains references the shared variables *param Shareds Context with the list of shared variables from the p *TaskFunction *param IfCond Not a nullptr if if clause was nullptr *otherwise *param PrivateVars List of references to private variables for the task *directive *param PrivateCopies List of private copies for each private variable in *p PrivateVars *param FirstprivateVars List of references to private variables for the *task directive *param FirstprivateCopies List of private copies for each private variable *in p FirstprivateVars *param FirstprivateInits List of references to auto generated variables *used for initialization of a single array element Used if firstprivate *variable is of array type *param Dependences List of dependences for the task construct
TypeSourceInfo * getTypeSourceInfo() const
Decl * ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, AccessSpecifier AS, SourceLocation ModulePrivateLoc, MultiTemplateParamsArg TemplateParameterLists, bool &OwnedDecl, bool &IsDependent, SourceLocation ScopedEnumKWLoc, bool ScopedEnumUsesClassTag, TypeResult UnderlyingType, bool IsTypeSpecifier, SkipBodyInfo *SkipBody=nullptr)
This is invoked when we see 'struct foo' or 'struct {'.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
void PopExpressionEvaluationContext()
static FriendTemplateDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation Loc, unsigned NParams, TemplateParameterList **Params, FriendUnion Friend, SourceLocation FriendLoc)
void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType)
FinalizeVarWithDestructor - Prepare for calling destructor on the constructed variable.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
void CheckExtraCXXDefaultArguments(Declarator &D)
CheckExtraCXXDefaultArguments - Check for any extra default arguments in the declarator, which is not a function declaration or definition and therefore is not permitted to have default arguments.
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
static bool adjustContextForLocalExternDecl(DeclContext *&DC)
Adjust the DeclContext for a function or variable that might be a function-local external declaration...
SpecialMemberOverloadResult - The overloading result for a special member function.
void NoteDeletedFunction(FunctionDecl *FD)
Emit a note explaining that this function is deleted.
The type of an exception.
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted per C++0x.
A location where the result (returned value) of evaluating a statement should be stored.
SourceLocation getBeginLoc() const
Get the begin source location.
static bool CheckConstexprDeclStmt(Sema &SemaRef, const FunctionDecl *Dcl, DeclStmt *DS, SourceLocation &Cxx1yLoc)
Check the given declaration statement is legal within a constexpr function body.
UnionParsedType DestructorName
When Kind == IK_DestructorName, the type referred to by the class-name.
Describes an C or C++ initializer list.
Represents a C++ using-declaration.
bool implicitCopyConstructorHasConstParam() const
Determine whether an implicit copy constructor for this type would have a parameter with a const-qual...
Represents a C++ unqualified-id that has been parsed.
An rvalue reference type, per C++11 [dcl.ref].
bool isCompleteType(SourceLocation Loc, QualType T)
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
NamespaceDecl * getOrCreateStdNamespace()
Retrieve the special "std" namespace, which may require us to implicitly define the namespace...
Represents the results of name lookup.
const TargetInfo & getTargetInfo() const
bool DiagnoseUnexpandedParameterPacks(SourceLocation Loc, UnexpandedParameterPackContext UPPC, ArrayRef< UnexpandedParameterPack > Unexpanded)
Diagnose unexpanded parameter packs.
bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics...
void CalledExpr(Expr *E)
Integrate an invoked expression into the collected data.
const LangOptions & getLangOpts() const
bool isLastDiagnosticIgnored() const
Determine whether the previous diagnostic was ignored.
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
static InitializedEntity InitializeDelegation(QualType Type)
Create the initialization entity for a delegated constructor.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
bool isInline() const
Returns true if this is an inline namespace declaration.
ImplicitExceptionSpecification ComputeInheritingCtorExceptionSpec(CXXConstructorDecl *CD)
Determine what sort of exception specification an inheriting constructor of a class will have...
IndirectFieldDecl * getIndirectMember() const
Microsoft throw(...) extension.
A convenient class for passing around template argument information.
bool isFunctionDeclarationContext() const
Return true if this declaration appears in a context where a function declarator would be a function ...
static bool isStaticDataMember(const Decl *D)
Determine whether the given declaration is a static data member.
virtual void HandleVTable(CXXRecordDecl *RD)
Callback involved at the end of a translation unit to notify the consumer that a vtable for the given...
CXXConstructorDecl * DeclareImplicitMoveConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit move constructor for the given class.
bool isSpecialMemberAccessibleForDeletion(CXXMethodDecl *decl, AccessSpecifier access, QualType objectType)
Is the given special member function accessible for the purposes of deciding whether to define a spec...
The base type of a class type.
bool checkThisInStaticMemberFunctionType(CXXMethodDecl *Method)
Check whether 'this' shows up in the type of a static member function after the (naturally empty) cv-...
QualType getReturnType() const
Look up all declarations in a scope with the given name, including resolved using declarations...
bool CheckUsingShadowDecl(UsingDecl *UD, NamedDecl *Target, const LookupResult &PreviousDecls, UsingShadowDecl *&PrevShadow)
Determines whether to create a using shadow decl for a particular decl, given the set of decls existi...
unsigned getMinRequiredArguments() const
getMinRequiredArguments - Returns the minimum number of arguments needed to call this function...
bool isCurrentClassNameTypo(IdentifierInfo *&II, const CXXScopeSpec *SS)
Determine whether the identifier II is a typo for the name of the class type currently being defined...
bool CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionExceptionSpec - Checks whether the exception spec is a subset of base spec...
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
bool isDefaulted() const
Whether this function is defaulted per C++0x.
bool CheckConstexprFunctionDecl(const FunctionDecl *FD)
void DefineInheritingConstructor(SourceLocation UseLoc, CXXConstructorDecl *Constructor)
Define the specified inheriting constructor.
An x-value expression is a reference to an object with independent storage but which can be "moved"...
field_range fields() const
A friend of a previously-undeclared entity.
void RemoveDecl(NamedDecl *D)
RemoveDecl - Unlink the decl from its shadowed decl chain.
static bool BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, ImplicitInitializerKind ImplicitInitKind, FieldDecl *Field, IndirectFieldDecl *Indirect, CXXCtorInitializer *&CXXMemberInit)
bool diagnoseQualifiedDeclaration(CXXScopeSpec &SS, DeclContext *DC, DeclarationName Name, SourceLocation Loc)
Diagnose a declaration whose declarator-id has the given nested-name-specifier.
static void NoteIndirectBases(ASTContext &Context, IndirectBaseSet &Set, const QualType &Type)
Recursively add the bases of Type. Don't add Type itself.
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, AttributeList *AttrList, bool IsInstantiation, bool HasTypenameKeyword, SourceLocation TypenameLoc)
Builds a using declaration.
static bool isValidUDSuffix(const LangOptions &LangOpts, StringRef Suffix)
Determine whether a suffix is a valid ud-suffix.
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
semantics_iterator semantics_end()
SourceLocation getLocStart() const LLVM_READONLY
TypeDecl - Represents a declaration of a type.
Expr * getNoexceptExpr() const
A builtin binary operation expression such as "x + y" or "x <= y".
An implicit 'self' parameter.
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
RecordDecl * getDecl() const
FunctionDecl * getTemplateInstantiationPattern() const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
void CheckDelegatingCtorCycles()
QualType CheckDestructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckDestructorDeclarator - Called by ActOnDeclarator to check the well-formednes of the destructor d...
ImplicitExceptionSpecification ComputeDefaultedDtorExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted destructor of a class will have...
static void ReferenceDllExportedMethods(Sema &S, CXXRecordDecl *Class)
static void checkMoveAssignmentForRepeatedMove(Sema &S, CXXRecordDecl *Class, SourceLocation CurrentLocation)
Check if we're implicitly defining a move assignment operator for a class with virtual bases...
void setExceptionVariable(bool EV)
bool isOverloadedOperator() const
isOverloadedOperator - Whether this function declaration represents an C++ overloaded operator...
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
bool isVariadic() const
Whether this function is variadic.
Scope - A scope is a transient data structure that is used while parsing the program.
ExprResult Perform(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, QualType *ResultType=nullptr)
Perform the actual initialization of the given entity based on the computed initialization sequence...
The type of a data member.
bool SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg, SourceLocation EqualLoc)
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
CXXBaseSpecifier * CheckBaseSpecifier(CXXRecordDecl *Class, SourceRange SpecifierRange, bool Virtual, AccessSpecifier Access, TypeSourceInfo *TInfo, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
ExprResult ActOnCXXThis(SourceLocation loc)
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
Represents a C++ nested-name-specifier or a global scope specifier.
static unsigned NumImplicitDefaultConstructorsDeclared
The number of implicitly-declared default constructors for which declarations were built...
void setNumCtorInitializers(unsigned numCtorInitializers)
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
static UnresolvedUsingValueDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo)
std::string getAsString() const
getNameAsString - Retrieve the human-readable string for this name.
SourceLocation getLocation() const
SourceLocation getLocStart() const LLVM_READONLY
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
bool isStaticLocal() const
isStaticLocal - Returns true if a variable with function scope is a static local variable.
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
static bool findCircularInheritance(const CXXRecordDecl *Class, const CXXRecordDecl *Current)
Determine whether the given class is a base class of the given class, including looking at dependent ...
static void DelegatingCycleHelper(CXXConstructorDecl *Ctor, llvm::SmallSet< CXXConstructorDecl *, 4 > &Valid, llvm::SmallSet< CXXConstructorDecl *, 4 > &Invalid, llvm::SmallSet< CXXConstructorDecl *, 4 > &Current, Sema &S)
An ordinary object is located at an address in memory.
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
A class that does preorder depth-first traversal on the entire Clang AST and visits each node...
Decl * ActOnStartLinkageSpecification(Scope *S, SourceLocation ExternLoc, Expr *LangStr, SourceLocation LBraceLoc)
ActOnStartLinkageSpecification - Parsed the beginning of a C++ linkage specification, including the language and (if present) the '{'.
Represents an ObjC class declaration.
DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, TemplateParameterList *TemplateParams, AccessSpecifier AS, SourceLocation ModulePrivateLoc, SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists, TemplateParameterList **OuterTemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
Represents a linkage specification.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
static FunctionTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
SourceLocation getLocStart() const LLVM_READONLY
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
Member name lookup, which finds the names of class/struct/union members.
decl_iterator decls_begin() const
SourceRange getSourceRange() const LLVM_READONLY
detail::InMemoryDirectory::const_iterator I
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
unsigned getNumParams() const
QualType getCanonicalTypeInternal() const
init_iterator init_begin()
Retrieve an iterator to the first initializer.
const LangOptions & LangOpts
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
bool isUnnamedBitfield() const
Determines whether this is an unnamed bitfield.
void ProcessDeclAttributeList(Scope *S, Decl *D, const AttributeList *AL, bool IncludeCXX11Attributes=true)
ProcessDeclAttributeList - Apply all the decl attributes in the specified attribute list to the speci...
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc)
PopPragmaVisibility - Pop the top element of the visibility stack; used for '#pragma GCC visibility' ...
This object can be modified without requiring retains or releases.
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5...
SourceRange getRange() const
bool isDefined(const FunctionDecl *&Definition) const
isDefined - Returns true if the function is defined at all, including a deleted definition.
param_iterator param_begin()
Represents the this expression in C++.
UsingShadowDecl * BuildUsingShadowDecl(Scope *S, UsingDecl *UD, NamedDecl *Target, UsingShadowDecl *PrevDecl)
Builds a shadow declaration corresponding to a 'using' declaration.
bool isAbstract() const
Determine whether this class has a pure virtual function.
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
field_iterator field_end() const
bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool IsForUsingDecl)
Class that aids in the construction of nested-name-specifiers along with source-location information ...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
static StmtResult buildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T, const ExprBuilder &To, const ExprBuilder &From, bool CopyingBaseSubobject, bool Copying)
SourceLocation LAngleLoc
The location of the '<' before the template argument list.
void removeInClassInitializer()
removeInClassInitializer - Remove the C++11 in-class initializer from this member.
CXXMethodDecl * getMethod() const
void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl)
ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an initializer for the declaratio...
bool isTemplateParameterPack() const
isTemplateParameter - Determines whether this declaration is a template parameter pack...
CXXSpecialMember
Kinds of C++ special members.
QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
MemInitResult BuildMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, Expr *Init, SourceLocation EllipsisLoc)
Handle a C++ member initializer.
void setBases(CXXBaseSpecifier const *const *Bases, unsigned NumBases)
Sets the base classes of this struct or class.
CXXConstructorDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
ConditionalOperator - The ?: ternary operator.
DeclSpec & getMutableDeclSpec()
getMutableDeclSpec - Return a non-const version of the DeclSpec.
Sema - This implements semantic analysis and AST building for C.
Decl * ActOnEmptyDeclaration(Scope *S, AttributeList *AttrList, SourceLocation SemiLoc)
Handle a C++11 empty-declaration and attribute-declaration.
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x alias-declaration.
CanQualType getCanonicalTypeUnqualified() const
TST getTypeSpecType() const
CompoundStmt - This represents a group of statements like { stmt stmt }.
const DeclarationNameInfo & getLookupNameInfo() const
Gets the name info to look up.
QualType getParamType(unsigned i) const
Represents a prototype with parameter type info, e.g.
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
bool hasIrrelevantDestructor() const
Determine whether this class has a destructor which has no semantic effect.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
void ClearConstexprSpec()
SourceLocation getLocStart() const LLVM_READONLY
CXXMethodDecl * getMethodDecl() const
Retrieves the declaration of the called method.
ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
CreateBuiltinBinOp - Creates a new built-in binary operation with operator Opc at location TokLoc...
void ActOnFinishCXXMemberDecls()
Perform any semantic analysis which needs to be delayed until all pending class member declarations h...
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
void DefineImplicitCopyAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared copy assignment operator.
Causes a block literal to by copied to the heap and then autoreleased.
bool isParameterPack() const
Determine whether this parameter is actually a function parameter pack.
static unsigned NumImplicitCopyConstructors
The number of implicitly-declared copy constructors.
A RAII object to enter scope of a compound statement.
bool isStdInitializerList(QualType Ty, QualType *Element)
Tests whether Ty is an instance of std::initializer_list and, if it is and Element is not NULL...
bool inferObjCARCLifetime(ValueDecl *decl)
Represents a ValueDecl that came out of a declarator.
bool needsImplicitMoveAssignment() const
Determine whether this class should get an implicit move assignment operator or if any existing speci...
static InitializedEntity InitializeMember(FieldDecl *Member, const InitializedEntity *Parent=nullptr)
Create the initialization entity for a member subobject.
param_type_iterator param_type_begin() const
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat)
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp)
ImplicitExceptionSpecification ComputeDefaultedCopyCtorExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted default constructor of a class will have...
SourceLocation getFriendSpecLoc() const
DeclarationNameTable DeclarationNames
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e.
static bool defaultedSpecialMemberIsConstexpr(Sema &S, CXXRecordDecl *ClassDecl, Sema::CXXSpecialMember CSM, bool ConstArg)
Determine whether the specified special member function would be constexpr if it were implicitly defi...
static EmptyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L)
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
static StaticAssertDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *Message, SourceLocation RParenLoc, bool Failed)
ID
Defines the set of possible language-specific address spaces.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
bool isMoreQualifiedThan(QualType Other) const
Determine whether this type is more qualified than the other given type, requiring exact equality for...
const CXXMethodDecl *const * method_iterator
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
void setInClassInitializer(Expr *Init)
setInClassInitializer - Set the C++11 in-class initializer for this member.
bool isCXXClassMember() const
Determine whether this declaration is a C++ class member.
void ActOnReenterCXXMethodParameter(Scope *S, ParmVarDecl *Param)
This is used to implement the constant expression evaluation part of the attribute enable_if extensio...
MemInitResult BuildMemberInitializer(ValueDecl *Member, Expr *Init, SourceLocation IdLoc)
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
bool InstantiateInClassInitializer(SourceLocation PointOfInstantiation, FieldDecl *Instantiation, FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the definition of a field from the given pattern.
unsigned getTypeQualifiers() const
getTypeQualifiers - Return a set of TQs.
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isImplicitlyDeclared)
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
Allows QualTypes to be sorted and hence used in maps and sets.
Decl * ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *AssertMessageExpr, SourceLocation RParenLoc)
bool isDeleted() const
Whether this function has been deleted.
bool checkThisInStaticMemberFunctionExceptionSpec(CXXMethodDecl *Method)
Whether this' shows up in the exception specification of a static member function.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
const Type * getTypeForDecl() const
unsigned param_size() const
unsigned getTypeQualifiers() const
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(NamedDecl *D, const TemplateArgumentList *Innermost=nullptr, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
StringRef getName() const
Return the actual identifier string.
void DefineImplicitCopyConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitCopyConstructor - Checks for feasibility of defining this constructor as the copy const...
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
SourceLocation getAtomicSpecLoc() const
bool isDeclarationOfFunction() const
Determine whether the declaration that will be produced from this declaration will be a function...
ImplicitExceptionSpecification ComputeDefaultedMoveCtorExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted move constructor of a class will have...
bool isDeclScope(Decl *D)
isDeclScope - Return true if this is the scope that the specified decl is declared in...
Helper class that collects exception specifications for implicitly-declared special member functions...
MatchFinder::MatchCallback * Callback
void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath)
Declaration of a template type parameter.
NestedNameSpecifier * getCorrectionSpecifier() const
Gets the NestedNameSpecifier needed to use the typo correction.
bool isFunctionDefinition() const
void setHideTags(bool Hide)
Sets whether tag declarations should be hidden by non-tag declarations during resolution.
static void getDefaultArgExprsForConstructors(Sema &S, CXXRecordDecl *Class)
This file defines the classes used to store parsed information about declaration-specifiers and decla...
bool Encloses(const DeclContext *DC) const
Determine whether this declaration context encloses the declaration context DC.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
void setRBraceLoc(SourceLocation L)
static InitializedEntity InitializeVariable(VarDecl *Var)
Create the initialization entity for a variable.
Represents a C++ destructor within a class.
LazyDeclPtr StdNamespace
The C++ "std" namespace, where the standard library resides.
void freeParams()
Reset the parameter list to having zero parameters.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
TranslationUnitDecl * getTranslationUnitDecl() const
static unsigned NumImplicitMoveConstructors
The number of implicitly-declared move constructors.
NamedDecl * getFoundDecl() const
Fetch the unique decl found by this lookup.
llvm::SmallSet< SpecialMemberDecl, 4 > SpecialMembersBeingDeclared
The C++ special members which we are currently in the process of declaring.
bool isLiteral() const
Determine whether this class is a literal type.
void PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir)
void setRBraceLoc(SourceLocation L)
Defines the clang::Preprocessor interface.
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD)
Additional checks for a using declaration referring to a constructor name.
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, bool AllowFold=true)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
ArgKind getKind() const
Return the kind of stored template argument.
const ParmVarDecl * getParamDecl(unsigned i) const
ExtProtoInfo getExtProtoInfo() const
bool isInitListConstructor(const CXXConstructorDecl *Ctor)
Determine whether Ctor is an initializer-list constructor, as defined in [dcl.init.list]p2.
SourceLocation getVolatileSpecLoc() const
bool isLocalExternDecl()
Determine whether this is a block-scope declaration with linkage.
bool ActOnAccessSpecifier(AccessSpecifier Access, SourceLocation ASLoc, SourceLocation ColonLoc, AttributeList *Attrs=nullptr)
ActOnAccessSpecifier - Parsed an access specifier followed by a colon.
DeclContext * getDeclContext()
void PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP=nullptr, const Decl *D=nullptr, const BlockExpr *blkExpr=nullptr)
FunctionProtoType::ExceptionSpecInfo getExceptionSpec() const
Overwrite an EPI's exception specification with this computed exception specification.
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
static TagTypeKind getTagTypeKindForTypeSpec(unsigned TypeSpec)
Converts a type specifier (DeclSpec::TST) into a tag type kind.
void ActOnFinishCXXInClassMemberInitializer(Decl *VarDecl, SourceLocation EqualLoc, Expr *Init)
This is invoked after parsing an in-class initializer for a non-static C++ class member, and after instantiating an in-class initializer in a class template.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
CXXTryStmt - A C++ try block, including all handlers.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param)
ActOnDelayedCXXMethodParameter - We've already started a delayed C++ method declaration.
Represents a C++ template name within the type system.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
bool hasUserDeclaredMoveConstructor() const
Determine whether this class has had a move constructor declared by the user.
NamedDecl * ActOnTypedefNameDecl(Scope *S, DeclContext *DC, TypedefNameDecl *D, LookupResult &Previous, bool &Redeclaration)
ActOnTypedefNameDecl - Perform semantic checking for a declaration which declares a typedef-name...
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
Defines the clang::TypeLoc interface and its subclasses.
There is no noexcept specifier.
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getLastLocation() const
SourceRange getDefaultArgRange() const
Retrieve the source range that covers the entire default argument.
bool isVisible(const NamedDecl *D)
Determine whether a declaration is visible to name lookup.
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
void DiscardCleanupsInEvaluationContext()
bool isConstexprSpecified() const
void propagateDLLAttrToBaseClassTemplate(CXXRecordDecl *Class, Attr *ClassAttr, ClassTemplateSpecializationDecl *BaseTemplateSpec, SourceLocation BaseLoc)
Perform propagation of DLL attributes from a derived class to a templated base class for MS compatibi...
ASTMutationListener * getASTMutationListener() const
bool isExplicit() const
Determine whether this constructor was marked "explicit" or not.
void setInheritConstructors(bool Inherit=true)
Set that this base class's constructors should be inherited.
QualType getType() const
Get the type for which this source info wrapper provides information.
SourceLocation getLocEnd() const LLVM_READONLY
SmallVector< VTableUse, 16 > VTableUses
The list of vtables that are required but have not yet been materialized.
static bool isPotentialConstantExpr(const FunctionDecl *FD, SmallVectorImpl< PartialDiagnosticAt > &Diags)
isPotentialConstantExpr - Return true if this function's definition might be usable in a constant exp...
StorageClass
Storage classes.
Expr * getSubExpr() const
bool hasTypeSpecifier() const
Return true if any type-specifier has been found.
TemplateDecl * AdjustDeclIfTemplate(Decl *&Decl)
AdjustDeclIfTemplate - If the given decl happens to be a template, reset the parameter D to reference...
void DefineImplicitMoveAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared move assignment operator.
void CheckCompletedCXXClass(CXXRecordDecl *Record)
Perform semantic checks on a class definition that has been completing, introducing implicitly-declar...
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
void AdjustDestructorExceptionSpec(CXXRecordDecl *ClassDecl, CXXDestructorDecl *Destructor)
Build an exception spec for destructors that don't have one.
SourceLocation getBeginLoc() const
getBeginLoc - Retrieve the location of the first token.
bool hasTrailingReturn() const
bool isFunctionOrMethod() const
clang::ObjCRuntime ObjCRuntime
InClassInitStyle
In-class initialization styles for non-static data members.
Declaration of an alias template.
static unsigned getRecordDiagFromTagKind(TagTypeKind Tag)
Get diagnostic select index for tag kind for record diagnostic message.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
const TemplateArgument * data() const
Retrieve a pointer to the template argument list.
void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc)
bool isExternallyVisible() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
void CalledDecl(SourceLocation CallLoc, const CXXMethodDecl *Method)
Integrate another called method into the collected data.
void setParams(ArrayRef< ParmVarDecl * > NewParamInfo)
DeclContextLookupResult slice(size_t N) const
SmallVector< ActiveTemplateInstantiation, 16 > ActiveTemplateInstantiations
List of active template instantiations.
bool RequireLiteralType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a literal type.
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
An lvalue reference type, per C++11 [dcl.ref].
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
DiagnosticsEngine & getDiagnostics() const
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
CXXRecordDecl * getStdBadAlloc() const
class LLVM_ALIGNAS(8) TemplateSpecializationType unsigned NumArgs
Represents a type template specialization; the template must be a class template, a type alias templa...
unsigned getNumBases() const
Retrieves the number of base classes of this class.
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
void ActOnCXXEnterDeclInitializer(Scope *S, Decl *Dcl)
ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an initializer for the declaration ...
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
Represents a C++ conversion function within a class.
QualType getCVRQualifiedType(QualType T, unsigned CVR) const
Return a type with additional const, volatile, or restrict qualifiers.
The result type of a method or function.
This template specialization was implicitly instantiated from a template.
llvm::FoldingSet< SpecialMemberOverloadResult > SpecialMemberCache
A cache of special member function overload resolution results for C++ records.
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=NotForRedeclaration)
Look up a name, looking for a single declaration.
SourceLocation getLocEnd() const LLVM_READONLY
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
SourceLocation getStorageClassSpecLoc() const
RecordDecl * getDefinition() const
getDefinition - Returns the RecordDecl that actually defines this struct/union/class.
unsigned getLocalCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers local to this particular QualType instan...
void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM)
Diagnose why the specified class does not have a trivial special member of the given kind...
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
bool CheckOverridingFunctionAttributes(const CXXMethodDecl *New, const CXXMethodDecl *Old)
void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitDefaultConstructor - Checks for feasibility of defining this constructor as the default...
TypeSourceInfo * getTypeSourceInfo() const
bool isVirtualSpecified() const
bool needsOverloadResolutionForCopyAssignment() const
Determine whether we need to eagerly declare a defaulted copy assignment operator for this class...
CXXConstructorDecl * LookupCopyingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the copying constructor for the given class.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
static bool RefersToRValueRef(Expr *MemRef)
const clang::PrintingPolicy & getPrintingPolicy() const
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
This is a legitimate overload: the existing declarations are functions or function templates with dif...
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
void ActOnFinishCXXMemberSpecification(Scope *S, SourceLocation RLoc, Decl *TagDecl, SourceLocation LBrac, SourceLocation RBrac, AttributeList *AttrList)
void NoteHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
static InitializationKind CreateCopy(SourceLocation InitLoc, SourceLocation EqualLoc, bool AllowExplicitConvs=false)
Create a copy initialization.
ExprResult ActOnFinishFullExpr(Expr *Expr)
const TypeClass * getTypePtr() const
bool CheckConstexprFunctionBody(const FunctionDecl *FD, Stmt *Body)
Check the body for the given constexpr function declaration only contains the permitted types of stat...
#define CheckPolymorphic(Type)
DeclarationNameInfo getNameInfo() const
DelegatingCtorDeclsType DelegatingCtorDecls
All the delegating constructors seen so far in the file, used for cycle detection at the end of the T...
void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow)
Hides a using shadow declaration.
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
bool isInMainFile(SourceLocation Loc) const
Returns whether the PresumedLoc for a given SourceLocation is in the main file.
IdentifierInfo * SetterId
static void SearchForReturnInStmt(Sema &Self, Stmt *S)
Wrapper for source info for arrays.
bool doesThisDeclarationHaveABody() const
doesThisDeclarationHaveABody - Returns whether this specific declaration of the function has a body -...
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
TemplateArgumentLoc getArgLoc(unsigned i) const
There is no lifetime qualification on this type.
void ActOnStartCXXInClassMemberInitializer()
Enter a new C++ default initializer scope.
DeclContext * getEntity() const
static bool CheckOperatorNewDeleteDeclarationScope(Sema &SemaRef, const FunctionDecl *FnDecl)
void setSourceOrder(int pos)
Set the source order of this initializer.
SourceRange getReturnTypeSourceRange() const
Attempt to compute an informative source range covering the function return type. ...
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
ASTMatchFinder *const Finder
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
static unsigned NumImplicitDestructorsDeclared
The number of implicitly-declared destructors for which declarations were built.
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
static CXXConstructorDecl * findUserDeclaredCtor(CXXRecordDecl *RD)
bool CheckUsingDeclQualifier(SourceLocation UsingLoc, const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, SourceLocation NameLoc)
Checks that the given nested-name qualifier used in a using decl in the current context is appropriat...
ExceptionSpecificationType Type
The kind of exception specification this is.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
enum clang::DeclaratorChunk::@183 Kind
SourceRange getSourceRange() const LLVM_READONLY
Determine the source range covering the entire initializer.
llvm::SmallPtrSet< QualType, 4 > IndirectBaseSet
Use small set to collect indirect bases.
This is not an overload because the lookup results contain a non-function.
Encodes a location in the source.
void setOperatorDelete(FunctionDecl *OD)
void ActOnFinishDelayedMemberDeclarations(Scope *S, Decl *Record)
bool isAnonymousStructOrUnion() const
isAnonymousStructOrUnion - Determines whether this field is a representative for an anonymous struct ...
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
unsigned getNumParams() const
getNumParams - Return the number of parameters this function must have based on its FunctionType...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange)
Mark the given method pure.
Decl * ActOnFinishLinkageSpecification(Scope *S, Decl *LinkageSpec, SourceLocation RBraceLoc)
ActOnFinishLinkageSpecification - Complete the definition of the C++ linkage specification LinkageSpe...
const TemplateArgument * iterator
bool InEnclosingNamespaceSetOf(const DeclContext *NS) const
Test if this context is part of the enclosing namespace set of the context NS, as defined in C++0x [n...
unsigned getBitWidthValue(const ASTContext &Ctx) const
method_iterator begin_overridden_methods() const
Decl * BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *AssertMessageExpr, SourceLocation RParenLoc, bool Failed)
FieldDecl * getAnyMember() const
An overloaded operator name, e.g., operator+.
Expr * getRepAsExpr() const
UnqualifiedId & getName()
Retrieve the name specified by this declarator.
static void CheckConstexprCtorInitializer(Sema &SemaRef, const FunctionDecl *Dcl, FieldDecl *Field, llvm::SmallSet< Decl *, 16 > &Inits, bool &Diagnosed)
Check that the given field is initialized within a constexpr constructor.
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isExplicit, bool isInline, bool isImplicitlyDeclared, bool isConstexpr)
bool isValid() const
Return true if this is a valid SourceLocation object.
static unsigned NumImplicitCopyAssignmentOperatorsDeclared
The number of implicitly-declared copy assignment operators for which declarations were built...
bool checkThisInStaticMemberFunctionAttributes(CXXMethodDecl *Method)
Check whether 'this' shows up in the attributes of the given static member function.
void ExitDeclaratorContext(Scope *S)
TagDecl - Represents the declaration of a struct/union/class/enum.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc)
Build the type that describes a C++ typename specifier, e.g., "typename T::type". ...
Represents a call to a member function that may be written either with member call syntax (e...
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
ASTContext & getASTContext() const LLVM_READONLY
unsigned size_overridden_methods() const
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
ASTContext & getASTContext() const
static bool CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl, CanQualType ExpectedResultType, CanQualType ExpectedFirstParamType, unsigned DependentParamTypeDiag, unsigned InvalidParamTypeDiag)
InheritableAttr * getDLLAttr(Decl *D)
Return a DLL attribute from the declaration.
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
void setReferenced(bool R=true)
IdentifierTable & getIdentifierTable()
bool SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
These methods set the specified attribute of the DeclSpec and return false if there was no error...
void DefineImplicitDestructor(SourceLocation CurrentLocation, CXXDestructorDecl *Destructor)
DefineImplicitDestructor - Checks for feasibility of defining this destructor as the default destruct...
Represents a dependent using declaration which was not marked with typename.
TagDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
static InitializedEntity InitializeElement(ASTContext &Context, unsigned Index, const InitializedEntity &Parent)
Create the initialization entity for an array element.
QualType withConst() const
void removeShadowDecl(UsingShadowDecl *S)
void setCtorInitializers(CXXCtorInitializer **Initializers)
ClassTemplateDecl * StdInitializerList
The C++ "std::initializer_list" template, which is defined in <initializer_list>. ...
Represents a static or instance method of a struct/union/class.
unsigned getDepth() const
Retrieve the depth of the template parameter.
void setDefaulted(bool D=true)
bool needsOverloadResolutionForMoveAssignment() const
Determine whether we need to eagerly declare a move assignment operator for this class.
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
ExprResult DefaultLvalueConversion(Expr *E)
No ref-qualifier was provided.
void setEntity(DeclContext *E)
bool CheckIfOverriddenFunctionIsMarkedFinal(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckForFunctionMarkedFinal - Checks whether a virtual member function overrides a virtual member fun...
bool hasUserProvidedDefaultConstructor() const
Whether this class has a user-provided default constructor per C++11.
llvm::SmallPtrSet< const CXXRecordDecl *, 8 > RecordDeclSetTy
bool isInvalid() const
An error occurred during parsing of the scope specifier.
std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths)
Builds a string representing ambiguous paths from a specific derived class to different subobjects of...
void setImplicitMoveConstructorIsDeleted()
Set that we attempted to declare an implicitly move constructor, but overload resolution failed so we...
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
const ConstantArrayType * getAsConstantArrayType(QualType T) const
Name lookup found an unresolvable value declaration and cannot yet complete.
const ObjCInterfaceDecl * getClassInterface() const
SourceLocation getConstexprSpecLoc() const
bool isTemplateParamScope() const
isTemplateParamScope - Return true if this scope is a C++ template parameter scope.
void push_back(const T &LocalValue)
static CXXBaseSpecifier * findDirectBaseWithType(CXXRecordDecl *Derived, QualType DesiredBase, bool &AnyDependentBases)
Find the base specifier for a base class with the given type.
void actOnDelayedExceptionSpecification(Decl *Method, ExceptionSpecificationType EST, SourceRange SpecificationRange, ArrayRef< ParsedType > DynamicExceptions, ArrayRef< SourceRange > DynamicExceptionRanges, Expr *NoexceptExpr)
Add an exception-specification to the given member function (or member function template).
Decl * ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc, unsigned TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, MultiTemplateParamsArg TempParamLists)
Handle a friend tag declaration where the scope specifier was templated.
Describes the kind of initialization being performed, along with location information for tokens rela...
static bool TryNamespaceTypoCorrection(Sema &S, LookupResult &R, Scope *Sc, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident)
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
A class for iterating through a result set and possibly filtering out results.
Direct list-initialization.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
Represents a C++11 virt-specifier-seq.
SourceLocation getVirtualSpecLoc() const
static CXXDefaultInitExpr * Create(const ASTContext &C, SourceLocation Loc, FieldDecl *Field)
Field is the non-static data member whose default initializer is used by this expression.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
TypeLocClass getTypeLocClass() const
bool isFinalSpelledSealed() const
void CheckExplicitlyDefaultedMemberExceptionSpec(CXXMethodDecl *MD, const FunctionProtoType *T)
Check whether the exception specification provided for an explicitly-defaulted special member matches...
void setIsParsingBaseSpecifiers()
SourceLocation getBegin() const
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
const T * castAs() const
Member-template castAs<specific type>.
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer.
TypeLoc getReturnLoc() const
SourceLocation getBeginLoc() const
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
static bool BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, ImplicitInitializerKind ImplicitInitKind, CXXBaseSpecifier *BaseSpec, bool IsInheritedVirtualBase, CXXCtorInitializer *&CXXBaseInit)
No entity found met the criteria.
NoexceptResult getNoexceptSpec(const ASTContext &Ctx) const
Get the meaning of the noexcept spec on this function, if any.
static bool CheckOperatorDeleteDeclaration(Sema &SemaRef, FunctionDecl *FnDecl)
void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class, bool DefinitionRequired=false)
Note that the vtable for the given class was used at the given location.
This template specialization was instantiated from a template due to an explicit instantiation defini...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
bool isFileContext() const
std::unique_ptr< CXXFieldCollector > FieldCollector
FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
bool CheckUsingDeclRedeclaration(SourceLocation UsingLoc, bool HasTypenameKeyword, const CXXScopeSpec &SS, SourceLocation NameLoc, const LookupResult &Previous)
Checks that the given using declaration is not an invalid redeclaration.
bool SetTypeQual(TQ T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const LangOptions &Lang)
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
bool isDependentType() const
Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...
void ActOnMemInitializers(Decl *ConstructorDecl, SourceLocation ColonLoc, ArrayRef< CXXCtorInitializer * > MemInits, bool AnyErrors)
ActOnMemInitializers - Handle the member initializers for a constructor.
Attr * clone(ASTContext &C) const
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl, ArrayRef< Decl * > Fields, SourceLocation LBrac, SourceLocation RBrac, AttributeList *AttrList)
IdentifierInfo * GetterId
SourceLocation getLocStart() const LLVM_READONLY
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
void setExplicitlyDefaulted(bool ED=true)
void setHasInheritedDefaultArg(bool I=true)
MutableArrayRef< Expr * > MultiExprArg
static Sema::ImplicitExceptionSpecification computeImplicitExceptionSpec(Sema &S, SourceLocation Loc, CXXMethodDecl *MD)
QualType getType() const
Return the type wrapped by this type source info.
void addArgument(const TemplateArgumentLoc &Loc)
bool isDynamicClass() const
CXXMethodDecl * getLambdaStaticInvoker() const
Retrieve the lambda static invoker, the address of which is returned by the conversion operator...
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
bool isFunctionProtoType() const
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
QualType getPointeeType() const
bool hasTrivialCopyAssignment() const
Determine whether this class has a trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
Decl * ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc, SourceLocation NamespcLoc, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *NamespcName, AttributeList *AttrList)
A constructor named via a template-id.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD)
getSpecialMember - get the special member enum for a method.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
CXXDestructorDecl * DeclareImplicitDestructor(CXXRecordDecl *ClassDecl)
Declare the implicit destructor for the given class.
static TypeAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
The expression in a static assertion.
MemInitResult BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init, CXXRecordDecl *ClassDecl)
SourceRange getSourceRange() const LLVM_READONLY
Get the source range that spans this declarator.
static AttributeList * getMSPropertyAttr(AttributeList *list)
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
Decl * ActOnExceptionDeclarator(Scope *S, Declarator &D)
ActOnExceptionDeclarator - Parsed the exception-declarator in a C++ catch handler.
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
Base class for declarations which introduce a typedef-name.
attr::Kind getKind() const
ast_type_traits::DynTypedNode Node
bool isAnonymousStructOrUnion() const
isAnonymousStructOrUnion - Whether this is an anonymous struct or union.
TLS with a dynamic initializer.
Represents a template argument.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
QualType getAsType() const
Retrieve the type for a type template argument.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument. ...
DeclContextLookupResult LookupConstructors(CXXRecordDecl *Class)
Look up the constructors for the given class.
TagTypeKind
The kind of a tag type.
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
TSCS getThreadStorageClassSpec() const
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
static LinkageSpecDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation ExternLoc, SourceLocation LangLoc, LanguageIDs Lang, bool HasBraces)
SourceLocation getLocStart() const LLVM_READONLY
void setDescribedAliasTemplate(TypeAliasTemplateDecl *TAT)
CXXConstructorDecl * DeclareImplicitCopyConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit copy constructor for the given class.
bool hasTypename() const
Return true if the using declaration has 'typename'.
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
not evaluated yet, for special member function
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
AccessSpecifier getAccessSpecifier() const
Returns the access specifier for this base specifier.
The base class of all kinds of template declarations (e.g., class, function, etc.).
void EnterDeclaratorContext(Scope *S, DeclContext *DC)
EnterDeclaratorContext - Used when we must lookup names in the context of a declarator's nested name ...
Sema::LookupNameKind getLookupKind() const
Gets the kind of lookup to perform.
bool hasUnparsedDefaultArg() const
hasUnparsedDefaultArg - Determines whether this parameter has a default argument that has not yet bee...
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isFriendSpecified() const
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return 0.
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_RValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CCK_ImplicitConversion)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
bool isTemporaryObject(ASTContext &Ctx, const CXXRecordDecl *TempTy) const
Determine whether the result of this expression is a temporary object of the given class type...
SourceLocation getLocStart() const LLVM_READONLY
unsigned isVariadic
isVariadic - If this function has a prototype, and if that proto ends with ',...)', this is true.
SourceLocation RAngleLoc
The location of the '>' after the template argument list.
static bool InitializationHasSideEffects(const FieldDecl &FD)
static __inline__ uint32_t volatile uint32_t * p
bool hasVariantMembers() const
Determine whether this class has any variant members.
bool isInvalidDecl() const
ImplicitExceptionSpecification ComputeDefaultedCopyAssignmentExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defautled copy assignment operator of a class will h...
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
void ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc, Expr *defarg)
ActOnParamDefaultArgument - Check whether the default argument provided for a function parameter is w...
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, QualType FromType, QualType ToType)
HandleFunctionTypeMismatch - Gives diagnostic information for differeing function types...
SourceLocation getFinalLoc() const
TypeLoc IgnoreParens() const
CanQualType UnsignedLongLongTy
bool isFinalSpecified() const
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
static void PopulateKeysForFields(FieldDecl *Field, SmallVectorImpl< const void * > &IdealInits)
std::pair< SourceLocation, SourceLocation > getImmediateExpansionRange(SourceLocation Loc) const
Return the start/end of the expansion information for an expansion location.
RecordDecl * getOuterLexicalRecordContext()
Retrieve the outermost lexically enclosing record context.
This template specialization was instantiated from a template due to an explicit instantiation declar...
static NamespaceDecl * getNamespaceDecl(NamedDecl *D)
getNamespaceDecl - Returns the namespace a decl represents.
QualType getExceptionObjectType(QualType T) const
Represents a dependent using declaration which was marked with typename.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
bool hasTrivialDefaultConstructor() const
Determine whether this class has a trivial default constructor (C++11 [class.ctor]p5).
DeclarationName - The name of a declaration.
ImplicitExceptionSpecification ComputeDefaultedDefaultCtorExceptionSpec(SourceLocation Loc, CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted copy constructor of a class will have...
unsigned getNumHandlers() const
void handleTagNumbering(const TagDecl *Tag, Scope *TagScope)
bool lookupInBases(BaseMatchesCallback BaseMatches, CXXBasePaths &Paths) const
Look for entities within the base classes of this C++ class, transitively searching all base class su...
static UnresolvedUsingTypenameDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation TypenameLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TargetNameLoc, DeclarationName TargetName)
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
std::pair< CXXRecordDecl *, SourceLocation > VTableUse
The list of classes whose vtables have been used within this translation unit, and the source locatio...
param_type_iterator param_type_end() const
A mapping from each virtual member function to its set of final overriders.
StringRef getString() const
SourceLocation getLocStart() const LLVM_READONLY
bool hasTrivialMoveConstructor() const
Determine whether this class has a trivial move constructor (C++11 [class.copy]p12) ...
detail::InMemoryDirectory::const_iterator E
bool isAmbiguous(CanQualType BaseType)
Determine whether the path from the most-derived type to the given base type is ambiguous (i...
A pointer to member type per C++ 8.3.3 - Pointers to members.
bool hasUserDeclaredMoveAssignment() const
Determine whether this class has had a move assignment declared by the user.
bool CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl)
CheckOverloadedOperatorDeclaration - Check whether the declaration of this overloaded operator is wel...
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
IdentifierResolver IdResolver
semantics_iterator semantics_begin()
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
bool isSingleResult() const
Determines if this names a single result which is not an unresolved value using decl.
SourceLocation getLocation() const
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool isMsStruct(const ASTContext &C) const
isMsStrust - Get whether or not this is an ms_struct which can be turned on with an attribute...
FieldDecl * getMember() const
If this is a member initializer, returns the declaration of the non-static data member being initiali...
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
static Sema::SpecialMemberOverloadResult * lookupCallFromSpecialMember(Sema &S, CXXRecordDecl *Class, Sema::CXXSpecialMember CSM, unsigned FieldQuals, bool ConstRHS)
Look up the special member function that would be called by a special member function for a subobject...
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to form a template specialization. ...
MemInitResult BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, Expr *Init, CXXRecordDecl *ClassDecl, SourceLocation EllipsisLoc)
bool hasUserDeclaredCopyConstructor() const
Determine whether this class has a user-declared copy constructor.
bool isLambda() const
Determine whether this class describes a lambda function object.
DeclClass * getCorrectionDeclAs() const
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext, providing only those that are of type SpecificDecl (or a class derived from it).
unsigned Map[Count]
The type of a lookup table which maps from language-specific address spaces to target-specific ones...
static unsigned NumImplicitCopyAssignmentOperators
The number of implicitly-declared copy assignment operators.
Expr * IgnoreParenImpCasts() LLVM_READONLY
IgnoreParenImpCasts - Ignore parentheses and implicit casts.
param_iterator param_end()
void PushUsingDirective(UsingDirectiveDecl *UDir)
CXXConstructorDecl * DeclareImplicitDefaultConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit default constructor for the given class.
bool isRValueReferenceType() const
const Stmt * getThen() const
static InitializedEntity InitializeBase(ASTContext &Context, const CXXBaseSpecifier *Base, bool IsInheritedVirtualBase)
Create the initialization entity for a base class subobject.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
void setNameLoc(SourceLocation Loc)
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
static FunctionProtoType::ExtProtoInfo getImplicitMethodEPI(Sema &S, CXXMethodDecl *MD)
bool hasInheritedDefaultArg() const
Name lookup found a single declaration that met the criteria.
bool empty() const
Return true if no decls were found.
bool isCurrentClassName(const IdentifierInfo &II, Scope *S, const CXXScopeSpec *SS=nullptr)
isCurrentClassName - Determine whether the identifier II is the name of the class type currently bein...
bool isObjCObjectType() const
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
NamedDecl * getCorrectionDecl() const
Gets the pointer to the declaration of the typo correction.
static AccessSpecifier MergeAccess(AccessSpecifier PathAccess, AccessSpecifier DeclAccess)
Calculates the access of a decl that is reached along a path.
QualType getLocalUnqualifiedType() const
Return this type with all of the instance-specific qualifiers removed, but without removing any quali...
Decl * ActOnStartNamespaceDef(Scope *S, SourceLocation InlineLoc, SourceLocation NamespaceLoc, SourceLocation IdentLoc, IdentifierInfo *Ident, SourceLocation LBrace, AttributeList *AttrList, UsingDirectiveDecl *&UsingDecl)
ActOnStartNamespaceDef - This is called at the start of a namespace definition.
bool isNotEmpty() const
A scope specifier is present, but may be valid or invalid.
bool hasTrivialMoveAssignment() const
Determine whether this class has a trivial move assignment operator (C++11 [class.copy]p25)
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
bool isTriviallyCopyableType(ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
Location wrapper for a TemplateArgument.
static bool CheckOperatorNewDeclaration(Sema &SemaRef, const FunctionDecl *FnDecl)
void setUnparsedDefaultArg()
setUnparsedDefaultArg - Specify that this parameter has an unparsed default argument.
Expr * getUninstantiatedDefaultArg()
static void diagnoseDeprecatedCopyOperation(Sema &S, CXXMethodDecl *CopyOp, SourceLocation UseLoc)
Diagnose an implicit copy operation for a class which is odr-used, but which is deprecated because th...
SourceManager & getSourceManager() const
bool TypeAlias
Whether this template specialization type is a substituted type alias.
bool CheckLiteralOperatorDeclaration(FunctionDecl *FnDecl)
CheckLiteralOperatorDeclaration - Check whether the declaration of this literal operator function is ...
const T * getAs() const
Member-template getAs<specific type>'.
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy.
static void extendRight(SourceRange &R, SourceRange After)
unsigned getTypeQuals() const
QualType getCanonicalType() const
Decl::Kind getDeclKind() const
bool ProcessAccessDeclAttributeList(AccessSpecDecl *ASDecl, const AttributeList *AttrList)
UsingDecl * getUsingDecl() const
Gets the using declaration to which this declaration is tied.
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, bool IsDecltype=false)
Represents a C++ base or member initializer.
LanguageIDs
Represents the language in a linkage specification.
This template specialization was declared or defined by an explicit specialization (C++ [temp...
SourceRange getSourceRange() const LLVM_READONLY
getSourceRange - The range of the declaration name.
void AddDecl(NamedDecl *D)
AddDecl - Link the decl to its shadowed decl chain.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, SourceLocation Loc, SourceRange Range, CXXCastPath *BasePath=nullptr, bool IgnoreAccess=false)
bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S=nullptr, bool AllowInlineNamespace=false)
isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true if 'D' is in Scope 'S'...
CXXRecordDecl * getOrigin() const
Retrieve the type from which this base-paths search began.
static Scope * getScopeForDeclContext(Scope *S, DeclContext *DC)
Finds the scope corresponding to the given decl context, if it happens to be an enclosing scope...
TrivialSubobjectKind
The kind of subobject we are checking for triviality.
NamedDecl * ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, Expr *BitfieldWidth, const VirtSpecifiers &VS, InClassInitStyle InitStyle)
ActOnCXXMemberDeclarator - This is invoked when a C++ class member declarator is parsed.
bool isFunctionType() const
static const void * GetKeyForBase(ASTContext &Context, QualType BaseType)
UnparsedDefaultArgInstantiationsMap UnparsedDefaultArgInstantiations
A mapping from parameters with unparsed default arguments to the set of instantiations of each parame...
TemplateParameterList * MatchTemplateParametersToScopeSpecifier(SourceLocation DeclStartLoc, SourceLocation DeclLoc, const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId, ArrayRef< TemplateParameterList * > ParamLists, bool IsFriend, bool &IsExplicitSpecialization, bool &Invalid)
Match the given template parameter lists to the given scope specifier, returning the template paramet...
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
QualType BuildDecltypeType(Expr *E, SourceLocation Loc, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
Expr * getArg(unsigned Arg)
Return the specified argument.
bool isImplicitlyDeleted(FunctionDecl *FD)
Determine whether the given function is an implicitly-deleted special member function.
The noexcept specifier evaluates to false.
Base for LValueReferenceType and RValueReferenceType.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
CXXConstructorDecl * getConstructor() const
ActionResult< Stmt * > StmtResult
static UsingShadowDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target)
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr)
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInline, bool isConstexpr, SourceLocation EndLocation)
The template argument is a type.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
ActionResult< ParsedType > TypeResult
static bool isInvalid(SourceLocation Loc, bool *Invalid)
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
void addDecl(Decl *D)
Add the declaration D into this context.
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
A template-id, e.g., f<int>.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, unsigned ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
Represents a base class of a C++ class.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
bool isAnyMemberInitializer() const
CK_UncheckedDerivedToBase - A conversion from a C++ class pointer/reference to a base class that can ...
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
const CXXConstructorDecl * getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
void checkClassLevelDLLAttribute(CXXRecordDecl *Class)
Check class-level dllimport/dllexport attribute.
void markUsed(ASTContext &C)
Mark the declaration used, in the sense of odr-use.
void DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc, ArrayRef< Expr * > Args)
DiagnoseSentinelCalls - This routine checks whether a call or message-send is to a declaration with t...
QualType getPointeeType() const
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
This is a scope that can contain a declaration.
bool isCompatibleWithMSVC(MSVCMajorVersion MajorVersion) const
IdentifierInfo * getIdentifier() const
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
NamedDecl * HandleDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists)
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
Scope * getScopeForContext(DeclContext *Ctx)
Determines the active Scope associated with the given declaration context.
static const void * GetKeyForMember(ASTContext &Context, CXXCtorInitializer *Member)
A use of a default initializer in a constructor or in aggregate initialization.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
A template argument list.
bool hasNonTrivialObjCLifetime() const
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
void setInvalidType(bool Val=true)
Expr * NoexceptExpr
Noexcept expression, if this is EST_ComputedNoexcept.
void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr, SourceLocation Loc)
PushNamespaceVisibilityAttr - Note that we've entered a namespace with a visibility attribute...
void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc)
ActOnParamDefaultArgumentError - Parsing or semantic analysis of the default argument for the paramet...
void DefineImplicitLambdaToBlockPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a block pointer.
bool isPODType(ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups, surround it with a ExprWithCleanups node.
ExprResult BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
void MarkBaseAndMemberDestructorsReferenced(SourceLocation Loc, CXXRecordDecl *Record)
MarkBaseAndMemberDestructorsReferenced - Given a record decl, mark all the non-trivial destructors of...
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
static bool functionDeclHasDefaultArgument(const FunctionDecl *FD)
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
void CheckOverrideControl(NamedDecl *D)
CheckOverrideControl - Check C++11 override control semantics.
ThreadStorageClassSpecifier
Thread storage-class-specifier.
void setImplicitMoveAssignmentIsDeleted()
Set that we attempted to declare an implicit move assignment operator, but overload resolution failed...
Describes the sequence of initializations required to initialize a given object or reference with a s...
Captures information about "declaration specifiers".
bool isAggregate() const
Determine whether this class is an aggregate (C++ [dcl.init.aggr]), which is a class with no user-dec...
bool isExplicitSpecified() const
static bool CheckConstexprParameterTypes(Sema &SemaRef, const FunctionDecl *FD)
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
SourceLocation getIdentifierLoc() const
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
ProcessDeclAttributes - Given a declarator (PD) with attributes indicated in it, apply them to D...
void setDefaultArg(Expr *defarg)
void setEnd(SourceLocation e)
const CXXMethodDecl * getCurrentKeyFunction(const CXXRecordDecl *RD)
Get our current best idea for the key function of the given record decl, or NULL if there isn't one...
Represents a C++ struct/union/class.
BoundNodesTreeBuilder *const Builder
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
static bool isCompoundAssignmentOp(Opcode Opc)
bool hasUserDeclaredDestructor() const
Determine whether this class has a user-declared destructor.
void setIvarInitializers(ASTContext &C, CXXCtorInitializer **initializers, unsigned numInitializers)
void diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals, SourceLocation FallbackLoc, SourceLocation ConstQualLoc=SourceLocation(), SourceLocation VolatileQualLoc=SourceLocation(), SourceLocation RestrictQualLoc=SourceLocation(), SourceLocation AtomicQualLoc=SourceLocation())
A user-defined literal name, e.g., operator "" _i.
void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc)
bool isObjCObjectPointerType() const
bool implicitCopyAssignmentHasConstParam() const
Determine whether an implicit copy assignment operator for this type would have a parameter with a co...
Look up a friend of a local class.
bool needsImplicitDefaultConstructor() const
Determine if we need to declare a default constructor for this class.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
CXXCatchStmt - This represents a C++ catch block.
void CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD)
void setConstexpr(bool IC)
void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock)
virtual bool isOutOfLine() const
Determine whether this declaration is declared out of line (outside its semantic context).
FunctionDecl * FindUsualDeallocationFunction(SourceLocation StartLoc, bool CanProvideSize, DeclarationName Name)
void addHiddenDecl(Decl *D)
Add the declaration D to this context without modifying any lookup tables.
void ActOnParamUnparsedDefaultArgument(Decl *param, SourceLocation EqualLoc, SourceLocation ArgLoc)
ActOnParamUnparsedDefaultArgument - We've seen a default argument for a function parameter, but we can't parse it yet because we're inside a class definition.
The parameter type of a method or function.
void setParam(unsigned i, ParmVarDecl *VD)
bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range)
CheckSpecifiedExceptionType - Check if the given type is valid in an exception specification.
CallingConv getDefaultCallingConvention(bool isVariadic, bool IsCXXMethod) const
Retrieves the default calling convention for the current target.
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult{return E;})
Process any TypoExprs in the given Expr and its children, generating diagnostics as appropriate and r...
TypeLoc getElementLoc() const
static bool hasOneRealArgument(MultiExprArg Args)
Determine whether the given list arguments contains exactly one "real" (non-default) argument...
AccessResult CheckBaseClassAccess(SourceLocation AccessLoc, QualType Base, QualType Derived, const CXXBasePath &Path, unsigned DiagID, bool ForceCheck=false, bool ForceUnprivileged=false)
Checks access for a hierarchy conversion.
static unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
SourceLocation getOverrideLoc() const
void setUnsupportedFriend(bool Unsupported)
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
Declaration of a class template.
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string...
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
const PropertyData & getPropertyData() const
bool isOverrideSpecified() const
LookupResultKind getResultKind() const
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
bool CheckOverridingFunctionReturnType(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionReturnType - Checks whether the return types are covariant, according to C++ [class.virtual]p5.
static bool checkTrivialSubobjectCall(Sema &S, SourceLocation SubobjLoc, QualType SubType, bool ConstRHS, Sema::CXXSpecialMember CSM, TrivialSubobjectKind Kind, bool Diagnose)
Check whether the special member selected for a given type would be trivial.
unsigned getIndex() const
Retrieve the index of the template parameter.
StringLiteral - This represents a string literal expression, e.g.
Defines the clang::TargetInfo interface.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
bool needsImplicitCopyConstructor() const
Determine whether this class needs an implicit copy constructor to be lazily declared.
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC...
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
const FunctionDecl * getOperatorDelete() const
void CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI, SmallVectorImpl< ObjCIvarDecl * > &Ivars)
CollectIvarsToConstructOrDestruct - Collect those ivars which require initialization.
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated, or computed.
FriendDecl * CheckFriendTypeDecl(SourceLocation LocStart, SourceLocation FriendLoc, TypeSourceInfo *TSInfo)
Perform semantic analysis of the given friend type declaration.
MemInitResult ActOnMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, SourceLocation LParenLoc, ArrayRef< Expr * > Args, SourceLocation RParenLoc, SourceLocation EllipsisLoc)
Handle a C++ member initializer using parentheses syntax.
static void CheckAbstractClassUsage(AbstractUsageInfo &Info, CXXMethodDecl *MD)
Check for invalid uses of an abstract type in a method declaration.
bool isIncompleteArrayType() const
bool isFragile() const
The inverse of isNonFragile(): does this runtime follow the set of implied behaviors for a "fragile" ...
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
TranslationUnitDecl - The top declaration context.
CK_NoOp - A conversion which does not affect the type other than (possibly) adding qualifiers...
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace nested inside this namespace, if any.
bool isValid() const
A scope specifier is present, and it refers to a real scope.
ImplicitExceptionSpecification ComputeDefaultedMoveAssignmentExceptionSpec(CXXMethodDecl *MD)
Determine what sort of exception specification a defaulted move assignment operator of a class will h...
A reference to a declared variable, function, enum, etc.
void CheckConversionDeclarator(Declarator &D, QualType &R, StorageClass &SC)
CheckConversionDeclarator - Called by ActOnDeclarator to check the well-formednes of the conversion f...
bool isSet() const
Deprecated.
NamedDecl * getMostRecentDecl()
SourceLocation getRAngleLoc() const
void DiagnoseHiddenVirtualMethods(CXXMethodDecl *MD)
Diagnose methods which overload virtual methods in a base class without overriding any...
CXXMethodDecl * DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit copy assignment operator for the given class.
bool isProvablyNotDerivedFrom(const CXXRecordDecl *Base) const
Determine whether this class is provably not derived from the type Base.
CXXConstructorDecl * LookupDefaultConstructor(CXXRecordDecl *Class)
Look up the default constructor for the given class.
QualType getElementType() const
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
Expr * getDefaultArgExprForConstructor(const CXXConstructorDecl *CD, unsigned ParmIdx)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool OdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2, C99 6.9p3)
llvm::DenseMap< CXXRecordDecl *, bool > VTablesUsed
The set of classes whose vtables have been used within this translation unit, and a bit that will be ...
SourceManager & SourceMgr
bool hasRefQualifier() const
Determine whether this function declaration contains a ref-qualifier.
SourceLocation getRefQualifierLoc() const
Retrieve the location of the ref-qualifier, if any.
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
virtual bool HandleTopLevelDecl(DeclGroupRef D)
HandleTopLevelDecl - Handle the specified top-level declaration.
void setBaseObjectType(QualType T)
Sets the base object type for this lookup.
static bool findTrivialSpecialMember(Sema &S, CXXRecordDecl *RD, Sema::CXXSpecialMember CSM, unsigned Quals, bool ConstRHS, CXXMethodDecl **Selected)
Perform lookup for a special member of the specified kind, and determine whether it is trivial...
const Expr * getInit(unsigned Init) const
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
bool CheckDestructor(CXXDestructorDecl *Destructor)
CheckDestructor - Checks a fully-formed destructor definition for well-formedness, issuing any diagnostics required.
void suppressDiagnostics()
Suppress the diagnostics that would normally fire because of this lookup.
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
An instance of this class represents the declaration of a property member.
AttributeList * getNext() const
An l-value expression is a reference to an object with independent storage.
StringRef getKindName() const
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
bool CompleteConstructorCall(CXXConstructorDecl *Constructor, MultiExprArg ArgsPtr, SourceLocation Loc, SmallVectorImpl< Expr * > &ConvertedArgs, bool AllowExplicit=false, bool IsListInitialization=false)
Given a constructor and the set of arguments provided for the constructor, convert the arguments and ...
bool ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, bool Diagnose=false)
Determine if a special member function should have a deleted definition when it is defaulted...
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, std::unique_ptr< CorrectionCandidateCallback > CCC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr, bool RecordFailure=true)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
NamedDecl - This represents a decl with a name.
bool isInvalidType() const
void DeclareInheritingConstructors(CXXRecordDecl *ClassDecl)
Declare all inheriting constructors for the given class.
virtual void diagnose(Sema &S, SourceLocation Loc, QualType T)=0
bool isModulePrivateSpecified() const
void setAccess(AccessSpecifier AS)
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
Represents a C++ namespace alias.
No keyword precedes the qualified type name.
SourceRange getSourceRange() const LLVM_READONLY
Retrieves the source range that contains the entire base specifier.
void getFinalOverriders(CXXFinalOverriderMap &FinaOverriders) const
Retrieve the final overriders for each virtual member function in the class hierarchy where this clas...
bool isConstQualified() const
Determine whether this type is const-qualified.
FullExprArg MakeFullDiscardedValueExpr(Expr *Arg)
Represents C++ using-directive.
SmallVector< std::pair< const CXXMethodDecl *, const CXXMethodDecl * >, 2 > DelayedExceptionSpecChecks
All the overriding functions seen during a class definition that had their exception spec checks dela...
void DiagnoseAbstractType(const CXXRecordDecl *RD)
static Expr * CastForMoving(Sema &SemaRef, Expr *E, QualType T=QualType())
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool isPolymorphic() const
Whether this class is polymorphic (C++ [class.virtual]), which means that the class contains or inher...
Describes an entity that is being initialized.
static InitializedEntity InitializeParameter(ASTContext &Context, ParmVarDecl *Parm)
Create the initialization entity for a parameter.
virtual void ReadUsedVTables(SmallVectorImpl< ExternalVTableUse > &VTables)
Read the set of used vtables known to the external Sema source.
The global specifier '::'. There is no stored value.
The noexcept specifier is dependent.
The type of an arbitrary declaration.
NamespaceDecl * getStdNamespace() const
bool CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New)
The object is actually the complete object.
void setType(QualType newType)
const TemplateArgument & getArgument() const
Wrapper for source info for pointers.
ParsedAttributes - A collection of parsed attributes.
SourceLocation ColonLoc
Location of ':'.
bool isExplicitSpecialization() const
void WillReplaceSpecifier(bool ForceReplacement)
Wrapper for source info for block pointers.
void setDeletedAsWritten(bool D=true)
void AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl)
AddImplicitlyDeclaredMembersToClass - Adds any implicitly-declared special functions, such as the default constructor, copy constructor, or destructor, to the given C++ class (C++ [special]p1).
void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation)
SetIvarInitializers - This routine builds initialization ASTs for the Objective-C implementation whos...
DeclarationNameInfo GetNameForDeclarator(Declarator &D)
GetNameForDeclarator - Determine the full declaration name for the given Declarator.
SmallVector< std::pair< CXXMethodDecl *, const FunctionProtoType * >, 2 > DelayedDefaultedMemberExceptionSpecs
All the members seen during a class definition which were both explicitly defaulted and had explicitl...
ArrayRef< QualType > exceptions() const
bool isBeingDefined() const
isBeingDefined - Return true if this decl is currently being defined.
Represents the canonical version of C arrays with a specified constant size.
base_class_range vbases()
ExceptionSpecInfo ExceptionSpec
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
enum clang::UnqualifiedId::IdKind Kind
Declaration of a template function.
void clear()
Clears out any current state.
std::list< CXXBasePath >::iterator paths_iterator
Represents an implicitly-generated value initialization of an object of a given type.
MSPropertyDecl * HandleMSProperty(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, InClassInitStyle InitStyle, AccessSpecifier AS, AttributeList *MSPropertyAttr)
HandleMSProperty - Analyze a __delcspec(property) field of a C++ class.
bool SetDelegatingInitializer(CXXConstructorDecl *Constructor, CXXCtorInitializer *Initializer)
void PushFunctionScope()
Enter a new function scope.
void DiagnoseAbsenceOfOverrideControl(NamedDecl *D)
DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was not used in the declaration of ...
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
void setElaboratedKeywordLoc(SourceLocation Loc)
NamedDeclSetType UnusedPrivateFields
Set containing all declared private fields that are not used.
Attr - This represents one attribute.
ParsedAttributes & getAttributes()
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
bool hasUserDeclaredConstructor() const
Determine whether this class has any user-declared constructors.
const RecordDecl * getParent() const
getParent - Returns the parent of this field declaration, which is the struct in which this method is...
Helper class that creates diagnostics with optional template instantiation stacks.
Expr * IgnoreParens() LLVM_READONLY
IgnoreParens - Ignore parentheses.
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
Decl * ActOnDeclarator(Scope *S, Declarator &D)
AttributeList - Represents a syntactic attribute.
Decl * ActOnConversionDeclarator(CXXConversionDecl *Conversion)
ActOnConversionDeclarator - Called by ActOnDeclarator to complete the declaration of the given C++ co...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool isMutable() const
isMutable - Determines whether this field is mutable (C++ only).
void FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S, bool ConsiderLinkage, bool AllowInlineNamespace)
Filters out lookup results that don't fall within the given scope as determined by isDeclInScope...
llvm::DenseMap< ParmVarDecl *, SourceLocation > UnparsedDefaultArgLocs
bool hasInClassInitializer() const
hasInClassInitializer - Determine whether this member has a C++11 in-class initializer.
bool isPointerType() const
static unsigned NumImplicitDestructors
The number of implicitly-declared destructors.
static bool isVisible(Sema &SemaRef, NamedDecl *D)
Determine whether the given declaration is visible to the program.
unsigned getNumTemplateParameterLists() const
NamedDecl * ActOnFriendFunctionDecl(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParams)
unsigned ActOnReenterTemplateScope(Scope *S, Decl *Template)
static void DiagnoseNamespaceInlineMismatch(Sema &S, SourceLocation KeywordLoc, SourceLocation Loc, IdentifierInfo *II, bool *IsInline, NamespaceDecl *PrevNS)
Diagnose a mismatch in 'inline' qualifiers when a namespace is reopened.
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any...
The subobject is a non-static data member.
SourceLocation getTemplateLoc() const