38 #include "llvm/ADT/APInt.h"
39 #include "llvm/ADT/STLExtras.h"
40 #include "llvm/Support/ErrorHandling.h"
41 using namespace clang;
73 llvm_unreachable(
"Nested name specifier is not a type for inheriting ctor");
78 return CreateParsedType(Type,
87 bool EnteringContext) {
112 bool isDependent =
false;
113 bool LookInScope =
false;
122 SearchType = GetTypeFromParser(ObjectTypePtr);
127 bool AlreadySearched =
false;
128 bool LookAtPrefix =
true;
140 DeclContext *DC = computeDeclContext(SS, EnteringContext);
142 AlreadySearched =
true;
145 }
else if (DC && isa<CXXRecordDecl>(DC)) {
146 LookAtPrefix =
false;
152 if (AlreadySearched) {
154 }
else if (LookAtPrefix && (Prefix = NNS->
getPrefix())) {
157 LookupCtx = computeDeclContext(PrefixSS, EnteringContext);
158 isDependent = isDependentScopeSpecifier(PrefixSS);
159 }
else if (ObjectTypePtr) {
160 LookupCtx = computeDeclContext(SearchType);
163 LookupCtx = computeDeclContext(SS, EnteringContext);
166 }
else if (ObjectTypePtr) {
174 LookupCtx = computeDeclContext(SearchType);
177 "Caller should have completed object type");
185 TypeDecl *NonMatchingTypeDecl =
nullptr;
186 LookupResult Found(*
this, &II, NameLoc, LookupOrdinaryName);
192 if (
Step == 0 && LookupCtx)
193 LookupQualifiedName(Found, LookupCtx);
194 else if (
Step == 1 && LookInScope && S)
195 LookupName(Found, S);
205 MarkAnyDeclReferenced(
Type->getLocation(),
Type,
false);
211 return CreateParsedType(T,
216 NonMatchingTypeDecl =
Type;
228 if (
DeclContext *Ctx = computeDeclContext(SS, EnteringContext)) {
234 if (MemberOfType.
isNull())
235 MemberOfType = SearchType;
237 if (MemberOfType.
isNull())
245 = dyn_cast<ClassTemplateSpecializationDecl>(Record->getDecl())) {
246 if (Spec->getSpecializedTemplate()->getCanonicalDecl() ==
247 Template->getCanonicalDecl())
248 return CreateParsedType(
268 if (SpecTemplate->getCanonicalDecl() == Template->getCanonicalDecl())
269 return CreateParsedType(
280 if (DepTemplate->isIdentifier() &&
281 DepTemplate->getIdentifier() == Template->getIdentifier())
282 return CreateParsedType(
303 if (NonMatchingTypeDecl) {
305 Diag(NameLoc, diag::err_destructor_expr_type_mismatch)
307 Diag(NonMatchingTypeDecl->getLocation(), diag::note_destructor_type_here)
309 }
else if (ObjectTypePtr)
310 Diag(NameLoc, diag::err_ident_in_dtor_not_a_type)
314 diag::err_destructor_class_name);
317 if (
const CXXRecordDecl *Class = dyn_cast_or_null<CXXRecordDecl>(Ctx))
319 Class->getNameAsString());
330 &&
"only get destructor types from declspecs");
332 QualType SearchType = GetTypeFromParser(ObjectType);
357 Diag(Name.
getLocStart(), diag::err_literal_operator_id_outside_namespace)
368 llvm_unreachable(
"unknown nested name specifier kind");
386 RequireCompleteType(TypeidLoc, T, diag::err_incomplete_typeid))
390 return ExprError(
Diag(TypeidLoc, diag::err_variably_modified_typeid) << T);
401 bool WasEvaluated =
false;
411 CXXRecordDecl *RecordD = cast<CXXRecordDecl>(RecordT->getDecl());
415 if (RequireCompleteType(TypeidLoc, T, diag::err_incomplete_typeid))
430 MarkVTableUsed(TypeidLoc, RecordD);
444 E = ImpCastExprToType(E, UnqualT, CK_NoOp, E->
getValueKind()).
get();
449 return ExprError(
Diag(TypeidLoc, diag::err_variably_modified_typeid)
451 else if (ActiveTemplateInstantiations.empty() &&
456 ? diag::warn_side_effects_typeid
457 : diag::warn_side_effects_unevaluated_context);
469 if (!getStdNamespace())
470 return ExprError(
Diag(OpLoc, diag::err_need_header_before_typeid));
472 if (!CXXTypeInfoDecl) {
473 IdentifierInfo *TypeInfoII = &PP.getIdentifierTable().get(
"type_info");
475 LookupQualifiedName(R, getStdNamespace());
479 if (!CXXTypeInfoDecl && LangOpts.MSVCCompat) {
483 if (!CXXTypeInfoDecl)
484 return ExprError(
Diag(OpLoc, diag::err_need_header_before_typeid));
487 if (!getLangOpts().RTTI) {
488 return ExprError(
Diag(OpLoc, diag::err_no_typeid_with_fno_rtti));
504 return BuildCXXTypeId(TypeInfoType, OpLoc, TInfo, RParenLoc);
508 return BuildCXXTypeId(TypeInfoType, OpLoc, (
Expr*)TyOrExpr, RParenLoc);
527 if (
const auto *Uuid = RD->getMostRecentDecl()->getAttr<UuidAttr>()) {
528 UuidAttrs.insert(Uuid);
533 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RD)) {
536 const UuidAttr *UuidForTA =
nullptr;
543 UuidAttrs.insert(UuidForTA);
557 if (UuidAttrs.empty())
558 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_without_guid));
559 if (UuidAttrs.size() > 1)
560 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_with_multiple_guids));
561 UuidStr = UuidAttrs.back()->getGuid();
576 UuidStr =
"00000000-0000-0000-0000-000000000000";
580 if (UuidAttrs.empty())
581 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_without_guid));
582 if (UuidAttrs.size() > 1)
583 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_with_multiple_guids));
584 UuidStr = UuidAttrs.back()->getGuid();
603 return ExprError(
Diag(OpLoc, diag::err_need_header_before_ms_uuidof));
619 return BuildCXXUuidof(GuidType, OpLoc, TInfo, RParenLoc);
623 return BuildCXXUuidof(GuidType, OpLoc, (
Expr*)TyOrExpr, RParenLoc);
629 assert((Kind == tok::kw_true || Kind == tok::kw_false) &&
630 "Unknown C++ Boolean value!");
644 bool IsThrownVarInScope =
false;
658 if (
VarDecl *Var = dyn_cast<VarDecl>(DRE->getDecl())) {
659 if (Var->hasLocalStorage() && !Var->getType().isVolatileQualified()) {
662 IsThrownVarInScope =
true;
676 return BuildCXXThrow(OpLoc, Ex, IsThrownVarInScope);
680 bool IsThrownVarInScope) {
682 if (!getLangOpts().CXXExceptions &&
683 !getSourceManager().isInSystemHeader(OpLoc))
684 Diag(OpLoc, diag::err_exceptions_disabled) <<
"throw";
686 if (getCurScope() && getCurScope()->isOpenMPSimdDirectiveScope())
687 Diag(OpLoc, diag::err_omp_simd_region_cannot_use_stmt) <<
"throw";
691 if (CheckCXXThrowOperand(OpLoc, ExceptionObjectTy, Ex))
709 const VarDecl *NRVOVariable =
nullptr;
710 if (IsThrownVarInScope)
711 NRVOVariable = getCopyElisionCandidate(
QualType(), Ex,
false);
714 OpLoc, ExceptionObjectTy,
715 NRVOVariable !=
nullptr);
716 ExprResult Res = PerformMoveOrCopyInitialization(
717 Entity, NRVOVariable,
QualType(), Ex, IsThrownVarInScope);
729 llvm::DenseMap<CXXRecordDecl *, unsigned> &SubobjectsSeen,
730 llvm::SmallPtrSetImpl<CXXRecordDecl *> &VBases,
731 llvm::SetVector<CXXRecordDecl *> &PublicSubobjectsSeen,
732 bool ParentIsPublic) {
734 CXXRecordDecl *BaseDecl = BS.getType()->getAsCXXRecordDecl();
739 NewSubobject = VBases.insert(BaseDecl).second;
744 ++SubobjectsSeen[BaseDecl];
747 bool PublicPath = ParentIsPublic && BS.getAccessSpecifier() ==
AS_public;
749 PublicSubobjectsSeen.insert(BaseDecl);
759 llvm::DenseMap<CXXRecordDecl *, unsigned> SubobjectsSeen;
760 llvm::SmallSet<CXXRecordDecl *, 2> VBases;
761 llvm::SetVector<CXXRecordDecl *> PublicSubobjectsSeen;
762 SubobjectsSeen[RD] = 1;
763 PublicSubobjectsSeen.insert(RD);
767 for (
CXXRecordDecl *PublicSubobject : PublicSubobjectsSeen) {
769 if (SubobjectsSeen[PublicSubobject] > 1)
772 Objects.push_back(PublicSubobject);
782 bool isPointer =
false;
788 if (RequireCompleteType(ThrowLoc, Ty,
789 isPointer ? diag::err_throw_incomplete_ptr
790 : diag::err_throw_incomplete,
791 E->getSourceRange()))
794 if (RequireNonAbstractType(ThrowLoc, ExceptionObjectTy,
795 diag::err_throw_abstract_type, E))
806 MarkVTableUsed(ThrowLoc, RD);
815 MarkFunctionReferenced(E->
getExprLoc(), Destructor);
816 CheckDestructorAccess(E->
getExprLoc(), Destructor,
817 PDiag(diag::err_access_dtor_exception) << Ty);
818 if (DiagnoseUseOfDecl(Destructor, E->
getExprLoc()))
833 for (
CXXRecordDecl *Subobject : UnambiguousPublicSubobjects) {
866 BuildCXXDefaultArgExpr(ThrowLoc, CD, CD->
getParamDecl(
I)).
get();
902 for (
int I = FunctionScopes.size();
903 I-- && isa<LambdaScopeInfo>(FunctionScopes[
I]);
905 CurLSI = cast<LambdaScopeInfo>(FunctionScopes[
I]);
912 if (C.isCopyCapture()) {
926 auto IsThisCaptured =
930 for (
auto &&C : Closure->
captures()) {
931 if (C.capturesThis()) {
942 bool IsByCopyCapture =
false;
943 bool IsConstCapture =
false;
944 CXXRecordDecl *Closure = cast<CXXRecordDecl>(CurDC->getParent());
946 IsThisCaptured(Closure, IsByCopyCapture, IsConstCapture)) {
947 if (IsByCopyCapture) {
963 QualType ThisTy = CXXThisTypeOverride;
966 if (method && method->isInstance())
967 ThisTy = method->getThisType(
Context);
971 !ActiveTemplateInstantiations.empty()) {
973 assert(isa<CXXRecordDecl>(DC) &&
974 "Trying to get 'this' type from static method?");
997 unsigned CXXThisTypeQuals,
999 : S(S), OldCXXThisTypeOverride(S.CXXThisTypeOverride), Enabled(
false)
1001 if (!Enabled || !ContextDecl)
1006 Record = Template->getTemplatedDecl();
1008 Record = cast<CXXRecordDecl>(ContextDecl);
1016 this->Enabled =
true;
1028 const bool ByCopy) {
1033 QualType CaptureThisFieldTy = ThisTy;
1044 Context, RD, Loc, Loc,
nullptr, CaptureThisFieldTy,
1048 Field->setImplicit(
true);
1058 nullptr, CaptureThisFieldTy, Loc);
1069 bool BuildAndDiagnose,
const unsigned *
const FunctionScopeIndexToStopAt,
1070 const bool ByCopy) {
1075 assert((!ByCopy || Explicit) &&
"cannot implicitly capture *this by value");
1077 const unsigned MaxFunctionScopesIndex = FunctionScopeIndexToStopAt ?
1103 unsigned NumCapturingClosures = 0;
1104 for (
unsigned idx = MaxFunctionScopesIndex; idx != 0; idx--) {
1107 if (CSI->CXXThisCaptureIndex != 0) {
1114 if (BuildAndDiagnose)
1115 Diag(Loc, diag::err_this_capture)
1116 << (Explicit && idx == MaxFunctionScopesIndex);
1123 (Explicit && idx == MaxFunctionScopesIndex)) {
1129 NumCapturingClosures++;
1133 if (BuildAndDiagnose)
1134 Diag(Loc, diag::err_this_capture)
1135 << (Explicit && idx == MaxFunctionScopesIndex);
1140 if (!BuildAndDiagnose)
return false;
1152 dyn_cast<LambdaScopeInfo>(
FunctionScopes[MaxFunctionScopesIndex])) &&
1153 "Only a lambda can capture the enclosing object (referred to by "
1158 for (
unsigned idx = MaxFunctionScopesIndex; NumCapturingClosures;
1159 --idx, --NumCapturingClosures) {
1161 Expr *ThisExpr =
nullptr;
1168 ByCopy && idx == MaxFunctionScopesIndex);
1176 bool isNested = NumCapturingClosures > 1;
1188 if (ThisTy.
isNull())
return Diag(Loc, diag::err_invalid_this_use);
1223 if (!
Result.isInvalid() &&
Result.get()->isInstantiationDependent() &&
1224 !
Result.get()->isTypeDependent())
1246 bool ListInitialization = LParenLoc.
isInvalid();
1247 assert((!ListInitialization || (Exprs.size() == 1 && isa<InitListExpr>(Exprs[0])))
1248 &&
"List initialization must have initializer list as expression.");
1250 ListInitialization ? Exprs[0]->
getSourceRange().getEnd() : RParenLoc);
1256 if (Exprs.size() == 1 && !ListInitialization) {
1257 Expr *Arg = Exprs[0];
1268 if (!ListInitialization)
1270 diag::err_value_init_for_array_type) << FullRange);
1275 return ExprError(
Diag(TyBeginLoc, diag::err_value_init_for_function_type)
1280 diag::err_invalid_incomplete_type_use, FullRange))
1284 diag::err_allocation_of_abstract_type))
1289 Exprs.size() ? ListInitialization
1296 if (Result.
isInvalid() || !ListInitialization)
1301 Inner = BTE->getSubExpr();
1302 if (!isa<CXXTemporaryObjectExpr>(Inner)) {
1314 CK_NoOp, Result.
get(),
nullptr, LParenLoc, RParenLoc);
1326 if (!record)
return false;
1339 if (ops.
empty())
return false;
1352 if (isa<FunctionTemplateDecl>(del)) {
1363 if (!cast<CXXMethodDecl>(del)->isUsualDeallocationFunction()) {
1399 Expr *ArraySize =
nullptr;
1404 if (TypeContainsAuto)
1426 if (!NumElts->isTypeDependent() && !NumElts->isValueDependent()) {
1432 assert(IntWidth &&
"Builtin type of size 0?");
1433 llvm::APSInt
Value(IntWidth);
1441 diag::err_new_array_nonconst)
1457 if (
ParenListExpr *List = dyn_cast_or_null<ParenListExpr>(Initializer))
1458 DirectInitRange = List->getSourceRange();
1478 return PLE->getNumExprs() == 0;
1479 if (isa<ImplicitValueInitExpr>(Init))
1482 return !CCE->isListInitialization() &&
1483 CCE->getConstructor()->isDefaultConstructor();
1485 assert(isa<InitListExpr>(Init) &&
1486 "Shouldn't create list CXXConstructExprs for arrays.");
1503 bool TypeMayContainAuto) {
1508 if (DirectInitRange.
isValid()) {
1509 assert(Initializer &&
"Have parens but no initializer.");
1511 }
else if (Initializer && isa<InitListExpr>(Initializer))
1514 assert((!Initializer || isa<ImplicitValueInitExpr>(Initializer) ||
1515 isa<CXXConstructExpr>(Initializer)) &&
1516 "Initializer expression that cannot have been implicitly created.");
1521 unsigned NumInits = Initializer ? 1 : 0;
1522 if (
ParenListExpr *List = dyn_cast_or_null<ParenListExpr>(Initializer)) {
1524 Inits = List->getExprs();
1525 NumInits = List->getNumExprs();
1531 return ExprError(
Diag(StartLoc, diag::err_auto_new_requires_ctor_arg)
1532 << AllocType << TypeRange);
1534 (NumInits == 1 && isa<InitListExpr>(Inits[0])))
1536 diag::err_auto_new_list_init)
1537 << AllocType << TypeRange);
1539 Expr *FirstBad = Inits[1];
1541 diag::err_auto_new_ctor_multiple_expressions)
1542 << AllocType << TypeRange);
1544 Expr *Deduce = Inits[0];
1547 return ExprError(
Diag(StartLoc, diag::err_auto_new_deduction_failure)
1548 << AllocType << Deduce->
getType()
1549 << TypeRange << Deduce->getSourceRange());
1550 if (DeducedType.
isNull())
1552 AllocType = DeducedType;
1563 AllocType = Array->getElementType();
1573 diag::warn_dangling_std_initializer_list)
1590 ArraySize = result.
get();
1607 if (!ConvertedSize.isInvalid() &&
1610 Diag(StartLoc, diag::warn_cxx98_compat_array_size_conversion)
1611 << ArraySize->
getType() << 0 <<
"'size_t'";
1618 SizeConvertDiagnoser(
Expr *ArraySize)
1620 ArraySize(ArraySize) {}
1624 return S.
Diag(Loc, diag::err_array_size_not_integral)
1630 return S.
Diag(Loc, diag::err_array_size_incomplete_type)
1631 << T << ArraySize->getSourceRange();
1636 return S.
Diag(Loc, diag::err_array_size_explicit_conversion) << T << ConvTy;
1641 return S.
Diag(Conv->getLocation(), diag::note_array_size_conversion)
1647 return S.
Diag(Loc, diag::err_array_size_ambiguous_conversion) << T;
1652 return S.
Diag(Conv->getLocation(), diag::note_array_size_conversion)
1661 ? diag::warn_cxx98_compat_array_size_conversion
1662 : diag::ext_array_size_conversion)
1665 } SizeDiagnoser(ArraySize);
1673 ArraySize = ConvertedSize.
get();
1694 if (Value < llvm::APSInt(
1695 llvm::APInt::getNullValue(Value.getBitWidth()),
1696 Value.isUnsigned())) {
1698 Diag(ArraySize->getLocStart(),
1699 diag::warn_typecheck_negative_array_new_size)
1700 << ArraySize->getSourceRange();
1703 diag::err_typecheck_negative_array_size)
1704 << ArraySize->getSourceRange());
1706 unsigned ActiveSizeBits =
1710 Diag(ArraySize->getLocStart(),
1711 diag::warn_array_new_too_large)
1712 << Value.toString(10)
1713 << ArraySize->getSourceRange();
1716 diag::err_array_too_large)
1717 << Value.toString(10)
1718 << ArraySize->getSourceRange());
1721 }
else if (TypeIdParens.
isValid()) {
1723 Diag(ArraySize->getLocStart(), diag::ext_new_paren_array_nonconst)
1724 << ArraySize->getSourceRange()
1743 UseGlobal, AllocType, ArraySize, PlacementArgs,
1744 OperatorNew, OperatorDelete))
1749 bool UsualArrayDeleteWantsSize =
false;
1751 UsualArrayDeleteWantsSize
1765 PlacementArgs, AllPlaceArgs, CallType))
1768 if (!AllPlaceArgs.empty())
1769 PlacementArgs = AllPlaceArgs;
1779 if (PlacementArgs.empty() && OperatorNew &&
1780 (OperatorNew->isImplicit() ||
1785 if (Align > SuitableAlign)
1786 Diag(StartLoc, diag::warn_overaligned_type)
1800 Inits[NumInits - 1]->getLocEnd());
1801 Diag(StartLoc, diag::err_new_array_init_args) << InitRange;
1804 if (
InitListExpr *ILE = dyn_cast_or_null<InitListExpr>(Initializer)) {
1808 unsigned NumElements = ILE->getNumInits() + 1;
1819 llvm::makeArrayRef(Inits, NumInits))) {
1835 DirectInitRange.
getEnd());
1848 dyn_cast_or_null<CXXBindTemporaryExpr>(FullInit.
get()))
1849 FullInit = Binder->getSubExpr();
1851 Initializer = FullInit.
get();
1860 if (OperatorDelete) {
1873 cast<CXXRecordDecl>(BaseRecordType->getDecl()))) {
1876 PDiag(diag::err_access_dtor)
1886 UsualArrayDeleteWantsSize, PlacementArgs, TypeIdParens,
1887 ArraySize, initStyle, Initializer, ResultType, AllocTypeInfo,
1888 Range, DirectInitRange);
1898 return Diag(Loc, diag::err_bad_new_type)
1899 << AllocType << 0 << R;
1901 return Diag(Loc, diag::err_bad_new_type)
1902 << AllocType << 1 << R;
1907 diag::err_allocation_of_abstract_type))
1910 return Diag(Loc, diag::err_variably_modified_new_type)
1913 return Diag(Loc, diag::err_address_space_qualified_new)
1920 return Diag(Loc, diag::err_arc_new_array_without_ownership)
1931 if (FD->isInvalidDecl())
1935 return Method->isUsualDeallocationFunction();
1952 bool UseGlobal,
QualType AllocType,
1973 AllocArgs[0] = &Size;
1974 std::copy(PlaceArgs.begin(), PlaceArgs.end(), AllocArgs.begin() + 1);
1983 IsArray ? OO_Array_New : OO_New);
1985 IsArray ? OO_Array_Delete : OO_Delete);
2003 FallbackEnabled, OperatorNew,
2004 !FallbackEnabled)) {
2005 if (!FallbackEnabled)
2015 false, OperatorNew))
2023 OperatorDelete =
nullptr;
2045 if (FoundDelete.
empty()) {
2059 bool isPlacementNew = (!PlaceArgs.empty() || OperatorNew->
param_size() != 1);
2061 if (isPlacementNew) {
2087 ExpectedFunctionType
2092 DEnd = FoundDelete.
end();
2096 = dyn_cast<FunctionTemplateDecl>((*D)->getUnderlyingDecl())) {
2104 Fn = cast<FunctionDecl>((*D)->getUnderlyingDecl());
2107 Matches.push_back(std::make_pair(D.getPair(), Fn));
2114 DEnd = FoundDelete.
end();
2116 if (
FunctionDecl *Fn = dyn_cast<FunctionDecl>((*D)->getUnderlyingDecl()))
2118 Matches.push_back(std::make_pair(D.getPair(), Fn));
2131 if (
getLangOpts().SizedDeallocation && Matches.size() == 2) {
2132 if (Matches[0].second->getNumParams() == 1)
2133 Matches.erase(Matches.begin());
2135 Matches.erase(Matches.begin() + 1);
2136 assert(Matches[0].second->getNumParams() == 2 &&
2137 "found an unexpected usual deallocation function");
2145 if (Matches.size() == 1) {
2146 OperatorDelete = Matches[0].second;
2154 if (!PlaceArgs.empty() &&
getLangOpts().CPlusPlus11 &&
2156 Diag(StartLoc, diag::err_placement_new_non_placement_delete)
2158 PlaceArgs.back()->getLocEnd());
2159 if (!OperatorDelete->isImplicit())
2160 Diag(OperatorDelete->getLocation(), diag::note_previous_decl)
2195 if (AllowMissing || !Diagnose)
2197 return Diag(StartLoc, diag::err_ovl_no_viable_function_in_call)
2208 Alloc != AllocEnd; ++Alloc) {
2242 Diag(StartLoc, diag::err_ovl_no_viable_function_in_call)
2250 Diag(StartLoc, diag::err_ovl_ambiguous_call)
2258 Diag(StartLoc, diag::err_ovl_deleted_call)
2259 << Best->Function->isDeleted()
2268 llvm_unreachable(
"Unreachable, bad result from BestViableFunction");
2373 unsigned NumParams = Param2.
isNull() ? 1 : 2;
2378 Alloc != AllocEnd; ++Alloc) {
2381 if (
FunctionDecl *Func = dyn_cast<FunctionDecl>(*Alloc)) {
2382 if (Func->getNumParams() == NumParams) {
2385 ->getType().getUnqualifiedType());
2389 ->getType().getUnqualifiedType())
2392 if (InitialParam1Type == Param1 &&
2393 (NumParams == 1 || InitialParam2Type == Param2)) {
2397 Func->setHidden(
false);
2407 bool HasBadAllocExceptionSpec
2410 if (HasBadAllocExceptionSpec) {
2413 assert(
StdBadAlloc &&
"Must have std::bad_alloc declared");
2422 QualType Params[] = { Param1, Param2 };
2425 Return, llvm::makeArrayRef(Params, NumParams), EPI);
2429 FnType,
nullptr,
SC_None,
false,
true);
2430 Alloc->setImplicit();
2433 Alloc->addAttr(VisibilityAttr::CreateImplicit(
Context,
2434 VisibilityAttr::Default));
2437 for (
unsigned I = 0;
I != NumParams; ++
I) {
2442 ParamDecls[
I]->setImplicit();
2444 Alloc->setParams(llvm::makeArrayRef(ParamDecls, NumParams));
2451 bool CanProvideSize,
2463 DEnd = FoundDelete.
end();
2467 Matches.push_back(Fn);
2477 if (
getLangOpts().SizedDeallocation && Matches.size() == 2) {
2478 unsigned NumArgs = CanProvideSize ? 2 : 1;
2479 if (Matches[0]->getNumParams() !=
NumArgs)
2480 Matches.erase(Matches.begin());
2482 Matches.erase(Matches.begin() + 1);
2483 assert(Matches[0]->getNumParams() == NumArgs &&
2484 "found an unexpected usual deallocation function");
2490 assert(Matches.size() == 1 &&
2491 "unexpectedly have multiple usual deallocation functions");
2492 return Matches.front();
2514 if (isa<FunctionTemplateDecl>(ND))
2517 if (cast<CXXMethodDecl>(ND)->isUsualDeallocationFunction())
2518 Matches.push_back(F.getPair());
2525 if (Matches.size() == 1) {
2526 Operator = cast<CXXMethodDecl>(Matches[0]->getUnderlyingDecl());
2530 Diag(StartLoc, diag::err_deleted_function_use);
2543 }
else if (!Matches.empty()) {
2545 Diag(StartLoc, diag::err_ambiguous_suitable_delete_member_function_found)
2549 F = Matches.begin(), FEnd = Matches.end(); F != FEnd; ++F)
2550 Diag((*F)->getUnderlyingDecl()->getLocation(),
2551 diag::note_member_declared_here) << Name;
2558 if (!Found.
empty()) {
2560 Diag(StartLoc, diag::err_no_suitable_delete_member_function_found)
2565 Diag((*F)->getUnderlyingDecl()->getLocation(),
2566 diag::note_member_declared_here) << Name;
2578 class MismatchingNewDeleteDetector {
2580 enum MismatchResult {
2586 MemberInitMismatches,
2595 explicit MismatchingNewDeleteDetector(
bool EndOfTU)
2596 : IsArrayForm(
false), Field(nullptr), EndOfTU(EndOfTU),
2597 HasUndefinedConstructors(
false) {}
2614 MismatchResult analyzeField(
FieldDecl *Field,
bool DeleteWasArrayForm);
2624 bool HasUndefinedConstructors;
2636 MismatchResult analyzeMemberExpr(
const MemberExpr *ME);
2659 MismatchResult analyzeInClassInitializer();
2663 MismatchingNewDeleteDetector::MismatchResult
2664 MismatchingNewDeleteDetector::analyzeDeleteExpr(
const CXXDeleteExpr *DE) {
2666 assert(DE &&
"Expected delete-expression");
2669 if (
const MemberExpr *ME = dyn_cast<const MemberExpr>(E)) {
2670 return analyzeMemberExpr(ME);
2671 }
else if (
const DeclRefExpr *D = dyn_cast<const DeclRefExpr>(E)) {
2672 if (!hasMatchingVarInit(D))
2673 return VarInitMismatches;
2679 MismatchingNewDeleteDetector::getNewExprFromInitListOrExpr(
const Expr *E) {
2680 assert(E !=
nullptr &&
"Expected a valid initializer expression");
2682 if (
const InitListExpr *ILE = dyn_cast<const InitListExpr>(E)) {
2683 if (ILE->getNumInits() == 1)
2684 E = dyn_cast<const CXXNewExpr>(ILE->getInit(0)->IgnoreParenImpCasts());
2687 return dyn_cast_or_null<const CXXNewExpr>(
E);
2690 bool MismatchingNewDeleteDetector::hasMatchingNewInCtorInit(
2694 (NE = getNewExprFromInitListOrExpr(CI->
getInit()))) {
2695 if (NE->
isArray() == IsArrayForm)
2698 NewExprs.push_back(NE);
2703 bool MismatchingNewDeleteDetector::hasMatchingNewInCtor(
2705 if (CD->isImplicit())
2709 HasUndefinedConstructors =
true;
2712 for (
const auto *CI : cast<const CXXConstructorDecl>(Definition)->inits()) {
2713 if (hasMatchingNewInCtorInit(CI))
2719 MismatchingNewDeleteDetector::MismatchResult
2720 MismatchingNewDeleteDetector::analyzeInClassInitializer() {
2721 assert(Field !=
nullptr &&
"This should be called only for members");
2722 const Expr *InitExpr =
Field->getInClassInitializer();
2724 return EndOfTU ? NoMismatch : AnalyzeLater;
2725 if (
const CXXNewExpr *NE = getNewExprFromInitListOrExpr(InitExpr)) {
2726 if (NE->
isArray() != IsArrayForm) {
2727 NewExprs.push_back(NE);
2728 return MemberInitMismatches;
2734 MismatchingNewDeleteDetector::MismatchResult
2735 MismatchingNewDeleteDetector::analyzeField(
FieldDecl *Field,
2736 bool DeleteWasArrayForm) {
2737 assert(Field !=
nullptr &&
"Analysis requires a valid class member.");
2738 this->Field = Field;
2739 IsArrayForm = DeleteWasArrayForm;
2741 for (
const auto *CD : RD->
ctors()) {
2742 if (hasMatchingNewInCtor(CD))
2745 if (HasUndefinedConstructors)
2746 return EndOfTU ? NoMismatch : AnalyzeLater;
2747 if (!NewExprs.empty())
2748 return MemberInitMismatches;
2753 MismatchingNewDeleteDetector::MismatchResult
2754 MismatchingNewDeleteDetector::analyzeMemberExpr(
const MemberExpr *ME) {
2755 assert(ME !=
nullptr &&
"Expected a member expression");
2757 return analyzeField(F, IsArrayForm);
2761 bool MismatchingNewDeleteDetector::hasMatchingVarInit(
const DeclRefExpr *D) {
2764 if (VD->hasInit() && (NE = getNewExprFromInitListOrExpr(VD->getInit())) &&
2765 NE->
isArray() != IsArrayForm) {
2766 NewExprs.push_back(NE);
2769 return NewExprs.empty();
2774 const MismatchingNewDeleteDetector &Detector) {
2777 if (!Detector.IsArrayForm)
2786 SemaRef.
Diag(DeleteLoc, diag::warn_mismatched_delete_new)
2787 << Detector.IsArrayForm << H;
2789 for (
const auto *NE : Detector.NewExprs)
2791 << Detector.IsArrayForm;
2794 void Sema::AnalyzeDeleteExprMismatch(
const CXXDeleteExpr *DE) {
2797 MismatchingNewDeleteDetector Detector(
false);
2798 switch (Detector.analyzeDeleteExpr(DE)) {
2799 case MismatchingNewDeleteDetector::VarInitMismatches:
2800 case MismatchingNewDeleteDetector::MemberInitMismatches: {
2804 case MismatchingNewDeleteDetector::AnalyzeLater: {
2809 case MismatchingNewDeleteDetector::NoMismatch:
2815 bool DeleteWasArrayForm) {
2816 MismatchingNewDeleteDetector Detector(
true);
2817 switch (Detector.analyzeField(Field, DeleteWasArrayForm)) {
2818 case MismatchingNewDeleteDetector::VarInitMismatches:
2819 llvm_unreachable(
"This analysis should have been done for class members.");
2820 case MismatchingNewDeleteDetector::AnalyzeLater:
2821 llvm_unreachable(
"Analysis cannot be postponed any point beyond end of "
2822 "translation unit.");
2823 case MismatchingNewDeleteDetector::MemberInitMismatches:
2826 case MismatchingNewDeleteDetector::NoMismatch:
2837 bool ArrayForm,
Expr *ExE) {
2847 bool ArrayFormAsWritten = ArrayForm;
2848 bool UsualArrayDeleteWantsSize =
false;
2866 if (ConvPtrType->getPointeeType()->isIncompleteOrObjectType())
2873 return S.
Diag(Loc, diag::err_delete_operand) << T;
2878 return S.
Diag(Loc, diag::err_delete_incomplete_class_type) << T;
2884 return S.
Diag(Loc, diag::err_delete_explicit_conversion) << T << ConvTy;
2889 return S.
Diag(Conv->getLocation(), diag::note_delete_conversion)
2895 return S.
Diag(Loc, diag::err_ambiguous_delete_operand) << T;
2900 return S.
Diag(Conv->getLocation(), diag::note_delete_conversion)
2907 llvm_unreachable(
"conversion functions are permitted");
2915 if (!Converter.match(Type))
2924 return Diag(Ex.
get()->getLocStart(),
2925 diag::err_address_space_qualified_delete)
2933 Diag(StartLoc, diag::ext_delete_void_ptr_operand)
2934 << Type << Ex.
get()->getSourceRange();
2937 << Type << Ex.
get()->getSourceRange());
2942 diag::warn_delete_incomplete, Ex.
get())) {
2944 PointeeRD = cast<CXXRecordDecl>(RT->getDecl());
2949 Diag(StartLoc, diag::warn_delete_array_type)
2950 << Type << Ex.
get()->getSourceRange()
2956 ArrayForm ? OO_Array_Delete : OO_Delete);
2970 UsualArrayDeleteWantsSize =
2975 else if (OperatorDelete && isa<CXXMethodDecl>(OperatorDelete))
2976 UsualArrayDeleteWantsSize = (OperatorDelete->
getNumParams() == 2);
2982 const_cast<CXXDestructorDecl*>(Dtor));
2993 if (!OperatorDelete)
2997 (!ArrayForm || UsualArrayDeleteWantsSize ||
3007 PDiag(diag::err_access_dtor) << PointeeElem);
3014 UsualArrayDeleteWantsSize, OperatorDelete, Ex.
get(), StartLoc);
3015 AnalyzeDeleteExprMismatch(Result);
3020 bool IsDelete,
bool CallCanBeVirtual,
3021 bool WarnOnNonAbstractTypes,
3023 if (!dtor || dtor->
isVirtual() || !CallCanBeVirtual)
3035 if (!PointeeRD->
isPolymorphic() || PointeeRD->hasAttr<FinalAttr>())
3042 Diag(Loc, diag::warn_delete_abstract_non_virtual_dtor) << (IsDelete ? 0 : 1)
3044 }
else if (WarnOnNonAbstractTypes) {
3047 Diag(Loc, diag::warn_delete_non_virtual_dtor) << (IsDelete ? 0 : 1)
3051 std::string TypeStr;
3053 Diag(DtorLoc, diag::note_delete_non_virtual)
3074 if (ConditionVar->isInvalidDecl())
3083 diag::err_invalid_use_of_function_type)
3087 diag::err_invalid_use_of_array_type)
3092 false, ConditionVar->getLocation(),
3108 llvm_unreachable(
"unexpected condition kind");
3122 llvm::APSInt
Value(1);
3137 From = Cast->getSubExpr();
3149 if (!ToPtrType->getPointeeType().hasQualifiers()) {
3150 switch (StrLit->getKind()) {
3157 return (ToPointeeType->getKind() == BuiltinType::Char_U ||
3158 ToPointeeType->getKind() == BuiltinType::Char_S);
3175 bool HadMultipleCandidates,
3178 default: llvm_unreachable(
"Unhandled cast kind!");
3179 case CK_ConstructorConversion: {
3184 diag::err_allocation_of_abstract_type))
3196 CastLoc, Ty, FoundDecl, cast<CXXConstructorDecl>(Method),
3197 ConstructorArgs, HadMultipleCandidates,
3198 false,
false,
false,
3206 case CK_UserDefinedConversion: {
3216 HadMultipleCandidates);
3217 if (Result.isInvalid())
3221 CK_UserDefinedConversion, Result.get(),
3222 nullptr, Result.get()->getValueKind());
3254 assert(FD &&
"no conversion function for user-defined conversion seq");
3256 CastKind = CK_UserDefinedConversion;
3264 CastKind = CK_ConstructorConversion;
3286 From->getLocStart(),
3296 From = CastArg.
get();
3304 PDiag(diag::err_typecheck_ambiguous_condition)
3305 << From->getSourceRange());
3309 llvm_unreachable(
"Cannot perform an ellipsis conversion");
3349 ConstructorArgs,
false,
3350 false,
false,
false,
3357 false,
false,
false,
3380 ToAtomicType = ToType;
3381 ToType = ToAtomic->getValueType();
3384 QualType InitialFromType = FromType;
3386 switch (SCS.
First) {
3389 FromType = FromAtomic->getValueType().getUnqualifiedType();
3398 assert(!FromRes.isInvalid() &&
"Can't perform deduced conversion?!");
3399 From = FromRes.get();
3400 FromType = From->getType();
3417 llvm_unreachable(
"Improper first standard conversion");
3464 "only enums with fixed underlying type can promote to bool");
3486 CK = CK_FloatingComplexCast;
3488 CK = CK_FloatingComplexToIntegralComplex;
3490 CK = CK_IntegralComplexToFloatingComplex;
3492 CK = CK_IntegralComplexCast;
3518 Diag(From->getLocStart(),
3519 diag::ext_typecheck_convert_incompatible_pointer)
3520 << ToType << From->
getType() << Action
3521 << From->getSourceRange() << 0;
3523 Diag(From->getLocStart(),
3524 diag::ext_typecheck_convert_incompatible_pointer)
3525 << From->
getType() << ToType << Action
3526 << From->getSourceRange() << 0;
3536 Diag(From->getLocStart(),
3537 diag::err_arc_weak_unavailable_assign);
3539 Diag(From->getLocStart(),
3540 diag::err_arc_convesion_of_weak_unavailable)
3542 << From->getSourceRange();
3552 if (Kind == CK_BlockPointerToObjCPointerCast) {
3600 From->getLocStart(),
3601 From->getSourceRange(),
3608 &BasePath, CCK).
get();
3621 nullptr, CCK).
get();
3628 QualType ElType = ToComplex->getElementType();
3636 isFloatingComplex ? CK_FloatingCast : CK_FloatingToIntegral).
get();
3640 isFloatingComplex ? CK_IntegralToFloating : CK_IntegralCast).
get();
3644 isFloatingComplex ? CK_FloatingRealToComplex
3645 : CK_IntegralRealToComplex).
get();
3650 assert(FromComplex);
3657 isFloatingComplex ? CK_FloatingComplexToReal
3658 : CK_IntegralComplexToReal,
3666 isFloatingComplex ? CK_FloatingCast : CK_IntegralToFloating,
3671 isFloatingComplex ? CK_FloatingToIntegral : CK_IntegralCast,
3689 From = FromRes.
get();
3691 "Improper transparent union conversion");
3708 llvm_unreachable(
"Improper second standard conversion");
3711 switch (SCS.
Third) {
3722 CK_NoOp, VK,
nullptr, CCK).
get();
3727 ? diag::ext_deprecated_string_literal_conversion
3728 : diag::warn_deprecated_string_literal_conversion)
3736 llvm_unreachable(
"Improper third standard conversion");
3741 if (!ToAtomicType.
isNull()) {
3752 From->getLocStart());
3776 default: llvm_unreachable(
"not a UTT");
3829 Loc, ArgTy, diag::err_incomplete_type_used_in_type_trait_expr);
3838 Loc, ArgTy, diag::err_incomplete_type_used_in_type_trait_expr);
3879 Loc, ElTy, diag::err_incomplete_type_used_in_type_trait_expr);
3890 if ((RD->*HasTrivial)() && !(RD->*HasNonTrivial)())
3897 bool FoundOperator =
false;
3900 Op != OpEnd; ++Op) {
3901 if (isa<FunctionTemplateDecl>(*Op))
3905 if((Operator->*IsDesiredOp)()) {
3906 FoundOperator =
true;
3914 return FoundOperator;
3921 assert(!T->
isDependentType() &&
"Cannot evaluate traits of dependent type");
3925 default: llvm_unreachable(
"not a UTT");
4025 return RD->hasAttr<FinalAttr>();
4054 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl())
4064 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl())
4085 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl())
4131 if (
auto *RD = C.getBaseElementType(T)->getAsCXXRecordDecl()) {
4140 if (C.getLangOpts().AccessControl && Destructor->getAccess() !=
AS_public)
4167 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl())
4179 if (C.getBaseElementType(T).isConstQualified())
4218 bool FoundConstructor =
false;
4224 if (isa<FunctionTemplateDecl>(ND))
4228 FoundConstructor =
true;
4241 return FoundConstructor;
4252 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl()) {
4257 bool FoundConstructor =
false;
4260 if (isa<FunctionTemplateDecl>(ND))
4264 FoundConstructor =
true;
4276 return FoundConstructor;
4285 return Destructor->isVirtual();
4315 llvm_unreachable(
"Unknown ObjC lifetime qualifier");
4329 Args[1]->getType(), RParenLoc);
4348 assert(!Args.empty());
4353 for (
const auto *TSI : Args) {
4359 diag::err_incomplete_type_used_in_type_trait_expr))
4375 ArgExprs.reserve(Args.size() - 1);
4376 for (
unsigned I = 1, N = Args.size();
I != N; ++
I) {
4380 OpaqueArgExprs.push_back(
4385 for (
Expr &E : OpaqueArgExprs)
4386 ArgExprs.push_back(&E);
4419 return !Result.
get()->hasNonTrivialCall(S.
Context);
4422 llvm_unreachable(
"unhandled type trait");
4425 default: llvm_unreachable(
"not a TT");
4437 *
this, Kind, KWLoc, Args[0]->getType()))
4440 bool Dependent =
false;
4441 for (
unsigned I = 0, N = Args.size();
I != N; ++
I) {
4442 if (Args[
I]->getType()->isDependentType()) {
4460 ConvertedArgs.reserve(Args.size());
4462 for (
unsigned I = 0, N = Args.size();
I != N; ++
I) {
4468 ConvertedArgs.push_back(TInfo);
4477 "Cannot evaluate traits of dependent types");
4487 if (!lhsRecord)
return false;
4490 if (!rhsRecord)
return false;
4493 == (lhsRecord == rhsRecord));
4495 if (lhsRecord == rhsRecord)
4503 diag::err_incomplete_type_used_in_type_trait_expr))
4506 return cast<CXXRecordDecl>(rhsRecord->
getDecl())
4507 ->isDerivedFrom(cast<CXXRecordDecl>(lhsRecord->
getDecl()));
4561 Expr *FromPtr = &From;
4594 diag::err_incomplete_type_used_in_type_trait_expr))
4598 diag::err_incomplete_type_used_in_type_trait_expr))
4639 return !Result.get()->hasNonTrivialCall(Self.
Context);
4642 llvm_unreachable(
"unhandled type trait");
4645 default: llvm_unreachable(
"not a BTT");
4647 llvm_unreachable(
"Unknown type trait or not implemented");
4666 assert(!T->
isDependentType() &&
"Cannot evaluate traits of dependent type");
4674 T = AT->getElementType();
4684 diag::err_dimension_expr_not_constant_integer,
4687 if (Value.isSigned() && Value.isNegative()) {
4688 Self.
Diag(KeyLoc, diag::err_dimension_expr_not_constant_integer)
4689 << DimExpr->getSourceRange();
4692 Dim = Value.getLimitedValue();
4696 bool Matched =
false;
4703 T = AT->getElementType();
4708 return CAT->getSize().getLimitedValue();
4714 llvm_unreachable(
"Unknown type trait or not implemented");
4757 llvm_unreachable(
"Expression trait not covered by switch");
4784 "placeholders should have been weeded out by now");
4796 const char *OpSpelling = isIndirect ?
"->*" :
".*";
4804 Diag(Loc, diag::err_bad_memptr_rhs)
4805 << OpSpelling << RHSType << RHS.
get()->getSourceRange();
4826 Diag(Loc, diag::err_bad_memptr_lhs)
4827 << OpSpelling << 1 << LHSType
4836 OpSpelling, (
int)isIndirect)) {
4841 Diag(Loc, diag::err_bad_memptr_lhs) << OpSpelling
4849 RHS.
get()->getLocEnd()),
4863 Diag(Loc, diag::err_pointer_to_member_type) << isIndirect;
4882 switch (Proto->getRefQualifier()) {
4889 Diag(Loc, diag::err_pointer_to_member_oper_value_classify)
4890 << RHSType << 1 << LHS.
get()->getSourceRange();
4895 Diag(Loc, diag::err_pointer_to_member_oper_value_classify)
4896 << RHSType << 0 << LHS.
get()->getSourceRange();
4911 }
else if (isIndirect) {
4929 bool &HaveConversion,
4931 HaveConversion =
false;
4956 HaveConversion =
true;
4961 return InitSeq.
Diagnose(Self, Entity, Kind, From);
4971 bool FDerivedFromT = FRec && TRec && FRec != TRec &&
4973 if (FRec && TRec && (FRec == TRec || FDerivedFromT ||
4978 if (FRec == TRec || FDerivedFromT) {
4983 HaveConversion =
true;
4988 return InitSeq.
Diagnose(Self, Entity, Kind, From);
5007 HaveConversion = !InitSeq.
Failed();
5010 return InitSeq.
Diagnose(Self, Entity, Kind, From);
5058 Self.
Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands)
5059 << LHS.
get()->getType() << RHS.
get()->getType()
5060 << LHS.
get()->getSourceRange() << RHS.
get()->getSourceRange();
5064 Self.
Diag(QuestionLoc, diag::err_conditional_ambiguous_ovl)
5065 << LHS.
get()->getType() << RHS.
get()->getType()
5066 << LHS.
get()->getSourceRange() << RHS.
get()->getSourceRange();
5072 llvm_unreachable(
"Conditional operator has only built-in overloads");
5127 if (LVoid || RVoid) {
5134 if (LThrow != RThrow) {
5135 Expr *NonThrow = LThrow ? RHS.
get() : LHS.
get();
5149 Diag(QuestionLoc, diag::err_conditional_void_nonvoid)
5150 << (LVoid ? RTy : LTy) << (LVoid ? 0 : 1)
5151 << LHS.
get()->getSourceRange() << RHS.
get()->getSourceRange();
5165 bool HaveL2R, HaveR2L;
5172 if (HaveL2R && HaveR2L) {
5173 Diag(QuestionLoc, diag::err_conditional_ambiguous)
5174 << LTy << RTy << LHS.
get()->getSourceRange() << RHS.
get()->getSourceRange();
5185 }
else if (HaveR2L) {
5206 if (RCVR.isStrictSupersetOf(LCVR)) {
5224 if (Same && LVK == RVK && LVK !=
VK_RValue &&
5237 if (!Same && (LTy->isRecordType() || RTy->
isRecordType())) {
5253 RTy = RHS.get()->getType();
5262 if (LTy->isRecordType()) {
5265 diag::err_allocation_of_abstract_type))
5303 diag::err_typecheck_cond_incompatible_operands) << LTy << RTy
5304 << LHS.
get()->getSourceRange() << RHS.get()->getSourceRange();
5326 bool NonStandardCompositeType =
false;
5329 : &NonStandardCompositeType);
5330 if (!Composite.
isNull()) {
5331 if (NonStandardCompositeType)
5333 diag::ext_typecheck_cond_incompatible_operands_nonstandard)
5334 << LTy << RTy << Composite
5335 << LHS.
get()->getSourceRange() << RHS.get()->getSourceRange();
5349 Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands)
5350 << LHS.
get()->
getType() << RHS.get()->getType()
5351 << LHS.
get()->getSourceRange() << RHS.get()->getSourceRange();
5371 bool *NonStandardCompositeType) {
5372 if (NonStandardCompositeType)
5373 *NonStandardCompositeType =
false;
5385 !T2->isAnyPointerType() && !T2->isMemberPointerType()) {
5391 if (T2->isNullPtrType() &&
5400 if (T2->isMemberPointerType())
5416 (!T2->isPointerType() && !T2->isMemberPointerType()))
5431 QualifierVector QualifierUnion;
5433 ContainingClassVector;
5434 ContainingClassVector MemberOfClass;
5437 unsigned NeedConstBefore = 0;
5447 if (NonStandardCompositeType &&
5449 NeedConstBefore = QualifierUnion.size();
5451 QualifierUnion.push_back(
5453 MemberOfClass.push_back(std::make_pair(
nullptr,
nullptr));
5465 if (NonStandardCompositeType &&
5467 NeedConstBefore = QualifierUnion.size();
5469 QualifierUnion.push_back(
5471 MemberOfClass.push_back(std::make_pair(MemPtr1->
getClass(),
5482 if (NeedConstBefore && NonStandardCompositeType) {
5486 for (
unsigned I = 0;
I != NeedConstBefore; ++
I) {
5489 *NonStandardCompositeType =
true;
5495 ContainingClassVector::reverse_iterator MOC
5496 = MemberOfClass.rbegin();
5497 for (QualifierVector::reverse_iterator
5498 I = QualifierUnion.rbegin(),
5499 E = QualifierUnion.rend();
5500 I !=
E; (void)++
I, ++MOC) {
5502 if (MOC->first && MOC->second) {
5527 if (E1ToC1 && E2ToC1) {
5536 if (E1ToC2 && E2ToC2) {
5545 = E1ToC1.
Perform(*
this, Entity1, Kind, E1);
5552 = E2ToC1.
Perform(*
this, Entity1, Kind, E2);
5553 if (E2Result.isInvalid())
5555 E2 = E2Result.getAs<
Expr>();
5565 if (!E1ToC2 || !E2ToC2)
5570 = E1ToC2.
Perform(*
this, Entity2, Kind, E1);
5577 = E2ToC2.
Perform(*
this, Entity2, Kind, E2);
5578 if (E2Result.isInvalid())
5580 E2 = E2Result.getAs<
Expr>();
5589 assert(!isa<CXXBindTemporaryExpr>(E) &&
"Double-bound temporary?");
5600 bool ReturnsRetained;
5604 if (
CallExpr *Call = dyn_cast<CallExpr>(E)) {
5605 Expr *Callee = Call->getCallee()->IgnoreParens();
5611 T = BinOp->getRHS()->getType();
5612 else if (
MemberExpr *Mem = dyn_cast<MemberExpr>(Callee))
5613 T = Mem->getMemberDecl()->getType();
5624 assert(FTy &&
"call to value not of function type?");
5629 }
else if (isa<StmtExpr>(E)) {
5630 ReturnsRetained =
true;
5634 }
else if (isa<CastExpr>(E) &&
5635 isa<BlockExpr>(cast<CastExpr>(E)->getSubExpr())) {
5644 D = Send->getMethodDecl();
5645 }
else if (
ObjCBoxedExpr *BoxedExpr = dyn_cast<ObjCBoxedExpr>(E)) {
5646 D = BoxedExpr->getBoxingMethod();
5648 D = ArrayLit->getArrayWithObjectsMethod();
5650 = dyn_cast<ObjCDictionaryLiteral>(E)) {
5651 D = DictLit->getDictWithObjectsMethod();
5654 ReturnsRetained = (D && D->hasAttr<NSReturnsRetainedAttr>());
5659 if (!ReturnsRetained &&
5670 CastKind ck = (ReturnsRetained ? CK_ARCConsumeObject
5671 : CK_ARCReclaimReturnedObject);
5686 RT = cast<RecordType>(T);
5688 case Type::ConstantArray:
5689 case Type::IncompleteArray:
5690 case Type::VariableArray:
5691 case Type::DependentSizedArray:
5692 T = cast<ArrayType>(T)->getElementType().getTypePtr();
5711 PDiag(diag::err_access_dtor_temp)
5742 assert(SubExpr &&
"subexpression can't be null!");
5764 assert(SubStmt &&
"sub-statement can't be null!");
5788 assert(
ExprEvalContexts.back().IsDecltype &&
"not in a decltype expression");
5800 if (
ParenExpr *PE = dyn_cast<ParenExpr>(E)) {
5804 if (SubExpr.
get() == PE->getSubExpr())
5809 if (BO->getOpcode() == BO_Comma) {
5813 if (RHS.
get() == BO->getRHS())
5816 BO->getLHS(), RHS.
get(), BO_Comma, BO->
getType(), BO->getValueKind(),
5817 BO->getObjectKind(), BO->getOperatorLoc(), BO->isFPContractable());
5841 if (Call == TopCall)
5856 if (Bind == TopBind)
5868 PDiag(diag::err_access_dtor_temp)
5884 unsigned SkipStart = OperatorArrows.size(), SkipCount = 0;
5887 if (OperatorArrows.size() > Limit) {
5889 SkipStart = (Limit - 1) / 2 + (Limit - 1) % 2;
5890 SkipCount = OperatorArrows.size() - (Limit - 1);
5893 for (
unsigned I = 0;
I < OperatorArrows.size(); ) {
5894 if (
I == SkipStart) {
5895 S.
Diag(OperatorArrows[
I]->getLocation(),
5896 diag::note_operator_arrows_suppressed)
5900 S.
Diag(OperatorArrows[
I]->getLocation(), diag::note_operator_arrow_here)
5901 << OperatorArrows[
I]->getCallResultType();
5911 bool &MayBePseudoDestructor) {
5915 Base = Result.
get();
5919 Base = Result.
get();
5922 MayBePseudoDestructor =
false;
5927 if (OpKind == tok::arrow)
5932 MayBePseudoDestructor =
true;
5939 if (OpKind == tok::arrow) {
5941 bool NoArrowOperatorFound =
false;
5942 bool FirstIteration =
true;
5945 llvm::SmallPtrSet<CanQualType,8> CTypes;
5950 if (OperatorArrows.size() >=
getLangOpts().ArrowDepth) {
5951 Diag(OpLoc, diag::err_operator_arrow_depth_exceeded)
5952 << StartingType <<
getLangOpts().ArrowDepth << Base->getSourceRange();
5954 Diag(OpLoc, diag::note_operator_arrow_depth)
5967 : &NoArrowOperatorFound);
5969 if (NoArrowOperatorFound) {
5970 if (FirstIteration) {
5971 Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
5972 << BaseType << 1 << Base->getSourceRange()
5974 OpKind = tok::period;
5977 Diag(OpLoc, diag::err_typecheck_member_reference_arrow)
5978 << BaseType << Base->getSourceRange();
5982 diag::note_member_reference_arrow_from_operator_arrow);
5987 Base = Result.
get();
5989 OperatorArrows.push_back(OpCall->getDirectCallee());
5992 if (!CTypes.insert(CBaseType).second) {
5993 Diag(OpLoc, diag::err_operator_arrow_circular) << StartingType;
5997 FirstIteration =
false;
6000 if (OpKind == tok::arrow &&
6023 MayBePseudoDestructor =
true;
6026 ObjectType =
nullptr;
6027 MayBePseudoDestructor =
true;
6055 Base = result.
get();
6065 if (OpKind == tok::arrow) {
6070 S.
Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
6071 << ObjectType <<
true
6076 OpKind = tok::period;
6094 if (
CheckArrow(*
this, ObjectType, Base, OpKind, OpLoc))
6100 Diag(OpLoc, diag::ext_pseudo_dtor_on_void) << Base->getSourceRange();
6102 Diag(OpLoc, diag::err_pseudo_dtor_base_not_scalar)
6103 << ObjectType << Base->getSourceRange();
6111 if (DestructedTypeInfo) {
6117 Diag(DestructedTypeStart, diag::err_pseudo_dtor_type_mismatch)
6118 << ObjectType << DestructedType << Base->getSourceRange()
6122 DestructedType = ObjectType;
6124 DestructedTypeStart);
6133 Diag(DestructedTypeStart, diag::err_arc_pseudo_dtor_inconstant_quals)
6134 << ObjectType << DestructedType << Base->getSourceRange()
6139 DestructedType = ObjectType;
6141 DestructedTypeStart);
6154 if (ScopeTypeInfo) {
6160 diag::err_pseudo_dtor_type_mismatch)
6161 << ObjectType << ScopeType << Base->getSourceRange()
6165 ScopeTypeInfo =
nullptr;
6171 OpKind == tok::arrow, OpLoc,
6191 "Invalid first type name in pseudo-destructor");
6194 "Invalid second type name in pseudo-destructor");
6197 if (
CheckArrow(*
this, ObjectType, Base, OpKind, OpLoc))
6218 S, &SS,
true,
false, ObjectTypePtrForLookup);
6230 diag::err_pseudo_dtor_destructor_non_type)
6236 DestructedType = ObjectType;
6251 if (T.isInvalid() || !T.get()) {
6253 DestructedType = ObjectType;
6260 if (!DestructedType.
isNull()) {
6261 if (!DestructedTypeInfo)
6275 S, &SS,
true,
false, ObjectTypePtrForLookup);
6278 diag::err_pseudo_dtor_destructor_non_type)
6300 if (T.isInvalid() || !T.get()) {
6308 if (!ScopeType.
isNull() && !ScopeTypeInfo)
6314 ScopeTypeInfo, CCLoc, TildeLoc,
6324 if (
CheckArrow(*
this, ObjectType, Base, OpKind, OpLoc))
6343 bool HadMultipleCandidates) {
6354 SubE = BE->getSubExpr();
6355 if (isa<LambdaExpr>(SubE)) {
6382 if (HadMultipleCandidates)
6392 Exp.
get()->getLocEnd());
6412 Diag(Operand->
getExprLoc(), diag::warn_side_effects_unevaluated_context);
6434 if (isa<DeclRefExpr>(E))
6438 if (isa<ArraySubscriptExpr>(E))
6442 if (isa<MemberExpr>(E))
6447 if (UO->getOpcode() == UO_Deref)
6452 if (BO->isPtrMemOp())
6456 if (BO->getOpcode() == BO_Comma)
6467 dyn_cast<BinaryConditionalOperator>(E)) {
6468 if (
OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(BCO->getTrueExpr()))
6474 if (isa<PseudoObjectExpr>(E) || isa<ObjCIvarRefExpr>(
E))
6522 if (!T->getDecl()->isComplete()) {
6536 diag::err_incomplete_type);
6554 if (isa<ParmVarDecl>(Var))
return true;
6555 const VarDecl *DefVD =
nullptr;
6560 if (DefVD->
isWeak())
return false;
6588 "The current call operator must be synchronized with Sema's CurContext");
6598 const unsigned NumPotentialCaptures =
6600 for (
unsigned I = 0;
I != NumPotentialCaptures; ++
I) {
6601 Expr *VarExpr =
nullptr;
6616 !IsFullExprInstantiationDependent)
6623 FunctionScopesArrayRef, Var, S)) {
6624 const unsigned FunctionScopeIndexOfCapturableLambda = Index.getValue();
6626 &FunctionScopeIndexOfCapturableLambda);
6628 const bool IsVarNeverAConstantExpression =
6630 if (!IsFullExprInstantiationDependent || IsVarNeverAConstantExpression) {
6642 DeclRefType,
nullptr)) {
6648 DeclRefType,
nullptr);
6659 FunctionScopesArrayRef,
nullptr, S)) {
6660 const unsigned FunctionScopeIndexOfCapturableLambda = Index.getValue();
6663 &FunctionScopeIndexOfCapturableLambda);
6686 R.setLookupName(ND->getDeclName());
6688 if (ND->isCXXClassMember()) {
6692 Record = NNS->getAsType()->getAsCXXRecordDecl();
6695 dyn_cast<
CXXRecordDecl>(ND->getDeclContext()->getRedeclContext());
6697 R.setNamingClass(Record);
6701 bool MightBeImplicitMember;
6703 MightBeImplicitMember =
true;
6705 MightBeImplicitMember =
false;
6706 else if (R.isOverloadedResult())
6707 MightBeImplicitMember =
false;
6708 else if (R.isUnresolvableResult())
6709 MightBeImplicitMember =
true;
6711 MightBeImplicitMember = isa<FieldDecl>(ND) ||
6712 isa<IndirectFieldDecl>(ND) ||
6713 isa<MSPropertyDecl>(ND);
6715 if (MightBeImplicitMember)
6719 }
else if (
auto *Ivar = dyn_cast<ObjCIvarDecl>(ND)) {
6721 Ivar->getIdentifier());
6735 : TypoExprs(TypoExprs) {}
6737 TypoExprs.insert(TE);
6742 class TransformTypos :
public TreeTransform<TransformTypos> {
6747 llvm::function_ref<ExprResult(Expr *)> ExprFilter;
6749 llvm::SmallDenseMap<TypoExpr *, ExprResult, 2> TransformCache;
6750 llvm::SmallDenseMap<OverloadExpr *, Expr *, 4> OverloadResolution;
6756 void EmitAllDiagnostics() {
6757 for (
auto E : TypoExprs) {
6759 auto &
State = SemaRef.getTypoExprState(TE);
6760 if (State.DiagHandler) {
6770 Replacement.
isInvalid() ?
nullptr : Replacement.
get()))
6773 State.DiagHandler(TC);
6775 SemaRef.clearDelayedTypo(TE);
6788 bool CheckAndAdvanceTypoExprCorrectionStreams() {
6789 for (
auto TE : TypoExprs) {
6790 auto &State = SemaRef.getTypoExprState(TE);
6791 TransformCache.erase(TE);
6792 if (!State.Consumer->finished())
6794 State.Consumer->resetCorrectionStream();
6800 if (
auto *OE = dyn_cast_or_null<OverloadExpr>(E))
6801 E = OverloadResolution[OE];
6805 if (
auto *DRE = dyn_cast<DeclRefExpr>(E))
6806 return DRE->getFoundDecl();
6807 if (
auto *ME = dyn_cast<MemberExpr>(E))
6818 if (Trap.hasErrorOccurred() || Res.
isInvalid())
6821 return ExprFilter(Res.
get());
6826 : BaseTransform(SemaRef), InitDecl(InitDecl), ExprFilter(Filter) {}
6831 Expr *ExecConfig =
nullptr) {
6832 auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args,
6833 RParenLoc, ExecConfig);
6834 if (
auto *OE = dyn_cast<OverloadExpr>(Callee)) {
6837 if (
auto *BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall))
6838 ResultCall = BE->getSubExpr();
6839 if (
auto *CE = dyn_cast<CallExpr>(ResultCall))
6840 OverloadResolution[OE] = CE->getCallee();
6861 Res = TryTransform(E);
6866 !CheckAndAdvanceTypoExprCorrectionStreams())
6879 while (!AmbiguousTypoExprs.empty()) {
6880 auto TE = AmbiguousTypoExprs.back();
6881 auto Cached = TransformCache[TE];
6883 State.Consumer->saveCurrentPosition();
6884 TransformCache.erase(TE);
6886 State.Consumer->resetCorrectionStream();
6887 TransformCache.erase(TE);
6891 AmbiguousTypoExprs.remove(TE);
6892 State.Consumer->restoreSavedPosition();
6893 TransformCache[TE] = Cached;
6899 FindTypoExprs(TypoExprs).TraverseStmt(E);
6901 EmitAllDiagnostics();
6910 auto &CacheEntry = TransformCache[
E];
6911 if (!TypoExprs.insert(E) && !CacheEntry.isUnset()) {
6916 assert(State.Consumer &&
"Cannot transform a cleared TypoExpr");
6920 while (
TypoCorrection TC = State.Consumer->getNextCorrection()) {
6924 State.RecoveryHandler(SemaRef, E, TC) :
6931 if ((Next = State.Consumer->peekNextCorrection()) &&
6933 AmbiguousTypoExprs.insert(E);
6935 AmbiguousTypoExprs.remove(E);
6938 "Typo was transformed into a valid-but-null ExprResult");
6939 return CacheEntry = NE;
6957 assert(TyposInContext < ~0U &&
"Recursive call of CorrectDelayedTyposInExpr");
6959 auto TyposResolved = DelayedTypos.size();
6960 auto Result = TransformTypos(*
this, InitDecl, Filter).Transform(E);
6962 TyposResolved -= DelayedTypos.size();
6967 assert(TyposResolved == 0 &&
"Corrected typo but got same Expr back?");
6973 bool DiscardedValue,
6975 bool IsLambdaInitCaptureInitializer) {
6978 if (!FullExpr.
get())
6996 if (!IsLambdaInitCaptureInitializer &&
7001 if (DiscardedValue &&
getLangOpts().DebuggerCastResultToId &&
7008 if (DiscardedValue) {
7022 CheckCompletedExpr(FullExpr.
get(), CC, IsConstexpr);
7070 if (IsInLambdaDeclContext && CurrentLSI &&
7071 CurrentLSI->hasPotentialCaptures() && !FullExpr.
isInvalid())
7115 llvm_unreachable(
"Invalid LookupResult Kind!");
7128 if (!Unexpanded.empty()) {
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
bool isDependentName() const
Determines whether the name itself is dependent, e.g., because it involves a C++ type that is itself ...
static bool CheckArrow(Sema &S, QualType &ObjectType, Expr *&Base, tok::TokenKind &OpKind, SourceLocation OpLoc)
unsigned getFlags() const
getFlags - Return the flags for this scope.
A call to an overloaded operator written using operator syntax.
unsigned getAddressSpace() const
Return the address space of this type.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
bool isObjCObjectOrInterfaceType() const
DeclAccessPair FoundConversionFunction
The declaration that we found via name lookup, which might be the same as ConversionFunction or it mi...
Defines the clang::ASTContext interface.
bool isAddressOfOperand() const
SourceLocation getEnd() const
CanThrowResult canThrow(const Expr *E)
unsigned DeprecatedStringLiteralToCharPtr
Whether this is the deprecated conversion of a string literal to a pointer to non-const character dat...
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
This is the scope of a C++ try statement.
ExprResult ActOnArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, ParsedType LhsTy, Expr *DimExpr, SourceLocation RParen)
ActOnArrayTypeTrait - Parsed one of the bianry type trait support pseudo-functions.
CastKind getCastKind() const
The null pointer literal (C++11 [lex.nullptr])
void clearPotentialCaptures()
IdKind getKind() const
Determine what kind of name we have.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
void MarkVarDeclODRUsed(VarDecl *Var, SourceLocation Loc, Sema &SemaRef, const unsigned *const FunctionScopeIndexToStopAt)
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, DeclarationName Name, FunctionDecl *&Operator, bool Diagnose=true)
Name lookup found a set of overloaded functions that met the criteria.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
bool EllipsisConversion
EllipsisConversion - When this is true, it means user-defined conversion sequence starts with a ...
bool isNullPtrType() const
static bool EvaluateExpressionTrait(ExpressionTrait ET, Expr *E)
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
bool Diagnose(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, ArrayRef< Expr * > Args)
Diagnose an potentially-invalid initialization sequence.
bool isNonOverloadPlaceholderType() const
Test for a placeholder type other than Overload; see BuiltinType::isNonOverloadPlaceholderType.
PointerType - C99 6.7.5.1 - Pointer Declarators.
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
Stores the type being destroyed by a pseudo-destructor expression.
A (possibly-)qualified type.
This is a scope that corresponds to the parameters within a function prototype.
Simple class containing the result of Sema::CorrectTypo.
void addThisCapture(bool isNested, SourceLocation Loc, Expr *Cpy, bool ByCopy)
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
static bool IsSpecialDiscardedValue(Expr *E)
capture_const_range captures() const
ConditionResult ActOnConditionVariable(Decl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
void EraseUnwantedCUDAMatches(const FunctionDecl *Caller, SmallVectorImpl< FunctionDecl * > &Matches)
Finds a function in Matches with highest calling priority from Caller context and erases all function...
bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id)
QualType getConversionType() const
Returns the type that this conversion function is converting to.
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after...
bool isMemberPointerType() const
static InitializedEntity InitializeException(SourceLocation ThrowLoc, QualType Type, bool NRVO)
Create the initialization entity for an exception object.
SourceLocation StartLocation
The location of the first token that describes this unqualified-id, which will be the location of the...
static const CastKind CK_Invalid
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
bool tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name)
Try to add the given declaration to the top level scope, if it (or a redeclaration of it) hasn't alre...
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc...
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type...
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
const LangOptions & getLangOpts() const
SourceLocation TemplateNameLoc
TemplateNameLoc - The location of the template name within the source.
static ConditionResult ConditionError()
Qualifiers::ObjCLifetime getObjCARCImplicitLifetime() const
Return the implicit lifetime for this type, which must not be dependent.
DeclClass * getAsSingle() const
static void collectPublicBases(CXXRecordDecl *RD, llvm::DenseMap< CXXRecordDecl *, unsigned > &SubobjectsSeen, llvm::SmallPtrSetImpl< CXXRecordDecl * > &VBases, llvm::SetVector< CXXRecordDecl * > &PublicSubobjectsSeen, bool ParentIsPublic)
QualType CXXThisTypeOverride
When non-NULL, the C++ 'this' expression is allowed despite the current context not being a non-stati...
IdentifierInfo * Identifier
When Kind == IK_Identifier, the parsed identifier, or when Kind == IK_UserLiteralId, the identifier suffix.
bool isGenericLambdaCallOperatorSpecialization(const CXXMethodDecl *MD)
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Filter makeFilter()
Create a filter for this result set.
FunctionType - C99 6.7.5.3 - Function Declarators.
FullExprArg MakeFullExpr(Expr *Arg)
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
Provides information about an attempted template argument deduction, whose success or failure was des...
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>.
Microsoft __if_not_exists.
static void getUnambiguousPublicSubobjects(CXXRecordDecl *RD, llvm::SmallVectorImpl< CXXRecordDecl * > &Objects)
const Scope * getParent() const
getParent - Return the scope that this is nested in.
void addConst()
Add the const type qualifier to this QualType.
ActionResult< Expr * > ExprResult
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
The current expression is potentially evaluated at run time, which means that code may be generated t...
Complex conversions (C99 6.3.1.6)
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
void erase()
Erase the last element returned from this iterator.
bool isRecordType() const
UserDefinedConversionSequence UserDefined
When ConversionKind == UserDefinedConversion, provides the details of the user-defined conversion seq...
static bool FindConditionalOverload(Sema &Self, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
Try to find a common type for two according to C++0x 5.16p5.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
bool DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr, SourceLocation QuestionLoc)
Emit a specialized diagnostic when one expression is a null pointer constant and the other is not a p...
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.
ExprResult ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation LParen, Expr *Operand, SourceLocation RParen)
void addDefaultArgExprForConstructor(const CXXConstructorDecl *CD, unsigned ParmIdx, Expr *DAE)
AssignConvertType
AssignConvertType - All of the 'assignment' semantic checks return this enum to indicate whether the ...
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
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...
ExprResult BuildBlockForLambdaConversion(SourceLocation CurrentLocation, SourceLocation ConvLocation, CXXConversionDecl *Conv, Expr *Src)
bool isEnumeralType() const
ParenExpr - This represents a parethesized expression, e.g.
ExprResult forceUnknownAnyToType(Expr *E, QualType ToType)
Force an expression with unknown-type to an expression of the given type.
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...
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
QualType getPointeeType() const
The base class of the type hierarchy.
This indicates that the scope corresponds to a function, which means that labels are set here...
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
unsigned IncompatibleObjC
IncompatibleObjC - Whether this is an Objective-C conversion that we should warn about (if we actuall...
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
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...
Represents an array type, per C99 6.7.5.2 - Array Declarators.
void MarkDeclRefReferenced(DeclRefExpr *E)
Perform reference-marking and odr-use handling for a DeclRefExpr.
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
static InitializationKind CreateDefault(SourceLocation InitLoc)
Create a default initialization.
static void CheckIfAnyEnclosingLambdasMustCaptureAnyPotentialCaptures(Expr *const FE, LambdaScopeInfo *const CurrentLSI, Sema &S)
Check if the current lambda has any potential captures that must be captured by any of its enclosing ...
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
Represents a call to a C++ constructor.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent...
Ambiguous candidates found.
bool isBooleanType() const
A container of type source information.
bool hasPotentialThisCapture() const
Conversions between compatible types in C99.
bool isBlockPointerType() const
static bool evaluateTypeTrait(Sema &S, TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
static CXXFunctionalCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, TypeSourceInfo *Written, CastKind Kind, Expr *Op, const CXXCastPath *Path, SourceLocation LPLoc, SourceLocation RPLoc)
ExprResult ActOnExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
ActOnExpressionTrait - Parsed one of the unary type trait support pseudo-functions.
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...
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2, C99 6.9p3)
void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return, QualType Param1, QualType Param2=QualType())
DeclareGlobalAllocationFunction - Declares a single implicit global allocation function if it doesn't...
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
static InitializedEntity InitializeTemporary(QualType Type)
Create the initialization entity for a temporary.
bool DisableTypoCorrection
Tracks whether we are in a context where typo correction is disabled.
An identifier, stored as an IdentifierInfo*.
This file provides some common utility functions for processing Lambda related AST Constructs...
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
RAII object that enters a new expression evaluation context.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
ExprResult PerformObjectArgumentInitialization(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, CXXMethodDecl *Method)
PerformObjectArgumentInitialization - Perform initialization of the implicit object parameter for the...
static ExprResult attemptRecovery(Sema &SemaRef, const TypoCorrectionConsumer &Consumer, const TypoCorrection &TC)
IfExistsResult
Describes the result of an "if-exists" condition check.
Expr * getInit() const
Get the initializer.
CleanupInfo Cleanup
Used to control the generation of ExprWithCleanups.
Information about one declarator, including the parsed type information and the identifier.
DiagnosticsEngine & Diags
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
Extra information about a function prototype.
AccessResult CheckDestructorAccess(SourceLocation Loc, CXXDestructorDecl *Dtor, const PartialDiagnostic &PDiag, QualType objectType=QualType())
std::string getDeletedOrUnavailableSuffix(const FunctionDecl *FD)
Retrieve the message suffix that should be added to a diagnostic complaining about the given function...
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...
ObjCMethodDecl - Represents an instance or class method declaration.
QualType getThisType(ASTContext &C) const
Returns the type of the this pointer.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
A namespace, stored as a NamespaceDecl*.
bool HadMultipleCandidates
HadMultipleCandidates - When this is true, it means that the conversion function was resolved from an...
Removal of noreturn from a type (Clang)
bool isMemberDataPointerType() const
static InitializationKind CreateDirectList(SourceLocation InitLoc)
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class.copy]p25)
bool tryCaptureVariable(VarDecl *Var, SourceLocation Loc, TryCaptureKind Kind, SourceLocation EllipsisLoc, bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const unsigned *const FunctionScopeIndexToStopAt)
Try to capture the given variable.
A C++ throw-expression (C++ [except.throw]).
static bool doesUsualArrayDeleteWantSize(Sema &S, SourceLocation loc, QualType allocType)
doesUsualArrayDeleteWantSize - Answers whether the usual operator delete[] for the given type has a s...
ParmVarDecl - Represents a parameter to a function.
bool isObjCRetainableType() const
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant...
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
Defines the clang::Expr interface and subclasses for C++ expressions.
bool isCXXThisCaptured() const
Determine whether the C++ 'this' is captured.
bool isEmpty() const
No scope specifier.
The collection of all-type qualifiers we support.
Information about a template-id annotation token.
EvaluatedStmt * ensureEvaluatedStmt() const
Convert the initializer for this declaration to the elaborated EvaluatedStmt form, which contains extra information on the evaluated value of the initializer.
static CXXUnresolvedConstructExpr * Create(const ASTContext &C, TypeSourceInfo *Type, SourceLocation LParenLoc, ArrayRef< Expr * > Args, SourceLocation RParenLoc)
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
bool hasTrivialCopyConstructor() const
Determine whether this class has a trivial copy constructor (C++ [class.copy]p6, C++11 [class...
ExprResult PerformImplicitConversion(Expr *From, QualType ToType, AssignmentAction Action, bool AllowExplicit=false)
PerformImplicitConversion - Perform an implicit conversion of the expression From to the type ToType...
void setCorrectionDecl(NamedDecl *CDecl)
Clears the list of NamedDecls before adding the new one.
static void noteOperatorArrows(Sema &S, ArrayRef< FunctionDecl * > OperatorArrows)
Note a set of 'operator->' functions that were used for a member access.
unsigned getNumParams() const
Expr * FixOverloadedFunctionReference(Expr *E, DeclAccessPair FoundDecl, FunctionDecl *Fn)
FixOverloadedFunctionReference - E is an expression that refers to a C++ overloaded function (possibl...
RecordDecl - Represents a struct/union/class.
QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
FindCompositeObjCPointerType - Helper method to find composite type of two objective-c pointer types ...
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
static bool ConvertForConditional(Sema &Self, ExprResult &E, QualType T)
Perform an "extended" implicit conversion as returned by TryClassUnification.
TemplateIdAnnotation * TemplateId
When Kind == IK_TemplateId or IK_ConstructorTemplateId, the template-id annotation that contains the ...
DeclarationName getName() const
getName - Returns the embedded declaration name.
Boolean conversions (C++ 4.12)
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 isScalarType() const
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name)
Retrieves the declaration name from a parsed unqualified-id.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isDirectReferenceBinding() const
Determine whether this initialization is a direct reference binding (C++ [dcl.init.ref]).
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
void DropFirstTypeObject()
A C++ nested-name-specifier augmented with source location information.
Represents a dependent template name that cannot be resolved prior to template instantiation.
The results of name lookup within a DeclContext.
bool isObjCARCImplicitlyUnretainedType() const
Determines if this type, which must satisfy isObjCLifetimeType(), is implicitly __unsafe_unretained r...
bool hasNonTrivialCopyConstructor() const
Determine whether this class has a non-trivial copy constructor (C++ [class.copy]p6, C++11 [class.copy]p12)
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
const ASTMatchFinder::BindKind Bind
QualType getLifetimeQualifiedType(QualType type, Qualifiers::ObjCLifetime lifetime)
Return a type with the given lifetime qualifier.
bool isReferenceType() const
QualType getReturnType() const
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
bool isAnyPointerType() const
Identity conversion (no conversion)
void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AddBuiltinOperatorCandidates - Add the appropriate built-in operator overloads to the candidate set (...
bool isAbstractType(SourceLocation Loc, QualType T)
TypeResult ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false)
Floating point conversions (C++ 4.8)
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 const TST TST_error
ExprResult ActOnCXXUuidof(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXUuidof - Parse __uuidof( something ).
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
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)
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
bool hasNonTrivialDefaultConstructor() const
Determine whether this class has a non-trivial default constructor (C++11 [class.ctor]p5).
SourceLocation getTypeSpecTypeLoc() const
ParsedType getDestructorName(SourceLocation TildeLoc, IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
static bool hasNontrivialObjCLifetime(QualType T)
Determine whether T has a non-trivial Objective-C lifetime in ARC mode.
ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose=true)
DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
void PopExpressionEvaluationContext()
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
Stmt * MaybeCreateStmtWithCleanups(Stmt *SubStmt)
void NoteDeletedFunction(FunctionDecl *FD)
Emit a note explaining that this function is deleted.
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
void getPotentialVariableCapture(unsigned Idx, VarDecl *&VD, Expr *&E) const
Floating point promotions (C++ 4.6)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
SourceLocation getBeginLoc() const
Get the begin source location.
Describes an C or C++ initializer list.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
This is a scope that corresponds to a block/closure object.
ExprResult ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *expr)
ActOnCXXThrow - Parse throw expressions.
Represents a C++ unqualified-id that has been parsed.
bool isCompleteType(SourceLocation Loc, QualType T)
void setNameLoc(SourceLocation Loc)
NamespaceDecl * getOrCreateStdNamespace()
Retrieve the special "std" namespace, which may require us to implicitly define the namespace...
Represents the results of name lookup.
void DeclareGlobalNewDelete()
DeclareGlobalNewDelete - Declare the global forms of operator new and delete.
const TargetInfo & getTargetInfo() const
An lvalue ref-qualifier was provided (&).
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...
ExprResult MaybeConvertParenListExprToParenExpr(Scope *S, Expr *ME)
This is not an AltiVec-style cast or or C++ direct-initialization, so turn the ParenListExpr into a s...
const LangOptions & getLangOpts() const
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
bool isFundamentalType() const
Tests whether the type is categorized as a fundamental type.
Succeeded, but refers to a deleted function.
const CXXScopeSpec * getSS() const
bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E)
CheckCXXThrowOperand - Validate the operand of a throw.
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
bool exprNeedsCleanups() const
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, Expr *ArraySize, SourceRange DirectInitRange, Expr *Initializer, bool TypeMayContainAuto=true)
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit=false, bool BuildAndDiagnose=true, const unsigned *const FunctionScopeIndexToStopAt=nullptr, bool ByCopy=false)
Make sure the value of 'this' is actually available in the current context, if it is a potentially ev...
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
char * location_data() const
Retrieve the data associated with the source-location information.
SourceLocation getLocStart() const LLVM_READONLY
TypeDecl - Represents a declaration of a type.
A builtin binary operation expression such as "x + y" or "x <= y".
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
RecordDecl * getDecl() const
ImplicitConversionKind Second
Second - The second conversion can be an integral promotion, floating point promotion, integral conversion, floating point conversion, floating-integral conversion, pointer conversion, pointer-to-member conversion, or boolean conversion.
ParsedTemplateArgument * getTemplateArgs()
Retrieves a pointer to the template arguments.
static InitializationKind CreateValue(SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool isImplicit=false)
Create a value initialization.
CheckedConversionKind
The kind of conversion being performed.
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
FunctionDecl * ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, QualType TargetType, bool Complain, DeclAccessPair &Found, bool *pHadMultipleCandidates=nullptr)
ResolveAddressOfOverloadedFunction - Try to resolve the address of an overloaded function (C++ [over...
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
IfExistsResult CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS, const DeclarationNameInfo &TargetNameInfo)
DeclContext * getLambdaAwareParentOfDeclContext(DeclContext *DC)
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...
New-expression has a C++98 paren-delimited initializer.
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Qualification conversions (C++ 4.4)
bool isAmbiguous() const
Determine whether this initialization failed due to an ambiguity.
static unsigned getNumAddressingBits(const ASTContext &Context, QualType ElementType, const llvm::APInt &NumElements)
Determine the number of bits required to address a member of.
ExprResult ActOnCXXThis(SourceLocation loc)
bool isWeak() const
Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr...
Represents a C++ nested-name-specifier or a global scope specifier.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
TypeSourceInfo * getTypeSourceInfo() const
TypeClass getTypeClass() const
bool isStructureType() const
ExprResult CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond)
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
Represents binding an expression to a temporary.
ArrayTypeTrait
Names for the array type traits.
CXXTemporary * getTemporary()
AccessResult CheckConstructorAccess(SourceLocation Loc, CXXConstructorDecl *D, DeclAccessPair FoundDecl, const InitializedEntity &Entity, bool IsCopyBindingRefToTemp=false)
Checks access to a constructor.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
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'.
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
bool isTrivialType(const ASTContext &Context) const
Return true if this is a trivial type per (C++0x [basic.types]p9)
An ordinary object is located at an address in memory.
bool isLambdaCallOperator(const CXXMethodDecl *MD)
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
The number of conversion kinds.
A class that does preordor or postorder depth-first traversal on the entire Clang AST and visits each...
CastKind PrepareScalarCast(ExprResult &src, QualType destType)
Prepares for a scalar cast, performing all the necessary stages except the final cast and returning t...
ImplicitConversionKind Third
Third - The third conversion can be a qualification conversion.
detail::InMemoryDirectory::const_iterator I
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
Integral promotions (C++ 4.5)
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInlineSpecified=false, bool hasWrittenPrototype=true, bool isConstexprSpecified=false)
bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType)
Helper function to determine whether this is the (deprecated) C++ conversion from a string literal to...
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...
bool isDefined(const FunctionDecl *&Definition) const
isDefined - Returns true if the function is defined at all, including a deleted definition.
SourceLocation TemplateKWLoc
TemplateKWLoc - The location of the template keyword within the source.
Represents the this expression in C++.
bool isAbstract() const
Determine whether this class has a pure virtual function.
New-expression has no initializer as written.
unsigned getPreferredTypeAlign(const Type *T) const
Return the "preferred" alignment of the specified type T for the current target, in bits...
static InitializedEntity InitializeNew(SourceLocation NewLoc, QualType Type)
Create the initialization entity for an object allocated via new.
TypeTrait
Names for traits that operate specifically on types.
SourceLocation LAngleLoc
The location of the '<' before the template argument list.
EnumDecl * getDecl() const
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
ConditionalOperator - The ?: ternary operator.
ExtInfo getExtInfo() const
Sema - This implements semantic analysis and AST building for C.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
CompoundStmt - This represents a group of statements like { stmt stmt }.
TST getTypeSpecType() const
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.
static NamedDecl * getDeclFromExpr(Expr *E)
Transparent Union Conversions.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
Retains information about a captured region.
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...
CastKind
CastKind - The kind of operation required for a conversion.
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat)
DeclarationNameTable DeclarationNames
QualType getLogicalOperationType() const
The result type of logical operations, '<', '>', '!=', etc.
bool CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess, bool Diagnose=true)
CheckPointerConversion - Check the pointer conversion from the expression From to the type ToType...
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
SourceLocation PotentialThisCaptureLocation
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
ExprResult CheckConditionVariable(VarDecl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
Check the use of the given variable as a C++ condition in an if, while, do-while, or switch statement...
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
bool isRealFloatingType() const
Floating point categories.
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
unsigned hasStatic
True if this dimension included the 'static' keyword.
bool isDeleted() const
Whether this function has been deleted.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
Expr - This represents one expression.
bool isOrdinaryOrBitFieldObject() const
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
static ExprResult BuildCXXCastArgument(Sema &S, SourceLocation CastLoc, QualType Ty, CastKind Kind, CXXMethodDecl *Method, DeclAccessPair FoundDecl, bool HadMultipleCandidates, Expr *From)
CXXRecordDecl * getNamingClass() const
Returns the 'naming class' for this lookup, i.e.
bool isDeclScope(Decl *D)
isDeclScope - Return true if this is the scope that the specified decl is declared in...
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=nullptr, bool IsCtorOrDtorName=false, bool WantNontrivialTypeSourceInfo=false, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type...
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT, SourceLocation KeyLoc, QualType T)
NestedNameSpecifier * getCorrectionSpecifier() const
Gets the NestedNameSpecifier needed to use the typo correction.
static SourceLocation findLocationAfterToken(SourceLocation loc, tok::TokenKind TKind, const SourceManager &SM, const LangOptions &LangOpts, bool SkipTrailingWhitespaceAndNewLine)
Checks that the given token is the first token that occurs after the given location (this excludes co...
StandardConversionSequence After
After - Represents the standard conversion that occurs after the actual user-defined conversion...
This file defines the classes used to store parsed information about declaration-specifiers and decla...
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Represents a C++ destructor within a class.
New-expression has a C++11 list-initializer.
ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, UnqualifiedId &SecondTypeName)
TranslationUnitDecl * getTranslationUnitDecl() const
NamedDecl * getFoundDecl() const
Fetch the unique decl found by this lookup.
Defines the clang::Preprocessor interface.
SmallVectorImpl< OverloadCandidate >::iterator iterator
bool IsVariableAConstantExpression(VarDecl *Var, ASTContext &Context)
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, bool AllowFold=true)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
const ParmVarDecl * getParamDecl(unsigned i) const
CXXConstructorDecl * CopyConstructor
CopyConstructor - The copy constructor that is used to perform this conversion, when the conversion i...
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Overload resolution succeeded.
bool isFloatingType() const
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
Classification Classify(ASTContext &Ctx) const
Classify - Classify this expression according to the C++11 expression taxonomy.
Represents a C++ template name within the type system.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
enum clang::DeclaratorChunk::@185 Kind
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.
A namespace alias, stored as a NamespaceAliasDecl*.
Floating-integral conversions (C++ 4.9)
void DiscardCleanupsInEvaluationContext()
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT, QualType LhsT, QualType RhsT, SourceLocation KeyLoc)
ExprResult ActOnTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< ParsedType > Args, SourceLocation RParenLoc)
Parsed one of the type trait support pseudo-functions.
void NoteCandidates(Sema &S, OverloadCandidateDisplayKind OCD, ArrayRef< Expr * > Args, StringRef Opc="", SourceLocation Loc=SourceLocation())
PrintOverloadCandidates - When overload resolution fails, prints diagnostic messages containing the c...
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes
Stack containing information about each of the nested function, block, and method scopes that are cur...
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
SourceLocation Loc
Loc - The place where this type was defined.
StandardConversionSequence Standard
When ConversionKind == StandardConversion, provides the details of the standard conversion sequence...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
QualType getObjCIdType() const
Represents the Objective-CC id type.
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false)
Add a C++ function template specialization as a candidate in the candidate set, using template argume...
A boolean condition, from 'if', 'while', 'for', or 'do'.
An expression that sends a message to the given Objective-C object or class.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
static uint64_t EvaluateArrayTypeTrait(Sema &Self, ArrayTypeTrait ATT, QualType T, Expr *DimExpr, SourceLocation KeyLoc)
SmallVector< ActiveTemplateInstantiation, 16 > ActiveTemplateInstantiations
List of active template instantiations.
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
ParsedType getInheritingConstructorName(CXXScopeSpec &SS, SourceLocation NameLoc, IdentifierInfo &Name)
Handle the result of the special case name lookup for inheriting constructor declarations.
CXXRecordDecl * getStdBadAlloc() const
void CleanupVarDeclMarking()
class LLVM_ALIGNAS(8) TemplateSpecializationType unsigned NumArgs
Represents a type template specialization; the template must be a class template, a type alias templa...
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
bool isStrictSupersetOf(Qualifiers Other) const
Determine whether this set of qualifiers is a strict superset of another set of qualifiers, not considering qualifier compatibility.
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.
void removeLocalCVRQualifiers(unsigned Mask)
A type, stored as a Type*.
const LookupResult & getLookupResult() const
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
QualType getWideCharType() const
Return the type of wide characters.
unsigned getEditDistance(bool Normalized=true) const
Gets the "edit distance" of the typo correction from the typo.
const Expr * getAnyInitializer() const
getAnyInitializer - Get the initializer for this variable, no matter which declaration it is attached...
const TypoExprState & getTypoExprState(TypoExpr *TE) const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
bool isObjectType() const
Determine whether this type is an object type.
static InitializationKind CreateCopy(SourceLocation InitLoc, SourceLocation EqualLoc, bool AllowExplicitConvs=false)
Create a copy initialization.
ExprResult ActOnFinishFullExpr(Expr *Expr)
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, bool *NonStandardCompositeType=nullptr)
Find a merged pointer type and convert the two expressions to it.
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
Lvalue-to-rvalue conversion (C++ 4.1)
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
bool isNothrow(const ASTContext &Ctx, bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
CanThrowResult
Possible results from evaluation of a noexcept expression.
ParsedType getDestructorType(const DeclSpec &DS, ParsedType ObjectType)
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, 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...
There is no lifetime qualification on this type.
ExprResult ActOnDecltypeExpression(Expr *E)
Process the expression contained within a decltype.
DeclContext * getEntity() const
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Integral conversions (C++ 4.7)
Complex promotions (Clang extension)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor...
Assigning into this object requires the old value to be released and the new value to be retained...
static CXXBindTemporaryExpr * Create(const ASTContext &C, CXXTemporary *Temp, Expr *SubExpr)
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
bool FindAllocationOverload(SourceLocation StartLoc, SourceRange Range, DeclarationName Name, MultiExprArg Args, DeclContext *Ctx, bool AllowMissing, FunctionDecl *&Operator, bool Diagnose=true)
Find an fitting overload for the allocation function in the specified scope.
ExceptionSpecificationType Type
The kind of exception specification this is.
ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, IdentifierInfo *II, bool AllowBuiltinCreation=false)
LookupInObjCMethod - The parser has read a name in, and Sema has detected that we're currently inside...
Encodes a location in the source.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
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.
static InitializedEntity InitializeLambdaCapture(IdentifierInfo *VarID, QualType FieldType, SourceLocation Loc)
Create the initialization entity for a lambda capture.
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
QualType getElementType() const
QualType withCVRQualifiers(unsigned CVR) const
Represents a C++ temporary.
Expr * getRepAsExpr() const
bool isValid() const
Return true if this is a valid SourceLocation object.
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
Represents a call to a member function that may be written either with member call syntax (e...
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.
IdentifierTable & getIdentifierTable()
A vector splat from an arithmetic type.
Optional< unsigned > getStackIndexOfNearestEnclosingCaptureCapableLambda(ArrayRef< const sema::FunctionScopeInfo * > FunctionScopes, VarDecl *VarToCapture, Sema &S)
Examines the FunctionScopeInfo stack to determine the nearest enclosing lambda (to the current lambda...
QualType withConst() const
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
SourceLocation getLocStart() const LLVM_READONLY
Represents a static or instance method of a struct/union/class.
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
ExprResult DefaultLvalueConversion(Expr *E)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
No ref-qualifier was provided.
void setDestructor(const CXXDestructorDecl *Dtor)
Objective-C ARC writeback conversion.
bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
bool isInvalid() const
An error occurred during parsing of the scope specifier.
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
const ConstantArrayType * getAsConstantArrayType(QualType T) const
Name lookup found an unresolvable value declaration and cannot yet complete.
bool isIntegerConstantExpr(llvm::APSInt &Result, const ASTContext &Ctx, SourceLocation *Loc=nullptr, bool isEvaluated=true) const
isIntegerConstantExpr - Return true if this expression is a valid integer constant expression...
ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr=false)
CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Describes the kind of initialization being performed, along with location information for tokens rela...
TemplateDeductionResult DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, const TemplateArgumentList &TemplateArgs, sema::TemplateDeductionInfo &Info)
Perform template argument deduction to determine whether the given template arguments match the given...
Look up any declaration with any name.
AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, ExprResult &RHS)
bool CheckMemberPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess)
CheckMemberPointerConversion - Check the member pointer conversion from the expression From to the ty...
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.
Pointer conversions (C++ 4.10)
Lookup for candidates for a call using operator syntax.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
static bool VariableCanNeverBeAConstantExpression(VarDecl *Var, ASTContext &Context)
SourceLocation getBegin() const
Requests that all candidates be shown.
const T * castAs() const
Member-template castAs<specific type>.
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.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
No entity found met the criteria.
bool isFileContext() const
bool isVectorType() const
bool isThisOutsideMemberFunctionBody(QualType BaseType)
Determine whether the given type is the type of *this that is used outside of the body of a member fu...
SourceRange getSourceRange() const override LLVM_READONLY
The name is a dependent name, so the results will differ from one instantiation to the next...
An expression trait intrinsic.
bool isMemberFunctionPointerType() const
Derived-to-base (C++ [over.best.ics])
Complex-real conversions (C99 6.3.1.7)
An rvalue ref-qualifier was provided (&&).
Assigning into this object requires a lifetime extension.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
static Expr * captureThis(Sema &S, ASTContext &Context, RecordDecl *RD, QualType ThisTy, SourceLocation Loc, const bool ByCopy)
ObjCBoxedExpr - used for generalized expression boxing.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13...
Constant expression in a noptr-new-declarator.
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, Declarator &D, Expr *Initializer)
ActOnCXXNew - Parsed a C++ 'new' expression.
MutableArrayRef< Expr * > MultiExprArg
QualType getType() const
Return the type wrapped by this type source info.
static bool CheckUnaryTypeTraitTypeCompleteness(Sema &S, TypeTrait UTT, SourceLocation Loc, QualType ArgTy)
Check the completeness of a type in a unary type trait.
QualType CXXCheckConditionalOperands(ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc)
Check the operands of ?: under C++ semantics.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
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)
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
bool containsPlaceholderType() const
A POD class for pairing a NamedDecl* with an access specifier.
AccessResult CheckAllocationAccess(SourceLocation OperatorLoc, SourceRange PlacementRange, CXXRecordDecl *NamingClass, DeclAccessPair FoundDecl, bool Diagnose=true)
Checks access to an overloaded operator new or delete.
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool *NoArrowOperatorFound=nullptr)
BuildOverloadedArrowExpr - Build a call to an overloaded operator-> (if one exists), where Base is an expression of class type and Member is the name of the member we're trying to find.
ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl, CXXConversionDecl *Method, bool HadMultipleCandidates)
The scope of a struct/union/class definition.
QualType getCallReturnType(const ASTContext &Ctx) const
getCallReturnType - Get the return type of the call expr.
SourceRange getSourceRange() const LLVM_READONLY
Get the source range that spans this declarator.
static unsigned getMaxSizeBits(const ASTContext &Context)
Determine the maximum number of active bits that an array's size can require, which limits the maximu...
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
sema::LambdaScopeInfo * getCurLambda()
Retrieve the current lambda scope info, if any.
Represents a template argument.
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
void DiagnoseAmbiguousConversion(Sema &S, SourceLocation CaretLoc, const PartialDiagnostic &PDiag) const
Diagnoses an ambiguous conversion.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
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.
This file provides some common utility functions for processing Lambdas.
DeclAccessPair FoundCopyConstructor
static bool isInvalid(LocType Loc, bool *Invalid)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
Abstract base class used to perform a contextual implicit conversion from an expression to any type p...
void CheckVirtualDtorCall(CXXDestructorDecl *dtor, SourceLocation Loc, bool IsDelete, bool CallCanBeVirtual, bool WarnOnNonAbstractTypes, SourceLocation DtorLoc)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
static bool isLegalArrayNewInitializer(CXXNewExpr::InitializationStyle Style, Expr *Init)
The base class of all kinds of template declarations (e.g., class, function, etc.).
Sema::LookupNameKind getLookupKind() const
Gets the kind of lookup to perform.
static const TST TST_decltype
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
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.
void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, CXXConstructorDecl *CD)
CXXScopeSpec SS
The nested-name-specifier that precedes the template name.
SourceLocation RAngleLoc
The location of the '>' after the template argument list.
bool getProducesResult() const
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
Conversions allowed in C, but not C++.
A constant boolean condition from 'if constexpr'.
Array-to-pointer conversion (C++ 4.2)
bool isStandardLayoutType() const
Test if this type is a standard-layout type.
QualType getExceptionObjectType(QualType T) const
bool GlobalNewDeleteDeclared
A flag to remember whether the implicit forms of operator new and delete have been declared...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
bool hasTrivialDefaultConstructor() const
Determine whether this class has a trivial default constructor (C++11 [class.ctor]p5).
DeclarationName - The name of a declaration.
StandardConversionSequence Before
Represents the standard conversion that occurs before the actual user-defined conversion.
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language...
ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr)
Prepare SplattedExpr for a vector splat operation, adding implicit casts if necessary.
bool isThisDeclarationADefinition() const
isThisDeclarationADefinition - Returns whether this specific declaration of the function is also a de...
SourceLocation getLocStart() const LLVM_READONLY
size_t param_size() const
bool hasTrivialMoveConstructor() const
Determine whether this class has a trivial move constructor (C++11 [class.copy]p12) ...
Requests that only viable candidates be shown.
detail::InMemoryDirectory::const_iterator E
A pointer to member type per C++ 8.3.3 - Pointers to members.
ExprResult BuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo, SourceLocation LParenLoc, Expr *CastExpr, SourceLocation RParenLoc)
IdentifierResolver IdResolver
bool isSingleResult() const
Determines if this names a single result which is not an unresolved value using decl.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)
ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...
CXXThisScopeRAII(Sema &S, Decl *ContextDecl, unsigned CXXThisTypeQuals, bool Enabled=true)
Introduce a new scope where 'this' may be allowed (when enabled), using the given declaration (which ...
bool isLValueReferenceType() const
FieldDecl * getMember() const
If this is a member initializer, returns the declaration of the non-static data member being initiali...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
A type that was preceded by the 'template' keyword, stored as a Type*.
bool isLambda() const
Determine whether this class describes a lambda function object.
Expr * IgnoreParenImpCasts() LLVM_READONLY
IgnoreParenImpCasts - Ignore parentheses and implicit casts.
bool isRValueReferenceType() const
llvm::MapVector< FieldDecl *, DeleteLocs > DeleteExprs
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
FunctionDecl * ConversionFunction
ConversionFunction - The function that will perform the user-defined conversion.
ExprResult IgnoredValueConversions(Expr *E)
IgnoredValueConversions - Given that an expression's result is syntactically ignored, perform any conversions that are required.
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Name lookup found a single declaration that met the criteria.
bool empty() const
Return true if no decls were found.
static void DiagnoseMismatchedNewDelete(Sema &SemaRef, SourceLocation DeleteLoc, const MismatchingNewDeleteDetector &Detector)
StmtResult ActOnFinishFullStmt(Stmt *Stmt)
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a method that was resolved from an overloaded...
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...
Complex values, per C99 6.2.5p11.
SourceManager & getSourceManager() const
The lookup is a reference to this name that is not for the purpose of redeclaring the name...
const T * getAs() const
Member-template getAs<specific type>'.
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy.
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, bool IsDecltype=false)
Represents a C++ base or member initializer.
ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnCXXBoolLiteral - Parse {true,false} literals.
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, SourceLocation Loc, SourceRange Range, CXXCastPath *BasePath=nullptr, bool IgnoreAccess=false)
QualType CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, SourceLocation OpLoc, bool isIndirect)
ExprResult ActOnCXXTypeConstructExpr(ParsedType TypeRep, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
NamedDecl * getFoundDecl() const
Get the correction declaration found by name lookup (before we looked through using shadow declaratio...
SourceLocation getLocStart() const LLVM_READONLY
bool isFunctionType() const
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...
CanQualType BoundMemberTy
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
AccessResult CheckMemberOperatorAccess(SourceLocation Loc, Expr *ObjectExpr, Expr *ArgExpr, DeclAccessPair FoundDecl)
Checks access to an overloaded member operator, including conversion operators.
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr)
uint64_t getCharWidth() const
Return the size of the character type, in bits.
The template argument is a type.
ExprResult ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXTypeid - Parse typeid( something ).
Block Pointer conversions.
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...
unsigned getIntWidth() const
getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for this target, in bits.
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...
void setExprNeedsCleanups(bool SideEffects)
SmallVector< BlockDecl *, 8 > ExprCleanupObjects
ExprCleanupObjects - This is the stack of objects requiring cleanup that are created by the current f...
Represents a base class of a C++ class.
A bitfield object is a bitfield on a C or C++ record.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
Capture & getCXXThisCapture()
Retrieve the capture of C++ 'this', if it has been captured.
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...
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Condition in a constexpr if statement.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
static void getUuidAttrOfType(Sema &SemaRef, QualType QT, llvm::SmallSetVector< const UuidAttr *, 1 > &UuidAttrs)
Grabs __declspec(uuid()) off a type, or returns 0 if we cannot resolve to a single GUID...
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
static bool TryClassUnification(Sema &Self, Expr *From, Expr *To, SourceLocation QuestionLoc, bool &HaveConversion, QualType &ToType)
Try to convert a type to another according to C++11 5.16p3.
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
A template argument list.
SourceRange getCorrectionRange() const
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
const Type * getClass() const
Reading or writing from this object requires a barrier call.
An integral condition for a 'switch' statement.
bool hasNonTrivialMoveConstructor() const
Determine whether this class has a non-trivial move constructor (C++11 [class.copy]p12) ...
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups, surround it with a ExprWithCleanups node.
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
Function-to-pointer (C++ 4.3)
bool Failed() const
Determine whether the initialization sequence is invalid.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
static bool isNonPlacementDeallocationFunction(Sema &S, FunctionDecl *FD)
Determine whether the given function is a non-placement deallocation function.
Describes the sequence of initializations required to initialize a given object or reference with a s...
Captures information about "declaration specifiers".
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=false)
AddOverloadCandidate - Adds the given function to the set of candidate functions, using the given fun...
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Represents a C++ struct/union/class.
Compatible - the types are compatible according to the standard.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
A user-defined literal name, e.g., operator "" _i.
bool isObjCObjectPointerType() const
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
static QualType adjustCVQualifiersForCXXThisWithinLambda(ArrayRef< FunctionScopeInfo * > FunctionScopes, QualType ThisTy, DeclContext *CurSemaContext, ASTContext &ASTCtx)
Optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
static CXXTemporary * Create(const ASTContext &C, const CXXDestructorDecl *Destructor)
Expr * NumElts
This is the size of the array, or null if [] or [*] was specified.
FunctionDecl * FindUsualDeallocationFunction(SourceLocation StartLoc, bool CanProvideSize, DeclarationName Name)
static bool HasNoThrowOperator(const RecordType *RT, OverloadedOperatorKind Op, Sema &Self, SourceLocation KeyLoc, ASTContext &C, bool(CXXRecordDecl::*HasTrivial)() const, bool(CXXRecordDecl::*HasNonTrivial)() const, bool(CXXMethodDecl::*IsDesiredOp)() const)
bool isCompoundType() const
Tests whether the type is categorized as a compound type.
static TypeTraitExpr * Create(const ASTContext &C, QualType T, SourceLocation Loc, TypeTrait Kind, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc, bool Value)
Create a new type trait expression.
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...
bool CheckAllocatedType(QualType AllocType, SourceLocation Loc, SourceRange R)
Checks that a type is suitable as the allocated type in a new-expression.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
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...
This class is used for builtin types like 'int'.
LookupResultKind getResultKind() const
OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best, bool UserDefinedConversion=false)
Find the best viable function on this overload set, if it exists.
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]).
QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool AllowBothBool, bool AllowBoolConversion)
type checking for vector binary operators.
static bool hasAnyTypeDependentArguments(ArrayRef< Expr * > Exprs)
hasAnyTypeDependentArguments - Determines if any of the expressions in Exprs is type-dependent.
static Qualifiers fromCVRMask(unsigned CVR)
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type...
bool isIncompleteArrayType() const
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
static OpaquePtr make(QualTypeP)
bool isValid() const
A scope specifier is present, and it refers to a real scope.
A reference to a declared variable, function, enum, etc.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool isSet() const
Deprecated.
unsigned getSuitableAlign() const
Return the alignment that is suitable for storing any object with a fundamental alignment requirement...
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7)...
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
QualType getElementType() const
Expr * getDefaultArgExprForConstructor(const CXXConstructorDecl *CD, unsigned ParmIdx)
unsigned getNumPotentialVariableCaptures() const
Zero constant to event (OpenCL1.2 6.12.10)
ImplicitConversionKind First
First – The first conversion can be an lvalue-to-rvalue conversion, array-to-pointer conversion...
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
const Expr * getSubExpr() const
No viable function found.
DeduceAutoResult DeduceAutoType(TypeSourceInfo *AutoType, Expr *&Initializer, QualType &Result)
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 l-value expression is a reference to an object with independent storage.
bool isInterfaceType() const
A trivial tuple used to represent a source range.
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 ...
void diagnoseNullableToNonnullConversion(QualType DstType, QualType SrcType, SourceLocation Loc)
Warn if we're implicitly casting from a _Nullable pointer type to a _Nonnull one. ...
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
NamedDecl - This represents a decl with a name.
bool isInvalidType() const
A boolean literal, per ([C++ lex.bool] Boolean literals).
bool isVariableExprMarkedAsNonODRUsed(Expr *CapturingVarExpr) const
bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc, CallExpr *CE, FunctionDecl *FD)
CheckCallReturnType - Checks that a call expression's return type is complete.
bool isArithmeticType() const
ARCConversionResult CheckObjCARCConversion(SourceRange castRange, QualType castType, Expr *&op, CheckedConversionKind CCK, bool Diagnose=true, bool DiagnoseCFAudited=false, BinaryOperatorKind Opc=BO_PtrMemD)
Checks for invalid conversions and casts between retainable pointers and other pointer kinds...
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
No keyword precedes the qualified type name.
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], or an enum decl which has a signed representation.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
bool isConstQualified() const
Determine whether this type is const-qualified.
Pointer-to-member conversions (C++ 4.11)
bool cleanupsHaveSideEffects() const
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 FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
unsigned NumArgs
NumArgs - The number of template arguments.
SourceLocation getLocEnd() const LLVM_READONLY
The global specifier '::'. There is no stored value.
static OpaquePtr getFromOpaquePtr(void *P)
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
void WillReplaceSpecifier(bool ForceReplacement)
TemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon, QualType Aliased)
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.
This scope corresponds to an Objective-C method body.
ExceptionSpecInfo ExceptionSpec
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
The symbol does not exist.
Declaration of a template function.
void clear()
Clears out any current state.
bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, bool UseGlobal, QualType AllocType, bool IsArray, MultiExprArg PlaceArgs, FunctionDecl *&OperatorNew, FunctionDecl *&OperatorDelete)
FindAllocationFunctions - Finds the overloads of operator new and delete that are appropriate for the...
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals...
QualType UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, bool IsCompAssign=false)
UsualArithmeticConversions - Performs various conversions that are common to binary operators (C99 6...
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
ParsedTemplateTy Template
The declaration of the template corresponding to the template-name.
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.
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
Expr * IgnoreParens() LLVM_READONLY
IgnoreParens - Ignore parentheses.
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
bool hasInClassInitializer() const
hasInClassInitializer - Determine whether this member has a C++11 in-class initializer.
bool isPointerType() const
Structure used to store a statement, the constant value to which it was evaluated (if any)...
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any...
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3.1.1).