39 #include "llvm/ADT/APInt.h" 40 #include "llvm/ADT/STLExtras.h" 41 #include "llvm/Support/ErrorHandling.h" 42 using namespace clang;
74 llvm_unreachable(
"Nested name specifier is not a type for inheriting ctor");
79 return CreateParsedType(Type,
86 bool EnteringContext) {
89 "not a constructor name");
99 if (SS.
isNotEmpty() && RequireCompleteDeclContext(SS, CurClass))
111 if (RD && RD->isInjectedClassName()) {
112 InjectedClassName = RD;
116 if (!InjectedClassName) {
121 diag::err_incomplete_nested_name_spec) << CurClass << SS.
getRange();
127 DiagnoseUseOfDecl(InjectedClassName, NameLoc);
128 MarkAnyDeclReferenced(NameLoc, InjectedClassName,
false);
138 bool EnteringContext) {
163 bool isDependent =
false;
164 bool LookInScope =
false;
173 SearchType = GetTypeFromParser(ObjectTypePtr);
178 bool AlreadySearched =
false;
179 bool LookAtPrefix =
true;
191 DeclContext *DC = computeDeclContext(SS, EnteringContext);
193 AlreadySearched =
true;
196 }
else if (DC && isa<CXXRecordDecl>(DC)) {
197 LookAtPrefix =
false;
203 if (AlreadySearched) {
205 }
else if (LookAtPrefix && (Prefix = NNS->
getPrefix())) {
208 LookupCtx = computeDeclContext(PrefixSS, EnteringContext);
209 isDependent = isDependentScopeSpecifier(PrefixSS);
210 }
else if (ObjectTypePtr) {
211 LookupCtx = computeDeclContext(SearchType);
214 LookupCtx = computeDeclContext(SS, EnteringContext);
217 }
else if (ObjectTypePtr) {
225 LookupCtx = computeDeclContext(SearchType);
228 "Caller should have completed object type");
236 TypeDecl *NonMatchingTypeDecl =
nullptr;
237 LookupResult Found(*
this, &II, NameLoc, LookupOrdinaryName);
243 if (
Step == 0 && LookupCtx) {
244 if (RequireCompleteDeclContext(SS, LookupCtx))
246 LookupQualifiedName(Found, LookupCtx);
247 }
else if (
Step == 1 && LookInScope && S) {
248 LookupName(Found, S);
259 MarkAnyDeclReferenced(
Type->getLocation(),
Type,
false);
265 return CreateParsedType(T,
270 NonMatchingTypeDecl =
Type;
282 if (
DeclContext *Ctx = computeDeclContext(SS, EnteringContext)) {
288 if (MemberOfType.
isNull())
289 MemberOfType = SearchType;
291 if (MemberOfType.
isNull())
299 = dyn_cast<ClassTemplateSpecializationDecl>(Record->getDecl())) {
300 if (Spec->getSpecializedTemplate()->getCanonicalDecl() ==
301 Template->getCanonicalDecl())
302 return CreateParsedType(
322 if (SpecTemplate->getCanonicalDecl() == Template->getCanonicalDecl())
323 return CreateParsedType(
334 if (DepTemplate->isIdentifier() &&
335 DepTemplate->getIdentifier() == Template->getIdentifier())
336 return CreateParsedType(
357 if (NonMatchingTypeDecl) {
359 Diag(NameLoc, diag::err_destructor_expr_type_mismatch)
361 Diag(NonMatchingTypeDecl->
getLocation(), diag::note_destructor_type_here)
363 }
else if (ObjectTypePtr)
364 Diag(NameLoc, diag::err_ident_in_dtor_not_a_type)
368 diag::err_destructor_class_name);
371 if (
const CXXRecordDecl *Class = dyn_cast_or_null<CXXRecordDecl>(Ctx))
373 Class->getNameAsString());
391 "unexpected type in getDestructorType");
396 QualType SearchType = GetTypeFromParser(ObjectType);
397 if (!SearchType.isNull() && !SearchType->isDependentType() &&
422 Diag(Name.
getBeginLoc(), diag::err_literal_operator_id_outside_namespace)
433 llvm_unreachable(
"unknown nested name specifier kind");
451 RequireCompleteType(TypeidLoc, T, diag::err_incomplete_typeid))
455 return ExprError(
Diag(TypeidLoc, diag::err_variably_modified_typeid) << T);
457 if (CheckQualifiedFunctionForTypeId(T, TypeidLoc))
469 bool WasEvaluated =
false;
479 CXXRecordDecl *RecordD = cast<CXXRecordDecl>(RecordT->getDecl());
483 if (RequireCompleteType(TypeidLoc, T, diag::err_incomplete_typeid))
493 ExprResult Result = TransformToPotentiallyEvaluated(E);
498 MarkVTableUsed(TypeidLoc, RecordD);
503 ExprResult Result = CheckUnevaluatedOperand(E);
517 E = ImpCastExprToType(E, UnqualT, CK_NoOp, E->
getValueKind()).
get();
522 return ExprError(
Diag(TypeidLoc, diag::err_variably_modified_typeid)
524 else if (!inTemplateInstantiation() &&
529 ? diag::warn_side_effects_typeid
530 : diag::warn_side_effects_unevaluated_context);
542 if (getLangOpts().OpenCLCPlusPlus) {
543 return ExprError(
Diag(OpLoc, diag::err_openclcxx_not_supported)
548 if (!getStdNamespace())
549 return ExprError(
Diag(OpLoc, diag::err_need_header_before_typeid));
551 if (!CXXTypeInfoDecl) {
552 IdentifierInfo *TypeInfoII = &PP.getIdentifierTable().get(
"type_info");
554 LookupQualifiedName(R, getStdNamespace());
558 if (!CXXTypeInfoDecl && LangOpts.MSVCCompat) {
562 if (!CXXTypeInfoDecl)
563 return ExprError(
Diag(OpLoc, diag::err_need_header_before_typeid));
566 if (!getLangOpts().RTTI) {
567 return ExprError(
Diag(OpLoc, diag::err_no_typeid_with_fno_rtti));
583 return BuildCXXTypeId(TypeInfoType, OpLoc, TInfo, RParenLoc);
587 return BuildCXXTypeId(TypeInfoType, OpLoc, (
Expr*)TyOrExpr, RParenLoc);
606 if (
const auto *Uuid = TD->getMostRecentDecl()->getAttr<UuidAttr>()) {
607 UuidAttrs.insert(Uuid);
612 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(TD)) {
615 const UuidAttr *UuidForTA =
nullptr;
622 UuidAttrs.insert(UuidForTA);
636 if (UuidAttrs.empty())
637 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_without_guid));
638 if (UuidAttrs.size() > 1)
639 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_with_multiple_guids));
640 UuidStr = UuidAttrs.back()->getGuid();
655 UuidStr =
"00000000-0000-0000-0000-000000000000";
659 if (UuidAttrs.empty())
660 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_without_guid));
661 if (UuidAttrs.size() > 1)
662 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_with_multiple_guids));
663 UuidStr = UuidAttrs.back()->getGuid();
682 return ExprError(
Diag(OpLoc, diag::err_need_header_before_ms_uuidof));
698 return BuildCXXUuidof(GuidType, OpLoc, TInfo, RParenLoc);
702 return BuildCXXUuidof(GuidType, OpLoc, (
Expr*)TyOrExpr, RParenLoc);
708 assert((Kind == tok::kw_true || Kind == tok::kw_false) &&
709 "Unknown C++ Boolean value!");
723 bool IsThrownVarInScope =
false;
737 if (
VarDecl *Var = dyn_cast<VarDecl>(DRE->getDecl())) {
738 if (Var->hasLocalStorage() && !Var->getType().isVolatileQualified()) {
741 IsThrownVarInScope =
true;
755 return BuildCXXThrow(OpLoc, Ex, IsThrownVarInScope);
759 bool IsThrownVarInScope) {
761 if (!getLangOpts().CXXExceptions &&
762 !getSourceManager().isInSystemHeader(OpLoc) && !getLangOpts().
CUDA) {
764 targetDiag(OpLoc, diag::err_exceptions_disabled) <<
"throw";
768 if (getLangOpts().
CUDA)
769 CUDADiagIfDeviceCode(OpLoc, diag::err_cuda_device_exceptions)
770 <<
"throw" << CurrentCUDATarget();
772 if (getCurScope() && getCurScope()->isOpenMPSimdDirectiveScope())
773 Diag(OpLoc, diag::err_omp_simd_region_cannot_use_stmt) <<
"throw";
777 if (CheckCXXThrowOperand(OpLoc, ExceptionObjectTy, Ex))
795 const VarDecl *NRVOVariable =
nullptr;
796 if (IsThrownVarInScope)
797 NRVOVariable = getCopyElisionCandidate(
QualType(), Ex, CES_Strict);
800 OpLoc, ExceptionObjectTy,
801 NRVOVariable !=
nullptr);
802 ExprResult Res = PerformMoveOrCopyInitialization(
803 Entity, NRVOVariable,
QualType(), Ex, IsThrownVarInScope);
815 llvm::DenseMap<CXXRecordDecl *, unsigned> &SubobjectsSeen,
816 llvm::SmallPtrSetImpl<CXXRecordDecl *> &VBases,
817 llvm::SetVector<CXXRecordDecl *> &PublicSubobjectsSeen,
818 bool ParentIsPublic) {
820 CXXRecordDecl *BaseDecl = BS.getType()->getAsCXXRecordDecl();
825 NewSubobject = VBases.insert(BaseDecl).second;
830 ++SubobjectsSeen[BaseDecl];
833 bool PublicPath = ParentIsPublic && BS.getAccessSpecifier() ==
AS_public;
835 PublicSubobjectsSeen.insert(BaseDecl);
845 llvm::DenseMap<CXXRecordDecl *, unsigned> SubobjectsSeen;
846 llvm::SmallSet<CXXRecordDecl *, 2> VBases;
847 llvm::SetVector<CXXRecordDecl *> PublicSubobjectsSeen;
848 SubobjectsSeen[RD] = 1;
849 PublicSubobjectsSeen.insert(RD);
853 for (
CXXRecordDecl *PublicSubobject : PublicSubobjectsSeen) {
855 if (SubobjectsSeen[PublicSubobject] > 1)
858 Objects.push_back(PublicSubobject);
868 bool isPointer =
false;
874 if (RequireCompleteType(ThrowLoc, Ty,
875 isPointer ? diag::err_throw_incomplete_ptr
876 : diag::err_throw_incomplete,
880 if (RequireNonAbstractType(ThrowLoc, ExceptionObjectTy,
881 diag::err_throw_abstract_type, E))
892 MarkVTableUsed(ThrowLoc, RD);
901 MarkFunctionReferenced(E->
getExprLoc(), Destructor);
902 CheckDestructorAccess(E->
getExprLoc(), Destructor,
903 PDiag(diag::err_access_dtor_exception) << Ty);
904 if (DiagnoseUseOfDecl(Destructor, E->
getExprLoc()))
919 for (
CXXRecordDecl *Subobject : UnambiguousPublicSubobjects) {
946 for (
unsigned I = 1, E = CD->
getNumParams(); I != E; ++I) {
947 if (CheckCXXDefaultArgExpr(ThrowLoc, CD, CD->
getParamDecl(I)))
960 if (ExnObjAlign < TypeAlign) {
961 Diag(ThrowLoc, diag::warn_throw_underaligned_obj);
962 Diag(ThrowLoc, diag::note_throw_underaligned_obj)
1015 for (
int I = FunctionScopes.size();
1016 I-- && isa<LambdaScopeInfo>(FunctionScopes[I]) &&
1018 cast<LambdaScopeInfo>(FunctionScopes[I])->CallOperator);
1020 CurLSI = cast<LambdaScopeInfo>(FunctionScopes[I]);
1027 if (C.isCopyCapture()) {
1038 assert(CurLSI &&
"While computing 'this' capture-type for a generic " 1039 "lambda, we must have a corresponding LambdaScopeInfo");
1041 "While computing 'this' capture-type for a generic lambda, when we " 1042 "run out of enclosing LSI's, yet the enclosing DC is a " 1043 "lambda-call-operator we must be (i.e. Current LSI) in a generic " 1044 "lambda call oeprator");
1047 auto IsThisCaptured =
1051 for (
auto &&C : Closure->
captures()) {
1052 if (C.capturesThis()) {
1063 bool IsByCopyCapture =
false;
1064 bool IsConstCapture =
false;
1067 IsThisCaptured(Closure, IsByCopyCapture, IsConstCapture)) {
1068 if (IsByCopyCapture) {
1084 QualType ThisTy = CXXThisTypeOverride;
1087 if (method && method->isInstance())
1088 ThisTy = method->getThisType();
1092 inTemplateInstantiation()) {
1094 assert(isa<CXXRecordDecl>(DC) &&
1095 "Trying to get 'this' type from static method?");
1112 CurContext, Context);
1120 : S(S), OldCXXThisTypeOverride(S.CXXThisTypeOverride), Enabled(
false)
1122 if (!Enabled || !ContextDecl)
1127 Record = Template->getTemplatedDecl();
1129 Record = cast<CXXRecordDecl>(ContextDecl);
1136 this->Enabled =
true;
1147 bool BuildAndDiagnose,
const unsigned *
const FunctionScopeIndexToStopAt,
1148 const bool ByCopy) {
1153 assert((!ByCopy || Explicit) &&
"cannot implicitly capture *this by value");
1155 const int MaxFunctionScopesIndex = FunctionScopeIndexToStopAt
1156 ? *FunctionScopeIndexToStopAt
1182 unsigned NumCapturingClosures = 0;
1183 for (
int idx = MaxFunctionScopesIndex; idx >= 0; idx--) {
1186 if (CSI->CXXThisCaptureIndex != 0) {
1188 CSI->Captures[CSI->CXXThisCaptureIndex - 1].markUsed(BuildAndDiagnose);
1194 if (BuildAndDiagnose)
1195 Diag(Loc, diag::err_this_capture)
1196 << (Explicit && idx == MaxFunctionScopesIndex);
1203 (Explicit && idx == MaxFunctionScopesIndex)) {
1209 NumCapturingClosures++;
1213 if (BuildAndDiagnose)
1214 Diag(Loc, diag::err_this_capture)
1215 << (Explicit && idx == MaxFunctionScopesIndex);
1220 if (!BuildAndDiagnose)
return false;
1232 dyn_cast<LambdaScopeInfo>(
FunctionScopes[MaxFunctionScopesIndex])) &&
1233 "Only a lambda can capture the enclosing object (referred to by " 1236 for (
int idx = MaxFunctionScopesIndex; NumCapturingClosures;
1237 --idx, --NumCapturingClosures) {
1252 bool isNested = NumCapturingClosures > 1;
1265 return Diag(Loc, diag::err_invalid_this_use);
1301 bool ListInitialization) {
1311 RParenOrBraceLoc, ListInitialization);
1315 if (!
Result.isInvalid() &&
Result.get()->isInstantiationDependent() &&
1316 !
Result.get()->isTypeDependent())
1326 bool ListInitialization) {
1335 : SourceRange(LParenOrBraceLoc, RParenOrBraceLoc);
1340 assert((!ListInitialization ||
1341 (Exprs.size() == 1 && isa<InitListExpr>(Exprs[0]))) &&
1342 "List initialization must have initializer list as expression.");
1348 ? ListInitialization
1350 TyBeginLoc, LParenOrBraceLoc, RParenOrBraceLoc)
1360 if (Deduced && isa<DeducedTemplateSpecializationType>(Deduced)) {
1372 if (Exprs.size() == 1 && !ListInitialization &&
1373 !isa<InitListExpr>(Exprs[0])) {
1374 Expr *Arg = Exprs[0];
1382 if (!ListInitialization)
1383 return ExprError(
Diag(TyBeginLoc, diag::err_value_init_for_array_type)
1391 return ExprError(
Diag(TyBeginLoc, diag::err_init_for_function_type)
1392 << Ty << FullRange);
1399 diag::err_invalid_incomplete_type_use, FullRange))
1412 Inner = BTE->getSubExpr();
1413 if (!isa<CXXTemporaryObjectExpr>(Inner) &&
1414 !isa<CXXScalarValueInitExpr>(Inner)) {
1426 : SourceRange(LParenOrBraceLoc, RParenOrBraceLoc);
1450 return llvm::none_of(PreventedBy, [&](
const FunctionDecl *FD) {
1452 "Only single-operand functions should be in PreventedBy");
1467 unsigned UsualParams = 1;
1485 struct UsualDeallocFnInfo {
1486 UsualDeallocFnInfo() : Found(), FD(
nullptr) {}
1489 Destroying(
false), HasSizeT(
false), HasAlignValT(
false),
1494 unsigned NumBaseParams = 1;
1495 if (FD->isDestroyingOperatorDelete()) {
1500 if (NumBaseParams < FD->getNumParams() &&
1502 FD->getParamDecl(NumBaseParams)->getType(),
1508 if (NumBaseParams < FD->getNumParams() &&
1509 FD->getParamDecl(NumBaseParams)->getType()->isAlignValT()) {
1511 HasAlignValT =
true;
1516 if (
auto *Caller = dyn_cast<FunctionDecl>(S.
CurContext))
1520 explicit operator bool()
const {
return FD; }
1522 bool isBetterThan(
const UsualDeallocFnInfo &Other,
bool WantSize,
1523 bool WantAlign)
const {
1527 if (Destroying != Other.Destroying)
1534 if (HasAlignValT != Other.HasAlignValT)
1535 return HasAlignValT == WantAlign;
1537 if (HasSizeT != Other.HasSizeT)
1538 return HasSizeT == WantSize;
1541 return CUDAPref > Other.CUDAPref;
1546 bool Destroying, HasSizeT, HasAlignValT;
1566 UsualDeallocFnInfo Best;
1568 for (
auto I = R.
begin(), E = R.
end(); I != E; ++I) {
1569 UsualDeallocFnInfo Info(S, I.getPair());
1577 BestFns->push_back(Info);
1581 if (Best.isBetterThan(Info, WantSize, WantAlign))
1586 if (BestFns && Info.isBetterThan(Best, WantSize, WantAlign))
1591 BestFns->push_back(Info);
1605 if (!record)
return false;
1618 if (ops.
empty())
return false;
1630 return Best && Best.HasSizeT;
1681 if (!NumElts->isTypeDependent() && !NumElts->isValueDependent()) {
1687 assert(IntWidth &&
"Builtin type of size 0?");
1696 diag::err_new_array_nonconst)
1712 if (
ParenListExpr *List = dyn_cast_or_null<ParenListExpr>(Initializer))
1713 DirectInitRange = List->getSourceRange();
1716 PlacementLParen, PlacementArgs, PlacementRParen,
1717 TypeIdParens, AllocType, TInfo, ArraySize, DirectInitRange,
1726 return PLE->getNumExprs() == 0;
1727 if (isa<ImplicitValueInitExpr>(Init))
1730 return !CCE->isListInitialization() &&
1731 CCE->getConstructor()->isDefaultConstructor();
1733 assert(isa<InitListExpr>(Init) &&
1734 "Shouldn't create list CXXConstructExprs for arrays.");
1746 bool IsAligned =
false;
1758 StringRef OSName = AvailabilityAttr::getPlatformNameSourceSpelling(
1762 bool IsDelete = Kind == OO_Delete || Kind == OO_Array_Delete;
1763 Diag(Loc, diag::err_aligned_allocation_unavailable)
1766 Diag(Loc, diag::note_silence_aligned_allocation_unavailable);
1785 if (DirectInitRange.
isValid()) {
1786 assert(Initializer &&
"Have parens but no initializer.");
1788 }
else if (Initializer && isa<InitListExpr>(Initializer))
1791 assert((!Initializer || isa<ImplicitValueInitExpr>(Initializer) ||
1792 isa<CXXConstructExpr>(Initializer)) &&
1793 "Initializer expression that cannot have been implicitly created.");
1798 unsigned NumInits = Initializer ? 1 : 0;
1799 if (
ParenListExpr *List = dyn_cast_or_null<ParenListExpr>(Initializer)) {
1801 Inits = List->getExprs();
1802 NumInits = List->getNumExprs();
1823 DirectInitRange.
getEnd());
1827 if (Deduced && isa<DeducedTemplateSpecializationType>(Deduced)) {
1830 Diag(ArraySize ? (*ArraySize)->getExprLoc() : TypeRange.
getBegin(),
1831 diag::err_deduced_class_template_compound_type)
1833 << (ArraySize ? (*ArraySize)->getSourceRange() : TypeRange));
1838 AllocTypeInfo, Entity, Kind,
MultiExprArg(Inits, NumInits));
1841 }
else if (Deduced) {
1843 if (NumInits == 1) {
1844 if (
auto p = dyn_cast_or_null<InitListExpr>(Inits[0])) {
1845 Inits = p->getInits();
1846 NumInits = p->getNumInits();
1852 return ExprError(
Diag(StartLoc, diag::err_auto_new_requires_ctor_arg)
1853 << AllocType << TypeRange);
1855 Expr *FirstBad = Inits[1];
1857 diag::err_auto_new_ctor_multiple_expressions)
1858 << AllocType << TypeRange);
1862 << AllocType << TypeRange;
1863 Expr *Deduce = Inits[0];
1866 return ExprError(
Diag(StartLoc, diag::err_auto_new_deduction_failure)
1867 << AllocType << Deduce->getType()
1868 << TypeRange << Deduce->getSourceRange());
1869 if (DeducedType.
isNull())
1871 AllocType = DeducedType;
1882 AllocType = Array->getElementType();
1899 if (ArraySize && *ArraySize &&
1900 (*ArraySize)->getType()->isNonOverloadPlaceholderType()) {
1903 ArraySize = result.
get();
1913 if (ArraySize && *ArraySize && !(*ArraySize)->isTypeDependent()) {
1921 if (!ConvertedSize.isInvalid() &&
1922 (*ArraySize)->getType()->getAs<
RecordType>())
1924 Diag(StartLoc, diag::warn_cxx98_compat_array_size_conversion)
1925 << (*ArraySize)->getType() << 0 <<
"'size_t'";
1932 SizeConvertDiagnoser(
Expr *ArraySize)
1934 ArraySize(ArraySize) {}
1938 return S.
Diag(Loc, diag::err_array_size_not_integral)
1944 return S.
Diag(Loc, diag::err_array_size_incomplete_type)
1950 return S.
Diag(Loc, diag::err_array_size_explicit_conversion) << T << ConvTy;
1961 return S.
Diag(Loc, diag::err_array_size_ambiguous_conversion) << T;
1975 ? diag::warn_cxx98_compat_array_size_conversion
1976 : diag::ext_array_size_conversion)
1979 } SizeDiagnoser(*ArraySize);
1987 ArraySize = ConvertedSize.
get();
1988 QualType SizeType = (*ArraySize)->getType();
2000 if (!(*ArraySize)->isValueDependent()) {
2007 if ((*ArraySize)->isIntegerConstantExpr(Value,
Context)) {
2008 if (Value.isSigned() && Value.isNegative()) {
2010 diag::err_typecheck_negative_array_size)
2011 << (*ArraySize)->getSourceRange());
2015 unsigned ActiveSizeBits =
2019 Diag((*ArraySize)->getBeginLoc(), diag::err_array_too_large)
2020 << Value.toString(10) << (*ArraySize)->getSourceRange());
2023 KnownArraySize = Value.getZExtValue();
2024 }
else if (TypeIdParens.
isValid()) {
2026 Diag((*ArraySize)->getBeginLoc(), diag::ext_new_paren_array_nonconst)
2027 << (*ArraySize)->getSourceRange()
2041 unsigned Alignment =
2044 bool PassAlignment =
getLangOpts().AlignedAllocation &&
2045 Alignment > NewAlignment;
2051 StartLoc,
SourceRange(PlacementLParen, PlacementRParen), Scope, Scope,
2052 AllocType, ArraySize.hasValue(), PassAlignment, PlacementArgs,
2053 OperatorNew, OperatorDelete))
2058 bool UsualArrayDeleteWantsSize =
false;
2060 UsualArrayDeleteWantsSize =
2075 PassAlignment ? 2 : 1, PlacementArgs,
2076 AllPlaceArgs, CallType))
2079 if (!AllPlaceArgs.empty())
2080 PlacementArgs = AllPlaceArgs;
2089 if (PlacementArgs.empty() && !PassAlignment &&
2090 (OperatorNew->isImplicit() ||
2091 (OperatorNew->getBeginLoc().isValid() &&
2093 if (Alignment > NewAlignment)
2094 Diag(StartLoc, diag::warn_overaligned_type)
2106 Inits[NumInits - 1]->getEndLoc());
2107 Diag(StartLoc, diag::err_new_array_init_args) << InitRange;
2115 llvm::makeArrayRef(Inits, NumInits))) {
2128 InitType = AllocType;
2143 dyn_cast_or_null<CXXBindTemporaryExpr>(FullInit.
get()))
2144 FullInit = Binder->getSubExpr();
2146 Initializer = FullInit.
get();
2151 if (ArraySize && !*ArraySize) {
2159 Diag(TypeRange.
getEnd(), diag::err_new_array_size_unknown_from_init)
2171 if (OperatorDelete) {
2178 PassAlignment, UsualArrayDeleteWantsSize,
2179 PlacementArgs, TypeIdParens, ArraySize, initStyle,
2180 Initializer, ResultType, AllocTypeInfo, Range,
2191 return Diag(Loc, diag::err_bad_new_type)
2192 << AllocType << 0 << R;
2194 return Diag(Loc, diag::err_bad_new_type)
2195 << AllocType << 1 << R;
2200 diag::err_allocation_of_abstract_type))
2203 return Diag(Loc, diag::err_variably_modified_new_type)
2207 return Diag(Loc, diag::err_address_space_qualified_new)
2215 return Diag(Loc, diag::err_arc_new_array_without_ownership)
2230 Alloc != AllocEnd; ++Alloc) {
2250 switch (Candidates.BestViableFunction(S, R.
getNameLoc(), Best)) {
2267 if (PassAlignment) {
2268 PassAlignment =
false;
2270 Args.erase(Args.begin() + 1);
2272 Operator, &Candidates, AlignArg,
2300 if (AlignedCandidates) {
2302 return C.Function->getNumParams() > 1 &&
2303 C.Function->getParamDecl(1)->getType()->isAlignValT();
2309 Args.insert(Args.begin() + 1, AlignArg);
2312 Args.erase(Args.begin() + 1);
2323 Candidates.NoteCandidates(
2325 S.
PDiag(diag::err_ovl_ambiguous_call)
2333 Candidates.NoteCandidates(
2335 S.
PDiag(diag::err_ovl_deleted_call)
2342 llvm_unreachable(
"Unreachable, bad result from BestViableFunction");
2364 AllocArgs.reserve((PassAlignment ? 2 : 1) + PlaceArgs.size());
2374 AllocArgs.push_back(&Size);
2377 if (PassAlignment) {
2383 AllocArgs.push_back(&Align);
2385 AllocArgs.insert(AllocArgs.end(), PlaceArgs.begin(), PlaceArgs.end());
2394 IsArray ? OO_Array_New : OO_New);
2426 if (PlaceArgs.empty()) {
2427 Diag(StartLoc, diag::err_openclcxx_not_supported) <<
"default new";
2429 Diag(StartLoc, diag::err_openclcxx_placement_new);
2434 assert(!R.
empty() &&
"implicitly declared allocation functions not found");
2435 assert(!R.
isAmbiguous() &&
"global allocation functions are ambiguous");
2441 OperatorNew,
nullptr,
2448 OperatorDelete =
nullptr;
2477 bool FoundGlobalDelete = FoundDelete.
empty();
2478 if (FoundDelete.
empty()) {
2503 bool isPlacementNew = !PlaceArgs.empty() || OperatorNew->
param_size() != 1 ||
2506 if (isPlacementNew) {
2524 for (
unsigned I = 1, N = Proto->
getNumParams(); I < N; ++I)
2531 ExpectedFunctionType
2536 DEnd = FoundDelete.
end();
2540 dyn_cast<FunctionTemplateDecl>((*D)->getUnderlyingDecl())) {
2548 Fn = cast<FunctionDecl>((*D)->getUnderlyingDecl());
2551 ExpectedFunctionType,
2553 ExpectedFunctionType))
2554 Matches.push_back(std::make_pair(D.getPair(), Fn));
2569 *
this, FoundDelete, FoundGlobalDelete,
2573 Matches.push_back(std::make_pair(Selected.Found, Selected.FD));
2577 for (
auto Fn : BestDeallocFns)
2578 Matches.push_back(std::make_pair(Fn.Found, Fn.FD));
2586 if (Matches.size() == 1) {
2587 OperatorDelete = Matches[0].second;
2595 if (
getLangOpts().CPlusPlus11 && isPlacementNew &&
2597 UsualDeallocFnInfo Info(*
this,
2603 bool IsSizedDelete = Info.HasSizeT;
2604 if (IsSizedDelete && !FoundGlobalDelete) {
2605 auto NonSizedDelete =
2608 if (NonSizedDelete && !NonSizedDelete.HasSizeT &&
2609 NonSizedDelete.HasAlignValT == Info.HasAlignValT)
2610 IsSizedDelete =
false;
2613 if (IsSizedDelete) {
2617 PlaceArgs.back()->getEndLoc());
2618 Diag(StartLoc, diag::err_placement_new_non_placement_delete) << R;
2627 }
else if (!Matches.empty()) {
2631 Diag(StartLoc, diag::warn_ambiguous_suitable_delete_function_found)
2632 << DeleteName << AllocElemType;
2634 for (
auto &Match : Matches)
2635 Diag(Match.second->getLocation(),
2636 diag::note_member_declared_here) << DeleteName;
2722 AlignValT->setImplicit(
true);
2734 Params.push_back(Param);
2737 bool HasSizedVariant =
getLangOpts().SizedDeallocation &&
2738 (Kind == OO_Delete || Kind == OO_Array_Delete);
2739 bool HasAlignedVariant =
getLangOpts().AlignedAllocation;
2741 int NumSizeVariants = (HasSizedVariant ? 2 : 1);
2742 int NumAlignVariants = (HasAlignedVariant ? 2 : 1);
2743 for (
int Sized = 0; Sized < NumSizeVariants; ++Sized) {
2745 Params.push_back(SizeT);
2747 for (
int Aligned = 0; Aligned < NumAlignVariants; ++Aligned) {
2760 DeclareGlobalAllocationFunctions(OO_New, VoidPtr, SizeT);
2761 DeclareGlobalAllocationFunctions(OO_Array_New, VoidPtr, SizeT);
2762 DeclareGlobalAllocationFunctions(OO_Delete,
Context.
VoidTy, VoidPtr);
2763 DeclareGlobalAllocationFunctions(OO_Array_Delete,
Context.
VoidTy, VoidPtr);
2776 Alloc != AllocEnd; ++Alloc) {
2779 if (
FunctionDecl *Func = dyn_cast<FunctionDecl>(*Alloc)) {
2780 if (Func->getNumParams() == Params.size()) {
2782 for (
auto *
P : Func->parameters())
2783 FuncParams.push_back(
2785 if (llvm::makeArrayRef(FuncParams) == Params) {
2789 Func->setVisibleDespiteOwningModule();
2797 false,
false,
true));
2800 bool HasBadAllocExceptionSpec
2803 if (HasBadAllocExceptionSpec) {
2806 assert(
StdBadAlloc &&
"Must have std::bad_alloc declared");
2808 EPI.ExceptionSpec.Exceptions = llvm::makeArrayRef(BadAllocType);
2815 auto CreateAllocationFunctionDecl = [&](
Attr *ExtraAttr) {
2819 FnType,
nullptr,
SC_None,
false,
true);
2824 Alloc->
addAttr(VisibilityAttr::CreateImplicit(
2826 ? VisibilityAttr::Hidden
2834 ParamDecls.back()->setImplicit();
2836 Alloc->setParams(ParamDecls);
2844 CreateAllocationFunctionDecl(
nullptr);
2848 CreateAllocationFunctionDecl(CUDAHostAttr::CreateImplicit(
Context));
2849 CreateAllocationFunctionDecl(CUDADeviceAttr::CreateImplicit(
Context));
2854 bool CanProvideSize,
2868 assert(Result.FD &&
"operator delete missing from global scope?");
2880 return OperatorDelete;
2908 Overaligned, &Matches);
2911 if (Matches.size() == 1) {
2912 Operator = cast<CXXMethodDecl>(Matches[0].FD);
2917 Diag(StartLoc, diag::err_deleted_function_use);
2933 if (!Matches.empty()) {
2935 Diag(StartLoc, diag::err_ambiguous_suitable_delete_member_function_found)
2937 for (
auto &Match : Matches)
2938 Diag(Match.FD->getLocation(), diag::note_member_declared_here) << Name;
2945 if (!Found.
empty()) {
2947 Diag(StartLoc, diag::err_no_suitable_delete_member_function_found)
2951 Diag(D->getUnderlyingDecl()->getLocation(),
2952 diag::note_member_declared_here) << Name;
2964 class MismatchingNewDeleteDetector {
2966 enum MismatchResult {
2972 MemberInitMismatches,
2981 explicit MismatchingNewDeleteDetector(
bool EndOfTU)
2982 : Field(
nullptr), IsArrayForm(
false), EndOfTU(EndOfTU),
2983 HasUndefinedConstructors(
false) {}
3000 MismatchResult analyzeField(
FieldDecl *Field,
bool DeleteWasArrayForm);
3010 bool HasUndefinedConstructors;
3022 MismatchResult analyzeMemberExpr(
const MemberExpr *ME);
3045 MismatchResult analyzeInClassInitializer();
3049 MismatchingNewDeleteDetector::MismatchResult
3050 MismatchingNewDeleteDetector::analyzeDeleteExpr(
const CXXDeleteExpr *DE) {
3052 assert(DE &&
"Expected delete-expression");
3055 if (
const MemberExpr *ME = dyn_cast<const MemberExpr>(E)) {
3056 return analyzeMemberExpr(ME);
3057 }
else if (
const DeclRefExpr *D = dyn_cast<const DeclRefExpr>(E)) {
3058 if (!hasMatchingVarInit(D))
3059 return VarInitMismatches;
3065 MismatchingNewDeleteDetector::getNewExprFromInitListOrExpr(
const Expr *E) {
3066 assert(E !=
nullptr &&
"Expected a valid initializer expression");
3068 if (
const InitListExpr *ILE = dyn_cast<const InitListExpr>(E)) {
3069 if (ILE->getNumInits() == 1)
3070 E = dyn_cast<const CXXNewExpr>(ILE->getInit(0)->IgnoreParenImpCasts());
3073 return dyn_cast_or_null<const CXXNewExpr>(E);
3076 bool MismatchingNewDeleteDetector::hasMatchingNewInCtorInit(
3080 (NE = getNewExprFromInitListOrExpr(CI->
getInit()))) {
3081 if (NE->
isArray() == IsArrayForm)
3084 NewExprs.push_back(NE);
3089 bool MismatchingNewDeleteDetector::hasMatchingNewInCtor(
3095 HasUndefinedConstructors =
true;
3098 for (
const auto *CI : cast<const CXXConstructorDecl>(Definition)->inits()) {
3099 if (hasMatchingNewInCtorInit(CI))
3105 MismatchingNewDeleteDetector::MismatchResult
3106 MismatchingNewDeleteDetector::analyzeInClassInitializer() {
3107 assert(Field !=
nullptr &&
"This should be called only for members");
3108 const Expr *InitExpr = Field->getInClassInitializer();
3110 return EndOfTU ? NoMismatch : AnalyzeLater;
3111 if (
const CXXNewExpr *
NE = getNewExprFromInitListOrExpr(InitExpr)) {
3112 if (
NE->isArray() != IsArrayForm) {
3113 NewExprs.push_back(
NE);
3114 return MemberInitMismatches;
3120 MismatchingNewDeleteDetector::MismatchResult
3121 MismatchingNewDeleteDetector::analyzeField(
FieldDecl *Field,
3122 bool DeleteWasArrayForm) {
3123 assert(Field !=
nullptr &&
"Analysis requires a valid class member.");
3124 this->Field = Field;
3125 IsArrayForm = DeleteWasArrayForm;
3127 for (
const auto *CD : RD->
ctors()) {
3128 if (hasMatchingNewInCtor(CD))
3131 if (HasUndefinedConstructors)
3132 return EndOfTU ? NoMismatch : AnalyzeLater;
3133 if (!NewExprs.empty())
3134 return MemberInitMismatches;
3139 MismatchingNewDeleteDetector::MismatchResult
3140 MismatchingNewDeleteDetector::analyzeMemberExpr(
const MemberExpr *ME) {
3141 assert(ME !=
nullptr &&
"Expected a member expression");
3143 return analyzeField(F, IsArrayForm);
3147 bool MismatchingNewDeleteDetector::hasMatchingVarInit(
const DeclRefExpr *D) {
3150 if (VD->hasInit() && (NE = getNewExprFromInitListOrExpr(VD->getInit())) &&
3151 NE->
isArray() != IsArrayForm) {
3152 NewExprs.push_back(NE);
3155 return NewExprs.empty();
3160 const MismatchingNewDeleteDetector &Detector) {
3163 if (!Detector.IsArrayForm)
3172 SemaRef.
Diag(DeleteLoc, diag::warn_mismatched_delete_new)
3173 << Detector.IsArrayForm << H;
3175 for (
const auto *
NE : Detector.NewExprs)
3176 SemaRef.
Diag(
NE->getExprLoc(), diag::note_allocated_here)
3177 << Detector.IsArrayForm;
3180 void Sema::AnalyzeDeleteExprMismatch(
const CXXDeleteExpr *DE) {
3183 MismatchingNewDeleteDetector Detector(
false);
3184 switch (Detector.analyzeDeleteExpr(DE)) {
3185 case MismatchingNewDeleteDetector::VarInitMismatches:
3186 case MismatchingNewDeleteDetector::MemberInitMismatches: {
3190 case MismatchingNewDeleteDetector::AnalyzeLater: {
3195 case MismatchingNewDeleteDetector::NoMismatch:
3201 bool DeleteWasArrayForm) {
3202 MismatchingNewDeleteDetector Detector(
true);
3203 switch (Detector.analyzeField(Field, DeleteWasArrayForm)) {
3204 case MismatchingNewDeleteDetector::VarInitMismatches:
3205 llvm_unreachable(
"This analysis should have been done for class members.");
3206 case MismatchingNewDeleteDetector::AnalyzeLater:
3207 llvm_unreachable(
"Analysis cannot be postponed any point beyond end of " 3208 "translation unit.");
3209 case MismatchingNewDeleteDetector::MemberInitMismatches:
3212 case MismatchingNewDeleteDetector::NoMismatch:
3223 bool ArrayForm,
Expr *ExE) {
3233 bool ArrayFormAsWritten = ArrayForm;
3234 bool UsualArrayDeleteWantsSize =
false;
3236 if (!Ex.
get()->isTypeDependent()) {
3252 if (ConvPtrType->getPointeeType()->isIncompleteOrObjectType())
3259 return S.
Diag(Loc, diag::err_delete_operand) << T;
3264 return S.
Diag(Loc, diag::err_delete_incomplete_class_type) << T;
3270 return S.
Diag(Loc, diag::err_delete_explicit_conversion) << T << ConvTy;
3281 return S.
Diag(Loc, diag::err_ambiguous_delete_operand) << T;
3293 llvm_unreachable(
"conversion functions are permitted");
3300 Type = Ex.
get()->getType();
3301 if (!Converter.match(Type))
3311 return Diag(Ex.
get()->getBeginLoc(),
3312 diag::err_address_space_qualified_delete)
3321 Diag(StartLoc, diag::ext_delete_void_ptr_operand)
3322 << Type << Ex.
get()->getSourceRange();
3325 << Type << Ex.
get()->getSourceRange());
3330 diag::warn_delete_incomplete, Ex.
get())) {
3332 PointeeRD = cast<CXXRecordDecl>(RT->getDecl());
3337 Diag(StartLoc, diag::warn_delete_array_type)
3338 << Type << Ex.
get()->getSourceRange()
3344 ArrayForm ? OO_Array_Delete : OO_Delete);
3358 UsualArrayDeleteWantsSize =
3363 else if (OperatorDelete && isa<CXXMethodDecl>(OperatorDelete))
3364 UsualArrayDeleteWantsSize =
3365 UsualDeallocFnInfo(*
this,
3373 const_cast<CXXDestructorDecl*>(Dtor));
3384 if (!OperatorDelete) {
3386 Diag(StartLoc, diag::err_openclcxx_not_supported) <<
"default delete";
3391 bool CanProvideSize =
3392 IsComplete && (!ArrayForm || UsualArrayDeleteWantsSize ||
3398 Overaligned, DeleteName);
3405 bool IsVirtualDelete =
false;
3409 PDiag(diag::err_access_dtor) << PointeeElem);
3410 IsVirtualDelete = Dtor->isVirtual();
3439 UsualArrayDeleteWantsSize, OperatorDelete, Ex.
get(), StartLoc);
3440 AnalyzeDeleteExprMismatch(Result);
3449 IsDelete ? OO_Delete : OO_New);
3453 assert(!R.empty() &&
"implicitly declared allocation functions not found");
3454 assert(!R.isAmbiguous() &&
"global allocation functions are ambiguous");
3457 R.suppressDiagnostics();
3463 FnOvl != FnOvlEnd; ++FnOvl) {
3466 NamedDecl *D = (*FnOvl)->getUnderlyingDecl();
3485 switch (Candidates.BestViableFunction(S, R.getNameLoc(), Best)) {
3489 assert(R.getNamingClass() ==
nullptr &&
3490 "class members should not be considered");
3493 S.
Diag(R.getNameLoc(), diag::err_builtin_operator_new_delete_not_usual)
3494 << (IsDelete ? 1 : 0) << Range;
3495 S.
Diag(FnDecl->
getLocation(), diag::note_non_usual_function_declared_here)
3505 Candidates.NoteCandidates(
3507 S.
PDiag(diag::err_ovl_no_viable_function_in_call)
3508 << R.getLookupName() << Range),
3513 Candidates.NoteCandidates(
3515 S.
PDiag(diag::err_ovl_ambiguous_call)
3516 << R.getLookupName() << Range),
3521 Candidates.NoteCandidates(
3523 << R.getLookupName() << Range),
3528 llvm_unreachable(
"Unreachable, bad result from BestViableFunction");
3532 Sema::SemaBuiltinOperatorNewDeleteOverloaded(
ExprResult TheCallResult,
3534 CallExpr *TheCall = cast<CallExpr>(TheCallResult.
get());
3537 << (IsDelete ?
"__builtin_operator_delete" :
"__builtin_operator_new")
3547 OperatorNewOrDelete))
3549 assert(OperatorNewOrDelete &&
"should be found");
3555 for (
unsigned i = 0; i != TheCall->
getNumArgs(); ++i) {
3566 assert(Callee && Callee->getCastKind() == CK_BuiltinFnToFnPtr &&
3567 "Callee expected to be implicit cast to a builtin function pointer");
3570 return TheCallResult;
3574 bool IsDelete,
bool CallCanBeVirtual,
3575 bool WarnOnNonAbstractTypes,
3602 Diag(Loc, diag::warn_delete_abstract_non_virtual_dtor) << (IsDelete ? 0 : 1)
3604 }
else if (WarnOnNonAbstractTypes) {
3607 Diag(Loc, diag::warn_delete_non_virtual_dtor) << (IsDelete ? 0 : 1)
3611 std::string TypeStr;
3613 Diag(DtorLoc, diag::note_delete_non_virtual)
3643 diag::err_invalid_use_of_function_type)
3647 diag::err_invalid_use_of_array_type)
3665 llvm_unreachable(
"unexpected condition kind");
3694 From =
Cast->getSubExpr();
3706 if (!ToPtrType->getPointeeType().hasQualifiers()) {
3707 switch (StrLit->getKind()) {
3714 return (ToPointeeType->getKind() == BuiltinType::Char_U ||
3715 ToPointeeType->getKind() == BuiltinType::Char_S);
3732 bool HadMultipleCandidates,
3735 default: llvm_unreachable(
"Unhandled cast kind!");
3736 case CK_ConstructorConversion: {
3741 diag::err_allocation_of_abstract_type))
3753 CastLoc, Ty, FoundDecl, cast<CXXConstructorDecl>(Method),
3754 ConstructorArgs, HadMultipleCandidates,
3755 false,
false,
false,
3763 case CK_UserDefinedConversion: {
3773 HadMultipleCandidates);
3774 if (Result.isInvalid())
3778 CK_UserDefinedConversion, Result.get(),
3779 nullptr, Result.get()->getValueKind());
3815 assert(FD &&
"no conversion function for user-defined conversion seq");
3817 CastKind = CK_UserDefinedConversion;
3825 CastKind = CK_ConstructorConversion;
3853 From = CastArg.
get();
3867 PDiag(diag::err_typecheck_ambiguous_condition)
3872 llvm_unreachable(
"Cannot perform an ellipsis conversion");
3877 From->
getType(), From, Action);
3878 assert(Diagnosed &&
"failed to diagnose bad conversion"); (void)Diagnosed;
3916 ConstructorArgs,
false,
3917 false,
false,
false,
3924 false,
false,
false,
3947 ToAtomicType = ToType;
3948 ToType = ToAtomic->getValueType();
3951 QualType InitialFromType = FromType;
3953 switch (SCS.
First) {
3956 FromType = FromAtomic->getValueType().getUnqualifiedType();
3965 assert(!FromRes.isInvalid() &&
"Can't perform deduced conversion?!");
3966 From = FromRes.get();
3967 FromType = From->getType();
3984 llvm_unreachable(
"Improper first standard conversion");
4021 "only enums with fixed underlying type can promote to bool");
4043 CK = CK_FloatingComplexCast;
4045 CK = CK_FloatingComplexToIntegralComplex;
4047 CK = CK_IntegralComplexToFloatingComplex;
4049 CK = CK_IntegralComplexCast;
4076 diag::ext_typecheck_convert_incompatible_pointer)
4081 diag::ext_typecheck_convert_incompatible_pointer)
4094 Diag(From->
getBeginLoc(), diag::err_arc_convesion_of_weak_unavailable)
4123 if (Kind == CK_BlockPointerToObjCPointerCast) {
4128 if (
getLangOpts().allowsNonTrivialObjCLifetimeQualifiers())
4176 &BasePath, CCK).
get();
4189 nullptr, CCK).
get();
4196 QualType ElType = ToComplex->getElementType();
4204 isFloatingComplex ? CK_FloatingCast : CK_FloatingToIntegral).
get();
4208 isFloatingComplex ? CK_IntegralToFloating : CK_IntegralCast).
get();
4212 isFloatingComplex ? CK_FloatingRealToComplex
4213 : CK_IntegralRealToComplex).
get();
4218 assert(FromComplex);
4225 isFloatingComplex ? CK_FloatingComplexToReal
4226 : CK_IntegralComplexToReal,
4234 isFloatingComplex ? CK_FloatingCast : CK_IntegralToFloating,
4239 isFloatingComplex ? CK_FloatingToIntegral : CK_IntegralCast,
4253 AddrSpaceL != AddrSpaceR ? CK_AddressSpaceConversion : CK_BitCast;
4265 From = FromRes.
get();
4267 "Improper transparent union conversion");
4275 CK_ZeroToOCLOpaqueType,
4287 llvm_unreachable(
"Improper second standard conversion");
4290 switch (SCS.
Third) {
4316 CK = CK_AddressSpaceConversion;
4321 CK = CK_AddressSpaceConversion;
4331 ? diag::ext_deprecated_string_literal_conversion
4332 : diag::warn_deprecated_string_literal_conversion)
4340 llvm_unreachable(
"Improper third standard conversion");
4345 if (!ToAtomicType.
isNull()) {
4380 default: llvm_unreachable(
"not a UTT");
4433 Loc, ArgTy, diag::err_incomplete_type_used_in_type_trait_expr);
4442 Loc, ArgTy, diag::err_incomplete_type_used_in_type_trait_expr);
4480 Loc, ArgTy, diag::err_incomplete_type_used_in_type_trait_expr);
4491 if ((RD->*HasTrivial)() && !(RD->*HasNonTrivial)())
4498 bool FoundOperator =
false;
4501 Op != OpEnd; ++Op) {
4502 if (isa<FunctionTemplateDecl>(*Op))
4506 if((Operator->*IsDesiredOp)()) {
4507 FoundOperator =
true;
4515 return FoundOperator;
4522 assert(!T->
isDependentType() &&
"Cannot evaluate traits of dependent type");
4526 default: llvm_unreachable(
"not a UTT");
4608 return !RD->isUnion() && RD->isEmpty();
4612 return !RD->isUnion() && RD->isPolymorphic();
4616 return !RD->isUnion() && RD->isAbstract();
4632 return RD->hasAttr<FinalAttr>();
4663 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl())
4664 return RD->hasTrivialDefaultConstructor() &&
4665 !RD->hasNonTrivialDefaultConstructor();
4673 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl())
4674 return RD->hasTrivialMoveConstructor() && !RD->hasNonTrivialMoveConstructor();
4685 return RD->hasTrivialCopyConstructor() &&
4686 !RD->hasNonTrivialCopyConstructor();
4694 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl())
4695 return RD->hasTrivialMoveAssignment() && !RD->hasNonTrivialMoveAssignment();
4715 return RD->hasTrivialCopyAssignment() &&
4716 !RD->hasNonTrivialCopyAssignment();
4746 if (
auto *RD = C.getBaseElementType(T)->getAsCXXRecordDecl()) {
4782 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl())
4783 return RD->hasTrivialDestructor();
4794 if (C.getBaseElementType(T).isConstQualified())
4829 if (RD->hasTrivialCopyConstructor() &&
4830 !RD->hasNonTrivialCopyConstructor())
4833 bool FoundConstructor =
false;
4839 if (isa<FunctionTemplateDecl>(ND->getUnderlyingDecl()))
4842 if (isa<UsingDecl>(ND))
4844 auto *Constructor = cast<CXXConstructorDecl>(ND->getUnderlyingDecl());
4845 if (Constructor->isCopyConstructor(FoundTQs)) {
4846 FoundConstructor =
true;
4859 return FoundConstructor;
4870 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl()) {
4871 if (RD->hasTrivialDefaultConstructor() &&
4872 !RD->hasNonTrivialDefaultConstructor())
4875 bool FoundConstructor =
false;
4878 if (isa<FunctionTemplateDecl>(ND->getUnderlyingDecl()))
4881 if (isa<UsingDecl>(ND))
4883 auto *Constructor = cast<CXXConstructorDecl>(ND->getUnderlyingDecl());
4884 if (Constructor->isDefaultConstructor()) {
4885 FoundConstructor =
true;
4897 return FoundConstructor;
4906 return Destructor->isVirtual();
4918 return C.hasUniqueObjectRepresentations(T);
4935 Args[1]->getType(), RParenLoc);
4955 assert(!Args.empty());
4960 for (
const auto *TSI : Args) {
4966 diag::err_incomplete_type_used_in_type_trait_expr))
4982 ArgExprs.reserve(Args.size() - 1);
4983 for (
unsigned I = 1, N = Args.size(); I != N; ++I) {
4984 QualType ArgTy = Args[I]->getType();
4987 OpaqueArgExprs.push_back(
4992 for (
Expr &E : OpaqueArgExprs)
4993 ArgExprs.push_back(&E);
5033 return !Result.
get()->hasNonTrivialCall(S.
Context);
5036 llvm_unreachable(
"unhandled type trait");
5039 default: llvm_unreachable(
"not a TT");
5051 *
this, Kind, KWLoc, Args[0]->getType()))
5054 bool Dependent =
false;
5055 for (
unsigned I = 0, N = Args.size(); I != N; ++I) {
5056 if (Args[I]->getType()->isDependentType()) {
5074 ConvertedArgs.reserve(Args.size());
5076 for (
unsigned I = 0, N = Args.size(); I != N; ++I) {
5082 ConvertedArgs.push_back(TInfo);
5091 "Cannot evaluate traits of dependent types");
5102 if (!rhsRecord || !lhsRecord) {
5105 if (!LHSObjTy || !RHSObjTy)
5110 if (!BaseInterface || !DerivedInterface)
5114 KeyLoc, RhsT, diag::err_incomplete_type_used_in_type_trait_expr))
5121 == (lhsRecord == rhsRecord));
5127 if (rhsRecord && rhsRecord->getDecl()->isUnion())
5130 if (lhsRecord == rhsRecord)
5138 diag::err_incomplete_type_used_in_type_trait_expr))
5141 return cast<CXXRecordDecl>(rhsRecord->getDecl())
5142 ->isDerivedFrom(cast<CXXRecordDecl>(lhsRecord->
getDecl()));
5200 Expr *FromPtr = &From;
5234 diag::err_incomplete_type_used_in_type_trait_expr))
5238 diag::err_incomplete_type_used_in_type_trait_expr))
5264 if (Result.isInvalid())
5285 return !Result.get()->hasNonTrivialCall(Self.
Context);
5288 llvm_unreachable(
"unhandled type trait");
5291 default: llvm_unreachable(
"not a BTT");
5293 llvm_unreachable(
"Unknown type trait or not implemented");
5312 assert(!T->
isDependentType() &&
"Cannot evaluate traits of dependent type");
5320 T = AT->getElementType();
5330 diag::err_dimension_expr_not_constant_integer,
5333 if (Value.isSigned() && Value.isNegative()) {
5334 Self.
Diag(KeyLoc, diag::err_dimension_expr_not_constant_integer)
5338 Dim = Value.getLimitedValue();
5342 bool Matched =
false;
5349 T = AT->getElementType();
5354 return CAT->getSize().getLimitedValue();
5360 llvm_unreachable(
"Unknown type trait or not implemented");
5403 llvm_unreachable(
"Expression trait not covered by switch");
5428 assert(!LHS.
get()->getType()->isPlaceholderType() &&
5429 !RHS.
get()->getType()->isPlaceholderType() &&
5430 "placeholders should have been weeded out by now");
5436 else if (LHS.
get()->isRValue())
5445 const char *OpSpelling = isIndirect ?
"->*" :
".*";
5453 Diag(Loc, diag::err_bad_memptr_rhs)
5454 << OpSpelling << RHSType << RHS.
get()->getSourceRange();
5473 LHSType = Ptr->getPointeeType();
5475 Diag(Loc, diag::err_bad_memptr_lhs)
5476 << OpSpelling << 1 << LHSType
5485 OpSpelling, (
int)isIndirect)) {
5490 Diag(Loc, diag::err_bad_memptr_lhs) << OpSpelling
5491 << (int)isIndirect << LHS.
get()->getType();
5497 LHSType, Class, Loc,
5511 if (isa<CXXScalarValueInitExpr>(RHS.
get()->IgnoreParens())) {
5514 Diag(Loc, diag::err_pointer_to_member_type) << isIndirect;
5533 switch (Proto->getRefQualifier()) {
5539 if (!isIndirect && !LHS.
get()->Classify(
Context).isLValue()) {
5542 if (Proto->isConst() && !Proto->isVolatile())
5544 ? diag::warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue
5545 : diag::ext_pointer_to_const_ref_member_on_rvalue);
5547 Diag(Loc, diag::err_pointer_to_member_oper_value_classify)
5548 << RHSType << 1 << LHS.
get()->getSourceRange();
5553 if (isIndirect || !LHS.
get()->Classify(
Context).isRValue())
5554 Diag(Loc, diag::err_pointer_to_member_oper_value_classify)
5555 << RHSType << 0 << LHS.
get()->getSourceRange();
5570 }
else if (isIndirect) {
5573 VK = LHS.
get()->getValueKind();
5588 bool &HaveConversion,
5590 HaveConversion =
false;
5615 HaveConversion =
true;
5620 return InitSeq.
Diagnose(Self, Entity, Kind, From);
5630 bool FDerivedFromT = FRec && TRec && FRec != TRec &&
5632 if (FRec && TRec && (FRec == TRec || FDerivedFromT ||
5637 if (FRec == TRec || FDerivedFromT) {
5642 HaveConversion =
true;
5647 return InitSeq.
Diagnose(Self, Entity, Kind, From);
5665 HaveConversion = !InitSeq.
Failed();
5668 return InitSeq.
Diagnose(Self, Entity, Kind, From);
5691 LHS.
get(), Best->BuiltinParamTypes[0], Best->Conversions[0],
5698 RHS.
get(), Best->BuiltinParamTypes[1], Best->Conversions[1],
5716 Self.
Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands)
5717 << LHS.
get()->getType() << RHS.
get()->getType()
5718 << LHS.
get()->getSourceRange() << RHS.
get()->getSourceRange();
5722 Self.
Diag(QuestionLoc, diag::err_conditional_ambiguous_ovl)
5723 << LHS.
get()->getType() << RHS.
get()->getType()
5724 << LHS.
get()->getSourceRange() << RHS.
get()->getSourceRange();
5730 llvm_unreachable(
"Conditional operator has only built-in overloads");
5761 "Vectors cant be boolean or enum types");
5772 const auto *CondVT = CondType->getAs<
VectorType>();
5773 QualType CondElementTy = CondVT->getElementType();
5774 unsigned CondElementCount = CondVT->getNumElements();
5777 QualType RHSType = RHS.get()->getType();
5784 if (LHSVT && isa<ExtVectorType>(LHSVT)) {
5785 Diag(QuestionLoc, diag::err_conditional_vector_operand_type)
5790 if (RHSVT && isa<ExtVectorType>(RHSVT)) {
5791 Diag(QuestionLoc, diag::err_conditional_vector_operand_type)
5796 if (LHSVT && RHSVT) {
5799 Diag(QuestionLoc, diag::err_conditional_vector_mismatched_vectors)
5800 << LHSType << RHSType;
5803 ResultType = LHSType;
5804 }
else if (LHSVT || RHSVT) {
5806 LHS, RHS, QuestionLoc,
false,
true,
5808 if (ResultType.isNull())
5817 ResultElementTy = LHSType;
5823 Diag(QuestionLoc, diag::err_conditional_vector_operand_type)
5824 <<
false << ResultElementTy;
5835 assert(!ResultType.isNull() && ResultType->isVectorType() &&
5836 "Result should have been a vector type");
5838 unsigned ResultElementCount =
5839 ResultType->getAs<
VectorType>()->getNumElements();
5841 if (ResultElementCount != CondElementCount) {
5842 Diag(QuestionLoc, diag::err_conditional_vector_size) << CondType
5849 Diag(QuestionLoc, diag::err_conditional_vector_element_size) << CondType
5881 bool IsVectorConditional =
5886 if (!Cond.
get()->isTypeDependent()) {
5904 if (LHS.
get()->isTypeDependent() || RHS.
get()->isTypeDependent())
5911 bool LVoid = LTy->isVoidType();
5913 if (LVoid || RVoid) {
5918 bool LThrow = isa<CXXThrowExpr>(LHS.
get()->IgnoreParenImpCasts());
5919 bool RThrow = isa<CXXThrowExpr>(RHS.
get()->IgnoreParenImpCasts());
5922 if (IsVectorConditional) {
5924 LVoid ? LHS.
get()->getSourceRange() : RHS.
get()->getSourceRange();
5925 bool IsThrow = LVoid ? LThrow : RThrow;
5926 Diag(DiagLoc.
getBegin(), diag::err_conditional_vector_has_void)
5927 << DiagLoc << IsThrow;
5931 if (LThrow != RThrow) {
5932 Expr *NonThrow = LThrow ? RHS.
get() : LHS.
get();
5946 Diag(QuestionLoc, diag::err_conditional_void_nonvoid)
5947 << (LVoid ? RTy : LTy) << (LVoid ? 0 : 1)
5948 << LHS.
get()->getSourceRange() << RHS.
get()->getSourceRange();
5953 if (IsVectorConditional)
5964 bool HaveL2R, HaveR2L;
5971 if (HaveL2R && HaveR2L) {
5972 Diag(QuestionLoc, diag::err_conditional_ambiguous)
5973 << LTy << RTy << LHS.
get()->getSourceRange() << RHS.
get()->getSourceRange();
5983 LTy = LHS.
get()->getType();
5984 }
else if (HaveR2L) {
5987 RTy = RHS.
get()->getType();
6009 ReferenceConversions::Qualification |
6010 ReferenceConversions::NestedQualification |
6016 !(RefConv & ~AllowedConversions) &&
6019 !RHS.
get()->refersToBitField() && !RHS.
get()->refersToVectorElement()) {
6021 RTy = RHS.
get()->getType();
6024 !(RefConv & ~AllowedConversions) &&
6025 !LHS.
get()->refersToBitField() &&
6026 !LHS.
get()->refersToVectorElement()) {
6028 LTy = LHS.
get()->getType();
6040 if (Same && LVK == RVK && LVK !=
VK_RValue &&
6041 LHS.
get()->isOrdinaryOrBitFieldObject() &&
6042 RHS.
get()->isOrdinaryOrBitFieldObject()) {
6043 VK = LHS.
get()->getValueKind();
6050 if (LTy->isFunctionPointerType() || LTy->isMemberFunctionPointerType()) {
6056 assert(!LTy.isNull() &&
"failed to find composite pointer type for " 6057 "canonically equivalent function ptr types");
6067 if (!Same && (LTy->isRecordType() || RTy->
isRecordType())) {
6082 LTy = LHS.
get()->getType();
6083 RTy = RHS.get()->getType();
6092 if (LTy->isRecordType()) {
6114 if (LTy->isFunctionPointerType() || LTy->isMemberFunctionPointerType()) {
6116 assert(!LTy.isNull() &&
"failed to find composite pointer type for " 6117 "canonically equivalent function ptr types");
6139 diag::err_typecheck_cond_incompatible_operands) << LTy << RTy
6140 << LHS.
get()->getSourceRange() << RHS.get()->getSourceRange();
6175 Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands)
6176 << LHS.
get()->getType() << RHS.get()->getType()
6177 << LHS.
get()->getSourceRange() << RHS.get()->getSourceRange();
6213 "computing composite pointer type of dependent types");
6228 llvm_unreachable(
"handled above");
6233 assert(EST2 ==
EST_Dynamic &&
"other cases should already be handled");
6234 llvm::SmallPtrSet<QualType, 8> Found;
6238 ExceptionTypeStorage.push_back(E);
6248 llvm_unreachable(
"shouldn't see unresolved exception specifications here");
6251 llvm_unreachable(
"invalid ExceptionSpecificationType");
6279 bool T2IsPointerLike = T2->isAnyPointerType() || T2->isMemberPointerType() ||
6280 T2->isNullPtrType();
6281 if (!T1IsPointerLike && !T2IsPointerLike)
6289 if (T1IsPointerLike &&
6293 ? CK_NullToMemberPointer
6294 : CK_NullToPointer).
get();
6297 if (T2IsPointerLike &&
6301 ? CK_NullToMemberPointer
6302 : CK_NullToPointer).
get();
6307 if (!T1IsPointerLike || !T2IsPointerLike)
6310 "nullptr_t should be a null pointer constant");
6313 enum Kind {
Pointer, ObjCPointer, MemberPointer, Array } K;
6318 const Type *ClassOrBound;
6321 : K(K), Quals(), ClassOrBound(ClassOrBound) {}
6332 if (
auto *CAT = cast_or_null<ConstantArrayType>(ClassOrBound))
6338 llvm_unreachable(
"unknown step kind");
6360 unsigned NeedConstBefore = 0;
6369 if (!Steps.empty()) {
6373 Q2.getCVRUQualifiers());
6377 if (Q1.getAddressSpace() == Q2.getAddressSpace()) {
6379 }
else if (Steps.size() == 1) {
6380 bool MaybeQ1 = Q1.isAddressSpaceSupersetOf(Q2);
6381 bool MaybeQ2 = Q2.isAddressSpaceSupersetOf(Q1);
6382 if (MaybeQ1 == MaybeQ2)
6385 : Q2.getAddressSpace());
6391 if (Q1.getObjCGCAttr() == Q2.getObjCGCAttr())
6397 if (Q1.getObjCLifetime() == Q2.getObjCLifetime())
6402 Steps.back().Quals = Quals;
6403 if (Q1 != Quals || Q2 != Quals)
6404 NeedConstBefore = Steps.size() - 1;
6413 Steps.emplace_back(Step::Pointer);
6422 Steps.emplace_back(Step::ObjCPointer);
6441 const Type *Class =
nullptr;
6446 else if (Steps.empty())
6452 Steps.emplace_back(Step::MemberPointer, Class);
6464 Steps.emplace_back(Step::Pointer);
6504 if (Steps.size() == 1) {
6520 ExceptionTypeStorage);
6523 FPT1->getParamTypes(), EPI1);
6525 FPT2->getParamTypes(), EPI2);
6531 if (Steps.size() == 1 && Steps.front().K == Step::Pointer &&
6537 Composite2 = Composite1;
6539 Composite1 = Composite2;
6548 Composite1 = Composite2;
6550 Composite2 = Composite1;
6560 for (
unsigned I = 0; I != NeedConstBefore; ++I)
6561 Steps[I].Quals.addConst();
6565 for (
auto &S : llvm::reverse(Steps))
6566 Composite = S.rebuild(
Context, Composite);
6587 E1 = E1Result.
get();
6592 E2 = E2Result.
get();
6602 assert(!isa<CXXBindTemporaryExpr>(E) &&
"Double-bound temporary?");
6613 bool ReturnsRetained;
6617 if (
CallExpr *Call = dyn_cast<CallExpr>(E)) {
6618 Expr *Callee = Call->getCallee()->IgnoreParens();
6624 T = BinOp->getRHS()->getType();
6625 else if (
MemberExpr *Mem = dyn_cast<MemberExpr>(Callee))
6626 T = Mem->getMemberDecl()->getType();
6637 assert(FTy &&
"call to value not of function type?");
6642 }
else if (isa<StmtExpr>(E)) {
6643 ReturnsRetained =
true;
6647 }
else if (isa<CastExpr>(E) &&
6648 isa<BlockExpr>(cast<CastExpr>(E)->getSubExpr())) {
6657 D = Send->getMethodDecl();
6658 }
else if (
ObjCBoxedExpr *BoxedExpr = dyn_cast<ObjCBoxedExpr>(E)) {
6659 D = BoxedExpr->getBoxingMethod();
6663 if (ArrayLit->getNumElements() == 0 &&
6667 D = ArrayLit->getArrayWithObjectsMethod();
6669 = dyn_cast<ObjCDictionaryLiteral>(E)) {
6672 if (DictLit->getNumElements() == 0 &&
6676 D = DictLit->getDictWithObjectsMethod();
6679 ReturnsRetained = (D && D->
hasAttr<NSReturnsRetainedAttr>());
6684 if (!ReturnsRetained &&
6695 CastKind ck = (ReturnsRetained ? CK_ARCConsumeObject
6696 : CK_ARCReclaimReturnedObject);
6711 RT = cast<RecordType>(T);
6713 case Type::ConstantArray:
6714 case Type::IncompleteArray:
6715 case Type::VariableArray:
6716 case Type::DependentSizedArray:
6717 T = cast<ArrayType>(T)->getElementType().getTypePtr();
6737 PDiag(diag::err_access_dtor_temp)
6768 assert(SubExpr &&
"subexpression can't be null!");
6790 assert(SubStmt &&
"sub-statement can't be null!");
6815 "not in a decltype expression");
6818 if (Result.isInvalid())
6832 if (
ParenExpr *PE = dyn_cast<ParenExpr>(E)) {
6836 if (SubExpr.
get() == PE->getSubExpr())
6841 if (BO->getOpcode() == BO_Comma) {
6845 if (RHS.
get() == BO->getRHS())
6848 BO->getLHS(), RHS.
get(), BO_Comma, BO->getType(), BO->getValueKind(),
6849 BO->getObjectKind(), BO->getOperatorLoc(), BO->getFPFeatures());
6866 if (Result.isInvalid())
6876 for (
unsigned I = 0, N =
ExprEvalContexts.back().DelayedDecltypeCalls.size();
6879 if (Call == TopCall)
6889 for (
unsigned I = 0, N =
ExprEvalContexts.back().DelayedDecltypeBinds.size();
6893 if (Bind == TopBind)
6905 PDiag(diag::err_access_dtor_temp)
6921 unsigned SkipStart = OperatorArrows.size(), SkipCount = 0;
6924 if (OperatorArrows.size() > Limit) {
6926 SkipStart = (Limit - 1) / 2 + (Limit - 1) % 2;
6927 SkipCount = OperatorArrows.size() - (Limit - 1);
6930 for (
unsigned I = 0; I < OperatorArrows.size(); ) {
6931 if (I == SkipStart) {
6932 S.
Diag(OperatorArrows[I]->getLocation(),
6933 diag::note_operator_arrows_suppressed)
6937 S.
Diag(OperatorArrows[I]->getLocation(), diag::note_operator_arrow_here)
6938 << OperatorArrows[I]->getCallResultType();
6948 bool &MayBePseudoDestructor) {
6952 Base = Result.
get();
6956 Base = Result.
get();
6959 MayBePseudoDestructor =
false;
6964 if (OpKind == tok::arrow)
6969 MayBePseudoDestructor =
true;
6976 if (OpKind == tok::arrow) {
6978 bool NoArrowOperatorFound =
false;
6979 bool FirstIteration =
true;
6982 llvm::SmallPtrSet<CanQualType,8> CTypes;
6987 if (OperatorArrows.size() >=
getLangOpts().ArrowDepth) {
6988 Diag(OpLoc, diag::err_operator_arrow_depth_exceeded)
6991 Diag(OpLoc, diag::note_operator_arrow_depth)
7004 : &NoArrowOperatorFound);
7006 if (NoArrowOperatorFound) {
7007 if (FirstIteration) {
7008 Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
7011 OpKind = tok::period;
7014 Diag(OpLoc, diag::err_typecheck_member_reference_arrow)
7019 diag::note_member_reference_arrow_from_operator_arrow);
7024 Base = Result.
get();
7026 OperatorArrows.push_back(OpCall->getDirectCallee());
7029 if (!CTypes.insert(CBaseType).second) {
7030 Diag(OpLoc, diag::err_operator_arrow_circular) << StartingType;
7034 FirstIteration =
false;
7037 if (OpKind == tok::arrow) {
7041 BaseType = AT->getElementType();
7063 MayBePseudoDestructor =
true;
7091 Base = result.
get();
7101 if (OpKind == tok::arrow) {
7106 S.
Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
7107 << ObjectType <<
true 7112 OpKind = tok::period;
7126 if (RD->hasDefinition())
7148 if (
CheckArrow(*
this, ObjectType, Base, OpKind, OpLoc))
7156 Diag(OpLoc, diag::err_pseudo_dtor_base_not_scalar)
7165 if (DestructedTypeInfo) {
7178 Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
7183 *
this, DestructedType))
7188 ObjectType = DestructedType;
7189 OpKind = tok::arrow;
7191 Diag(DestructedTypeStart, diag::err_pseudo_dtor_type_mismatch)
7196 DestructedType = ObjectType;
7197 DestructedTypeInfo =
7208 Diag(DestructedTypeStart, diag::err_arc_pseudo_dtor_inconstant_quals)
7214 DestructedType = ObjectType;
7216 DestructedTypeStart);
7229 if (ScopeTypeInfo) {
7235 diag::err_pseudo_dtor_type_mismatch)
7240 ScopeTypeInfo =
nullptr;
7246 OpKind == tok::arrow, OpLoc,
7266 "Invalid first type name in pseudo-destructor");
7269 "Invalid second type name in pseudo-destructor");
7272 if (
CheckArrow(*
this, ObjectType, Base, OpKind, OpLoc))
7293 S, &SS,
true,
false, ObjectTypePtrForLookup,
7306 diag::err_pseudo_dtor_destructor_non_type)
7312 DestructedType = ObjectType;
7330 if (T.isInvalid() || !T.get()) {
7332 DestructedType = ObjectType;
7339 if (!DestructedType.
isNull()) {
7340 if (!DestructedTypeInfo)
7354 S, &SS,
true,
false, ObjectTypePtrForLookup,
7358 diag::err_pseudo_dtor_destructor_non_type)
7383 if (T.isInvalid() || !T.get()) {
7391 if (!ScopeType.
isNull() && !ScopeTypeInfo)
7397 ScopeTypeInfo, CCLoc, TildeLoc,
7407 if (
CheckArrow(*
this, ObjectType, Base, OpKind, OpLoc))
7426 bool HadMultipleCandidates) {
7444 SubE = BE->getSubExpr();
7445 if (isa<LambdaExpr>(SubE)) {
7455 Exp.
get()->getExprLoc(), Exp.
get()->getExprLoc(), Method, Exp.
get());
7459 Diag(Exp.
get()->getExprLoc(), diag::note_lambda_to_block_conv);
7473 ResultType = ResultType.getNonLValueExprType(
Context);
7476 Context, ME, {}, ResultType, VK, Exp.
get()->getEndLoc());
7478 if (CheckFunctionCall(Method, CE,
7503 Diag(Operand->
getExprLoc(), diag::warn_side_effects_unevaluated_context);
7525 if (isa<DeclRefExpr>(E))
7529 if (isa<ArraySubscriptExpr>(E))
7533 if (isa<MemberExpr>(E))
7538 if (UO->getOpcode() == UO_Deref)
7543 if (BO->isPtrMemOp())
7547 if (BO->getOpcode() == BO_Comma)
7558 dyn_cast<BinaryConditionalOperator>(E)) {
7559 if (
OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(BCO->getTrueExpr()))
7565 if (isa<PseudoObjectExpr>(E) || isa<ObjCIvarRefExpr>(E))
7628 if (!T->getDecl()->isComplete()) {
7642 diag::err_incomplete_type);
7668 if (isa<ParmVarDecl>(Var))
return true;
7669 const VarDecl *DefVD =
nullptr;
7674 if (DefVD->
isWeak())
return false;
7703 while (DC && isa<CapturedDecl>(DC))
7707 "The current call operator must be synchronized with Sema's CurContext");
7728 !IsFullExprInstantiationDependent)
7738 const bool IsVarNeverAConstantExpression =
7740 if (!IsFullExprInstantiationDependent || IsVarNeverAConstantExpression) {
7752 DeclRefType,
nullptr)) {
7758 DeclRefType,
nullptr);
7770 const unsigned FunctionScopeIndexOfCapturableLambda = Index.getValue();
7773 &FunctionScopeIndexOfCapturableLambda);
7796 R.setLookupName(ND->getDeclName());
7798 if (ND->isCXXClassMember()) {
7802 Record = NNS->getAsType()->getAsCXXRecordDecl();
7805 dyn_cast<
CXXRecordDecl>(ND->getDeclContext()->getRedeclContext());
7807 R.setNamingClass(Record);
7811 bool MightBeImplicitMember;
7813 MightBeImplicitMember =
true;
7815 MightBeImplicitMember =
false;
7816 else if (R.isOverloadedResult())
7817 MightBeImplicitMember =
false;
7818 else if (R.isUnresolvableResult())
7819 MightBeImplicitMember =
true;
7821 MightBeImplicitMember = isa<FieldDecl>(ND) ||
7822 isa<IndirectFieldDecl>(ND) ||
7823 isa<MSPropertyDecl>(ND);
7825 if (MightBeImplicitMember)
7829 }
else if (
auto *Ivar = dyn_cast<ObjCIvarDecl>(ND)) {
7831 Ivar->getIdentifier());
7847 TypoExprs.insert(TE);
7852 class TransformTypos :
public TreeTransform<TransformTypos> {
7857 llvm::function_ref<ExprResult(Expr *)> ExprFilter;
7859 llvm::SmallDenseMap<TypoExpr *, ExprResult, 2> TransformCache;
7860 llvm::SmallDenseMap<OverloadExpr *, Expr *, 4> OverloadResolution;
7872 void EmitAllDiagnostics(
bool IsAmbiguous) {
7874 auto &
State = SemaRef.getTypoExprState(TE);
7875 if (
State.DiagHandler) {
7886 Replacement.
isInvalid() ? nullptr : Replacement.
get()))
7889 State.DiagHandler(TC);
7891 SemaRef.clearDelayedTypo(TE);
7904 bool CheckAndAdvanceTypoExprCorrectionStreams() {
7905 for (
auto TE : TypoExprs) {
7906 auto &
State = SemaRef.getTypoExprState(TE);
7907 TransformCache.erase(TE);
7908 if (!
State.Consumer->finished())
7910 State.Consumer->resetCorrectionStream();
7916 if (
auto *OE = dyn_cast_or_null<OverloadExpr>(E))
7917 E = OverloadResolution[OE];
7921 if (
auto *DRE = dyn_cast<DeclRefExpr>(E))
7922 return DRE->getFoundDecl();
7923 if (
auto *ME = dyn_cast<MemberExpr>(E))
7937 return ExprFilter(Res.
get());
7951 auto SavedTypoExprs = std::move(TypoExprs);
7952 auto SavedAmbiguousTypoExprs = std::move(AmbiguousTypoExprs);
7954 AmbiguousTypoExprs.clear();
7956 FindTypoExprs(TypoExprs).TraverseStmt(FixedExpr);
7957 if (!TypoExprs.empty()) {
7961 RecursiveTransformLoop(FixedExpr, IsAmbiguous);
7969 auto &SemaTypoExprs = SemaRef.TypoExprs;
7970 for (
auto TE : TypoExprs) {
7971 TransformCache.erase(TE);
7972 SemaRef.clearDelayedTypo(TE);
7974 auto SI = find(SemaTypoExprs, TE);
7975 if (SI != SemaTypoExprs.end()) {
7976 SemaTypoExprs.erase(SI);
7983 SavedTypoExprs.set_union(TypoExprs);
7987 TypoExprs = std::move(SavedTypoExprs);
7988 AmbiguousTypoExprs = std::move(SavedAmbiguousTypoExprs);
8000 auto SavedTypoExprs = std::move(SemaRef.TypoExprs);
8001 SemaRef.TypoExprs.clear();
8004 Res = CheckForRecursiveTypos(TryTransform(E), IsAmbiguous);
8018 if (!CheckAndAdvanceTypoExprCorrectionStreams())
8023 if (!IsAmbiguous && !Res.
isInvalid() && !AmbiguousTypoExprs.empty()) {
8024 auto SavedTransformCache =
8025 llvm::SmallDenseMap<TypoExpr *, ExprResult, 2>(TransformCache);
8029 while (!AmbiguousTypoExprs.empty()) {
8030 auto TE = AmbiguousTypoExprs.back();
8034 SemaRef.getTypoExprState(TE).Consumer->saveCurrentPosition();
8036 TypoCorrection TC = SemaRef.getTypoExprState(TE).Consumer->peekNextCorrection();
8042 TransformCache.erase(TE);
8043 ExprResult AmbigRes = CheckForRecursiveTypos(TryTransform(E), IsAmbiguous);
8045 if (!AmbigRes.
isInvalid() || IsAmbiguous) {
8046 SemaRef.getTypoExprState(TE).Consumer->resetCorrectionStream();
8047 SavedTransformCache.erase(TE);
8052 }
while ((Next = SemaRef.getTypoExprState(TE).Consumer->peekNextCorrection()) &&
8058 AmbiguousTypoExprs.remove(TE);
8059 SemaRef.getTypoExprState(TE).Consumer->restoreSavedPosition();
8061 TransformCache = std::move(SavedTransformCache);
8068 auto &SemaTypoExprs = SemaRef.TypoExprs;
8069 for (
auto Iterator = SemaTypoExprs.begin(); Iterator != SemaTypoExprs.end();) {
8070 auto TE = *Iterator;
8071 auto FI = find(TypoExprs, TE);
8072 if (FI != TypoExprs.end()) {
8076 SemaRef.clearDelayedTypo(TE);
8077 Iterator = SemaTypoExprs.erase(Iterator);
8079 SemaRef.TypoExprs = std::move(SavedTypoExprs);
8086 : BaseTransform(SemaRef), InitDecl(InitDecl), ExprFilter(
Filter) {}
8091 Expr *ExecConfig =
nullptr) {
8092 auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args,
8093 RParenLoc, ExecConfig);
8094 if (
auto *OE = dyn_cast<OverloadExpr>(Callee)) {
8097 if (
auto *BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall))
8098 ResultCall = BE->getSubExpr();
8099 if (
auto *CE = dyn_cast<CallExpr>(ResultCall))
8100 OverloadResolution[OE] = CE->getCallee();
8111 bool IsAmbiguous =
false;
8112 ExprResult Res = RecursiveTransformLoop(E, IsAmbiguous);
8115 FindTypoExprs(TypoExprs).TraverseStmt(E);
8117 EmitAllDiagnostics(IsAmbiguous);
8126 auto &CacheEntry = TransformCache[E];
8127 if (!TypoExprs.insert(E) && !CacheEntry.isUnset()) {
8132 assert(
State.Consumer &&
"Cannot transform a cleared TypoExpr");
8137 if (InitDecl && TC.getFoundDecl() == InitDecl)
8142 State.RecoveryHandler(SemaRef, E, TC) :
8149 if ((Next =
State.Consumer->peekNextCorrection()) &&
8151 AmbiguousTypoExprs.insert(E);
8153 AmbiguousTypoExprs.remove(E);
8156 "Typo was transformed into a valid-but-null ExprResult");
8157 return CacheEntry =
NE;
8174 auto TyposResolved = DelayedTypos.size();
8175 auto Result = TransformTypos(*
this, InitDecl,
Filter).Transform(E);
8176 TyposResolved -= DelayedTypos.size();
8181 assert(TyposResolved == 0 &&
"Corrected typo but got same Expr back?");
8187 bool DiscardedValue,
8191 if (!FullExpr.
get())
8197 if (DiscardedValue) {
8218 if (FullExpr.isInvalid())
8221 CheckCompletedExpr(FullExpr.get(), CC, IsConstexpr);
8270 while (DC && isa<CapturedDecl>(DC))
8273 if (IsInLambdaDeclContext && CurrentLSI &&
8274 CurrentLSI->hasPotentialCaptures() && !FullExpr.isInvalid())
8318 llvm_unreachable(
"Invalid LookupResult Kind!");
8346 assert(((!TypeName && TemplateId) || (TypeName && !TemplateId)) &&
8347 "Exactly one of TypeName and TemplateId must be specified.");
8352 NameLoc, &TSI,
false);
8413 E,
false, NoexceptLoc,
8441 for (
unsigned I = 0; I < TPL->
getDepth(); ++I)
8444 cast<TemplateTypeParmDecl>(TPL->
getParam(0))->getTypeConstraint()
8445 ->getImmediatelyDeclaredConstraint();
8448 "Substitution cannot fail as it is simply putting a type template " 8449 "argument into a concept specialization expression's parameter.");
8451 SubstitutedConstraintExpr =
8452 cast<ConceptSpecializationExpr>(Constraint.
get());
8453 if (!SubstitutedConstraintExpr->isSatisfied())
8457 ReturnTypeRequirement, Status,
8458 SubstitutedConstraintExpr);
8467 IsSimple, NoexceptLoc,
8468 ReturnTypeRequirement);
8515 if (Param->hasDefaultArg())
8519 Diag(Param->getDefaultArgRange().getBegin(),
8520 diag::err_requires_expr_local_parameter_default_argument);
8523 Param->setDeclContext(Body);
8525 if (Param->getIdentifier()) {
8534 assert(
CurContext &&
"DeclContext imbalance!");
8536 assert(
CurContext &&
"Popped translation unit!");
8546 Requirements, ClosingBraceLoc);
static bool CheckArrow(Sema &S, QualType &ObjectType, Expr *&Base, tok::TokenKind &OpKind, SourceLocation OpLoc)
A call to an overloaded operator written using operator syntax.
Function pointer conversion (C++17 [conv.fctptr])
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.
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
void diagnoseUnavailableAlignedAllocation(const FunctionDecl &FD, SourceLocation Loc)
Produce diagnostics if FD is an aligned allocation or deallocation function that is unavailable...
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 binary type trait support pseudo-functions.
The null pointer literal (C++11 [lex.nullptr])
void clearPotentialCaptures()
static const char * getPlatformName(Darwin::DarwinPlatformKind Platform, Darwin::DarwinEnvironmentKind Environment)
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
void setImplicit(bool I=true)
Represents a function declaration or definition.
void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, const LookupResult &R)
Diagnose variable or built-in function shadowing.
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 Qualifiers fromCVRUMask(unsigned CVRU)
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 ...
Expr * getInit() const
Get the initializer.
bool Cast(InterpState &S, CodePtr OpPC)
static bool EvaluateExpressionTrait(ExpressionTrait ET, Expr *E)
SourceRange getCorrectionRange() const
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
no exception specification
QualType getObjCIdType() const
Represents the Objective-CC id type.
SourceLocation getLastQualifierNameLoc() const
Retrieve the location of the name in the last qualifier in this nested name specifier.
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, ExpressionEvaluationContextRecord::ExpressionKind Type=ExpressionEvaluationContextRecord::EK_Other)
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
Stores the type being destroyed by a pseudo-destructor expression.
A (possibly-)qualified type.
bool isBlockPointerType() const
This is a scope that corresponds to the parameters within a function prototype.
Simple class containing the result of Sema::CorrectTypo.
static bool IsSpecialDiscardedValue(Expr *E)
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
bool isMemberPointerType() const
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
ConditionResult ActOnConditionVariable(Decl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id)
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
static InitializedEntity InitializeException(SourceLocation ThrowLoc, QualType Type, bool NRVO)
Create the initialization entity for an exception object.
bool isUnavailableAlignedAllocationFunction(const FunctionDecl &FD) const
Determine whether FD is an aligned allocation or deallocation function that is unavailable.
SourceLocation StartLocation
The location of the first token that describes this unqualified-id, which will be the location of the...
A requires-expression requirement which queries the validity and properties of an expression ('simple...
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
bool isMemberDataPointerType() const
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...
IdentifierInfo * Name
FIXME: Temporarily stores the name of a specialization.
void setLookupName(DeclarationName Name)
Sets the name to look up.
SourceLocation TemplateNameLoc
TemplateNameLoc - The location of the template name within the source.
static ConditionResult ConditionError()
QualType CXXThisTypeOverride
When non-NULL, the C++ 'this' expression is allowed despite the current context not being a non-stati...
bool isArithmeticType() const
Stmt - This represents one statement.
IdentifierInfo * Identifier
When Kind == IK_Identifier, the parsed identifier, or when Kind == IK_UserLiteralId, the identifier suffix.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
bool isGenericLambdaCallOperatorSpecialization(const CXXMethodDecl *MD)
FunctionType - C99 6.7.5.3 - Function Declarators.
FullExprArg MakeFullExpr(Expr *Arg)
Provides information about an attempted template argument deduction, whose success or failure was des...
ARCConversionResult CheckObjCConversion(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 for ARC ...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
Microsoft __if_not_exists.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
bool isRealFloatingType() const
Floating point categories.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
QualType getThisType() const
Return the type of the this pointer.
void addConst()
Add the const type qualifier to this QualType.
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
Complex conversions (C99 6.3.1.6)
void setObjCLifetime(ObjCLifetime type)
bool isRecordType() const
unsigned getTypeAlignIfKnown(QualType T) const
Return the ABI-specified alignment of a type, in bits, or 0 if the type is incomplete and we cannot d...
bool isEmpty() const
No scope specifier.
static InitializedEntity InitializeParameter(ASTContext &Context, const ParmVarDecl *Parm)
Create the initialization entity for a parameter.
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, Optional< unsigned > NumExpanded=None)
UserDefinedConversionSequence UserDefined
When ConversionKind == UserDefinedConversion, provides the details of the user-defined conversion seq...
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
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.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
bool hasIrrelevantDestructor() const
Determine whether this class has a destructor which has no semantic effect.
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...
Decl - This represents one declaration (or definition), e.g.
bool isVariadic() const
Whether this function prototype is variadic.
ExprResult ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation LParen, Expr *Operand, SourceLocation RParen)
bool isExtVectorType() const
concepts::Requirement * ActOnNestedRequirement(Expr *Constraint)
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.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
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...
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
ExprResult BuildBlockForLambdaConversion(SourceLocation CurrentLocation, SourceLocation ConvLocation, CXXConversionDecl *Conv, Expr *Src)
ParenExpr - This represents a parethesized expression, e.g.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
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.
const RecordDecl * getParent() const
Returns the parent of this field declaration, which is the struct in which this field is defined...
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
The base class of the type hierarchy.
concepts::Requirement * ActOnTypeRequirement(SourceLocation TypenameKWLoc, CXXScopeSpec &SS, SourceLocation NameLoc, IdentifierInfo *TypeName, TemplateIdAnnotation *TemplateId)
This indicates that the scope corresponds to a function, which means that labels are set here...
unsigned IncompatibleObjC
IncompatibleObjC - Whether this is an Objective-C conversion that we should warn about (if we actuall...
void setObjCGCAttr(GC type)
One instance of this struct is used for each type in a declarator that is parsed. ...
Represents an array type, per C99 6.7.5.2 - Array Declarators.
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 ...
static RequiresExpr * Create(ASTContext &C, SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, ArrayRef< ParmVarDecl *> LocalParameters, ArrayRef< concepts::Requirement *> Requirements, SourceLocation RBraceLoc)
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...
SourceLocation getEndLoc() const LLVM_READONLY
Ambiguous candidates found.
NamedDecl * getParam(unsigned Idx)
QualType withConst() const
Incompatible - We reject this conversion outright, it is invalid to represent it in the AST...
const TargetInfo & getTargetInfo() const
A container of type source information.
static bool evaluateTypeTrait(Sema &S, TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo *> Args, SourceLocation RParenLoc)
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
QualType getLogicalOperationType() const
The result type of logical operations, '<', '>', '!=', etc.
capture_const_range captures() const
Conversions between compatible types in C99.
constexpr XRayInstrMask Function
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, ConstexprSpecKind ConstexprKind=CSK_unspecified, Expr *TrailingRequiresClause=nullptr)
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
bool isDefined(const FunctionDecl *&Definition) const
Returns true if the function has a definition that does not need to be instantiated.
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.
const Expr * getAnyInitializer() const
Get the initializer for this variable, no matter which declaration it is attached to...
QualType getConversionType() const
Returns the type that this conversion function is converting to.
Represents a C++ constructor within a class.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
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)
bool isVariableExprMarkedAsNonODRUsed(Expr *CapturingVarExpr) const
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
size_t param_size() const
static InitializedEntity InitializeTemporary(QualType Type)
Create the initialization entity for a temporary.
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
bool isTrivialType(const ASTContext &Context) const
Return true if this is a trivial type per (C++0x [basic.types]p9)
An identifier, stored as an IdentifierInfo*.
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
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.
Represents a variable declaration or definition.
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
bool isStructureType() const
bool hasPotentialThisCapture() const
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.
CleanupInfo Cleanup
Used to control the generation of ExprWithCleanups.
DeclarationName getLookupName() const
Gets the name to look up.
Information about one declarator, including the parsed type information and the identifier.
QualType getReturnType() const
DiagnosticsEngine & Diags
static QualType adjustCVQualifiersForCXXThisWithinLambda(ArrayRef< FunctionScopeInfo *> FunctionScopes, QualType ThisTy, DeclContext *CurSemaContext, ASTContext &ASTCtx)
unsigned getNumParams() const
bool isEnumeralType() const
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
const T * getAs() const
Member-template getAs<specific type>'.
bool isDirectReferenceBinding() const
Determine whether this initialization is a direct reference binding (C++ [dcl.init.ref]).
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
bool This(InterpState &S, CodePtr OpPC)
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())
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
static bool hasNewExtendedAlignment(Sema &S, QualType AllocType)
Determine whether a type has new-extended alignment.
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.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
NestedNameSpecifier * getCorrectionSpecifier() const
Gets the NestedNameSpecifier needed to use the typo correction.
A namespace, stored as a NamespaceDecl*.
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 ...
bool HadMultipleCandidates
HadMultipleCandidates - When this is true, it means that the conversion function was resolved from an...
bool isInvalidDecl() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
static InitializationKind CreateDirectList(SourceLocation InitLoc)
ReferenceCompareResult CompareReferenceRelationship(SourceLocation Loc, QualType T1, QualType T2, ReferenceConversions *Conv=nullptr)
CompareReferenceRelationship - Compare the two types T1 and T2 to determine whether they are referenc...
concepts::TypeRequirement * BuildTypeRequirement(TypeSourceInfo *Type)
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
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, bool IsClassTemplateDeductionContext=true, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type...
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)
Determine whether a given type is a class for which 'delete[]' would call a member 'operator delete[]...
Represents a parameter to a function.
Defines the clang::Expr interface and subclasses for C++ expressions.
noexcept(expression), value-dependent
bool isStandardLayoutType() const
Test if this type is a standard-layout type.
The collection of all-type qualifiers we support.
Information about a template-id annotation token.
ExprResult PerformImplicitConversion(Expr *From, QualType ToType, AssignmentAction Action, bool AllowExplicit=false)
PerformImplicitConversion - Perform an implicit conversion of the expression From to the type ToType...
ExprResult ActOnRequiresExpr(SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, ArrayRef< ParmVarDecl *> LocalParameters, ArrayRef< concepts::Requirement *> Requirements, SourceLocation ClosingBraceLoc)
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
void setCorrectionDecl(NamedDecl *CDecl)
Clears the list of NamedDecls before adding the new one.
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
static CXXUnresolvedConstructExpr * Create(const ASTContext &Context, TypeSourceInfo *Type, SourceLocation LParenLoc, ArrayRef< Expr *> Args, SourceLocation RParenLoc)
Expr * FixOverloadedFunctionReference(Expr *E, DeclAccessPair FoundDecl, FunctionDecl *Fn)
FixOverloadedFunctionReference - E is an expression that refers to a C++ overloaded function (possibl...
Represents a struct/union/class.
QualType adjustCCAndNoReturn(QualType ArgFunctionType, QualType FunctionType, bool AdjustExceptionSpec=false)
Adjust the type ArgFunctionType to match the calling convention, noreturn, and optionally the excepti...
QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
FindCompositeObjCPointerType - Helper method to find composite type of two objective-c pointer types ...
static bool ConvertForConditional(Sema &Self, ExprResult &E, QualType T)
Perform an "extended" implicit conversion as returned by TryClassUnification.
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, AllocationFunctionScope NewScope, AllocationFunctionScope DeleteScope, QualType AllocType, bool IsArray, bool &PassAlignment, MultiExprArg PlaceArgs, FunctionDecl *&OperatorNew, FunctionDecl *&OperatorDelete, bool Diagnose=true)
Finds the overloads of operator new and delete that are appropriate for the allocation.
TemplateIdAnnotation * TemplateId
When Kind == IK_TemplateId or IK_ConstructorTemplateId, the template-id annotation that contains the ...
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Boolean conversions (C++ [conv.bool])
FunctionType::ExtInfo ExtInfo
Represents a class template specialization, which refers to a class template with a given set of temp...
One of these records is kept for each identifier that is lexed.
void setIntegerType(QualType T)
Set the underlying integer type.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
void visitPotentialCaptures(llvm::function_ref< void(VarDecl *, Expr *)> Callback) const
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name)
Retrieves the declaration name from a parsed unqualified-id.
void DiagnoseUnusedExprResult(const Stmt *S)
DiagnoseUnusedExprResult - If the statement passed in is an expression whose result is unused...
bool isNothrow(bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
Represents a class type in Objective C.
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.
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
Represents a dependent template name that cannot be resolved prior to template instantiation.
The results of name lookup within a DeclContext.
SourceLocation getTypeSpecTypeLoc() const
bool allowsNonTrivialObjCLifetimeQualifiers() const
True if any ObjC types may have non-trivial lifetime qualifiers.
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
FullExpr - Represents a "full-expression" node.
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
QualType getLifetimeQualifiedType(QualType type, Qualifiers::ObjCLifetime lifetime)
Return a type with the given lifetime qualifier.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
SourceLocation getBeginLoc() const LLVM_READONLY
Represents a member of a struct/union/class.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
The current expression is potentially evaluated at run time, which means that code may be generated t...
Identity conversion (no conversion)
unsigned getNewAlign() const
Return the largest alignment for which a suitably-sized allocation with '::operator new(size_t)' is g...
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible...
bool isAbstractType(SourceLocation Loc, QualType T)
const DeclarationNameInfo & getLookupNameInfo() const
Gets the name info to look up.
bool hasAutoTypeSpec() const
Floating point conversions (C++ [conv.double].
bool isReferenceType() const
CXXRecordDecl * getStdBadAlloc() const
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
bool hasTrivialMoveAssignment() const
Determine whether this class has a trivial move assignment operator (C++11 [class.copy]p25)
The iterator over UnresolvedSets.
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)
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
static bool resolveAllocationOverload(Sema &S, LookupResult &R, SourceRange Range, SmallVectorImpl< Expr *> &Args, bool &PassAlignment, FunctionDecl *&Operator, OverloadCandidateSet *AlignedCandidates, Expr *AlignArg, bool Diagnose)
A conditional (?:) operator.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
LookupResultKind getResultKind() const
ParsedType getDestructorName(SourceLocation TildeLoc, IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
SourceLocation getBeginLoc() const LLVM_READONLY
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose=true)
DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
void PopExpressionEvaluationContext()
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
A user-defined literal name, e.g., operator "" _i.
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.
bool isInvalidType() const
bool isDependentName() const
Determines whether the name itself is dependent, e.g., because it involves a C++ type that is itself ...
bool getProducesResult() const
DeclClass * getAsSingle() const
Floating point promotions (C++ [conv.fpprom])
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
bool isReplaceableGlobalAllocationFunction(bool *IsAligned=nullptr) const
Determines whether this function is one of the replaceable global allocation functions: void *operato...
Describes an C or C++ initializer list.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
DeduceAutoResult DeduceAutoType(TypeSourceInfo *AutoType, Expr *&Initializer, QualType &Result, Optional< unsigned > DependentDeductionDepth=None, bool IgnoreConstraints=false)
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 CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid)
Determine whether the use of this declaration is valid, without emitting diagnostics.
bool isCompleteType(SourceLocation Loc, QualType T)
ReferenceConversions
The conversions that would be performed on an lvalue of type T2 when binding a reference of type T1 t...
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
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.
An lvalue ref-qualifier was provided (&).
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
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...
CharUnits - This is an opaque type for sizes expressed in character units.
bool isItaniumFamily() const
Does this ABI generally fall into the Itanium family of ABIs?
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
Microsoft throw(...) extension.
Succeeded, but refers to a deleted function.
bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E)
CheckCXXThrowOperand - Validate the operand of a throw.
Ref_Compatible - The two types are reference-compatible.
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
CanThrowResult canThrow(const Stmt *E)
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
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 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...
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
concepts::NestedRequirement * BuildNestedRequirement(Expr *E)
Represents a declaration of a type.
A builtin binary operation expression such as "x + y" or "x <= y".
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
static CompoundStmt * Create(const ASTContext &C, ArrayRef< Stmt *> Stmts, SourceLocation LB, SourceLocation RB)
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.
QualType getExceptionObjectType(QualType T) const
A conversion for an operand of a builtin overloaded operator.
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.
const Type * getClass() const
bool isRValueReferenceType() const
CheckedConversionKind
The kind of conversion being performed.
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)
bool isLambda() const
Determine whether this class describes a lambda function object.
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...
QualType getCVRQualifiedType(QualType T, unsigned CVR) const
Return a type with additional const, volatile, or restrict qualifiers.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
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++ [conv.qual])
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)
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...
ExprResult CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond)
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...
const LangOptions & getLangOpts() const
static FunctionProtoType::ExceptionSpecInfo mergeExceptionSpecs(Sema &S, FunctionProtoType::ExceptionSpecInfo ESI1, FunctionProtoType::ExceptionSpecInfo ESI2, SmallVectorImpl< QualType > &ExceptionTypeStorage)
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'.
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.
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
bool isScalarType() const
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 preorder or postorder depth-first traversal on the entire Clang AST and visits each...
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5...
Represents an ObjC class declaration.
FieldDecl * getMember() const
If this is a member initializer, returns the declaration of the non-static data member being initiali...
CastKind PrepareScalarCast(ExprResult &src, QualType destType)
Prepares for a scalar cast, performing all the necessary stages except the final cast and returning t...
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface...
ImplicitConversionKind Third
Third - The third conversion can be a qualification conversion or a function conversion.
bool isAbstract() const
Determine whether this class has a pure virtual function.
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
ExprResult CheckUnevaluatedOperand(Expr *E)
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
Integral promotions (C++ [conv.prom])
const LangOptions & LangOpts
bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType)
Helper function to determine whether this is the (deprecated) C++ conversion from a string literal to...
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod, bool IsBuiltin=false) const
Retrieves the default calling convention for the current target.
This object can be modified without requiring retains or releases.
SourceLocation TemplateKWLoc
TemplateKWLoc - The location of the template keyword.
Represents the this expression in C++.
C-only conversion between pointers with incompatible types.
New-expression has no initializer as written.
static InitializedEntity InitializeNew(SourceLocation NewLoc, QualType Type)
Create the initialization entity for an object allocated via new.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
TypeTrait
Names for traits that operate specifically on types.
SourceLocation LAngleLoc
The location of the '<' before the template argument list.
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
bool isAmbiguous() const
Determine whether this initialization failed due to an ambiguity.
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
unsigned getFlags() const
getFlags - Return the flags for this scope.
ConditionalOperator - The ?: ternary operator.
Sema - This implements semantic analysis and AST building for C.
NamedDecl * getFoundDecl() const
Get the correction declaration found by name lookup (before we looked through using shadow declaratio...
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
concepts::Requirement * ActOnSimpleRequirement(Expr *E)
CompoundStmt - This represents a group of statements like { stmt stmt }.
A requires-expression requirement which queries the existence of a type name or type template special...
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
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 isUsableInConstantExpressions(ASTContext &C) const
Determine whether this variable's value can be used in a constant expression, according to the releva...
static NamedDecl * getDeclFromExpr(Expr *E)
SourceLocation getBeginLoc() const LLVM_READONLY
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any...
Transparent Union Conversions.
CastKind
CastKind - The kind of operation required for a conversion.
SourceRange getLocalSourceRange() const
Get the local source range.
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat)
DeclarationNameTable DeclarationNames
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...
Defines a function that returns the minimum OS versions supporting C++17's aligned allocation functio...
void addOuterRetainedLevel()
Add an outermost level that we are not substituting.
SourceRange getRange() const
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
SourceLocation PotentialThisCaptureLocation
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.
unsigned getEditDistance(bool Normalized=true) const
Gets the "edit distance" of the typo correction from the typo.
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...
TST getTypeSpecType() const
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
bool isUsualDeallocationFunction(const CXXMethodDecl *FD)
unsigned hasStatic
True if this dimension included the 'static' keyword.
SourceLocation getBeginLoc() const
Get the begin source location.
QualType UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, ArithConvKind ACK)
UsualArithmeticConversions - Performs various conversions that are common to binary operators (C99 6...
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
QualType getElementType() const
bool isWeak() const
Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr...
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorType::VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
This represents one expression.
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.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
static ExprResult BuildCXXCastArgument(Sema &S, SourceLocation CastLoc, QualType Ty, CastKind Kind, CXXMethodDecl *Method, DeclAccessPair FoundDecl, bool HadMultipleCandidates, Expr *From)
bool isVariadic() const
Whether this function is variadic.
Represents the body of a requires-expression.
llvm::StringRef getAsString(SyncScope S)
bool isDeclScope(Decl *D)
isDeclScope - Return true if this is the scope that the specified decl is declared in...
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
unsigned getIntWidth() const
getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for this target, in bits.
bool isObjCARCImplicitlyUnretainedType() const
Determines if this type, which must satisfy isObjCLifetimeType(), is implicitly __unsafe_unretained r...
ParsedType getDestructorTypeForDecltype(const DeclSpec &DS, ParsedType ObjectType)
static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT, SourceLocation KeyLoc, QualType T)
DeclContext * getEntity() const
bool CheckConstraintSatisfaction(const NamedDecl *Template, ArrayRef< const Expr *> ConstraintExprs, ArrayRef< TemplateArgument > TemplateArgs, SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction)
Check whether the given list of constraint expressions are satisfied (as if in a 'conjunction') given...
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...
const T * castAs() const
Member-template castAs<specific type>.
bool isObjCRetainableType() const
QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, bool ConvertArgs=true)
Find a merged pointer type and convert the two expressions to it.
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Represents a C++ destructor within a class.
New-expression has a C++11 list-initializer.
static UsualDeallocFnInfo resolveDeallocationOverload(Sema &S, LookupResult &R, bool WantSize, bool WantAlign, llvm::SmallVectorImpl< UsualDeallocFnInfo > *BestFns=nullptr)
Select the correct "usual" deallocation function to use from a selection of deallocation functions (e...
const CXXScopeSpec * getSS() const
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, UnqualifiedId &SecondTypeName)
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
Defines the clang::Preprocessor interface.
bool isNullPtrType() const
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, bool AllowFold=true)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
bool isFileContext() const
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
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...
DeclContext * getDeclContext()
Overload resolution succeeded.
bool isAnyComplexType() const
bool DiagnoseAssignmentResult(AssignConvertType ConvTy, SourceLocation Loc, QualType DstType, QualType SrcType, Expr *SrcExpr, AssignmentAction Action, bool *Complained=nullptr)
DiagnoseAssignmentResult - Emit a diagnostic, if required, for the assignment conversion type specifi...
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
Represents a C++ template name within the type system.
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
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++ [conv.fpint])
UnqualifiedIdKind getKind() const
Determine what kind of name we have.
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7)...
void DiscardCleanupsInEvaluationContext()
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
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.
bool isPolymorphic() const
Whether this class is polymorphic (C++ [class.virtual]), which means that the class contains or inher...
static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT, QualType LhsT, QualType RhsT, SourceLocation KeyLoc)
bool isTypeConstraint() const
ExprResult ActOnTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< ParsedType > Args, SourceLocation RParenLoc)
Parsed one of the type trait support pseudo-functions.
TagDecl * getAsTagDecl() const
Retrieves the TagDecl that this type refers to, either because the type is a TagType or because it is...
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...
SourceLocation Loc
Loc - The place where this type was defined.
StandardConversionSequence Standard
When ConversionKind == StandardConversion, provides the details of the standard conversion sequence...
clang::ObjCRuntime ObjCRuntime
DeclContext * getParent()
getParent - Returns the containing DeclContext.
void setAddressSpace(LangAS space)
void DiagnoseAmbiguousConversion(Sema &S, SourceLocation CaretLoc, const PartialDiagnostic &PDiag) const
Diagnoses an ambiguous conversion.
static void collectPublicBases(CXXRecordDecl *RD, llvm::DenseMap< CXXRecordDecl *, unsigned > &SubobjectsSeen, llvm::SmallPtrSetImpl< CXXRecordDecl *> &VBases, llvm::SetVector< CXXRecordDecl *> &PublicSubobjectsSeen, bool ParentIsPublic)
A boolean condition, from 'if', 'while', 'for', or 'do'.
An expression that sends a message to the given Objective-C object or class.
Data structure that captures multiple levels of template argument lists for use in template instantia...
QualType getRecordType(const RecordDecl *Decl) const
SourceLocation getEnd() const
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)
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
Represents a GCC generic vector type.
static bool CanThrow(Expr *E, ASTContext &Ctx)
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.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
void CleanupVarDeclMarking()
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
static bool isValidVectorForConditionalCondition(ASTContext &Ctx, QualType CondTy)
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression.
Represents a C++ conversion function within a class.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
The result type of a method or function.
TemplateParameterList * getTypeConstraintTemplateParameterList() const
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
const Expr * getSubExpr() const
void removeLocalCVRQualifiers(unsigned Mask)
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class.copy]p25)
A type, stored as a Type*.
bool hasEmptyCollections() const
Are the empty collection symbols available?
void removeCVRQualifiers(unsigned mask)
concepts::ExprRequirement * BuildExprRequirement(Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, Optional< Expr *> ArraySize, SourceRange DirectInitRange, Expr *Initializer)
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl *> Params, SourceLocation RAngleLoc, Expr *RequiresClause)
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
SourceLocation getEndLoc() const LLVM_READONLY
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
static InitializationKind CreateCopy(SourceLocation InitLoc, SourceLocation EqualLoc, bool AllowExplicitConvs=false)
Create a copy initialization.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
ExtInfo withNoReturn(bool noReturn) const
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
Lvalue-to-rvalue conversion (C++ [conv.lval])
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
bool isVoidPointerType() const
bool isConstQualified() const
Determine whether this type is const-qualified.
RecordDecl * getDecl() const
bool Diagnose(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, ArrayRef< Expr *> Args)
Diagnose an potentially-invalid initialization sequence.
noexcept(expression), evals to 'false'
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
void EraseUnwantedCUDAMatches(const FunctionDecl *Caller, SmallVectorImpl< std::pair< DeclAccessPair, FunctionDecl *>> &Matches)
Finds a function in Matches with highest calling priority from Caller context and erases all function...
void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr *> Args, OverloadCandidateSet &CandidateSet)
AddBuiltinOperatorCandidates - Add the appropriate built-in operator overloads to the candidate set (...
QualType getWideCharType() const
Return the type of wide characters.
bool isAddressOfOperand() const
char * location_data() const
Retrieve the data associated with the source-location information.
void MarkThisReferenced(CXXThisExpr *This)
CanThrowResult
Possible results from evaluation of a noexcept expression.
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.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Integral conversions (C++ [conv.integral])
SmallVectorImpl< OverloadCandidate >::iterator iterator
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...
QualType getCanonicalType() const
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
not a target-specific vector type
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
ExceptionSpecificationType Type
The kind of exception specification this is.
ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, IdentifierInfo *II, bool AllowBuiltinCreation=false)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method...
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
LazyDeclPtr StdAlignValT
The C++ "std::align_val_t" enum class, which is defined by the C++ standard library.
ASTContext & getASTContext() const
concepts::Requirement * ActOnCompoundRequirement(Expr *E, SourceLocation NoexceptLoc)
bool hasTrivialCopyAssignment() const
Determine whether this class has a trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant...
Encodes a location in the source.
CharUnits getExnObjectAlignment() const
Return the alignment (in bytes) of the thrown exception object.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
LangAS getAddressSpace() const
Return the address space of this type.
Represents a C++ temporary.
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
CXXRecordDecl * Lambda
The class that describes the lambda.
enum clang::DeclaratorChunk::@219 Kind
CastKind getCastKind() const
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
FunctionDecl * FindUsualDeallocationFunction(SourceLocation StartLoc, bool CanProvideSize, bool Overaligned, DeclarationName Name)
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
MemberExpr * BuildMemberExpr(Expr *Base, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec *SS, SourceLocation TemplateKWLoc, ValueDecl *Member, DeclAccessPair FoundDecl, bool HadMultipleCandidates, const DeclarationNameInfo &MemberNameInfo, QualType Ty, ExprValueKind VK, ExprObjectKind OK, const TemplateArgumentListInfo *TemplateArgs=nullptr)
DeclarationName getName() const
getName - Returns the embedded declaration name.
MutableArrayRef< Expr * > MultiExprArg
Represents a call to a member function that may be written either with member call syntax (e...
QualType DeduceTemplateSpecializationFromInitializer(TypeSourceInfo *TInfo, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Init)
Requests that only tied-for-best candidates be shown.
IdentifierTable & getIdentifierTable()
A vector splat from an arithmetic type.
bool isUsualDeallocationFunction(SmallVectorImpl< const FunctionDecl *> &PreventedBy) const
Determine whether this is a usual deallocation function (C++ [basic.stc.dynamic.deallocation]p2), which is an overloaded delete or delete[] operator with a particular signature.
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs. ...
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
Represents a static or instance method of a struct/union/class.
const LookupResult & getLookupResult() const
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
const ConstantArrayType * getAsConstantArrayType(QualType T) const
ExprResult DefaultLvalueConversion(Expr *E)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
No ref-qualifier was provided.
Only look for allocation functions in the scope of the allocated class.
void setDestructor(const CXXDestructorDecl *Dtor)
Objective-C ARC writeback conversion.
const ParmVarDecl * getParamDecl(unsigned i) const
ExprResult ActOnCXXTypeConstructExpr(ParsedType TypeRep, SourceLocation LParenOrBraceLoc, MultiExprArg Exprs, SourceLocation RParenOrBraceLoc, bool ListInitialization)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
Name lookup found an unresolvable value declaration and cannot yet complete.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
static bool isCast(CheckedConversionKind CCK)
OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best)
Find the best viable function on this overload set, if it exists.
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...
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
static void getUnambiguousPublicSubobjects(CXXRecordDecl *RD, llvm::SmallVectorImpl< CXXRecordDecl *> &Objects)
Look up any declaration with any name.
AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, ExprResult &RHS)
bool isMemberFunctionPointerType() const
bool isAnyPointerType() const
bool isObjCObjectPointerType() const
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...
void MarkCaptureUsedInEnclosingContext(VarDecl *Capture, SourceLocation Loc, unsigned CapturingScopeIndex)
Pointer conversions (C++ [conv.ptr])
const TypoExprState & getTypoExprState(TypoExpr *TE) const
C++ [over.match.oper]: Lookup of operator function candidates in 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)
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after...
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language...
Requests that all candidates be shown.
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics...
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
No entity found met the criteria.
TypeClass getTypeClass() 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
Source range that this declaration covers.
The name is a dependent name, so the results will differ from one instantiation to the next...
An expression trait intrinsic.
EnumDecl * getDecl() const
RequiresExprBodyDecl * ActOnStartRequiresExpr(SourceLocation RequiresKWLoc, ArrayRef< ParmVarDecl *> LocalParameters, Scope *BodyScope)
Derived-to-base (C++ [over.best.ics])
A static requirement that can be used in a requires-expression to check properties of types and expre...
bool isVectorType() const
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;}).
ObjCBoxedExpr - used for generalized expression boxing.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13...
Constant expression in a noptr-new-declarator.
ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, Declarator &D, Expr *Initializer)
ActOnCXXNew - Parsed a C++ 'new' expression.
bool isInvalid() const
An error occurred during parsing of the scope specifier.
static bool CheckUnaryTypeTraitTypeCompleteness(Sema &S, TypeTrait UTT, SourceLocation Loc, QualType ArgTy)
Check the completeness of a type in a unary type trait.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
QualType CheckGNUVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
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 getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
TypeResult ActOnTemplateIdType(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, IdentifierInfo *TemplateII, SourceLocation TemplateIILoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false, bool IsClassName=false)
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)
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
The scope of a struct/union/class definition.
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...
Represents a template argument.
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
static const TST TST_decltype_auto
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 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)
Dataflow Directional Tag Classes.
bool isValid() const
Return true if this is a valid SourceLocation object.
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type...
ExtInfo getExtInfo() const
not evaluated yet, for special member function
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return, ArrayRef< QualType > Params)
DeclareGlobalAllocationFunction - Declares a single implicit global allocation function if it doesn't...
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
llvm::SmallVector< TypoExpr *, 2 > TypoExprs
Holds TypoExprs that are created from createDelayedTypo.
static bool isLegalArrayNewInitializer(CXXNewExpr::InitializationStyle Style, Expr *Init)
The base class of all kinds of template declarations (e.g., class, function, etc.).
static void noteOperatorArrows(Sema &S, ArrayRef< FunctionDecl *> OperatorArrows)
Note a set of 'operator->' functions that were used for a member access.
static const TST TST_decltype
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
const Scope * getParent() const
getParent - Return the scope that this is nested in.
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)
bool NE(InterpState &S, CodePtr OpPC)
SourceLocation RAngleLoc
The location of the '>' after the template argument list.
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...
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
AccessSpecifier getAccess() const
Conversions allowed in C, but not C++.
A constant boolean condition from 'if constexpr'.
void ActOnFinishRequiresExpr()
Array-to-pointer conversion (C++ [conv.array])
llvm::VersionTuple alignedAllocMinVersion(llvm::Triple::OSType OS)
TypeSourceInfo * getTypeSourceInfo() const
bool GlobalNewDeleteDeclared
A flag to remember whether the implicit forms of operator new and delete have been declared...
The name of a declaration.
StandardConversionSequence Before
Represents the standard conversion that occurs before the actual user-defined conversion.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined...
bool isBooleanType() const
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr)
Prepare SplattedExpr for a vector splat operation, adding implicit casts if necessary.
AllocationFunctionScope
The scope in which to find allocation functions.
A pointer to member type per C++ 8.3.3 - Pointers to members.
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
IdentifierResolver IdResolver
Optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
bool isAggregateType() const
Determines whether the type is a C++ aggregate type or C aggregate or union type. ...
static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)
ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...
TypeResult ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, const CXXScopeSpec &SS, const IdentifierInfo &II, SourceLocation IdLoc)
Called when the parser has parsed a C++ typename specifier, e.g., "typename T::type".
QualType getCallReturnType(const ASTContext &Ctx) const
getCallReturnType - Get the return type of the call expr.
bool exprNeedsCleanups() const
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*.
static EnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl, bool IsScoped, bool IsScopedUsingClassTag, bool IsFixed)
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.
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
bool hasCVRQualifiers() const
bool isValid() const
A scope specifier is present, and it refers to a real scope.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
llvm::MapVector< FieldDecl *, DeleteLocs > DeleteExprs
unsigned getDepth() const
Get the depth of this template parameter list in the set of template parameter lists.
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 pointer to an Objective C object.
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.
static void DiagnoseMismatchedNewDelete(Sema &SemaRef, SourceLocation DeleteLoc, const MismatchingNewDeleteDetector &Detector)
SourceLocation getBeginLoc() const
StmtResult ActOnFinishFullStmt(Stmt *Stmt)
ParsedType getConstructorName(IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, bool EnteringContext)
bool isIncompleteArrayType() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
bool cleanupsHaveSideEffects() const
Complex values, per C99 6.2.5p11.
void addThisCapture(bool isNested, SourceLocation Loc, QualType CaptureType, bool ByCopy)
The lookup is a reference to this name that is not for the purpose of redeclaring the name...
CUDAFunctionPreference IdentifyCUDAPreference(const FunctionDecl *Caller, const FunctionDecl *Callee)
Identifies relative preference of a given Caller/Callee combination, based on their host/device attri...
Represents a C++ base or member initializer.
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
Look for allocation functions in both the global scope and in the scope of the allocated class...
bool hasNonTrivialObjCLifetime() const
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)
uint64_t getCharWidth() const
Return the size of the character type, in bits.
bool ActOnTypeConstraint(const CXXScopeSpec &SS, TemplateIdAnnotation *TypeConstraint, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
bool isSubstitutionFailure() const
QualType CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, SourceLocation OpLoc, bool isIndirect)
bool isFunctionType() const
CXXThisScopeRAII(Sema &S, Decl *ContextDecl, Qualifiers CXXThisTypeQuals, bool Enabled=true)
Introduce a new scope where 'this' may be allowed (when enabled), using the given declaration (which ...
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
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
AccessResult CheckMemberOperatorAccess(SourceLocation Loc, Expr *ObjectExpr, Expr *ArgExpr, DeclAccessPair FoundDecl)
Checks access to an overloaded member operator, including conversion operators.
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr *> Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, OverloadCandidateParamOrder PO={})
Add a C++ function template specialization as a candidate in the candidate set, using template argume...
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
The template argument is a type.
ExprResult ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXTypeid - Parse typeid( something ).
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
Block Pointer conversions.
Holds information about the various types of exception specification.
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...
Sema::LookupNameKind getLookupKind() const
Gets the kind of lookup to perform.
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type...
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)
void NoteCandidates(PartialDiagnosticAt PA, Sema &S, OverloadCandidateDisplayKind OCD, ArrayRef< Expr *> Args, StringRef Opc="", SourceLocation Loc=SourceLocation(), llvm::function_ref< bool(OverloadCandidate &)> Filter=[](OverloadCandidate &) { return true;})
When overload resolution fails, prints diagnostic messages containing the candidates in the candidate...
Capture & getCXXThisCapture()
Retrieve the capture of C++ 'this', if it has been captured.
bool isObjectType() const
Determine whether this type is an object type.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
Condition in a constexpr if statement.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
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...
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.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
EnumDecl * getStdAlignValT() const
A template argument list.
bool isSet() const
Deprecated.
bool isLValueReferenceType() const
ExprResult BuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo, QualType Type, SourceLocation LParenLoc, Expr *CastExpr, SourceLocation RParenLoc)
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
void CheckUnusedVolatileAssignment(Expr *E)
Check whether E, which is either a discarded-value expression or an unevaluated operand, is a simple-assignment to a volatlie-qualified lvalue, and if so, remove it from the list of volatile-qualified assignments that we are going to warn are deprecated.
CXXRecordDecl * getNamingClass() const
Returns the 'naming class' for this lookup, i.e.
Reading or writing from this object requires a barrier call.
An integral condition for a 'switch' statement.
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
FunctionDecl * FindDeallocationFunctionForDestructor(SourceLocation StartLoc, CXXRecordDecl *RD)
static CXXMemberCallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr *> Args, QualType Ty, ExprValueKind VK, SourceLocation RP, unsigned MinNumArgs=0)
QualType getParamType(unsigned i) const
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++ [conv.array])
bool Failed() const
Determine whether the initialization sequence is invalid.
TranslationUnitDecl * getTranslationUnitDecl() const
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".
ActionResult< Expr * > ExprResult
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Only look for allocation functions in the global scope.
Represents a C++ struct/union/class.
Compatible - the types are compatible according to the standard.
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 ...
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo *> Args, SourceLocation RParenLoc)
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
static bool hasAnyTypeDependentArguments(ArrayRef< Expr *> Exprs)
hasAnyTypeDependentArguments - Determines if any of the expressions in Exprs is type-dependent.
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.
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)
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool isNotEmpty() const
A scope specifier is present, but may be valid or invalid.
QualType removeAddrSpaceQualType(QualType T) const
Remove any existing address space on the type and returns the type with qualifiers intact (or that's ...
Represents the specialization of a concept - evaluates to a prvalue of type bool. ...
bool CheckAllocatedType(QualType AllocType, SourceLocation Loc, SourceRange R)
Checks that a type is suitable as the allocated type in a new-expression.
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr *> Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, bool AllowExplicitConversion=false, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, ConversionSequenceList EarlyConversions=None, OverloadCandidateParamOrder PO={})
AddOverloadCandidate - Adds the given function to the set of candidate functions, using the given fun...
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
bool isCXXThisCaptured() const
Determine whether the C++ 'this' is captured.
Declaration of a class template.
Qualifiers::ObjCLifetime getObjCARCImplicitLifetime() const
Return the implicit lifetime for this type, which must not be dependent.
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B)
Returns true if address space A is equal to or a superset of B.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
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'.
SourceManager & getSourceManager() const
A template-id, e.g., f<int>.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
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.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type...
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
unsigned getNumElements() const
static OpaquePtr make(QualType P)
bool isFundamentalType() const
Tests whether the type is categorized as a fundamental type.
Microsoft __declspec(nothrow) extension.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
static bool canRecoverDotPseudoDestructorCallsOnPointerObjects(Sema &SemaRef, QualType DestructedType)
Check if it's ok to try and recover dot pseudo destructor calls on pointer objects.
A reference to a declared variable, function, enum, etc.
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
Represents a type template specialization; the template must be a class template, a type alias templa...
bool isDeleted() const
Whether this function has been deleted.
bool isPointerType() const
Zero constant to event (OpenCL1.2 6.12.10)
unsigned getAddressSpaceAttributePrintValue() const
Get the address space attribute value to be printed by diagnostics.
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...
No viable function found.
void suppressDiagnostics()
Suppress the diagnostics that would normally fire because of this lookup.
An l-value expression is a reference to an object with independent storage.
bool empty() const
Return true if no decls were found.
bool isFloatingType() const
A trivial tuple used to represent a source range.
SourceLocation getBeginLoc() const LLVM_READONLY
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...
This represents a decl that may have a name.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
A boolean literal, per ([C++ lex.bool] Boolean literals).
Expr * getRepAsExpr() const
bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc, CallExpr *CE, FunctionDecl *FD)
CheckCallReturnType - Checks that a call expression's return type is complete.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
No keyword precedes the qualified type name.
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
bool isInterfaceType() const
Pointer-to-member conversions (C++ [conv.mem])
SourceLocation getNameLoc() const
Gets the location of the identifier.
Describes an entity that is being initialized.
unsigned NumArgs
NumArgs - The number of template arguments.
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...
The global specifier '::'. There is no stored value.
static bool resolveBuiltinNewDeleteOverload(Sema &S, CallExpr *TheCall, bool IsDelete, FunctionDecl *&Operator)
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
static OpaquePtr getFromOpaquePtr(void *P)
SourceLocation getBegin() const
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc, TypeSourceInfo **TSI, bool DeducedTSTContext)
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
const LangOptions & getLangOpts() const
void WillReplaceSpecifier(bool ForceReplacement)
Represents the canonical version of C arrays with a specified constant size.
This scope corresponds to an Objective-C method body.
ExceptionSpecInfo ExceptionSpec
The symbol does not exist.
Declaration of a template function.
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals...
Attr - This represents one attribute.
SourceLocation getLocation() const
QualType getPointeeType() const
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
QualType getType() const
Return the type wrapped by this type source info.
bool isBeingDefined() const
Return true if this decl is currently being defined.
ParsedTemplateTy Template
The declaration of the template corresponding to the template-name.
noexcept(expression), evals to 'true'
static CXXNewExpr * Create(const ASTContext &Ctx, bool IsGlobalNew, FunctionDecl *OperatorNew, FunctionDecl *OperatorDelete, bool ShouldPassAlignment, bool UsualArrayDeleteWantsSize, ArrayRef< Expr *> PlacementArgs, SourceRange TypeIdParens, Optional< Expr *> ArraySize, InitializationStyle InitializationStyle, Expr *Initializer, QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range, SourceRange DirectInitRange)
Create a c++ new expression.
Helper class that creates diagnostics with optional template instantiation stacks.
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.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point...
QualType getIncompleteArrayType(QualType EltTy, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type...
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
Structure used to store a statement, the constant value to which it was evaluated (if any)...
bool isCompoundType() const
Tests whether the type is categorized as a compound type.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3.1.1).