38 #include "llvm/ADT/APInt.h"
39 #include "llvm/ADT/STLExtras.h"
40 #include "llvm/Support/ErrorHandling.h"
41 using namespace clang;
73 llvm_unreachable(
"Nested name specifier is not a type for inheriting ctor");
78 return CreateParsedType(Type,
87 bool EnteringContext) {
112 bool isDependent =
false;
113 bool LookInScope =
false;
122 SearchType = GetTypeFromParser(ObjectTypePtr);
127 bool AlreadySearched =
false;
128 bool LookAtPrefix =
true;
140 DeclContext *DC = computeDeclContext(SS, EnteringContext);
142 AlreadySearched =
true;
145 }
else if (DC && isa<CXXRecordDecl>(DC)) {
146 LookAtPrefix =
false;
152 if (AlreadySearched) {
154 }
else if (LookAtPrefix && (Prefix = NNS->
getPrefix())) {
157 LookupCtx = computeDeclContext(PrefixSS, EnteringContext);
158 isDependent = isDependentScopeSpecifier(PrefixSS);
159 }
else if (ObjectTypePtr) {
160 LookupCtx = computeDeclContext(SearchType);
163 LookupCtx = computeDeclContext(SS, EnteringContext);
166 }
else if (ObjectTypePtr) {
174 LookupCtx = computeDeclContext(SearchType);
177 "Caller should have completed object type");
185 TypeDecl *NonMatchingTypeDecl =
nullptr;
186 LookupResult Found(*
this, &II, NameLoc, LookupOrdinaryName);
192 if (
Step == 0 && LookupCtx) {
193 if (RequireCompleteDeclContext(SS, LookupCtx))
195 LookupQualifiedName(Found, LookupCtx);
196 }
else if (
Step == 1 && LookInScope && S) {
197 LookupName(Found, S);
208 MarkAnyDeclReferenced(
Type->getLocation(),
Type,
false);
214 return CreateParsedType(T,
219 NonMatchingTypeDecl =
Type;
231 if (
DeclContext *Ctx = computeDeclContext(SS, EnteringContext)) {
237 if (MemberOfType.
isNull())
238 MemberOfType = SearchType;
240 if (MemberOfType.
isNull())
248 = dyn_cast<ClassTemplateSpecializationDecl>(Record->getDecl())) {
249 if (Spec->getSpecializedTemplate()->getCanonicalDecl() ==
250 Template->getCanonicalDecl())
251 return CreateParsedType(
271 if (SpecTemplate->getCanonicalDecl() == Template->getCanonicalDecl())
272 return CreateParsedType(
283 if (DepTemplate->isIdentifier() &&
284 DepTemplate->getIdentifier() == Template->getIdentifier())
285 return CreateParsedType(
306 if (NonMatchingTypeDecl) {
308 Diag(NameLoc, diag::err_destructor_expr_type_mismatch)
310 Diag(NonMatchingTypeDecl->
getLocation(), diag::note_destructor_type_here)
312 }
else if (ObjectTypePtr)
313 Diag(NameLoc, diag::err_ident_in_dtor_not_a_type)
317 diag::err_destructor_class_name);
320 if (
const CXXRecordDecl *Class = dyn_cast_or_null<CXXRecordDecl>(Ctx))
322 Class->getNameAsString());
340 "unexpected type in getDestructorType");
345 QualType SearchType = GetTypeFromParser(ObjectType);
346 if (!SearchType.isNull() && !SearchType->isDependentType() &&
371 Diag(Name.
getLocStart(), diag::err_literal_operator_id_outside_namespace)
382 llvm_unreachable(
"unknown nested name specifier kind");
400 RequireCompleteType(TypeidLoc, T, diag::err_incomplete_typeid))
404 return ExprError(
Diag(TypeidLoc, diag::err_variably_modified_typeid) << T);
415 bool WasEvaluated =
false;
425 CXXRecordDecl *RecordD = cast<CXXRecordDecl>(RecordT->getDecl());
429 if (RequireCompleteType(TypeidLoc, T, diag::err_incomplete_typeid))
444 MarkVTableUsed(TypeidLoc, RecordD);
458 E = ImpCastExprToType(E, UnqualT, CK_NoOp, E->
getValueKind()).
get();
463 return ExprError(
Diag(TypeidLoc, diag::err_variably_modified_typeid)
465 else if (!inTemplateInstantiation() &&
470 ? diag::warn_side_effects_typeid
471 : diag::warn_side_effects_unevaluated_context);
483 if (!getStdNamespace())
484 return ExprError(
Diag(OpLoc, diag::err_need_header_before_typeid));
486 if (!CXXTypeInfoDecl) {
487 IdentifierInfo *TypeInfoII = &PP.getIdentifierTable().get(
"type_info");
489 LookupQualifiedName(R, getStdNamespace());
493 if (!CXXTypeInfoDecl && LangOpts.MSVCCompat) {
497 if (!CXXTypeInfoDecl)
498 return ExprError(
Diag(OpLoc, diag::err_need_header_before_typeid));
501 if (!getLangOpts().RTTI) {
502 return ExprError(
Diag(OpLoc, diag::err_no_typeid_with_fno_rtti));
518 return BuildCXXTypeId(TypeInfoType, OpLoc, TInfo, RParenLoc);
522 return BuildCXXTypeId(TypeInfoType, OpLoc, (
Expr*)TyOrExpr, RParenLoc);
541 if (
const auto *Uuid = TD->getMostRecentDecl()->getAttr<UuidAttr>()) {
542 UuidAttrs.insert(Uuid);
547 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(TD)) {
550 const UuidAttr *UuidForTA =
nullptr;
557 UuidAttrs.insert(UuidForTA);
571 if (UuidAttrs.empty())
572 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_without_guid));
573 if (UuidAttrs.size() > 1)
574 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_with_multiple_guids));
575 UuidStr = UuidAttrs.back()->getGuid();
590 UuidStr =
"00000000-0000-0000-0000-000000000000";
594 if (UuidAttrs.empty())
595 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_without_guid));
596 if (UuidAttrs.size() > 1)
597 return ExprError(
Diag(TypeidLoc, diag::err_uuidof_with_multiple_guids));
598 UuidStr = UuidAttrs.back()->getGuid();
617 return ExprError(
Diag(OpLoc, diag::err_need_header_before_ms_uuidof));
633 return BuildCXXUuidof(GuidType, OpLoc, TInfo, RParenLoc);
637 return BuildCXXUuidof(GuidType, OpLoc, (
Expr*)TyOrExpr, RParenLoc);
643 assert((Kind == tok::kw_true || Kind == tok::kw_false) &&
644 "Unknown C++ Boolean value!");
658 bool IsThrownVarInScope =
false;
672 if (
VarDecl *Var = dyn_cast<VarDecl>(DRE->getDecl())) {
673 if (Var->hasLocalStorage() && !Var->getType().isVolatileQualified()) {
676 IsThrownVarInScope =
true;
690 return BuildCXXThrow(OpLoc, Ex, IsThrownVarInScope);
694 bool IsThrownVarInScope) {
696 if (!getLangOpts().CXXExceptions &&
697 !getSourceManager().isInSystemHeader(OpLoc))
698 Diag(OpLoc, diag::err_exceptions_disabled) <<
"throw";
701 if (getLangOpts().CUDA)
702 CUDADiagIfDeviceCode(OpLoc, diag::err_cuda_device_exceptions)
703 <<
"throw" << CurrentCUDATarget();
705 if (getCurScope() && getCurScope()->isOpenMPSimdDirectiveScope())
706 Diag(OpLoc, diag::err_omp_simd_region_cannot_use_stmt) <<
"throw";
710 if (CheckCXXThrowOperand(OpLoc, ExceptionObjectTy, Ex))
728 const VarDecl *NRVOVariable =
nullptr;
729 if (IsThrownVarInScope)
730 NRVOVariable = getCopyElisionCandidate(
QualType(), Ex,
false);
733 OpLoc, ExceptionObjectTy,
734 NRVOVariable !=
nullptr);
735 ExprResult Res = PerformMoveOrCopyInitialization(
736 Entity, NRVOVariable,
QualType(), Ex, IsThrownVarInScope);
748 llvm::DenseMap<CXXRecordDecl *, unsigned> &SubobjectsSeen,
749 llvm::SmallPtrSetImpl<CXXRecordDecl *> &VBases,
750 llvm::SetVector<CXXRecordDecl *> &PublicSubobjectsSeen,
751 bool ParentIsPublic) {
753 CXXRecordDecl *BaseDecl = BS.getType()->getAsCXXRecordDecl();
758 NewSubobject = VBases.insert(BaseDecl).second;
763 ++SubobjectsSeen[BaseDecl];
766 bool PublicPath = ParentIsPublic && BS.getAccessSpecifier() ==
AS_public;
768 PublicSubobjectsSeen.insert(BaseDecl);
778 llvm::DenseMap<CXXRecordDecl *, unsigned> SubobjectsSeen;
779 llvm::SmallSet<CXXRecordDecl *, 2> VBases;
780 llvm::SetVector<CXXRecordDecl *> PublicSubobjectsSeen;
781 SubobjectsSeen[RD] = 1;
782 PublicSubobjectsSeen.insert(RD);
786 for (
CXXRecordDecl *PublicSubobject : PublicSubobjectsSeen) {
788 if (SubobjectsSeen[PublicSubobject] > 1)
791 Objects.push_back(PublicSubobject);
801 bool isPointer =
false;
807 if (RequireCompleteType(ThrowLoc, Ty,
808 isPointer ? diag::err_throw_incomplete_ptr
809 : diag::err_throw_incomplete,
813 if (RequireNonAbstractType(ThrowLoc, ExceptionObjectTy,
814 diag::err_throw_abstract_type, E))
825 MarkVTableUsed(ThrowLoc, RD);
834 MarkFunctionReferenced(E->
getExprLoc(), Destructor);
835 CheckDestructorAccess(E->
getExprLoc(), Destructor,
836 PDiag(diag::err_access_dtor_exception) << Ty);
837 if (DiagnoseUseOfDecl(Destructor, E->
getExprLoc()))
852 for (
CXXRecordDecl *Subobject : UnambiguousPublicSubobjects) {
880 if (CheckCXXDefaultArgExpr(ThrowLoc, CD, CD->
getParamDecl(
I)))
933 for (
int I = FunctionScopes.size();
934 I-- && isa<LambdaScopeInfo>(FunctionScopes[
I]) &&
936 cast<LambdaScopeInfo>(FunctionScopes[
I])->CallOperator);
938 CurLSI = cast<LambdaScopeInfo>(FunctionScopes[
I]);
945 if (C.isCopyCapture()) {
956 assert(CurLSI &&
"While computing 'this' capture-type for a generic "
957 "lambda, we must have a corresponding LambdaScopeInfo");
959 "While computing 'this' capture-type for a generic lambda, when we "
960 "run out of enclosing LSI's, yet the enclosing DC is a "
961 "lambda-call-operator we must be (i.e. Current LSI) in a generic "
962 "lambda call oeprator");
965 auto IsThisCaptured =
969 for (
auto &&C : Closure->
captures()) {
970 if (C.capturesThis()) {
981 bool IsByCopyCapture =
false;
982 bool IsConstCapture =
false;
985 IsThisCaptured(Closure, IsByCopyCapture, IsConstCapture)) {
986 if (IsByCopyCapture) {
1002 QualType ThisTy = CXXThisTypeOverride;
1005 if (method && method->isInstance())
1006 ThisTy = method->getThisType(
Context);
1010 inTemplateInstantiation()) {
1012 assert(isa<CXXRecordDecl>(DC) &&
1013 "Trying to get 'this' type from static method?");
1036 unsigned CXXThisTypeQuals,
1038 : S(S), OldCXXThisTypeOverride(S.CXXThisTypeOverride), Enabled(
false)
1040 if (!Enabled || !ContextDecl)
1045 Record = Template->getTemplatedDecl();
1047 Record = cast<CXXRecordDecl>(ContextDecl);
1055 this->Enabled =
true;
1067 const bool ByCopy) {
1072 QualType CaptureThisFieldTy = ThisTy;
1083 Context, RD, Loc, Loc,
nullptr, CaptureThisFieldTy,
1097 nullptr, CaptureThisFieldTy, Loc);
1108 bool BuildAndDiagnose,
const unsigned *
const FunctionScopeIndexToStopAt,
1109 const bool ByCopy) {
1114 assert((!ByCopy || Explicit) &&
"cannot implicitly capture *this by value");
1116 const unsigned MaxFunctionScopesIndex = FunctionScopeIndexToStopAt ?
1142 unsigned NumCapturingClosures = 0;
1143 for (
unsigned idx = MaxFunctionScopesIndex; idx != 0; idx--) {
1146 if (CSI->CXXThisCaptureIndex != 0) {
1148 CSI->Captures[CSI->CXXThisCaptureIndex - 1].markUsed(BuildAndDiagnose);
1154 if (BuildAndDiagnose)
1155 Diag(Loc, diag::err_this_capture)
1156 << (Explicit && idx == MaxFunctionScopesIndex);
1163 (Explicit && idx == MaxFunctionScopesIndex)) {
1169 NumCapturingClosures++;
1173 if (BuildAndDiagnose)
1174 Diag(Loc, diag::err_this_capture)
1175 << (Explicit && idx == MaxFunctionScopesIndex);
1180 if (!BuildAndDiagnose)
return false;
1192 dyn_cast<LambdaScopeInfo>(
FunctionScopes[MaxFunctionScopesIndex])) &&
1193 "Only a lambda can capture the enclosing object (referred to by "
1198 for (
unsigned idx = MaxFunctionScopesIndex; NumCapturingClosures;
1199 --idx, --NumCapturingClosures) {
1201 Expr *ThisExpr =
nullptr;
1208 ByCopy && idx == MaxFunctionScopesIndex);
1216 bool isNested = NumCapturingClosures > 1;
1228 if (ThisTy.
isNull())
return Diag(Loc, diag::err_invalid_this_use);
1263 if (!
Result.isInvalid() &&
Result.get()->isInstantiationDependent() &&
1264 !
Result.get()->isTypeDependent())
1286 bool ListInitialization = LParenLoc.
isInvalid();
1287 assert((!ListInitialization ||
1288 (Exprs.size() == 1 && isa<InitListExpr>(Exprs[0]))) &&
1289 "List initialization must have initializer list as expression.");
1291 ListInitialization ? Exprs[0]->
getSourceRange().getEnd() : RParenLoc);
1296 ? ListInitialization
1306 if (Deduced && isa<DeducedTemplateSpecializationType>(Deduced)) {
1318 if (Exprs.size() == 1 && !ListInitialization &&
1319 !isa<InitListExpr>(Exprs[0])) {
1320 Expr *Arg = Exprs[0];
1327 if (!ListInitialization)
1328 return ExprError(
Diag(TyBeginLoc, diag::err_value_init_for_array_type)
1336 return ExprError(
Diag(TyBeginLoc, diag::err_init_for_function_type)
1337 << Ty << FullRange);
1344 diag::err_invalid_incomplete_type_use, FullRange))
1357 Inner = BTE->getSubExpr();
1358 if (!isa<CXXTemporaryObjectExpr>(Inner) &&
1359 !isa<CXXScalarValueInitExpr>(Inner)) {
1371 CK_NoOp, Result.
get(),
nullptr, LParenLoc, RParenLoc);
1384 return Method->isUsualDeallocationFunction();
1390 unsigned UsualParams = 1;
1408 struct UsualDeallocFnInfo {
1409 UsualDeallocFnInfo() : Found(), FD(nullptr) {}
1411 : Found(Found), FD(dyn_cast<
FunctionDecl>(Found->getUnderlyingDecl())),
1416 if (FD->getNumParams() == 3)
1417 HasAlignValT = HasSizeT =
true;
1418 else if (FD->getNumParams() == 2) {
1419 HasSizeT = FD->getParamDecl(1)->getType()->isIntegerType();
1420 HasAlignValT = !HasSizeT;
1425 if (
auto *Caller = dyn_cast<FunctionDecl>(S.
CurContext))
1429 operator bool()
const {
return FD; }
1431 bool isBetterThan(
const UsualDeallocFnInfo &Other,
bool WantSize,
1432 bool WantAlign)
const {
1437 if (HasAlignValT != Other.HasAlignValT)
1438 return HasAlignValT == WantAlign;
1440 if (HasSizeT != Other.HasSizeT)
1441 return HasSizeT == WantSize;
1444 return CUDAPref > Other.CUDAPref;
1449 bool HasSizeT, HasAlignValT;
1469 UsualDeallocFnInfo Best;
1472 UsualDeallocFnInfo Info(S,
I.getPair());
1480 BestFns->push_back(Info);
1484 if (Best.isBetterThan(Info, WantSize, WantAlign))
1489 if (BestFns && Info.isBetterThan(Best, WantSize, WantAlign))
1494 BestFns->push_back(Info);
1508 if (!record)
return false;
1521 if (ops.
empty())
return false;
1533 return Best && Best.HasSizeT;
1557 Expr *ArraySize =
nullptr;
1584 if (!NumElts->isTypeDependent() && !NumElts->isValueDependent()) {
1590 assert(IntWidth &&
"Builtin type of size 0?");
1591 llvm::APSInt
Value(IntWidth);
1599 diag::err_new_array_nonconst)
1615 if (
ParenListExpr *List = dyn_cast_or_null<ParenListExpr>(Initializer))
1616 DirectInitRange = List->getSourceRange();
1635 return PLE->getNumExprs() == 0;
1636 if (isa<ImplicitValueInitExpr>(Init))
1639 return !CCE->isListInitialization() &&
1640 CCE->getConstructor()->isDefaultConstructor();
1642 assert(isa<InitListExpr>(Init) &&
1643 "Shouldn't create list CXXConstructExprs for arrays.");
1654 if (!S.
getLangOpts().AlignedAllocationUnavailable)
1661 bool IsAligned =
false;
1663 S.
Diag(Loc, diag::warn_aligned_allocation_unavailable)
1666 S.
Diag(Loc, diag::note_silence_unligned_allocation_unavailable);
1680 Expr *Initializer) {
1685 if (DirectInitRange.
isValid()) {
1686 assert(Initializer &&
"Have parens but no initializer.");
1688 }
else if (Initializer && isa<InitListExpr>(Initializer))
1691 assert((!Initializer || isa<ImplicitValueInitExpr>(Initializer) ||
1692 isa<CXXConstructExpr>(Initializer)) &&
1693 "Initializer expression that cannot have been implicitly created.");
1698 unsigned NumInits = Initializer ? 1 : 0;
1699 if (
ParenListExpr *List = dyn_cast_or_null<ParenListExpr>(Initializer)) {
1701 Inits = List->getExprs();
1702 NumInits = List->getNumExprs();
1720 DirectInitRange.
getEnd());
1724 if (Deduced && isa<DeducedTemplateSpecializationType>(Deduced)) {
1727 diag::err_deduced_class_template_compound_type)
1733 AllocTypeInfo, Entity, Kind,
MultiExprArg(Inits, NumInits));
1736 }
else if (Deduced) {
1738 return ExprError(
Diag(StartLoc, diag::err_auto_new_requires_ctor_arg)
1739 << AllocType << TypeRange);
1741 (NumInits == 1 && isa<InitListExpr>(Inits[0])))
1743 diag::err_auto_new_list_init)
1744 << AllocType << TypeRange);
1746 Expr *FirstBad = Inits[1];
1748 diag::err_auto_new_ctor_multiple_expressions)
1749 << AllocType << TypeRange);
1751 Expr *Deduce = Inits[0];
1754 return ExprError(
Diag(StartLoc, diag::err_auto_new_deduction_failure)
1755 << AllocType << Deduce->
getType()
1757 if (DeducedType.
isNull())
1759 AllocType = DeducedType;
1770 AllocType = Array->getElementType();
1780 diag::warn_dangling_std_initializer_list)
1797 ArraySize = result.
get();
1815 if (!ConvertedSize.isInvalid() &&
1818 Diag(StartLoc, diag::warn_cxx98_compat_array_size_conversion)
1819 << ArraySize->
getType() << 0 <<
"'size_t'";
1826 SizeConvertDiagnoser(
Expr *ArraySize)
1828 ArraySize(ArraySize) {}
1832 return S.
Diag(Loc, diag::err_array_size_not_integral)
1838 return S.
Diag(Loc, diag::err_array_size_incomplete_type)
1844 return S.
Diag(Loc, diag::err_array_size_explicit_conversion) << T << ConvTy;
1855 return S.
Diag(Loc, diag::err_array_size_ambiguous_conversion) << T;
1869 ? diag::warn_cxx98_compat_array_size_conversion
1870 : diag::ext_array_size_conversion)
1873 } SizeDiagnoser(ArraySize);
1881 ArraySize = ConvertedSize.
get();
1902 if (Value.isSigned() && Value.isNegative()) {
1904 diag::err_typecheck_negative_array_size)
1909 unsigned ActiveSizeBits =
1913 diag::err_array_too_large)
1914 << Value.toString(10)
1918 KnownArraySize = Value.getZExtValue();
1919 }
else if (TypeIdParens.
isValid()) {
1936 unsigned Alignment =
1939 bool PassAlignment =
getLangOpts().AlignedAllocation &&
1940 Alignment > NewAlignment;
1946 UseGlobal, AllocType, ArraySize, PassAlignment,
1947 PlacementArgs, OperatorNew, OperatorDelete))
1952 bool UsualArrayDeleteWantsSize =
false;
1954 UsualArrayDeleteWantsSize =
1969 PassAlignment ? 2 : 1, PlacementArgs,
1970 AllPlaceArgs, CallType))
1973 if (!AllPlaceArgs.empty())
1974 PlacementArgs = AllPlaceArgs;
1983 if (PlacementArgs.empty() && !PassAlignment &&
1987 if (Alignment > NewAlignment)
1988 Diag(StartLoc, diag::warn_overaligned_type)
2000 Inits[NumInits - 1]->getLocEnd());
2001 Diag(StartLoc, diag::err_new_array_init_args) << InitRange;
2009 llvm::makeArrayRef(Inits, NumInits))) {
2021 InitType = AllocType;
2036 dyn_cast_or_null<CXXBindTemporaryExpr>(FullInit.
get()))
2037 FullInit = Binder->getSubExpr();
2039 Initializer = FullInit.
get();
2049 if (OperatorDelete) {
2063 cast<CXXRecordDecl>(BaseRecordType->getDecl()))) {
2066 PDiag(diag::err_access_dtor)
2076 UsualArrayDeleteWantsSize, PlacementArgs, TypeIdParens,
2077 ArraySize, initStyle, Initializer, ResultType, AllocTypeInfo,
2078 Range, DirectInitRange);
2088 return Diag(Loc, diag::err_bad_new_type)
2089 << AllocType << 0 << R;
2091 return Diag(Loc, diag::err_bad_new_type)
2092 << AllocType << 1 << R;
2097 diag::err_allocation_of_abstract_type))
2100 return Diag(Loc, diag::err_variably_modified_new_type)
2103 return Diag(Loc, diag::err_address_space_qualified_new)
2111 return Diag(Loc, diag::err_arc_new_array_without_ownership)
2124 Expr *AlignArg =
nullptr) {
2128 Alloc != AllocEnd; ++Alloc) {
2148 switch (Candidates.BestViableFunction(S, R.
getNameLoc(), Best)) {
2165 if (PassAlignment) {
2166 PassAlignment =
false;
2168 Args.erase(Args.begin() + 1);
2170 Operator, &Candidates, AlignArg);
2195 if (AlignedCandidates) {
2197 return C.Function->getNumParams() > 1 &&
2198 C.Function->getParamDecl(1)->getType()->isAlignValT();
2204 Args.insert(Args.begin() + 1, AlignArg);
2207 Args.erase(Args.begin() + 1);
2223 << Best->Function->isDeleted()
2231 llvm_unreachable(
"Unreachable, bad result from BestViableFunction");
2238 bool UseGlobal,
QualType AllocType,
2239 bool IsArray,
bool &PassAlignment,
2253 AllocArgs.reserve((PassAlignment ? 2 : 1) + PlaceArgs.size());
2263 AllocArgs.push_back(&Size);
2266 if (PassAlignment) {
2272 AllocArgs.push_back(&Align);
2274 AllocArgs.insert(AllocArgs.end(), PlaceArgs.begin(), PlaceArgs.end());
2283 IsArray ? OO_Array_New : OO_New);
2310 assert(!R.
empty() &&
"implicitly declared allocation functions not found");
2311 assert(!R.
isAmbiguous() &&
"global allocation functions are ambiguous");
2323 OperatorDelete =
nullptr;
2352 bool FoundGlobalDelete = FoundDelete.
empty();
2353 if (FoundDelete.
empty()) {
2375 bool isPlacementNew = !PlaceArgs.empty() || OperatorNew->
param_size() != 1 ||
2378 if (isPlacementNew) {
2403 ExpectedFunctionType
2408 DEnd = FoundDelete.
end();
2412 dyn_cast<FunctionTemplateDecl>((*D)->getUnderlyingDecl())) {
2420 Fn = cast<FunctionDecl>((*D)->getUnderlyingDecl());
2423 ExpectedFunctionType,
2425 ExpectedFunctionType))
2426 Matches.push_back(std::make_pair(D.getPair(), Fn));
2441 *
this, FoundDelete, FoundGlobalDelete,
2445 Matches.push_back(std::make_pair(Selected.Found, Selected.FD));
2449 for (
auto Fn : BestDeallocFns)
2450 Matches.push_back(std::make_pair(Fn.Found, Fn.FD));
2458 if (Matches.size() == 1) {
2459 OperatorDelete = Matches[0].second;
2467 if (
getLangOpts().CPlusPlus11 && isPlacementNew &&
2469 UsualDeallocFnInfo Info(*
this,
2475 bool IsSizedDelete = Info.HasSizeT;
2476 if (IsSizedDelete && !FoundGlobalDelete) {
2477 auto NonSizedDelete =
2480 if (NonSizedDelete && !NonSizedDelete.HasSizeT &&
2481 NonSizedDelete.HasAlignValT == Info.HasAlignValT)
2482 IsSizedDelete =
false;
2485 if (IsSizedDelete) {
2489 PlaceArgs.back()->getLocEnd());
2490 Diag(StartLoc, diag::err_placement_new_non_placement_delete) << R;
2499 }
else if (!Matches.empty()) {
2503 Diag(StartLoc, diag::warn_ambiguous_suitable_delete_function_found)
2504 << DeleteName << AllocElemType;
2506 for (
auto &Match : Matches)
2507 Diag(Match.second->getLocation(),
2508 diag::note_member_declared_here) << DeleteName;
2589 AlignValT->setImplicit(
true);
2601 Params.push_back(Param);
2604 bool HasSizedVariant =
getLangOpts().SizedDeallocation &&
2605 (Kind == OO_Delete || Kind == OO_Array_Delete);
2606 bool HasAlignedVariant =
getLangOpts().AlignedAllocation;
2608 int NumSizeVariants = (HasSizedVariant ? 2 : 1);
2609 int NumAlignVariants = (HasAlignedVariant ? 2 : 1);
2610 for (
int Sized = 0; Sized < NumSizeVariants; ++Sized) {
2612 Params.push_back(SizeT);
2614 for (
int Aligned = 0; Aligned < NumAlignVariants; ++Aligned) {
2627 DeclareGlobalAllocationFunctions(OO_New, VoidPtr, SizeT);
2628 DeclareGlobalAllocationFunctions(OO_Array_New, VoidPtr, SizeT);
2629 DeclareGlobalAllocationFunctions(OO_Delete,
Context.
VoidTy, VoidPtr);
2630 DeclareGlobalAllocationFunctions(OO_Array_Delete,
Context.
VoidTy, VoidPtr);
2643 Alloc != AllocEnd; ++Alloc) {
2646 if (
FunctionDecl *Func = dyn_cast<FunctionDecl>(*Alloc)) {
2647 if (Func->getNumParams() == Params.size()) {
2649 for (
auto *
P : Func->parameters())
2650 FuncParams.push_back(
2652 if (llvm::makeArrayRef(FuncParams) == Params) {
2656 Func->setVisibleDespiteOwningModule();
2666 bool HasBadAllocExceptionSpec
2669 if (HasBadAllocExceptionSpec) {
2672 assert(
StdBadAlloc &&
"Must have std::bad_alloc declared");
2681 auto CreateAllocationFunctionDecl = [&](
Attr *ExtraAttr) {
2685 FnType,
nullptr,
SC_None,
false,
true);
2699 ParamDecls.back()->setImplicit();
2701 Alloc->setParams(ParamDecls);
2709 CreateAllocationFunctionDecl(
nullptr);
2713 CreateAllocationFunctionDecl(CUDAHostAttr::CreateImplicit(
Context));
2714 CreateAllocationFunctionDecl(CUDADeviceAttr::CreateImplicit(
Context));
2719 bool CanProvideSize,
2733 assert(Result.FD &&
"operator delete missing from global scope?");
2745 return OperatorDelete;
2773 Overaligned, &Matches);
2776 if (Matches.size() == 1) {
2777 Operator = cast<CXXMethodDecl>(Matches[0].FD);
2782 Diag(StartLoc, diag::err_deleted_function_use);
2798 if (!Matches.empty()) {
2800 Diag(StartLoc, diag::err_ambiguous_suitable_delete_member_function_found)
2802 for (
auto &Match : Matches)
2803 Diag(Match.FD->getLocation(), diag::note_member_declared_here) << Name;
2810 if (!Found.
empty()) {
2812 Diag(StartLoc, diag::err_no_suitable_delete_member_function_found)
2816 Diag(D->getUnderlyingDecl()->getLocation(),
2817 diag::note_member_declared_here) << Name;
2829 class MismatchingNewDeleteDetector {
2831 enum MismatchResult {
2837 MemberInitMismatches,
2846 explicit MismatchingNewDeleteDetector(
bool EndOfTU)
2847 : Field(nullptr), IsArrayForm(
false), EndOfTU(EndOfTU),
2848 HasUndefinedConstructors(
false) {}
2865 MismatchResult analyzeField(
FieldDecl *Field,
bool DeleteWasArrayForm);
2875 bool HasUndefinedConstructors;
2887 MismatchResult analyzeMemberExpr(
const MemberExpr *ME);
2910 MismatchResult analyzeInClassInitializer();
2914 MismatchingNewDeleteDetector::MismatchResult
2915 MismatchingNewDeleteDetector::analyzeDeleteExpr(
const CXXDeleteExpr *DE) {
2917 assert(DE &&
"Expected delete-expression");
2920 if (
const MemberExpr *ME = dyn_cast<const MemberExpr>(E)) {
2921 return analyzeMemberExpr(ME);
2922 }
else if (
const DeclRefExpr *D = dyn_cast<const DeclRefExpr>(E)) {
2923 if (!hasMatchingVarInit(D))
2924 return VarInitMismatches;
2930 MismatchingNewDeleteDetector::getNewExprFromInitListOrExpr(
const Expr *E) {
2931 assert(E !=
nullptr &&
"Expected a valid initializer expression");
2933 if (
const InitListExpr *ILE = dyn_cast<const InitListExpr>(E)) {
2934 if (ILE->getNumInits() == 1)
2935 E = dyn_cast<const CXXNewExpr>(ILE->getInit(0)->IgnoreParenImpCasts());
2938 return dyn_cast_or_null<const CXXNewExpr>(
E);
2941 bool MismatchingNewDeleteDetector::hasMatchingNewInCtorInit(
2945 (NE = getNewExprFromInitListOrExpr(CI->
getInit()))) {
2946 if (NE->
isArray() == IsArrayForm)
2949 NewExprs.push_back(NE);
2954 bool MismatchingNewDeleteDetector::hasMatchingNewInCtor(
2960 HasUndefinedConstructors =
true;
2963 for (
const auto *CI : cast<const CXXConstructorDecl>(Definition)->inits()) {
2964 if (hasMatchingNewInCtorInit(CI))
2970 MismatchingNewDeleteDetector::MismatchResult
2971 MismatchingNewDeleteDetector::analyzeInClassInitializer() {
2972 assert(Field !=
nullptr &&
"This should be called only for members");
2973 const Expr *InitExpr =
Field->getInClassInitializer();
2975 return EndOfTU ? NoMismatch : AnalyzeLater;
2976 if (
const CXXNewExpr *NE = getNewExprFromInitListOrExpr(InitExpr)) {
2977 if (NE->
isArray() != IsArrayForm) {
2978 NewExprs.push_back(NE);
2979 return MemberInitMismatches;
2985 MismatchingNewDeleteDetector::MismatchResult
2986 MismatchingNewDeleteDetector::analyzeField(
FieldDecl *Field,
2987 bool DeleteWasArrayForm) {
2988 assert(Field !=
nullptr &&
"Analysis requires a valid class member.");
2989 this->Field = Field;
2990 IsArrayForm = DeleteWasArrayForm;
2992 for (
const auto *CD : RD->
ctors()) {
2993 if (hasMatchingNewInCtor(CD))
2996 if (HasUndefinedConstructors)
2997 return EndOfTU ? NoMismatch : AnalyzeLater;
2998 if (!NewExprs.empty())
2999 return MemberInitMismatches;
3004 MismatchingNewDeleteDetector::MismatchResult
3005 MismatchingNewDeleteDetector::analyzeMemberExpr(
const MemberExpr *ME) {
3006 assert(ME !=
nullptr &&
"Expected a member expression");
3008 return analyzeField(F, IsArrayForm);
3012 bool MismatchingNewDeleteDetector::hasMatchingVarInit(
const DeclRefExpr *D) {
3015 if (VD->hasInit() && (NE = getNewExprFromInitListOrExpr(VD->getInit())) &&
3016 NE->
isArray() != IsArrayForm) {
3017 NewExprs.push_back(NE);
3020 return NewExprs.empty();
3025 const MismatchingNewDeleteDetector &Detector) {
3028 if (!Detector.IsArrayForm)
3037 SemaRef.
Diag(DeleteLoc, diag::warn_mismatched_delete_new)
3038 << Detector.IsArrayForm << H;
3040 for (
const auto *NE : Detector.NewExprs)
3042 << Detector.IsArrayForm;
3045 void Sema::AnalyzeDeleteExprMismatch(
const CXXDeleteExpr *DE) {
3048 MismatchingNewDeleteDetector Detector(
false);
3049 switch (Detector.analyzeDeleteExpr(DE)) {
3050 case MismatchingNewDeleteDetector::VarInitMismatches:
3051 case MismatchingNewDeleteDetector::MemberInitMismatches: {
3055 case MismatchingNewDeleteDetector::AnalyzeLater: {
3060 case MismatchingNewDeleteDetector::NoMismatch:
3066 bool DeleteWasArrayForm) {
3067 MismatchingNewDeleteDetector Detector(
true);
3068 switch (Detector.analyzeField(Field, DeleteWasArrayForm)) {
3069 case MismatchingNewDeleteDetector::VarInitMismatches:
3070 llvm_unreachable(
"This analysis should have been done for class members.");
3071 case MismatchingNewDeleteDetector::AnalyzeLater:
3072 llvm_unreachable(
"Analysis cannot be postponed any point beyond end of "
3073 "translation unit.");
3074 case MismatchingNewDeleteDetector::MemberInitMismatches:
3077 case MismatchingNewDeleteDetector::NoMismatch:
3088 bool ArrayForm,
Expr *ExE) {
3098 bool ArrayFormAsWritten = ArrayForm;
3099 bool UsualArrayDeleteWantsSize =
false;
3117 if (ConvPtrType->getPointeeType()->isIncompleteOrObjectType())
3124 return S.
Diag(Loc, diag::err_delete_operand) << T;
3129 return S.
Diag(Loc, diag::err_delete_incomplete_class_type) << T;
3135 return S.
Diag(Loc, diag::err_delete_explicit_conversion) << T << ConvTy;
3146 return S.
Diag(Loc, diag::err_ambiguous_delete_operand) << T;
3158 llvm_unreachable(
"conversion functions are permitted");
3166 if (!Converter.match(Type))
3176 diag::err_address_space_qualified_delete)
3185 Diag(StartLoc, diag::ext_delete_void_ptr_operand)
3194 diag::warn_delete_incomplete, Ex.
get())) {
3196 PointeeRD = cast<CXXRecordDecl>(RT->getDecl());
3201 Diag(StartLoc, diag::warn_delete_array_type)
3208 ArrayForm ? OO_Array_Delete : OO_Delete);
3222 UsualArrayDeleteWantsSize =
3227 else if (OperatorDelete && isa<CXXMethodDecl>(OperatorDelete))
3228 UsualArrayDeleteWantsSize =
3229 UsualDeallocFnInfo(*
this,
3237 const_cast<CXXDestructorDecl*>(Dtor));
3248 if (!OperatorDelete) {
3250 bool CanProvideSize =
3251 IsComplete && (!ArrayForm || UsualArrayDeleteWantsSize ||
3257 Overaligned, DeleteName);
3266 PDiag(diag::err_access_dtor) << PointeeElem);
3276 UsualArrayDeleteWantsSize, OperatorDelete, Ex.
get(), StartLoc);
3277 AnalyzeDeleteExprMismatch(Result);
3282 bool IsDelete,
bool CallCanBeVirtual,
3283 bool WarnOnNonAbstractTypes,
3285 if (!dtor || dtor->
isVirtual() || !CallCanBeVirtual)
3304 Diag(Loc, diag::warn_delete_abstract_non_virtual_dtor) << (IsDelete ? 0 : 1)
3306 }
else if (WarnOnNonAbstractTypes) {
3309 Diag(Loc, diag::warn_delete_non_virtual_dtor) << (IsDelete ? 0 : 1)
3313 std::string TypeStr;
3315 Diag(DtorLoc, diag::note_delete_non_virtual)
3345 diag::err_invalid_use_of_function_type)
3349 diag::err_invalid_use_of_array_type)
3370 llvm_unreachable(
"unexpected condition kind");
3384 llvm::APSInt
Value(1);
3399 From = Cast->getSubExpr();
3411 if (!ToPtrType->getPointeeType().hasQualifiers()) {
3412 switch (StrLit->getKind()) {
3419 return (ToPointeeType->getKind() == BuiltinType::Char_U ||
3420 ToPointeeType->getKind() == BuiltinType::Char_S);
3437 bool HadMultipleCandidates,
3440 default: llvm_unreachable(
"Unhandled cast kind!");
3441 case CK_ConstructorConversion: {
3446 diag::err_allocation_of_abstract_type))
3458 CastLoc, Ty, FoundDecl, cast<CXXConstructorDecl>(Method),
3459 ConstructorArgs, HadMultipleCandidates,
3460 false,
false,
false,
3468 case CK_UserDefinedConversion: {
3478 HadMultipleCandidates);
3479 if (Result.isInvalid())
3483 CK_UserDefinedConversion, Result.get(),
3484 nullptr, Result.get()->getValueKind());
3516 assert(FD &&
"no conversion function for user-defined conversion seq");
3518 CastKind = CK_UserDefinedConversion;
3526 CastKind = CK_ConstructorConversion;
3558 From = CastArg.
get();
3566 PDiag(diag::err_typecheck_ambiguous_condition)
3571 llvm_unreachable(
"Cannot perform an ellipsis conversion");
3577 assert(Diagnosed &&
"failed to diagnose bad conversion"); (void)Diagnosed;
3615 ConstructorArgs,
false,
3616 false,
false,
false,
3623 false,
false,
false,
3646 ToAtomicType = ToType;
3647 ToType = ToAtomic->getValueType();
3650 QualType InitialFromType = FromType;
3652 switch (SCS.
First) {
3655 FromType = FromAtomic->getValueType().getUnqualifiedType();
3664 assert(!FromRes.isInvalid() &&
"Can't perform deduced conversion?!");
3665 From = FromRes.get();
3666 FromType = From->getType();
3683 llvm_unreachable(
"Improper first standard conversion");
3720 "only enums with fixed underlying type can promote to bool");
3742 CK = CK_FloatingComplexCast;
3744 CK = CK_FloatingComplexToIntegralComplex;
3746 CK = CK_IntegralComplexToFloatingComplex;
3748 CK = CK_IntegralComplexCast;
3775 diag::ext_typecheck_convert_incompatible_pointer)
3776 << ToType << From->
getType() << Action
3780 diag::ext_typecheck_convert_incompatible_pointer)
3781 << From->
getType() << ToType << Action
3792 diag::err_arc_weak_unavailable_assign);
3795 diag::err_arc_convesion_of_weak_unavailable)
3807 if (Kind == CK_BlockPointerToObjCPointerCast) {
3812 if (
getLangOpts().allowsNonTrivialObjCLifetimeQualifiers())
3863 &BasePath, CCK).
get();
3876 nullptr, CCK).
get();
3883 QualType ElType = ToComplex->getElementType();
3891 isFloatingComplex ? CK_FloatingCast : CK_FloatingToIntegral).
get();
3895 isFloatingComplex ? CK_IntegralToFloating : CK_IntegralCast).
get();
3899 isFloatingComplex ? CK_FloatingRealToComplex
3900 : CK_IntegralRealToComplex).
get();
3905 assert(FromComplex);
3912 isFloatingComplex ? CK_FloatingComplexToReal
3913 : CK_IntegralComplexToReal,
3921 isFloatingComplex ? CK_FloatingCast : CK_IntegralToFloating,
3926 isFloatingComplex ? CK_FloatingToIntegral : CK_IntegralCast,
3944 From = FromRes.
get();
3946 "Improper transparent union conversion");
3971 llvm_unreachable(
"Improper second standard conversion");
3974 switch (SCS.
Third) {
3995 CK_NoOp, VK,
nullptr, CCK).
get();
4000 ? diag::ext_deprecated_string_literal_conversion
4001 : diag::warn_deprecated_string_literal_conversion)
4009 llvm_unreachable(
"Improper third standard conversion");
4014 if (!ToAtomicType.
isNull()) {
4049 default: llvm_unreachable(
"not a UTT");
4102 Loc, ArgTy, diag::err_incomplete_type_used_in_type_trait_expr);
4111 Loc, ArgTy, diag::err_incomplete_type_used_in_type_trait_expr);
4148 Loc, ArgTy, diag::err_incomplete_type_used_in_type_trait_expr);
4159 if ((RD->*HasTrivial)() && !(RD->*HasNonTrivial)())
4166 bool FoundOperator =
false;
4169 Op != OpEnd; ++Op) {
4170 if (isa<FunctionTemplateDecl>(*Op))
4174 if((Operator->*IsDesiredOp)()) {
4175 FoundOperator =
true;
4183 return FoundOperator;
4190 assert(!T->
isDependentType() &&
"Cannot evaluate traits of dependent type");
4194 default: llvm_unreachable(
"not a UTT");
4300 return RD->
hasAttr<FinalAttr>();
4329 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl())
4339 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl())
4360 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl())
4412 if (
auto *RD = C.getBaseElementType(T)->getAsCXXRecordDecl()) {
4448 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl())
4460 if (C.getBaseElementType(T).isConstQualified())
4499 bool FoundConstructor =
false;
4505 if (isa<FunctionTemplateDecl>(ND->getUnderlyingDecl()))
4508 if (isa<UsingDecl>(ND))
4510 auto *Constructor = cast<CXXConstructorDecl>(ND->getUnderlyingDecl());
4511 if (Constructor->isCopyConstructor(FoundTQs)) {
4512 FoundConstructor =
true;
4525 return FoundConstructor;
4536 if (
CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl()) {
4541 bool FoundConstructor =
false;
4544 if (isa<FunctionTemplateDecl>(ND->getUnderlyingDecl()))
4547 if (isa<UsingDecl>(ND))
4549 auto *Constructor = cast<CXXConstructorDecl>(ND->getUnderlyingDecl());
4550 if (Constructor->isDefaultConstructor()) {
4551 FoundConstructor =
true;
4563 return FoundConstructor;
4572 return Destructor->isVirtual();
4597 Args[1]->getType(), RParenLoc);
4616 assert(!Args.empty());
4621 for (
const auto *TSI : Args) {
4627 diag::err_incomplete_type_used_in_type_trait_expr))
4643 ArgExprs.reserve(Args.size() - 1);
4644 for (
unsigned I = 1, N = Args.size();
I != N; ++
I) {
4648 OpaqueArgExprs.push_back(
4653 for (
Expr &E : OpaqueArgExprs)
4654 ArgExprs.push_back(&E);
4687 return !Result.
get()->hasNonTrivialCall(S.
Context);
4690 llvm_unreachable(
"unhandled type trait");
4693 default: llvm_unreachable(
"not a TT");
4705 *
this, Kind, KWLoc, Args[0]->getType()))
4708 bool Dependent =
false;
4709 for (
unsigned I = 0, N = Args.size();
I != N; ++
I) {
4710 if (Args[
I]->getType()->isDependentType()) {
4728 ConvertedArgs.reserve(Args.size());
4730 for (
unsigned I = 0, N = Args.size();
I != N; ++
I) {
4736 ConvertedArgs.push_back(TInfo);
4745 "Cannot evaluate traits of dependent types");
4756 if (!rhsRecord || !lhsRecord) {
4759 if (!LHSObjTy || !RHSObjTy)
4764 if (!BaseInterface || !DerivedInterface)
4768 KeyLoc, RhsT, diag::err_incomplete_type_used_in_type_trait_expr))
4775 == (lhsRecord == rhsRecord));
4777 if (lhsRecord == rhsRecord)
4785 diag::err_incomplete_type_used_in_type_trait_expr))
4788 return cast<CXXRecordDecl>(rhsRecord->getDecl())
4789 ->isDerivedFrom(cast<CXXRecordDecl>(lhsRecord->
getDecl()));
4843 Expr *FromPtr = &From;
4877 diag::err_incomplete_type_used_in_type_trait_expr))
4881 diag::err_incomplete_type_used_in_type_trait_expr))
4922 return !Result.get()->hasNonTrivialCall(Self.
Context);
4925 llvm_unreachable(
"unhandled type trait");
4928 default: llvm_unreachable(
"not a BTT");
4930 llvm_unreachable(
"Unknown type trait or not implemented");
4949 assert(!T->
isDependentType() &&
"Cannot evaluate traits of dependent type");
4957 T = AT->getElementType();
4967 diag::err_dimension_expr_not_constant_integer,
4970 if (Value.isSigned() && Value.isNegative()) {
4971 Self.
Diag(KeyLoc, diag::err_dimension_expr_not_constant_integer)
4975 Dim = Value.getLimitedValue();
4979 bool Matched =
false;
4986 T = AT->getElementType();
4991 return CAT->getSize().getLimitedValue();
4997 llvm_unreachable(
"Unknown type trait or not implemented");
5040 llvm_unreachable(
"Expression trait not covered by switch");
5067 "placeholders should have been weeded out by now");
5082 const char *OpSpelling = isIndirect ?
"->*" :
".*";
5090 Diag(Loc, diag::err_bad_memptr_rhs)
5112 Diag(Loc, diag::err_bad_memptr_lhs)
5113 << OpSpelling << 1 << LHSType
5122 OpSpelling, (
int)isIndirect)) {
5127 Diag(Loc, diag::err_bad_memptr_lhs) << OpSpelling
5151 Diag(Loc, diag::err_pointer_to_member_type) << isIndirect;
5170 switch (Proto->getRefQualifier()) {
5177 Diag(Loc, diag::err_pointer_to_member_oper_value_classify)
5183 Diag(Loc, diag::err_pointer_to_member_oper_value_classify)
5199 }
else if (isIndirect) {
5217 bool &HaveConversion,
5219 HaveConversion =
false;
5244 HaveConversion =
true;
5249 return InitSeq.
Diagnose(Self, Entity, Kind, From);
5259 bool FDerivedFromT = FRec && TRec && FRec != TRec &&
5261 if (FRec && TRec && (FRec == TRec || FDerivedFromT ||
5266 if (FRec == TRec || FDerivedFromT) {
5271 HaveConversion =
true;
5276 return InitSeq.
Diagnose(Self, Entity, Kind, From);
5294 HaveConversion = !InitSeq.
Failed();
5297 return InitSeq.
Diagnose(Self, Entity, Kind, From);
5320 LHS.
get(), Best->BuiltinParamTypes[0], Best->Conversions[0],
5327 RHS.
get(), Best->BuiltinParamTypes[1], Best->Conversions[1],
5345 Self.
Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands)
5346 << LHS.
get()->getType() << RHS.
get()->getType()
5347 << LHS.
get()->getSourceRange() << RHS.
get()->getSourceRange();
5351 Self.
Diag(QuestionLoc, diag::err_conditional_ambiguous_ovl)
5352 << LHS.
get()->getType() << RHS.
get()->getType()
5353 << LHS.
get()->getSourceRange() << RHS.
get()->getSourceRange();
5359 llvm_unreachable(
"Conditional operator has only built-in overloads");
5423 if (LVoid || RVoid) {
5430 if (LThrow != RThrow) {
5431 Expr *NonThrow = LThrow ? RHS.
get() : LHS.
get();
5445 Diag(QuestionLoc, diag::err_conditional_void_nonvoid)
5446 << (LVoid ? RTy : LTy) << (LVoid ? 0 : 1)
5461 bool HaveL2R, HaveR2L;
5468 if (HaveL2R && HaveR2L) {
5469 Diag(QuestionLoc, diag::err_conditional_ambiguous)
5481 }
else if (HaveR2L) {
5502 bool DerivedToBase, ObjCConversion, ObjCLifetimeConversion;
5504 QuestionLoc, LTy, RTy, DerivedToBase,
5506 !DerivedToBase && !ObjCConversion && !ObjCLifetimeConversion &&
5514 QuestionLoc, RTy, LTy, DerivedToBase,
5516 !DerivedToBase && !ObjCConversion && !ObjCLifetimeConversion &&
5532 if (Same && LVK == RVK && LVK !=
VK_RValue &&
5542 if (LTy->isFunctionPointerType() || LTy->isMemberFunctionPointerType()) {
5548 assert(!LTy.isNull() &&
"failed to find composite pointer type for "
5549 "canonically equivalent function ptr types");
5559 if (!Same && (LTy->isRecordType() || RTy->
isRecordType())) {
5575 RTy = RHS.get()->getType();
5584 if (LTy->isRecordType()) {
5606 if (LTy->isFunctionPointerType() || LTy->isMemberFunctionPointerType()) {
5608 assert(!LTy.isNull() &&
"failed to find composite pointer type for "
5609 "canonically equivalent function ptr types");
5630 diag::err_typecheck_cond_incompatible_operands) << LTy << RTy
5666 Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands)
5667 << LHS.
get()->
getType() << RHS.get()->getType()
5706 "computing composite pointer type of dependent types");
5718 llvm_unreachable(
"handled above");
5723 assert(EST2 ==
EST_Dynamic &&
"other cases should already be handled");
5724 llvm::SmallPtrSet<QualType, 8> Found;
5728 ExceptionTypeStorage.push_back(E);
5738 llvm_unreachable(
"shouldn't see unresolved exception specifications here");
5741 llvm_unreachable(
"invalid ExceptionSpecificationType");
5769 bool T2IsPointerLike = T2->isAnyPointerType() || T2->isMemberPointerType() ||
5770 T2->isNullPtrType();
5771 if (!T1IsPointerLike && !T2IsPointerLike)
5779 if (T1IsPointerLike &&
5783 ? CK_NullToMemberPointer
5784 : CK_NullToPointer).
get();
5787 if (T2IsPointerLike &&
5791 ? CK_NullToMemberPointer
5792 : CK_NullToPointer).
get();
5797 if (!T1IsPointerLike || !T2IsPointerLike)
5800 "nullptr_t should be a null pointer constant");
5840 unsigned NeedConstBefore = 0;
5851 NeedConstBefore = QualifierUnion.size();
5853 QualifierUnion.push_back(
5855 MemberOfClass.push_back(std::make_pair(
nullptr,
nullptr));
5868 NeedConstBefore = QualifierUnion.size();
5870 QualifierUnion.push_back(
5872 MemberOfClass.push_back(std::make_pair(MemPtr1->
getClass(),
5892 if (QualifierUnion.size() == 1) {
5908 ExceptionTypeStorage);
5911 FPT1->getParamTypes(), EPI1);
5913 FPT2->getParamTypes(), EPI2);
5918 if (NeedConstBefore) {
5922 for (
unsigned I = 0;
I != NeedConstBefore; ++
I)
5924 QualifierUnion[
I] = QualifierUnion[
I] | Qualifiers::Const;
5928 auto MOC = MemberOfClass.rbegin();
5929 for (
unsigned CVR : llvm::reverse(QualifierUnion)) {
5931 auto Classes = *MOC++;
5932 if (Classes.first && Classes.second) {
5958 :
S(S), E1(E1), E2(E2), Composite(Composite),
5961 E1ToC(S, Entity,
Kind, E1), E2ToC(S, Entity,
Kind, E2),
5962 Viable(E1ToC && E2ToC) {}
5971 if (E2Result.isInvalid())
5973 E2 = E2Result.getAs<
Expr>();
5980 Conversion C1(*
this, Loc, E1, E2, Composite1);
5982 if (ConvertArgs && C1.perform())
5984 return C1.Composite;
5986 Conversion C2(*
this, Loc, E1, E2, Composite2);
5988 if (C1.Viable == C2.Viable) {
5996 if (ConvertArgs && (C1.Viable ? C1 : C2).perform())
5999 return C1.Viable ? C1.Composite : C2.Composite;
6006 assert(!isa<CXXBindTemporaryExpr>(E) &&
"Double-bound temporary?");
6017 bool ReturnsRetained;
6021 if (
CallExpr *Call = dyn_cast<CallExpr>(E)) {
6022 Expr *Callee = Call->getCallee()->IgnoreParens();
6028 T = BinOp->getRHS()->getType();
6029 else if (
MemberExpr *Mem = dyn_cast<MemberExpr>(Callee))
6030 T = Mem->getMemberDecl()->getType();
6041 assert(FTy &&
"call to value not of function type?");
6046 }
else if (isa<StmtExpr>(E)) {
6047 ReturnsRetained =
true;
6051 }
else if (isa<CastExpr>(E) &&
6052 isa<BlockExpr>(cast<CastExpr>(E)->getSubExpr())) {
6061 D = Send->getMethodDecl();
6062 }
else if (
ObjCBoxedExpr *BoxedExpr = dyn_cast<ObjCBoxedExpr>(E)) {
6063 D = BoxedExpr->getBoxingMethod();
6067 if (ArrayLit->getNumElements() == 0 &&
6071 D = ArrayLit->getArrayWithObjectsMethod();
6073 = dyn_cast<ObjCDictionaryLiteral>(E)) {
6076 if (DictLit->getNumElements() == 0 &&
6080 D = DictLit->getDictWithObjectsMethod();
6083 ReturnsRetained = (D && D->
hasAttr<NSReturnsRetainedAttr>());
6088 if (!ReturnsRetained &&
6099 CastKind ck = (ReturnsRetained ? CK_ARCConsumeObject
6100 : CK_ARCReclaimReturnedObject);
6115 RT = cast<RecordType>(T);
6117 case Type::ConstantArray:
6118 case Type::IncompleteArray:
6119 case Type::VariableArray:
6120 case Type::DependentSizedArray:
6121 T = cast<ArrayType>(T)->getElementType().getTypePtr();
6140 PDiag(diag::err_access_dtor_temp)
6171 assert(SubExpr &&
"subexpression can't be null!");
6193 assert(SubStmt &&
"sub-statement can't be null!");
6217 assert(
ExprEvalContexts.back().IsDecltype &&
"not in a decltype expression");
6229 if (
ParenExpr *PE = dyn_cast<ParenExpr>(E)) {
6233 if (SubExpr.
get() == PE->getSubExpr())
6238 if (BO->getOpcode() == BO_Comma) {
6242 if (RHS.
get() == BO->getRHS())
6245 BO->getLHS(), RHS.
get(), BO_Comma, BO->
getType(), BO->getValueKind(),
6246 BO->getObjectKind(), BO->getOperatorLoc(), BO->getFPFeatures());
6270 if (Call == TopCall)
6285 if (Bind == TopBind)
6297 PDiag(diag::err_access_dtor_temp)
6313 unsigned SkipStart = OperatorArrows.size(), SkipCount = 0;
6316 if (OperatorArrows.size() > Limit) {
6318 SkipStart = (Limit - 1) / 2 + (Limit - 1) % 2;
6319 SkipCount = OperatorArrows.size() - (Limit - 1);
6322 for (
unsigned I = 0;
I < OperatorArrows.size(); ) {
6323 if (
I == SkipStart) {
6324 S.
Diag(OperatorArrows[
I]->getLocation(),
6325 diag::note_operator_arrows_suppressed)
6329 S.
Diag(OperatorArrows[
I]->getLocation(), diag::note_operator_arrow_here)
6330 << OperatorArrows[
I]->getCallResultType();
6340 bool &MayBePseudoDestructor) {
6344 Base = Result.
get();
6348 Base = Result.
get();
6351 MayBePseudoDestructor =
false;
6356 if (OpKind == tok::arrow)
6361 MayBePseudoDestructor =
true;
6368 if (OpKind == tok::arrow) {
6370 bool NoArrowOperatorFound =
false;
6371 bool FirstIteration =
true;
6374 llvm::SmallPtrSet<CanQualType,8> CTypes;
6379 if (OperatorArrows.size() >=
getLangOpts().ArrowDepth) {
6380 Diag(OpLoc, diag::err_operator_arrow_depth_exceeded)
6383 Diag(OpLoc, diag::note_operator_arrow_depth)
6396 : &NoArrowOperatorFound);
6398 if (NoArrowOperatorFound) {
6399 if (FirstIteration) {
6400 Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
6403 OpKind = tok::period;
6406 Diag(OpLoc, diag::err_typecheck_member_reference_arrow)
6411 diag::note_member_reference_arrow_from_operator_arrow);
6416 Base = Result.
get();
6418 OperatorArrows.push_back(OpCall->getDirectCallee());
6421 if (!CTypes.insert(CBaseType).second) {
6422 Diag(OpLoc, diag::err_operator_arrow_circular) << StartingType;
6426 FirstIteration =
false;
6429 if (OpKind == tok::arrow &&
6452 MayBePseudoDestructor =
true;
6455 ObjectType =
nullptr;
6456 MayBePseudoDestructor =
true;
6484 Base = result.
get();
6494 if (OpKind == tok::arrow) {
6499 S.
Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
6500 << ObjectType <<
true
6505 OpKind = tok::period;
6540 if (
CheckArrow(*
this, ObjectType, Base, OpKind, OpLoc))
6548 Diag(OpLoc, diag::err_pseudo_dtor_base_not_scalar)
6557 if (DestructedTypeInfo) {
6570 Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
6575 *
this, DestructedType))
6580 ObjectType = DestructedType;
6581 OpKind = tok::arrow;
6583 Diag(DestructedTypeStart, diag::err_pseudo_dtor_type_mismatch)
6588 DestructedType = ObjectType;
6589 DestructedTypeInfo =
6600 Diag(DestructedTypeStart, diag::err_arc_pseudo_dtor_inconstant_quals)
6606 DestructedType = ObjectType;
6608 DestructedTypeStart);
6621 if (ScopeTypeInfo) {
6627 diag::err_pseudo_dtor_type_mismatch)
6632 ScopeTypeInfo =
nullptr;
6638 OpKind == tok::arrow, OpLoc,
6658 "Invalid first type name in pseudo-destructor");
6661 "Invalid second type name in pseudo-destructor");
6664 if (
CheckArrow(*
this, ObjectType, Base, OpKind, OpLoc))
6685 S, &SS,
true,
false, ObjectTypePtrForLookup,
6698 diag::err_pseudo_dtor_destructor_non_type)
6704 DestructedType = ObjectType;
6721 if (T.isInvalid() || !T.get()) {
6723 DestructedType = ObjectType;
6730 if (!DestructedType.
isNull()) {
6731 if (!DestructedTypeInfo)
6745 S, &SS,
true,
false, ObjectTypePtrForLookup,
6749 diag::err_pseudo_dtor_destructor_non_type)
6773 if (T.isInvalid() || !T.get()) {
6781 if (!ScopeType.
isNull() && !ScopeTypeInfo)
6787 ScopeTypeInfo, CCLoc, TildeLoc,
6797 if (
CheckArrow(*
this, ObjectType, Base, OpKind, OpLoc))
6816 bool HadMultipleCandidates) {
6827 SubE = BE->getSubExpr();
6828 if (isa<LambdaExpr>(SubE)) {
6856 if (HadMultipleCandidates)
6868 if (CheckFunctionCall(Method, CE,
6890 Diag(Operand->
getExprLoc(), diag::warn_side_effects_unevaluated_context);
6912 if (isa<DeclRefExpr>(E))
6916 if (isa<ArraySubscriptExpr>(E))
6920 if (isa<MemberExpr>(E))
6925 if (UO->getOpcode() == UO_Deref)
6930 if (BO->isPtrMemOp())
6934 if (BO->getOpcode() == BO_Comma)
6945 dyn_cast<BinaryConditionalOperator>(E)) {
6946 if (
OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(BCO->getTrueExpr()))
6952 if (isa<PseudoObjectExpr>(E) || isa<ObjCIvarRefExpr>(
E))
7010 if (!T->getDecl()->isComplete()) {
7024 diag::err_incomplete_type);
7042 if (isa<ParmVarDecl>(Var))
return true;
7043 const VarDecl *DefVD =
nullptr;
7048 if (DefVD->
isWeak())
return false;
7077 while (DC && isa<CapturedDecl>(DC))
7081 "The current call operator must be synchronized with Sema's CurContext");
7092 const unsigned NumPotentialCaptures =
7094 for (
unsigned I = 0;
I != NumPotentialCaptures; ++
I) {
7095 Expr *VarExpr =
nullptr;
7110 !IsFullExprInstantiationDependent)
7117 FunctionScopesArrayRef, Var, S)) {
7118 const unsigned FunctionScopeIndexOfCapturableLambda = Index.getValue();
7120 &FunctionScopeIndexOfCapturableLambda);
7122 const bool IsVarNeverAConstantExpression =
7124 if (!IsFullExprInstantiationDependent || IsVarNeverAConstantExpression) {
7136 DeclRefType,
nullptr)) {
7142 DeclRefType,
nullptr);
7153 FunctionScopesArrayRef,
nullptr, S)) {
7154 const unsigned FunctionScopeIndexOfCapturableLambda = Index.getValue();
7157 &FunctionScopeIndexOfCapturableLambda);
7180 R.setLookupName(ND->getDeclName());
7182 if (ND->isCXXClassMember()) {
7186 Record = NNS->getAsType()->getAsCXXRecordDecl();
7189 dyn_cast<
CXXRecordDecl>(ND->getDeclContext()->getRedeclContext());
7191 R.setNamingClass(Record);
7195 bool MightBeImplicitMember;
7197 MightBeImplicitMember =
true;
7199 MightBeImplicitMember =
false;
7200 else if (R.isOverloadedResult())
7201 MightBeImplicitMember =
false;
7202 else if (R.isUnresolvableResult())
7203 MightBeImplicitMember =
true;
7205 MightBeImplicitMember = isa<FieldDecl>(ND) ||
7206 isa<IndirectFieldDecl>(ND) ||
7207 isa<MSPropertyDecl>(ND);
7209 if (MightBeImplicitMember)
7213 }
else if (
auto *Ivar = dyn_cast<ObjCIvarDecl>(ND)) {
7215 Ivar->getIdentifier());
7229 : TypoExprs(TypoExprs) {}
7231 TypoExprs.insert(TE);
7236 class TransformTypos :
public TreeTransform<TransformTypos> {
7241 llvm::function_ref<ExprResult(Expr *)> ExprFilter;
7243 llvm::SmallDenseMap<TypoExpr *, ExprResult, 2> TransformCache;
7244 llvm::SmallDenseMap<OverloadExpr *, Expr *, 4> OverloadResolution;
7250 void EmitAllDiagnostics() {
7251 for (
auto E : TypoExprs) {
7253 auto &
State = SemaRef.getTypoExprState(TE);
7254 if (State.DiagHandler) {
7264 Replacement.
isInvalid() ?
nullptr : Replacement.
get()))
7267 State.DiagHandler(TC);
7269 SemaRef.clearDelayedTypo(TE);
7282 bool CheckAndAdvanceTypoExprCorrectionStreams() {
7283 for (
auto TE : TypoExprs) {
7284 auto &State = SemaRef.getTypoExprState(TE);
7285 TransformCache.erase(TE);
7286 if (!State.Consumer->finished())
7288 State.Consumer->resetCorrectionStream();
7294 if (
auto *OE = dyn_cast_or_null<OverloadExpr>(E))
7295 E = OverloadResolution[OE];
7299 if (
auto *DRE = dyn_cast<DeclRefExpr>(E))
7300 return DRE->getFoundDecl();
7301 if (
auto *ME = dyn_cast<MemberExpr>(E))
7312 if (Trap.hasErrorOccurred() || Res.
isInvalid())
7315 return ExprFilter(Res.
get());
7320 : BaseTransform(SemaRef), InitDecl(InitDecl), ExprFilter(Filter) {}
7325 Expr *ExecConfig =
nullptr) {
7326 auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args,
7327 RParenLoc, ExecConfig);
7328 if (
auto *OE = dyn_cast<OverloadExpr>(Callee)) {
7331 if (
auto *BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall))
7332 ResultCall = BE->getSubExpr();
7333 if (
auto *CE = dyn_cast<CallExpr>(ResultCall))
7334 OverloadResolution[OE] = CE->getCallee();
7347 Res = TryTransform(E);
7352 !CheckAndAdvanceTypoExprCorrectionStreams())
7365 while (!AmbiguousTypoExprs.empty()) {
7366 auto TE = AmbiguousTypoExprs.back();
7367 auto Cached = TransformCache[TE];
7369 State.Consumer->saveCurrentPosition();
7370 TransformCache.erase(TE);
7372 State.Consumer->resetCorrectionStream();
7373 TransformCache.erase(TE);
7377 AmbiguousTypoExprs.remove(TE);
7378 State.Consumer->restoreSavedPosition();
7379 TransformCache[TE] = Cached;
7385 FindTypoExprs(TypoExprs).TraverseStmt(E);
7387 EmitAllDiagnostics();
7396 auto &CacheEntry = TransformCache[
E];
7397 if (!TypoExprs.insert(E) && !CacheEntry.isUnset()) {
7402 assert(State.Consumer &&
"Cannot transform a cleared TypoExpr");
7406 while (
TypoCorrection TC = State.Consumer->getNextCorrection()) {
7412 State.RecoveryHandler(SemaRef, E, TC) :
7419 if ((Next = State.Consumer->peekNextCorrection()) &&
7421 AmbiguousTypoExprs.insert(E);
7423 AmbiguousTypoExprs.remove(E);
7426 "Typo was transformed into a valid-but-null ExprResult");
7427 return CacheEntry = NE;
7445 assert(TyposInContext < ~0U &&
"Recursive call of CorrectDelayedTyposInExpr");
7447 auto TyposResolved = DelayedTypos.size();
7448 auto Result = TransformTypos(*
this, InitDecl, Filter).Transform(E);
7450 TyposResolved -= DelayedTypos.size();
7455 assert(TyposResolved == 0 &&
"Corrected typo but got same Expr back?");
7461 bool DiscardedValue,
7463 bool IsLambdaInitCaptureInitializer) {
7466 if (!FullExpr.
get())
7484 if (!IsLambdaInitCaptureInitializer &&
7489 if (DiscardedValue &&
getLangOpts().DebuggerCastResultToId &&
7496 if (DiscardedValue) {
7510 CheckCompletedExpr(FullExpr.
get(), CC, IsConstexpr);
7559 while (DC && isa<CapturedDecl>(DC))
7562 if (IsInLambdaDeclContext && CurrentLSI &&
7563 CurrentLSI->hasPotentialCaptures() && !FullExpr.
isInvalid())
7607 llvm_unreachable(
"Invalid LookupResult Kind!");
bool isDependentName() const
Determines whether the name itself is dependent, e.g., because it involves a C++ type that is itself ...
static bool CheckArrow(Sema &S, QualType &ObjectType, Expr *&Base, tok::TokenKind &OpKind, SourceLocation OpLoc)
unsigned getFlags() const
getFlags - Return the flags for this scope.
A call to an overloaded operator written using operator syntax.
unsigned getAddressSpace() const
Return the address space of this type.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
bool isObjCObjectOrInterfaceType() const
Function pointer conversion (C++17 4.13)
DeclAccessPair FoundConversionFunction
The declaration that we found via name lookup, which might be the same as ConversionFunction or it mi...
Defines the clang::ASTContext interface.
bool isAddressOfOperand() const
SourceLocation getEnd() const
CanThrowResult canThrow(const Expr *E)
unsigned DeprecatedStringLiteralToCharPtr
Whether this is the deprecated conversion of a string literal to a pointer to non-const character dat...
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
This is the scope of a C++ try statement.
ExprResult ActOnArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, ParsedType LhsTy, Expr *DimExpr, SourceLocation RParen)
ActOnArrayTypeTrait - Parsed one of the binary type trait support pseudo-functions.
CastKind getCastKind() const
The null pointer literal (C++11 [lex.nullptr])
void clearPotentialCaptures()
IdKind getKind() const
Determine what kind of name we have.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
void setImplicit(bool I=true)
void MarkVarDeclODRUsed(VarDecl *Var, SourceLocation Loc, Sema &SemaRef, const unsigned *const FunctionScopeIndexToStopAt)
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, DeclarationName Name, FunctionDecl *&Operator, bool Diagnose=true)
Name lookup found a set of overloaded functions that met the criteria.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
bool EllipsisConversion
EllipsisConversion - When this is true, it means user-defined conversion sequence starts with a ...
bool isNullPtrType() const
static bool EvaluateExpressionTrait(ExpressionTrait ET, Expr *E)
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
no exception specification
bool Diagnose(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, ArrayRef< Expr * > Args)
Diagnose an potentially-invalid initialization sequence.
bool isNonOverloadPlaceholderType() const
Test for a placeholder type other than Overload; see BuiltinType::isNonOverloadPlaceholderType.
PointerType - C99 6.7.5.1 - Pointer Declarators.
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
Stores the type being destroyed by a pseudo-destructor expression.
A (possibly-)qualified type.
This is a scope that corresponds to the parameters within a function prototype.
Simple class containing the result of Sema::CorrectTypo.
void addThisCapture(bool isNested, SourceLocation Loc, Expr *Cpy, bool ByCopy)
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
static bool IsSpecialDiscardedValue(Expr *E)
capture_const_range captures() const
ConditionResult ActOnConditionVariable(Decl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id)
QualType getConversionType() const
Returns the type that this conversion function is converting to.
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after...
bool isMemberPointerType() const
static InitializedEntity InitializeException(SourceLocation ThrowLoc, QualType Type, bool NRVO)
Create the initialization entity for an exception object.
SourceLocation StartLocation
The location of the first token that describes this unqualified-id, which will be the location of the...
static const CastKind CK_Invalid
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
bool tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name)
Try to add the given declaration to the top level scope, if it (or a redeclaration of it) hasn't alre...
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc...
IdentifierInfo * Name
FIXME: Temporarily stores the name of a specialization.
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type...
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
const LangOptions & getLangOpts() const
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()
Qualifiers::ObjCLifetime getObjCARCImplicitLifetime() const
Return the implicit lifetime for this type, which must not be dependent.
DeclClass * getAsSingle() const
static void collectPublicBases(CXXRecordDecl *RD, llvm::DenseMap< CXXRecordDecl *, unsigned > &SubobjectsSeen, llvm::SmallPtrSetImpl< CXXRecordDecl * > &VBases, llvm::SetVector< CXXRecordDecl * > &PublicSubobjectsSeen, bool ParentIsPublic)
QualType CXXThisTypeOverride
When non-NULL, the C++ 'this' expression is allowed despite the current context not being a non-stati...
Stmt - This represents one statement.
IdentifierInfo * Identifier
When Kind == IK_Identifier, the parsed identifier, or when Kind == IK_UserLiteralId, the identifier suffix.
bool isGenericLambdaCallOperatorSpecialization(const CXXMethodDecl *MD)
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
FunctionType - C99 6.7.5.3 - Function Declarators.
FullExprArg MakeFullExpr(Expr *Arg)
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
Provides information about an attempted template argument deduction, whose success or failure was des...
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
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 ...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
Microsoft __if_not_exists.
static void getUnambiguousPublicSubobjects(CXXRecordDecl *RD, llvm::SmallVectorImpl< CXXRecordDecl * > &Objects)
const Scope * getParent() const
getParent - Return the scope that this is nested in.
void addConst()
Add the const type qualifier to this QualType.
ActionResult< Expr * > ExprResult
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
Complex conversions (C99 6.3.1.6)
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
bool isRecordType() const
UserDefinedConversionSequence UserDefined
When ConversionKind == UserDefinedConversion, provides the details of the user-defined conversion seq...
static bool FindConditionalOverload(Sema &Self, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
Try to find a common type for two according to C++0x 5.16p5.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
bool DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr, SourceLocation QuestionLoc)
Emit a specialized diagnostic when one expression is a null pointer constant and the other is not a p...
Decl - This represents one declaration (or definition), e.g.
bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, const FunctionProtoType *Proto, unsigned FirstParam, ArrayRef< Expr * > Args, SmallVectorImpl< Expr * > &AllArgs, VariadicCallType CallType=VariadicDoesNotApply, bool AllowExplicit=false, bool IsListInitialization=false)
GatherArgumentsForCall - Collector argument expressions for various form of call prototypes.
ExprResult ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation LParen, Expr *Operand, SourceLocation RParen)
AssignConvertType
AssignConvertType - All of the 'assignment' semantic checks return this enum to indicate whether the ...
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, bool AllowBuiltinCreation=false, bool EnteringContext=false)
Performs name lookup for a name that was parsed in the source code, and may contain a C++ scope speci...
ExprResult BuildBlockForLambdaConversion(SourceLocation CurrentLocation, SourceLocation ConvLocation, CXXConversionDecl *Conv, Expr *Src)
bool hasAutoTypeSpec() const
bool isEnumeralType() const
ParenExpr - This represents a parethesized expression, e.g.
std::string getAsString() 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.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
QualType getPointeeType() const
The base class of the type hierarchy.
This indicates that the scope corresponds to a function, which means that labels are set here...
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
unsigned IncompatibleObjC
IncompatibleObjC - Whether this is an Objective-C conversion that we should warn about (if we actuall...
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
QualType getRecordType(const RecordDecl *Decl) const
One instance of this struct is used for each type in a declarator that is parsed. ...
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 ...
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
Represents a call to a C++ constructor.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent...
Ambiguous candidates found.
Incompatible - We reject this conversion outright, it is invalid to represent it in the AST...
bool isBooleanType() const
A container of type source information.
bool hasPotentialThisCapture() const
Conversions between compatible types in C99.
bool isBlockPointerType() const
static bool evaluateTypeTrait(Sema &S, TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
static CXXFunctionalCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, TypeSourceInfo *Written, CastKind Kind, Expr *Op, const CXXCastPath *Path, SourceLocation LPLoc, SourceLocation RPLoc)
ExprResult ActOnExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
ActOnExpressionTrait - Parsed one of the unary type trait support pseudo-functions.
Represents a C++ constructor within a class.
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2, C99 6.9p3)
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
static InitializedEntity InitializeTemporary(QualType Type)
Create the initialization entity for a temporary.
bool DisableTypoCorrection
Tracks whether we are in a context where typo correction is disabled.
An identifier, stored as an IdentifierInfo*.
This file provides some common utility functions for processing Lambda related AST Constructs...
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
RAII object that enters a new expression evaluation context.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
ExprResult PerformObjectArgumentInitialization(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, CXXMethodDecl *Method)
PerformObjectArgumentInitialization - Perform initialization of the implicit object parameter for the...
static ExprResult attemptRecovery(Sema &SemaRef, const TypoCorrectionConsumer &Consumer, const TypoCorrection &TC)
IfExistsResult
Describes the result of an "if-exists" condition check.
Expr * getInit() const
Get the initializer.
CleanupInfo Cleanup
Used to control the generation of ExprWithCleanups.
Information about one declarator, including the parsed type information and the identifier.
DiagnosticsEngine & Diags
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
Extra information about a function prototype.
AccessSpecifier getAccess() const
AccessResult CheckDestructorAccess(SourceLocation Loc, CXXDestructorDecl *Dtor, const PartialDiagnostic &PDiag, QualType objectType=QualType())
std::string getDeletedOrUnavailableSuffix(const FunctionDecl *FD)
Retrieve the message suffix that should be added to a diagnostic complaining about the given function...
static bool hasNewExtendedAlignment(Sema &S, QualType AllocType)
Determine whether a type has new-extended alignment.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
bool allowsNonTrivialObjCLifetimeQualifiers() const
True if any ObjC types may have non-trivial lifetime qualifiers.
RAII class that determines when any errors have occurred between the time the instance was created an...
ObjCMethodDecl - Represents an instance or class method declaration.
QualType getThisType(ASTContext &C) const
Returns the type of the this pointer.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
A namespace, stored as a NamespaceDecl*.
bool HadMultipleCandidates
HadMultipleCandidates - When this is true, it means that the conversion function was resolved from an...
bool isMemberDataPointerType() const
static InitializationKind CreateDirectList(SourceLocation InitLoc)
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class.copy]p25)
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[]...
bool isObjCRetainableType() const
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant...
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
Defines the clang::Expr interface and subclasses for C++ expressions.
bool isCXXThisCaptured() const
Determine whether the C++ 'this' is captured.
bool isEmpty() const
No scope specifier.
The collection of all-type qualifiers we support.
Information about a template-id annotation token.
EvaluatedStmt * ensureEvaluatedStmt() const
Convert the initializer for this declaration to the elaborated EvaluatedStmt form, which contains extra information on the evaluated value of the initializer.
static CXXUnresolvedConstructExpr * Create(const ASTContext &C, TypeSourceInfo *Type, SourceLocation LParenLoc, ArrayRef< Expr * > Args, SourceLocation RParenLoc)
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
bool hasTrivialCopyConstructor() const
Determine whether this class has a trivial copy constructor (C++ [class.copy]p6, C++11 [class...
ExprResult PerformImplicitConversion(Expr *From, QualType ToType, AssignmentAction Action, bool AllowExplicit=false)
PerformImplicitConversion - Perform an implicit conversion of the expression From to the type ToType...
void setCorrectionDecl(NamedDecl *CDecl)
Clears the list of NamedDecls before adding the new one.
static void noteOperatorArrows(Sema &S, ArrayRef< FunctionDecl * > OperatorArrows)
Note a set of 'operator->' functions that were used for a member access.
unsigned getNumParams() const
Expr * FixOverloadedFunctionReference(Expr *E, DeclAccessPair FoundDecl, FunctionDecl *Fn)
FixOverloadedFunctionReference - E is an expression that refers to a C++ overloaded function (possibl...
RecordDecl - Represents a struct/union/class.
QualType 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 ...
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
static bool ConvertForConditional(Sema &Self, ExprResult &E, QualType T)
Perform an "extended" implicit conversion as returned by TryClassUnification.
TemplateIdAnnotation * TemplateId
When Kind == IK_TemplateId or IK_ConstructorTemplateId, the template-id annotation that contains the ...
DeclarationName getName() const
getName - Returns the embedded declaration name.
Boolean conversions (C++ 4.12)
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.
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
bool isScalarType() const
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name)
Retrieves the declaration name from a parsed unqualified-id.
TagDecl * getAsTagDecl() const
Retrieves the TagDecl that this type refers to, either because the type is a TagType or because it is...
Represents a class type in Objective C.
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isDirectReferenceBinding() const
Determine whether this initialization is a direct reference binding (C++ [dcl.init.ref]).
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
void DropFirstTypeObject()
A C++ nested-name-specifier augmented with source location information.
Represents a dependent template name that cannot be resolved prior to template instantiation.
The results of name lookup within a DeclContext.
bool isObjCARCImplicitlyUnretainedType() const
Determines if this type, which must satisfy isObjCLifetimeType(), is implicitly __unsafe_unretained r...
bool hasNonTrivialCopyConstructor() const
Determine whether this class has a non-trivial copy constructor (C++ [class.copy]p6, C++11 [class.copy]p12)
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
const ASTMatchFinder::BindKind Bind
QualType getLifetimeQualifiedType(QualType type, Qualifiers::ObjCLifetime lifetime)
Return a type with the given lifetime qualifier.
bool isReferenceType() const
QualType getReturnType() const
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
The current expression is potentially evaluated at run time, which means that code may be generated t...
bool isAnyPointerType() const
Identity conversion (no conversion)
void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AddBuiltinOperatorCandidates - Add the appropriate built-in operator overloads to the candidate set (...
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)
Floating point conversions (C++ 4.8)
The iterator over UnresolvedSets.
SourceRange getLocalSourceRange() const
Get the local source range.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
static const TST TST_error
ExprResult ActOnCXXUuidof(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXUuidof - Parse __uuidof( something ).
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
static DeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *D, bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc, QualType T, ExprValueKind VK, NamedDecl *FoundD=nullptr, const TemplateArgumentListInfo *TemplateArgs=nullptr)
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
bool hasNonTrivialDefaultConstructor() const
Determine whether this class has a non-trivial default constructor (C++11 [class.ctor]p5).
SourceLocation getTypeSpecTypeLoc() const
bool refersToVectorElement() const
Returns whether this expression refers to a vector element.
ParsedType getDestructorName(SourceLocation TildeLoc, IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose=true)
DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
void PopExpressionEvaluationContext()
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
Stmt * MaybeCreateStmtWithCleanups(Stmt *SubStmt)
void NoteDeletedFunction(FunctionDecl *FD)
Emit a note explaining that this function is deleted.
EnumDecl * getStdAlignValT() const
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
void getPotentialVariableCapture(unsigned Idx, VarDecl *&VD, Expr *&E) const
Floating point promotions (C++ 4.6)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
SourceLocation getBeginLoc() const
Get the begin source location.
Describes an C or C++ initializer list.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
This is a scope that corresponds to a block/closure object.
ExprResult ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *expr)
ActOnCXXThrow - Parse throw expressions.
Represents a C++ unqualified-id that has been parsed.
bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid)
Determine whether the use of this declaration is valid, without emitting diagnostics.
bool isCompleteType(SourceLocation Loc, QualType T)
void setNameLoc(SourceLocation Loc)
NamespaceDecl * getOrCreateStdNamespace()
Retrieve the special "std" namespace, which may require us to implicitly define the namespace...
Represents the results of name lookup.
void DeclareGlobalNewDelete()
DeclareGlobalNewDelete - Declare the global forms of operator new and delete.
const TargetInfo & getTargetInfo() const
An lvalue ref-qualifier was provided (&).
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...
const LangOptions & getLangOpts() const
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
bool isFundamentalType() const
Tests whether the type is categorized as a fundamental type.
Microsoft throw(...) extension.
ReferenceCompareResult CompareReferenceRelationship(SourceLocation Loc, QualType T1, QualType T2, bool &DerivedToBase, bool &ObjCConversion, bool &ObjCLifetimeConversion)
CompareReferenceRelationship - Compare the two types T1 and T2 to determine whether they are referenc...
Succeeded, but refers to a deleted function.
const CXXScopeSpec * getSS() const
bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E)
CheckCXXThrowOperand - Validate the operand of a throw.
Ref_Compatible - The two types are reference-compatible.
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
bool exprNeedsCleanups() const
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
unsigned getNewAlign() const
Return the largest alignment for which a suitably-sized allocation with '::operator new(size_t)' is g...
bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit=false, bool BuildAndDiagnose=true, const unsigned *const FunctionScopeIndexToStopAt=nullptr, bool ByCopy=false)
Make sure the value of 'this' is actually available in the current context, if it is a potentially ev...
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
char * location_data() const
Retrieve the data associated with the source-location information.
SourceLocation getLocStart() const LLVM_READONLY
TypeDecl - Represents a declaration of a type.
A builtin binary operation expression such as "x + y" or "x <= y".
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
RecordDecl * getDecl() const
ImplicitConversionKind Second
Second - The second conversion can be an integral promotion, floating point promotion, integral conversion, floating point conversion, floating-integral conversion, pointer conversion, pointer-to-member conversion, or boolean conversion.
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface...
ParsedTemplateArgument * getTemplateArgs()
Retrieves a pointer to the template arguments.
static InitializationKind CreateValue(SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool isImplicit=false)
Create a value initialization.
CheckedConversionKind
The kind of conversion being performed.
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
FunctionDecl * ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, QualType TargetType, bool Complain, DeclAccessPair &Found, bool *pHadMultipleCandidates=nullptr)
ResolveAddressOfOverloadedFunction - Try to resolve the address of an overloaded function (C++ [over...
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
IfExistsResult CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS, const DeclarationNameInfo &TargetNameInfo)
bool isVariadic() const
Whether this function is variadic.
DeclContext * getLambdaAwareParentOfDeclContext(DeclContext *DC)
Scope - A scope is a transient data structure that is used while parsing the program.
ExprResult Perform(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, QualType *ResultType=nullptr)
Perform the actual initialization of the given entity based on the computed initialization sequence...
New-expression has a C++98 paren-delimited initializer.
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Qualification conversions (C++ 4.4)
bool isAmbiguous() const
Determine whether this initialization failed due to an ambiguity.
bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, bool UseGlobal, QualType AllocType, bool IsArray, bool &PassAlignment, MultiExprArg PlaceArgs, FunctionDecl *&OperatorNew, FunctionDecl *&OperatorDelete)
FindAllocationFunctions - Finds the overloads of operator new and delete that are appropriate for the...
static unsigned getNumAddressingBits(const ASTContext &Context, QualType ElementType, const llvm::APInt &NumElements)
Determine the number of bits required to address a member of.
ExprResult ActOnCXXThis(SourceLocation loc)
bool isWeak() const
Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr...
Represents a C++ nested-name-specifier or a global scope specifier.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
TypeSourceInfo * getTypeSourceInfo() const
TypeClass getTypeClass() const
enum clang::DeclaratorChunk::@196 Kind
bool isStructureType() const
ExprResult CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond)
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
Represents binding an expression to a temporary.
ArrayTypeTrait
Names for the array type traits.
CXXTemporary * getTemporary()
AccessResult CheckConstructorAccess(SourceLocation Loc, CXXConstructorDecl *D, DeclAccessPair FoundDecl, const InitializedEntity &Entity, bool IsCopyBindingRefToTemp=false)
Checks access to a constructor.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
static 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'.
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
bool isTrivialType(const ASTContext &Context) const
Return true if this is a trivial type per (C++0x [basic.types]p9)
An ordinary object is located at an address in memory.
bool isLambdaCallOperator(const CXXMethodDecl *MD)
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
The number of conversion kinds.
A class that does preordor or postorder depth-first traversal on the entire Clang AST and visits each...
Represents an ObjC class declaration.
bool isExtVectorType() const
CastKind PrepareScalarCast(ExprResult &src, QualType destType)
Prepares for a scalar cast, performing all the necessary stages except the final cast and returning t...
ImplicitConversionKind Third
Third - The third conversion can be a qualification conversion or a function conversion.
detail::InMemoryDirectory::const_iterator I
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
Integral promotions (C++ 4.5)
const LangOptions & LangOpts
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInlineSpecified=false, bool hasWrittenPrototype=true, bool isConstexprSpecified=false)
bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType)
Helper function to determine whether this is the (deprecated) C++ conversion from a string literal to...
This object can be modified without requiring retains or releases.
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5...
bool isDefined(const FunctionDecl *&Definition) const
isDefined - Returns true if the function is defined at all, including a deleted definition.
SourceLocation TemplateKWLoc
TemplateKWLoc - The location of the template keyword.
Represents the this expression in C++.
C-only conversion between pointers with incompatible types.
bool isAbstract() const
Determine whether this class has a pure virtual function.
New-expression has no initializer as written.
static InitializedEntity InitializeNew(SourceLocation NewLoc, QualType Type)
Create the initialization entity for an object allocated via new.
TypeTrait
Names for traits that operate specifically on types.
SourceLocation LAngleLoc
The location of the '<' before the template argument list.
EnumDecl * getDecl() const
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
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...
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
ConditionalOperator - The ?: ternary operator.
ExtInfo getExtInfo() const
Sema - This implements semantic analysis and AST building for C.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
CompoundStmt - This represents a group of statements like { stmt stmt }.
TST getTypeSpecType() const
const DeclarationNameInfo & getLookupNameInfo() const
Gets the name info to look up.
QualType getParamType(unsigned i) const
Represents a prototype with parameter type info, e.g.
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
bool hasIrrelevantDestructor() const
Determine whether this class has a destructor which has no semantic effect.
static NamedDecl * getDeclFromExpr(Expr *E)
Transparent Union Conversions.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
Retains information about a captured region.
bool isStdInitializerList(QualType Ty, QualType *Element)
Tests whether Ty is an instance of std::initializer_list and, if it is and Element is not NULL...
CastKind
CastKind - The kind of operation required for a conversion.
SourceLocation getLocEnd() const LLVM_READONLY
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat)
DeclarationNameTable DeclarationNames
QualType getLogicalOperationType() const
The result type of logical operations, '<', '>', '!=', etc.
bool CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess, bool Diagnose=true)
CheckPointerConversion - Check the pointer conversion from the expression From to the type ToType...
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
SourceLocation PotentialThisCaptureLocation
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
ExprResult CheckConditionVariable(VarDecl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
Check the use of the given variable as a C++ condition in an if, while, do-while, or switch statement...
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
bool isRealFloatingType() const
Floating point categories.
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
unsigned hasStatic
True if this dimension included the 'static' keyword.
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
bool isDeleted() const
Whether this function has been deleted.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
static bool resolveAllocationOverload(Sema &S, LookupResult &R, SourceRange Range, SmallVectorImpl< Expr * > &Args, bool &PassAlignment, FunctionDecl *&Operator, OverloadCandidateSet *AlignedCandidates=nullptr, Expr *AlignArg=nullptr)
Expr - This represents one expression.
bool isOrdinaryOrBitFieldObject() const
DeclarationName getLookupName() const
Gets the name to look up.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
static ExprResult BuildCXXCastArgument(Sema &S, SourceLocation CastLoc, QualType Ty, CastKind Kind, CXXMethodDecl *Method, DeclAccessPair FoundDecl, bool HadMultipleCandidates, Expr *From)
CXXRecordDecl * getNamingClass() const
Returns the 'naming class' for this lookup, i.e.
bool isDeclScope(Decl *D)
isDeclScope - Return true if this is the scope that the specified decl is declared in...
bool isAnyComplexType() const
ParsedType getDestructorTypeForDecltype(const DeclSpec &DS, ParsedType ObjectType)
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT, SourceLocation KeyLoc, QualType T)
NestedNameSpecifier * getCorrectionSpecifier() const
Gets the NestedNameSpecifier needed to use the typo correction.
static SourceLocation findLocationAfterToken(SourceLocation loc, tok::TokenKind TKind, const SourceManager &SM, const LangOptions &LangOpts, bool SkipTrailingWhitespaceAndNewLine)
Checks that the given token is the first token that occurs after the given location (this excludes co...
StandardConversionSequence After
After - Represents the standard conversion that occurs after the actual user-defined conversion...
SourceLocation getNameLoc() const
Gets the location of the identifier.
This file defines the classes used to store parsed information about declaration-specifiers and decla...
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...
ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, UnqualifiedId &SecondTypeName)
TranslationUnitDecl * getTranslationUnitDecl() const
Defines the clang::Preprocessor interface.
SmallVectorImpl< OverloadCandidate >::iterator iterator
bool IsVariableAConstantExpression(VarDecl *Var, ASTContext &Context)
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, bool AllowFold=true)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
const ParmVarDecl * getParamDecl(unsigned i) const
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...
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 isFloatingType() 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...
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
Classification Classify(ASTContext &Ctx) const
Classify - Classify this expression according to the C++11 expression taxonomy.
Represents a C++ template name within the type system.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
Defines the clang::TypeLoc interface and its subclasses.
A namespace alias, stored as a NamespaceAliasDecl*.
Floating-integral conversions (C++ 4.9)
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7)...
void DiscardCleanupsInEvaluationContext()
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT, QualType LhsT, QualType RhsT, SourceLocation KeyLoc)
bool isReplaceableGlobalAllocationFunction(bool *IsAligned=nullptr) const
Determines whether this function is one of the replaceable global allocation functions: void *operato...
ExprResult ActOnTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< ParsedType > Args, SourceLocation RParenLoc)
Parsed one of the type trait support pseudo-functions.
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes
Stack containing information about each of the nested function, block, and method scopes that are cur...
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
SourceLocation Loc
Loc - The place where this type was defined.
StandardConversionSequence Standard
When ConversionKind == StandardConversion, provides the details of the standard conversion sequence...
clang::ObjCRuntime ObjCRuntime
DeclContext * getParent()
getParent - Returns the containing DeclContext.
QualType getObjCIdType() const
Represents the Objective-CC id type.
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false)
Add a C++ function template specialization as a candidate in the candidate set, using template argume...
A boolean condition, from 'if', 'while', 'for', or 'do'.
An expression that sends a message to the given Objective-C object or class.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
static uint64_t EvaluateArrayTypeTrait(Sema &Self, ArrayTypeTrait ATT, QualType T, Expr *DimExpr, SourceLocation KeyLoc)
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
ParsedType getInheritingConstructorName(CXXScopeSpec &SS, SourceLocation NameLoc, IdentifierInfo &Name)
Handle the result of the special case name lookup for inheriting constructor declarations.
CXXRecordDecl * getStdBadAlloc() const
void CleanupVarDeclMarking()
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
Represents a C++ conversion function within a class.
QualType getCVRQualifiedType(QualType T, unsigned CVR) const
Return a type with additional const, volatile, or restrict qualifiers.
The result type of a method or function.
void removeLocalCVRQualifiers(unsigned Mask)
A type, stored as a Type*.
const LookupResult & getLookupResult() const
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
QualType getWideCharType() const
Return the type of wide characters.
unsigned getEditDistance(bool Normalized=true) const
Gets the "edit distance" of the typo correction from the typo.
const Expr * getAnyInitializer() const
getAnyInitializer - Get the initializer for this variable, no matter which declaration it is attached...
const TypoExprState & getTypoExprState(TypoExpr *TE) const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
bool isObjectType() const
Determine whether this type is an object type.
static InitializationKind CreateCopy(SourceLocation InitLoc, SourceLocation EqualLoc, bool AllowExplicitConvs=false)
Create a copy initialization.
ExprResult ActOnFinishFullExpr(Expr *Expr)
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
Lvalue-to-rvalue conversion (C++ 4.1)
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
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.
DeclContext * getEntity() const
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
Integral conversions (C++ 4.7)
Complex promotions (Clang extension)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor...
Assigning into this object requires the old value to be released and the new value to be retained...
static CXXBindTemporaryExpr * Create(const ASTContext &C, CXXTemporary *Temp, Expr *SubExpr)
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
ExceptionSpecificationType Type
The kind of exception specification this is.
ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, IdentifierInfo *II, bool AllowBuiltinCreation=false)
LookupInObjCMethod - The parser has read a name in, and Sema has detected that we're currently inside...
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.
Encodes a location in the source.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
unsigned getNumParams() const
getNumParams - Return the number of parameters this function must have based on its FunctionType...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
static InitializedEntity InitializeLambdaCapture(IdentifierInfo *VarID, QualType FieldType, SourceLocation Loc)
Create the initialization entity for a lambda capture.
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
QualType getElementType() const
QualType withCVRQualifiers(unsigned CVR) const
static void diagnoseUnavailableAlignedAllocation(const FunctionDecl &FD, SourceLocation Loc, bool IsDelete, Sema &S)
Represents a C++ temporary.
CXXRecordDecl * Lambda
The class that describes the lambda.
Expr * getRepAsExpr() const
bool isValid() const
Return true if this is a valid SourceLocation object.
FunctionDecl * FindUsualDeallocationFunction(SourceLocation StartLoc, bool CanProvideSize, bool Overaligned, DeclarationName Name)
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
Represents a call to a member function that may be written either with member call syntax (e...
QualType DeduceTemplateSpecializationFromInitializer(TypeSourceInfo *TInfo, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Init)
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
ASTContext & getASTContext() const
IdentifierTable & getIdentifierTable()
A vector splat from an arithmetic type.
llvm::APSInt EvaluateKnownConstInt(const ASTContext &Ctx, SmallVectorImpl< PartialDiagnosticAt > *Diag=nullptr) const
EvaluateKnownConstInt - Call EvaluateAsRValue and return the folded integer.
Optional< unsigned > getStackIndexOfNearestEnclosingCaptureCapableLambda(ArrayRef< const sema::FunctionScopeInfo * > FunctionScopes, VarDecl *VarToCapture, Sema &S)
Examines the FunctionScopeInfo stack to determine the nearest enclosing lambda (to the current lambda...
QualType withConst() const
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
SourceLocation getLocStart() const LLVM_READONLY
Represents a static or instance method of a struct/union/class.
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
ExprResult DefaultLvalueConversion(Expr *E)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
No ref-qualifier was provided.
void setDestructor(const CXXDestructorDecl *Dtor)
ExtInfo withNoReturn(bool noReturn) const
Objective-C ARC writeback conversion.
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 CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
bool isInvalid() const
An error occurred during parsing of the scope specifier.
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
const ConstantArrayType * getAsConstantArrayType(QualType T) const
Name lookup found an unresolvable value declaration and cannot yet complete.
bool isNothrow(const ASTContext &Ctx, bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
bool isIntegerConstantExpr(llvm::APSInt &Result, const ASTContext &Ctx, SourceLocation *Loc=nullptr, bool isEvaluated=true) const
isIntegerConstantExpr - Return true if this expression is a valid integer constant expression...
ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr=false)
CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Describes the kind of initialization being performed, along with location information for tokens rela...
TemplateDeductionResult DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, const TemplateArgumentList &TemplateArgs, sema::TemplateDeductionInfo &Info)
Perform template argument deduction to determine whether the given template arguments match the given...
Look up any declaration with any name.
AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, ExprResult &RHS)
bool CheckMemberPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess)
CheckMemberPointerConversion - Check the member pointer conversion from the expression From to the ty...
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
Pointer conversions (C++ 4.10)
Lookup for candidates for a call using operator syntax.
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, Expr *ArraySize, SourceRange DirectInitRange, Expr *Initializer)
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
static bool VariableCanNeverBeAConstantExpression(VarDecl *Var, ASTContext &Context)
SourceLocation getBegin() const
Requests that all candidates be shown.
const T * castAs() const
Member-template castAs<specific type>.
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
No entity found met the criteria.
bool isFileContext() const
bool isVectorType() const
bool isThisOutsideMemberFunctionBody(QualType BaseType)
Determine whether the given type is the type of *this that is used outside of the body of a member fu...
SourceRange getSourceRange() const override LLVM_READONLY
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.
bool isMemberFunctionPointerType() const
Derived-to-base (C++ [over.best.ics])
Complex-real conversions (C99 6.3.1.7)
An rvalue ref-qualifier was provided (&&).
Assigning into this object requires a lifetime extension.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
static Expr * captureThis(Sema &S, ASTContext &Context, RecordDecl *RD, QualType ThisTy, SourceLocation Loc, const bool ByCopy)
ObjCBoxedExpr - used for generalized expression boxing.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13...
Constant expression in a noptr-new-declarator.
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, Declarator &D, Expr *Initializer)
ActOnCXXNew - Parsed a C++ 'new' expression.
bool refersToBitField() const
Returns true if this expression is a gl-value that potentially refers to a bit-field.
MutableArrayRef< Expr * > MultiExprArg
QualType getType() const
Return the type wrapped by this type source info.
static bool CheckUnaryTypeTraitTypeCompleteness(Sema &S, TypeTrait UTT, SourceLocation Loc, QualType ArgTy)
Check the completeness of a type in a unary type trait.
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type...
QualType CXXCheckConditionalOperands(ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc)
Check the operands of ?: under C++ semantics.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
QualType getPointeeType() const
bool hasTrivialCopyAssignment() const
Determine whether this class has a trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
A POD class for pairing a NamedDecl* with an access specifier.
AccessResult CheckAllocationAccess(SourceLocation OperatorLoc, SourceRange PlacementRange, CXXRecordDecl *NamingClass, DeclAccessPair FoundDecl, bool Diagnose=true)
Checks access to an overloaded operator new or delete.
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool *NoArrowOperatorFound=nullptr)
BuildOverloadedArrowExpr - Build a call to an overloaded operator-> (if one exists), where Base is an expression of class type and Member is the name of the member we're trying to find.
ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl, CXXConversionDecl *Method, bool HadMultipleCandidates)
The scope of a struct/union/class definition.
QualType getCallReturnType(const ASTContext &Ctx) const
getCallReturnType - Get the return type of the call expr.
SourceRange getSourceRange() const LLVM_READONLY
Get the source range that spans this declarator.
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
static unsigned getMaxSizeBits(const ASTContext &Context)
Determine the maximum number of active bits that an array's size can require, which limits the maximu...
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
Represents a template argument.
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
void DiagnoseAmbiguousConversion(Sema &S, SourceLocation CaretLoc, const PartialDiagnostic &PDiag) const
Diagnoses an ambiguous conversion.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
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 bool isInvalid(LocType Loc, bool *Invalid)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
Abstract base class used to perform a contextual implicit conversion from an expression to any type p...
void CheckVirtualDtorCall(CXXDestructorDecl *dtor, SourceLocation Loc, bool IsDelete, bool CallCanBeVirtual, bool WarnOnNonAbstractTypes, SourceLocation DtorLoc)
bool hasEmptyCollections() const
Are the empty collection symbols available?
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...
bool isAggregateType() const
Determines whether the type is a C++ aggregate type or C aggregate or union type. ...
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. ...
static bool isLegalArrayNewInitializer(CXXNewExpr::InitializationStyle Style, Expr *Init)
The base class of all kinds of template declarations (e.g., class, function, etc.).
Sema::LookupNameKind getLookupKind() const
Gets the kind of lookup to perform.
static const TST TST_decltype
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return 0.
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_RValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CCK_ImplicitConversion)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, CXXConstructorDecl *CD)
CXXScopeSpec SS
The nested-name-specifier that precedes the template name.
SourceLocation RAngleLoc
The location of the '>' after the template argument list.
bool isInvalidDecl() const
bool getProducesResult() const
bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics...
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
Conversions allowed in C, but not C++.
A constant boolean condition from 'if constexpr'.
Array-to-pointer conversion (C++ 4.2)
bool isStandardLayoutType() const
Test if this type is a standard-layout type.
QualType getExceptionObjectType(QualType T) const
bool GlobalNewDeleteDeclared
A flag to remember whether the implicit forms of operator new and delete have been declared...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
bool hasTrivialDefaultConstructor() const
Determine whether this class has a trivial default constructor (C++11 [class.ctor]p5).
DeclarationName - The name of a declaration.
StandardConversionSequence Before
Represents the standard conversion that occurs before the actual user-defined conversion.
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language...
ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr)
Prepare SplattedExpr for a vector splat operation, adding implicit casts if necessary.
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
SourceLocation getLocStart() const LLVM_READONLY
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
size_t param_size() const
bool hasTrivialMoveConstructor() const
Determine whether this class has a trivial move constructor (C++11 [class.copy]p12) ...
Requests that only viable candidates be shown.
detail::InMemoryDirectory::const_iterator E
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
A pointer to member type per C++ 8.3.3 - Pointers to members.
IdentifierResolver IdResolver
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)
ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...
CXXThisScopeRAII(Sema &S, Decl *ContextDecl, unsigned CXXThisTypeQuals, bool Enabled=true)
Introduce a new scope where 'this' may be allowed (when enabled), using the given declaration (which ...
bool isLValueReferenceType() const
FieldDecl * getMember() const
If this is a member initializer, returns the declaration of the non-static data member being initiali...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
A type that was preceded by the 'template' keyword, stored as a Type*.
static EnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl, bool IsScoped, bool IsScopedUsingClassTag, bool IsFixed)
bool isLambda() const
Determine whether this class describes a lambda function object.
Expr * IgnoreParenImpCasts() LLVM_READONLY
IgnoreParenImpCasts - Ignore parentheses and implicit casts.
bool isRValueReferenceType() const
llvm::MapVector< FieldDecl *, DeleteLocs > DeleteExprs
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
FunctionDecl * ConversionFunction
ConversionFunction - The function that will perform the user-defined conversion.
ExprResult IgnoredValueConversions(Expr *E)
IgnoredValueConversions - Given that an expression's result is syntactically ignored, perform any conversions that are required.
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Name lookup found a single declaration that met the criteria.
bool empty() const
Return true if no decls were found.
static void DiagnoseMismatchedNewDelete(Sema &SemaRef, SourceLocation DeleteLoc, const MismatchingNewDeleteDetector &Detector)
StmtResult ActOnFinishFullStmt(Stmt *Stmt)
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a method that was resolved from an overloaded...
bool hasTrivialMoveAssignment() const
Determine whether this class has a trivial move assignment operator (C++11 [class.copy]p25)
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Complex values, per C99 6.2.5p11.
SourceManager & getSourceManager() const
The lookup is a reference to this name that is not for the purpose of redeclaring the name...
const T * getAs() const
Member-template getAs<specific type>'.
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy.
CUDAFunctionPreference IdentifyCUDAPreference(const FunctionDecl *Caller, const FunctionDecl *Callee)
Identifies relative preference of a given Caller/Callee combination, based on their host/device attri...
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, bool IsDecltype=false)
Represents a C++ base or member initializer.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnCXXBoolLiteral - Parse {true,false} literals.
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, SourceLocation Loc, SourceRange Range, CXXCastPath *BasePath=nullptr, bool IgnoreAccess=false)
QualType CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, SourceLocation OpLoc, bool isIndirect)
ExprResult ActOnCXXTypeConstructExpr(ParsedType TypeRep, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
NamedDecl * getFoundDecl() const
Get the correction declaration found by name lookup (before we looked through using shadow declaratio...
SourceLocation getLocStart() const LLVM_READONLY
bool isFunctionType() const
QualType BuildDecltypeType(Expr *E, SourceLocation Loc, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
CanQualType BoundMemberTy
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
AccessResult CheckMemberOperatorAccess(SourceLocation Loc, Expr *ObjectExpr, Expr *ArgExpr, DeclAccessPair FoundDecl)
Checks access to an overloaded member operator, including conversion operators.
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
DeduceAutoResult DeduceAutoType(TypeSourceInfo *AutoType, Expr *&Initializer, QualType &Result, Optional< unsigned > DependentDeductionDepth=None)
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr)
uint64_t getCharWidth() const
Return the size of the character type, in bits.
The template argument is a type.
ExprResult ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXTypeid - Parse typeid( something ).
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
Block Pointer conversions.
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
void addDecl(Decl *D)
Add the declaration D into this context.
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
unsigned getIntWidth() const
getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for this target, in bits.
A template-id, e.g., f<int>.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
void setExprNeedsCleanups(bool SideEffects)
SmallVector< BlockDecl *, 8 > ExprCleanupObjects
ExprCleanupObjects - This is the stack of objects requiring cleanup that are created by the current f...
Represents a base class of a C++ class.
A bitfield object is a bitfield on a C or C++ record.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
Capture & getCXXThisCapture()
Retrieve the capture of C++ 'this', if it has been captured.
void DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc, ArrayRef< Expr * > Args)
DiagnoseSentinelCalls - This routine checks whether a call or message-send is to a declaration with t...
Condition in a constexpr if statement.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
static void getUuidAttrOfType(Sema &SemaRef, QualType QT, llvm::SmallSetVector< const UuidAttr *, 1 > &UuidAttrs)
Grabs __declspec(uuid()) off a type, or returns 0 if we cannot resolve to a single GUID...
static bool TryClassUnification(Sema &Self, Expr *From, Expr *To, SourceLocation QuestionLoc, bool &HaveConversion, QualType &ToType)
Try to convert a type to another according to C++11 5.16p3.
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
A template argument list.
bool hasNonTrivialObjCLifetime() const
ExprResult BuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo, QualType Type, SourceLocation LParenLoc, Expr *CastExpr, SourceLocation RParenLoc)
SourceRange getCorrectionRange() const
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
const Type * getClass() const
Reading or writing from this object requires a barrier call.
Expr * NoexceptExpr
Noexcept expression, if this is EST_ComputedNoexcept.
An integral condition for a 'switch' statement.
bool hasNonTrivialMoveConstructor() const
Determine whether this class has a non-trivial move constructor (C++11 [class.copy]p12) ...
FunctionDecl * FindDeallocationFunctionForDestructor(SourceLocation StartLoc, CXXRecordDecl *RD)
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups, surround it with a ExprWithCleanups node.
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
Function-to-pointer (C++ 4.3)
bool Failed() const
Determine whether the initialization sequence is invalid.
TypeResult ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, IdentifierInfo *TemplateII, SourceLocation TemplateIILoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false, bool IsClassName=false)
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".
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Represents a C++ struct/union/class.
Compatible - the types are compatible according to the standard.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
A user-defined literal name, e.g., operator "" _i.
bool isObjCObjectPointerType() const
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
static QualType adjustCVQualifiersForCXXThisWithinLambda(ArrayRef< FunctionScopeInfo * > FunctionScopes, QualType ThisTy, DeclContext *CurSemaContext, ASTContext &ASTCtx)
Optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
static CXXTemporary * Create(const ASTContext &C, const CXXDestructorDecl *Destructor)
Expr * NumElts
This is the size of the array, or null if [] or [*] was specified.
static bool HasNoThrowOperator(const RecordType *RT, OverloadedOperatorKind Op, Sema &Self, SourceLocation KeyLoc, ASTContext &C, bool(CXXRecordDecl::*HasTrivial)() const, bool(CXXRecordDecl::*HasNonTrivial)() const, bool(CXXMethodDecl::*IsDesiredOp)() const)
bool isCompoundType() const
Tests whether the type is categorized as a compound type.
static TypeTraitExpr * Create(const ASTContext &C, QualType T, SourceLocation Loc, TypeTrait Kind, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc, bool Value)
Create a new type trait expression.
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult{return E;})
Process any TypoExprs in the given Expr and its children, generating diagnostics as appropriate and r...
bool CheckAllocatedType(QualType AllocType, SourceLocation Loc, SourceRange R)
Checks that a type is suitable as the allocated type in a new-expression.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
Declaration of a class template.
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string...
This class is used for builtin types like 'int'.
LookupResultKind getResultKind() const
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) ...
OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best, bool UserDefinedConversion=false)
Find the best viable function on this overload set, if it exists.
StringLiteral - This represents a string literal expression, e.g.
Defines the clang::TargetInfo interface.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool AllowBothBool, bool AllowBoolConversion)
type checking for vector binary operators.
static bool hasAnyTypeDependentArguments(ArrayRef< Expr * > Exprs)
hasAnyTypeDependentArguments - Determines if any of the expressions in Exprs is type-dependent.
static Qualifiers fromCVRMask(unsigned CVR)
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type...
bool isIncompleteArrayType() const
unsigned getAddressSpaceAttributePrintValue() const
Get the address space attribute value to be printed by diagnostics.
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
static OpaquePtr make(QualTypeP)
bool isValid() const
A scope specifier is present, and it refers to a real scope.
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.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool isSet() const
Deprecated.
Represents a type template specialization; the template must be a class template, a type alias templa...
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
unsigned getNumPotentialVariableCaptures() const
Zero constant to event (OpenCL1.2 6.12.10)
ImplicitConversionKind First
First – The first conversion can be an lvalue-to-rvalue conversion, array-to-pointer conversion...
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
const Expr * getSubExpr() const
No viable function found.
void suppressDiagnostics()
Suppress the diagnostics that would normally fire because of this lookup.
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
An l-value expression is a reference to an object with independent storage.
bool isInterfaceType() const
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
bool CompleteConstructorCall(CXXConstructorDecl *Constructor, MultiExprArg ArgsPtr, SourceLocation Loc, SmallVectorImpl< Expr * > &ConvertedArgs, bool AllowExplicit=false, bool IsListInitialization=false)
Given a constructor and the set of arguments provided for the constructor, convert the arguments and ...
void diagnoseNullableToNonnullConversion(QualType DstType, QualType SrcType, SourceLocation Loc)
Warn if we're implicitly casting from a _Nullable pointer type to a _Nonnull one. ...
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
NamedDecl - This represents a decl with a name.
bool isInvalidType() const
A boolean literal, per ([C++ lex.bool] Boolean literals).
void setAccess(AccessSpecifier AS)
bool isVariableExprMarkedAsNonODRUsed(Expr *CapturingVarExpr) const
bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc, CallExpr *CE, FunctionDecl *FD)
CheckCallReturnType - Checks that a call expression's return type is complete.
bool isArithmeticType() const
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
No keyword precedes the qualified type name.
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], or an enum decl which has a signed representation.
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 isConstQualified() const
Determine whether this type is const-qualified.
Pointer-to-member conversions (C++ 4.11)
bool cleanupsHaveSideEffects() const
bool isNull() const
Return true if this QualType doesn't point to a type yet.
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=false, ConversionSequenceList EarlyConversions=None)
AddOverloadCandidate - Adds the given function to the set of candidate functions, using the given fun...
bool isPolymorphic() const
Whether this class is polymorphic (C++ [class.virtual]), which means that the class contains or inher...
Describes an entity that is being initialized.
static FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
unsigned NumArgs
NumArgs - The number of template arguments.
SourceLocation getLocEnd() const LLVM_READONLY
The global specifier '::'. There is no stored value.
SourceLocation getLocStart() const LLVM_READONLY
static OpaquePtr getFromOpaquePtr(void *P)
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
void WillReplaceSpecifier(bool ForceReplacement)
bool isBeingDefined() const
isBeingDefined - Return true if this decl is currently being defined.
Represents the canonical version of C arrays with a specified constant size.
This scope corresponds to an Objective-C method body.
ExceptionSpecInfo ExceptionSpec
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
The symbol does not exist.
Declaration of a template function.
void clear()
Clears out any current state.
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.
QualType UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, bool IsCompAssign=false)
UsualArithmeticConversions - Performs various conversions that are common to binary operators (C99 6...
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
ParsedTemplateTy Template
The declaration of the template corresponding to the template-name.
const RecordDecl * getParent() const
getParent - Returns the parent of this field declaration, which is the struct in which this field is ...
Helper class that creates diagnostics with optional template instantiation stacks.
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
Expr * IgnoreParens() LLVM_READONLY
IgnoreParens - Ignore parentheses.
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool hasInClassInitializer() const
hasInClassInitializer - Determine whether this member has a C++11 in-class initializer.
bool isPointerType() const
Structure used to store a statement, the constant value to which it was evaluated (if any)...
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any...
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3.1.1).