33 #include "llvm/Support/ErrorHandling.h"
34 #include "llvm/Support/raw_ostream.h"
37 using namespace clang;
51 return cast<CXXRecordDecl>(D);
61 if (
const CastExpr *CE = dyn_cast<CastExpr>(E)) {
72 if (CE->getCastKind() ==
CK_NoOp) {
76 }
else if (
const MemberExpr *ME = dyn_cast<MemberExpr>(E)) {
78 assert(ME->getBase()->getType()->isRecordType());
79 if (
FieldDecl *Field = dyn_cast<FieldDecl>(ME->getMemberDecl())) {
80 if (!Field->isBitField() && !Field->getType()->isReferenceType()) {
87 }
else if (
const BinaryOperator *BO = dyn_cast<BinaryOperator>(E)) {
88 if (BO->isPtrMemOp()) {
89 assert(BO->getRHS()->isRValue());
95 }
else if (BO->getOpcode() ==
BO_Comma) {
96 CommaLHSs.push_back(BO->getLHS());
121 switch (UO->getOpcode()) {
123 return UO->getSubExpr()->isKnownToHaveBooleanValue();
134 return CE->getSubExpr()->isKnownToHaveBooleanValue();
137 switch (BO->getOpcode()) {
138 default:
return false;
153 return BO->getLHS()->isKnownToHaveBooleanValue() &&
154 BO->getRHS()->isKnownToHaveBooleanValue();
158 return BO->getRHS()->isKnownToHaveBooleanValue();
163 return CO->getTrueExpr()->isKnownToHaveBooleanValue() &&
164 CO->getFalseExpr()->isKnownToHaveBooleanValue();
176 template <
class E,
class T>
179 return static_cast<const E*
>(
expr)->getExprLoc();
189 return static_cast<const E*
>(
expr)->getLocStart();
194 switch (getStmtClass()) {
195 case Stmt::NoStmtClass: llvm_unreachable(
"statement without class");
196 #define ABSTRACT_STMT(type)
197 #define STMT(type, base) \
198 case Stmt::type##Class: break;
199 #define EXPR(type, base) \
200 case Stmt::type##Class: return getExprLocImpl<type>(this, &type::getExprLoc);
201 #include "clang/AST/StmtNodes.inc"
203 llvm_unreachable(
"unknown expression kind");
215 bool &ValueDependent,
216 bool &InstantiationDependent) {
217 TypeDependent =
false;
218 ValueDependent =
false;
219 InstantiationDependent =
false;
232 TypeDependent =
true;
233 ValueDependent =
true;
234 InstantiationDependent =
true;
237 InstantiationDependent =
true;
245 TypeDependent =
true;
246 ValueDependent =
true;
247 InstantiationDependent =
true;
252 InstantiationDependent =
true;
256 if (isa<NonTypeTemplateParmDecl>(D)) {
257 ValueDependent =
true;
258 InstantiationDependent =
true;
269 if (
VarDecl *Var = dyn_cast<VarDecl>(D)) {
271 Var->getType()->isLiteralType(Ctx) :
272 Var->getType()->isIntegralOrEnumerationType()) &&
273 (Var->getType().isConstQualified() ||
274 Var->getType()->isReferenceType())) {
275 if (
const Expr *Init = Var->getAnyInitializer())
276 if (Init->isValueDependent()) {
277 ValueDependent =
true;
278 InstantiationDependent =
true;
285 if (Var->isStaticDataMember() &&
286 Var->getDeclContext()->isDependentContext()) {
287 ValueDependent =
true;
288 InstantiationDependent =
true;
291 TypeDependent =
true;
301 ValueDependent =
true;
302 InstantiationDependent =
true;
306 void DeclRefExpr::computeDependence(
const ASTContext &Ctx) {
307 bool TypeDependent =
false;
308 bool ValueDependent =
false;
309 bool InstantiationDependent =
false;
311 ValueDependent, InstantiationDependent);
313 ExprBits.TypeDependent |= TypeDependent;
314 ExprBits.ValueDependent |= ValueDependent;
315 ExprBits.InstantiationDependent |= InstantiationDependent;
318 if (
getDecl()->isParameterPack())
319 ExprBits.ContainsUnexpandedParameterPack =
true;
322 DeclRefExpr::DeclRefExpr(
const ASTContext &Ctx,
325 ValueDecl *D,
bool RefersToEnclosingVariableOrCapture,
331 D(D), Loc(NameInfo.getLoc()), DNLoc(NameInfo.
getInfo()) {
332 DeclRefExprBits.HasQualifier = QualifierLoc ? 1 : 0;
334 getInternalQualifierLoc() = QualifierLoc;
336 if (NNS->isInstantiationDependent())
337 ExprBits.InstantiationDependent =
true;
338 if (NNS->containsUnexpandedParameterPack())
339 ExprBits.ContainsUnexpandedParameterPack =
true;
341 DeclRefExprBits.HasFoundDecl = FoundD ? 1 : 0;
343 getInternalFoundDecl() = FoundD;
344 DeclRefExprBits.HasTemplateKWAndArgsInfo
345 = (TemplateArgs || TemplateKWLoc.
isValid()) ? 1 : 0;
346 DeclRefExprBits.RefersToEnclosingVariableOrCapture =
347 RefersToEnclosingVariableOrCapture;
349 bool Dependent =
false;
350 bool InstantiationDependent =
false;
351 bool ContainsUnexpandedParameterPack =
false;
352 getTemplateKWAndArgsInfo()->initializeFrom(TemplateKWLoc, *TemplateArgs,
354 InstantiationDependent,
355 ContainsUnexpandedParameterPack);
356 assert(!Dependent &&
"built a DeclRefExpr with dependent template args");
357 ExprBits.InstantiationDependent |= InstantiationDependent;
358 ExprBits.ContainsUnexpandedParameterPack |= ContainsUnexpandedParameterPack;
359 }
else if (TemplateKWLoc.
isValid()) {
360 getTemplateKWAndArgsInfo()->initializeFrom(TemplateKWLoc);
362 DeclRefExprBits.HadMultipleCandidates = 0;
364 computeDependence(Ctx);
371 bool RefersToEnclosingVariableOrCapture,
377 return Create(Context, QualifierLoc, TemplateKWLoc, D,
378 RefersToEnclosingVariableOrCapture,
380 T, VK, FoundD, TemplateArgs);
387 bool RefersToEnclosingVariableOrCapture,
404 else if (TemplateKWLoc.
isValid())
407 void *Mem = Context.
Allocate(Size, llvm::alignOf<DeclRefExpr>());
408 return new (Mem)
DeclRefExpr(Context, QualifierLoc, TemplateKWLoc, D,
409 RefersToEnclosingVariableOrCapture,
410 NameInfo, FoundD, TemplateArgs, T, VK);
416 bool HasTemplateKWAndArgsInfo,
417 unsigned NumTemplateArgs) {
423 if (HasTemplateKWAndArgsInfo)
426 void *Mem = Context.
Allocate(Size, llvm::alignOf<DeclRefExpr>());
444 FNTy->isDependentType(), FNTy->isDependentType(),
445 FNTy->isInstantiationDependentType(),
447 Loc(L),
Type(IT), FnName(SL) {}
450 return cast_or_null<StringLiteral>(FnName);
458 return "__FUNCTION__";
460 return "__FUNCDNAME__";
462 return "L__FUNCTION__";
464 return "__PRETTY_FUNCTION__";
466 return "__FUNCSIG__";
470 llvm_unreachable(
"Unknown ident type for PredefinedExpr");
479 if (
const NamedDecl *ND = dyn_cast<NamedDecl>(CurrentDecl)) {
480 std::unique_ptr<MangleContext> MC;
483 if (MC->shouldMangleDeclName(ND)) {
485 llvm::raw_svector_ostream Out(Buffer);
491 MC->mangleName(ND, Out);
494 if (!Buffer.empty() && Buffer.front() ==
'\01')
495 return Buffer.substr(1);
498 return ND->getIdentifier()->getName();
502 if (
auto *BD = dyn_cast<BlockDecl>(CurrentDecl)) {
503 std::unique_ptr<MangleContext> MC;
506 llvm::raw_svector_ostream Out(Buffer);
508 if (DC->isFileContext())
509 MC->mangleGlobalBlock(BD,
nullptr, Out);
510 else if (
const auto *CD = dyn_cast<CXXConstructorDecl>(DC))
512 else if (
const auto *DD = dyn_cast<CXXDestructorDecl>(DC))
515 MC->mangleBlock(DC, BD, Out);
518 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(CurrentDecl)) {
520 return FD->getNameAsString();
523 llvm::raw_svector_ostream Out(Name);
534 llvm::raw_string_ostream POut(Proto);
541 if (FD->hasWrittenPrototype())
542 FT = dyn_cast<FunctionProtoType>(AFT);
545 switch (FT->getCallConv()) {
546 case CC_C: POut <<
"__cdecl ";
break;
556 FD->printQualifiedName(POut, Policy);
560 for (
unsigned i = 0, e = Decl->
getNumParams(); i != e; ++i) {
565 if (FT->isVariadic()) {
566 if (FD->getNumParams()) POut <<
", ";
588 while (Ctx && isa<NamedDecl>(Ctx)) {
592 Specs.push_back(Spec);
596 std::string TemplateParams;
597 llvm::raw_string_ostream TOut(TemplateParams);
598 for (SpecsTy::reverse_iterator I = Specs.rbegin(), E = Specs.rend();
601 = (*I)->getSpecializedTemplate()->getTemplateParameters();
603 assert(Params->
size() == Args.
size());
604 for (
unsigned i = 0, numParams = Params->
size(); i != numParams; ++i) {
606 if (Param.empty())
continue;
607 TOut << Param <<
" = ";
614 = FD->getTemplateSpecializationInfo();
619 assert(Params->
size() == Args->
size());
620 for (
unsigned i = 0, e = Params->
size(); i != e; ++i) {
622 if (Param.empty())
continue;
623 TOut << Param <<
" = ";
630 if (!TemplateParams.empty()) {
632 TemplateParams.resize(TemplateParams.size() - 2);
633 POut <<
" [" << TemplateParams <<
"]";
642 if (isa<CXXMethodDecl>(FD) &&
643 cast<CXXMethodDecl>(FD)->getParent()->isLambda())
644 Proto =
"auto " + Proto;
645 else if (FT && FT->getReturnType()->getAs<
DecltypeType>())
650 else if (!isa<CXXConstructorDecl>(FD) && !isa<CXXDestructorDecl>(FD))
656 return Name.str().str();
658 if (
const CapturedDecl *CD = dyn_cast<CapturedDecl>(CurrentDecl)) {
662 if (DC->isFunctionOrMethod() && (DC->getDeclKind() != Decl::Captured)) {
666 llvm_unreachable(
"CapturedDecl not inside a function or method");
668 if (
const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(CurrentDecl)) {
670 llvm::raw_svector_ostream Out(Name);
671 Out << (MD->isInstanceMethod() ?
'-' :
'+');
680 dyn_cast<ObjCCategoryImplDecl>(MD->getDeclContext()))
681 Out <<
'(' << *CID <<
')';
684 MD->getSelector().print(Out);
688 return Name.str().str();
690 if (isa<TranslationUnitDecl>(CurrentDecl) && IT ==
PrettyFunction) {
698 const llvm::APInt &Val) {
702 BitWidth = Val.getBitWidth();
703 unsigned NumWords = Val.getNumWords();
704 const uint64_t* Words = Val.getRawData();
706 pVal =
new (
C) uint64_t[NumWords];
707 std::copy(Words, Words + NumWords,
pVal);
708 }
else if (NumWords == 1)
714 IntegerLiteral::IntegerLiteral(
const ASTContext &
C,
const llvm::APInt &V,
719 assert(type->
isIntegerType() &&
"Illegal type in IntegerLiteral");
721 "Integer type is not the correct size for constant.");
736 FloatingLiteral::FloatingLiteral(
const ASTContext &
C,
const llvm::APFloat &V,
740 setSemantics(V.getSemantics());
741 FloatingLiteralBits.IsExact = isexact;
745 FloatingLiteral::FloatingLiteral(
const ASTContext &C, EmptyShell Empty)
746 :
Expr(FloatingLiteralClass, Empty) {
747 setRawSemantics(IEEEhalf);
748 FloatingLiteralBits.IsExact =
false;
763 switch(FloatingLiteralBits.Semantics) {
765 return llvm::APFloat::IEEEhalf;
767 return llvm::APFloat::IEEEsingle;
769 return llvm::APFloat::IEEEdouble;
770 case x87DoubleExtended:
771 return llvm::APFloat::x87DoubleExtended;
773 return llvm::APFloat::IEEEquad;
774 case PPCDoubleDouble:
775 return llvm::APFloat::PPCDoubleDouble;
777 llvm_unreachable(
"Unrecognised floating semantics");
781 if (&Sem == &llvm::APFloat::IEEEhalf)
782 FloatingLiteralBits.Semantics = IEEEhalf;
783 else if (&Sem == &llvm::APFloat::IEEEsingle)
784 FloatingLiteralBits.Semantics = IEEEsingle;
785 else if (&Sem == &llvm::APFloat::IEEEdouble)
786 FloatingLiteralBits.Semantics = IEEEdouble;
787 else if (&Sem == &llvm::APFloat::x87DoubleExtended)
788 FloatingLiteralBits.Semantics = x87DoubleExtended;
789 else if (&Sem == &llvm::APFloat::IEEEquad)
790 FloatingLiteralBits.Semantics = IEEEquad;
791 else if (&Sem == &llvm::APFloat::PPCDoubleDouble)
792 FloatingLiteralBits.Semantics = PPCDoubleDouble;
794 llvm_unreachable(
"Unknown floating semantics");
803 V.convert(llvm::APFloat::IEEEdouble, llvm::APFloat::rmNearestTiesToEven,
805 return V.convertToDouble();
808 int StringLiteral::mapCharByteWidth(
TargetInfo const &target,StringKind k) {
809 int CharByteWidth = 0;
825 assert((CharByteWidth & 7) == 0 &&
"Assumes character size is byte multiple");
827 assert((CharByteWidth==1 || CharByteWidth==2 || CharByteWidth==4)
828 &&
"character byte widths supported are 1, 2, and 4 only");
829 return CharByteWidth;
837 "StringLiteral must be of constant array type!");
843 llvm::alignOf<StringLiteral>());
849 SL->TokLocs[0] = Loc[0];
850 SL->NumConcatenated = NumStrs;
853 memcpy(&SL->TokLocs[1], Loc+1,
sizeof(
SourceLocation)*(NumStrs-1));
861 llvm::alignOf<StringLiteral>());
863 SL->CharByteWidth = 0;
865 SL->NumConcatenated = NumStrs;
872 case Wide: OS <<
'L';
break;
873 case UTF8: OS <<
"u8";
break;
874 case UTF16: OS <<
'u';
break;
875 case UTF32: OS <<
'U';
break;
878 static const char Hex[] =
"0123456789ABCDEF";
881 for (
unsigned I = 0, N =
getLength(); I != N; ++I) {
888 if (
getKind() ==
UTF16 && I != N - 1 && Char >= 0xd800 &&
891 if (Trail >= 0xdc00 && Trail <= 0xdfff) {
892 Char = 0x10000 + ((Char - 0xd800) << 10) + (Trail - 0xdc00);
902 (Char >= 0xd800 && Char <= 0xdfff) || Char >= 0x110000) {
906 while ((Char >> Shift) == 0)
908 for (; Shift >= 0; Shift -= 4)
909 OS << Hex[(Char >> Shift) & 15];
916 << Hex[(Char >> 20) & 15]
917 << Hex[(Char >> 16) & 15];
920 OS << Hex[(Char >> 12) & 15]
921 << Hex[(Char >> 8) & 15]
922 << Hex[(Char >> 4) & 15]
923 << Hex[(Char >> 0) & 15];
929 if (LastSlashX + 1 == I) {
931 case '0':
case '1':
case '2':
case '3':
case '4':
932 case '5':
case '6':
case '7':
case '8':
case '9':
933 case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
934 case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
939 assert(Char <= 0xff &&
940 "Characters above 0xff should already have been handled.");
946 << (char)(
'0' + ((Char >> 6) & 7))
947 << (char)(
'0' + ((Char >> 3) & 7))
948 << (char)(
'0' + ((Char >> 0) & 7));
951 case '\\': OS <<
"\\\\";
break;
952 case '"': OS <<
"\\\"";
break;
953 case '\n': OS <<
"\\n";
break;
954 case '\t': OS <<
"\\t";
break;
955 case '\a': OS <<
"\\a";
break;
956 case '\b': OS <<
"\\b";
break;
967 this->IsPascal = IsPascal;
970 assert((Str.size()%CharByteWidth == 0)
971 &&
"size of data must be multiple of CharByteWidth");
972 Length = Str.size()/CharByteWidth;
974 switch(CharByteWidth) {
976 char *AStrData =
new (
C)
char[Length];
977 std::memcpy(AStrData,Str.data(),Length*
sizeof(*AStrData));
978 StrData.asChar = AStrData;
982 uint16_t *AStrData =
new (
C) uint16_t[Length];
983 std::memcpy(AStrData,Str.data(),Length*
sizeof(*AStrData));
984 StrData.asUInt16 = AStrData;
988 uint32_t *AStrData =
new (
C) uint32_t[Length];
989 std::memcpy(AStrData,Str.data(),Length*
sizeof(*AStrData));
990 StrData.asUInt32 = AStrData;
994 assert(
false &&
"unsupported CharByteWidth");
1009 "Only narrow string literals are currently supported");
1024 std::pair<FileID, unsigned> LocInfo =SM.
getDecomposedLoc(StrTokSpellingLoc);
1025 bool Invalid =
false;
1026 StringRef Buffer = SM.
getBufferData(LocInfo.first, &Invalid);
1028 return StrTokSpellingLoc;
1030 const char *StrData = Buffer.data()+LocInfo.second;
1034 Buffer.begin(), StrData, Buffer.end());
1036 TheLexer.LexFromRawLexer(TheTok);
1043 if (ByteNo < TokNumBytes ||
1054 ByteNo -= TokNumBytes;
1074 case UO_Real:
return "__real";
1075 case UO_Imag:
return "__imag";
1078 llvm_unreachable(
"Unknown unary operator");
1084 default: llvm_unreachable(
"No unary operator for overloaded function");
1091 case OO_Tilde:
return UO_Not;
1092 case OO_Exclaim:
return UO_LNot;
1104 case UO_Not:
return OO_Tilde;
1105 case UO_LNot:
return OO_Exclaim;
1119 fn->isTypeDependent(),
1120 fn->isValueDependent(),
1121 fn->isInstantiationDependent(),
1122 fn->containsUnexpandedParameterPack()),
1123 NumArgs(args.size()) {
1125 SubExprs =
new (
C)
Stmt*[args.size()+PREARGS_START+NumPreArgs];
1127 for (
unsigned i = 0; i != args.size(); ++i) {
1129 ExprBits.TypeDependent =
true;
1131 ExprBits.ValueDependent =
true;
1133 ExprBits.InstantiationDependent =
true;
1135 ExprBits.ContainsUnexpandedParameterPack =
true;
1137 SubExprs[i+PREARGS_START+NumPreArgs] = args[i];
1140 CallExprBits.NumPreArgs = NumPreArgs;
1141 RParenLoc = rparenloc;
1146 :
CallExpr(C, CallExprClass, fn, 0, args, t, VK, rparenloc) {
1154 :
Expr(SC, Empty), SubExprs(nullptr), NumArgs(0) {
1156 SubExprs =
new (
C)
Stmt*[PREARGS_START+NumPreArgs];
1157 CallExprBits.NumPreArgs = NumPreArgs;
1164 = dyn_cast<SubstNonTypeTemplateParmExpr>(CEE)) {
1170 if (BO->isPtrMemOp())
1172 }
else if (
UnaryOperator *UO = dyn_cast<UnaryOperator>(CEE)) {
1176 if (
DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(CEE))
1177 return DRE->getDecl();
1178 if (
MemberExpr *ME = dyn_cast<MemberExpr>(CEE))
1179 return ME->getMemberDecl();
1197 this->NumArgs = NumArgs;
1203 Stmt **NewSubExprs =
new (
C)
Stmt*[NumArgs+PREARGS_START+NumPreArgs];
1205 for (
unsigned i = 0; i !=
getNumArgs()+PREARGS_START+NumPreArgs; ++i)
1206 NewSubExprs[i] = SubExprs[i];
1208 for (
unsigned i =
getNumArgs()+PREARGS_START+NumPreArgs;
1209 i != NumArgs+PREARGS_START+NumPreArgs; ++i)
1210 NewSubExprs[i] =
nullptr;
1213 SubExprs = NewSubExprs;
1214 this->NumArgs = NumArgs;
1255 if (isa<CXXPseudoDestructorExpr>(Callee->
IgnoreParens()))
1267 if (isa<CXXOperatorCallExpr>(
this))
1268 return cast<CXXOperatorCallExpr>(
this)->
getLocStart();
1272 begin =
getArg(0)->getLocStart();
1276 if (isa<CXXOperatorCallExpr>(
this))
1277 return cast<CXXOperatorCallExpr>(
this)->
getLocEnd();
1293 sizeof(
Expr*) * exprs.size());
1295 return new (Mem)
OffsetOfExpr(C, type, OperatorLoc, tsi, comps, exprs,
1300 unsigned numComps,
unsigned numExprs) {
1303 sizeof(
Expr*) * numExprs);
1313 tsi->getType()->isDependentType(),
1314 tsi->getType()->isInstantiationDependentType(),
1315 tsi->getType()->containsUnexpandedParameterPack()),
1316 OperatorLoc(OperatorLoc), RParenLoc(RParenLoc), TSInfo(tsi),
1317 NumComps(comps.size()), NumExprs(exprs.size())
1319 for (
unsigned i = 0; i != comps.size(); ++i) {
1323 for (
unsigned i = 0; i != exprs.size(); ++i) {
1325 ExprBits.ValueDependent =
true;
1327 ExprBits.ContainsUnexpandedParameterPack =
true;
1338 return reinterpret_cast<IdentifierInfo *
> (Data & ~(uintptr_t)Mask);
1349 OpLoc(op), RParenLoc(rp) {
1350 UnaryExprOrTypeTraitExprBits.Kind = ExprKind;
1351 UnaryExprOrTypeTraitExprBits.IsType =
false;
1361 if (
const auto *DRE = dyn_cast<DeclRefExpr>(E))
1363 else if (
const auto *ME = dyn_cast<MemberExpr>(E))
1364 D = ME->getMemberDecl();
1368 if (I->isAlignmentDependent()) {
1387 bool hasQualOrFound = (QualifierLoc ||
1388 founddecl.
getDecl() != memberdecl ||
1391 Size +=
sizeof(MemberNameQualifier);
1395 else if (TemplateKWLoc.
isValid())
1398 void *Mem = C.
Allocate(Size, llvm::alignOf<MemberExpr>());
1400 MemberExpr(base, isarrow, OperatorLoc, memberdecl, nameinfo, ty, vk, ok);
1402 if (hasQualOrFound) {
1409 else if (QualifierLoc &&
1413 E->HasQualifierOrFoundDecl =
true;
1415 MemberNameQualifier *NQ = E->getMemberQualifier();
1416 NQ->QualifierLoc = QualifierLoc;
1417 NQ->FoundDecl = founddecl;
1420 E->HasTemplateKWAndArgsInfo = (targs || TemplateKWLoc.
isValid());
1423 bool Dependent =
false;
1424 bool InstantiationDependent =
false;
1425 bool ContainsUnexpandedParameterPack =
false;
1428 InstantiationDependent,
1429 ContainsUnexpandedParameterPack);
1430 if (InstantiationDependent)
1432 }
else if (TemplateKWLoc.
isValid()) {
1450 return BaseStartLoc;
1458 EndLoc =
getBase()->getLocEnd();
1462 bool CastExpr::CastConsistency()
const {
1469 assert(!
path_empty() &&
"Cast kind should have a base path!");
1473 assert(
getType()->isObjCObjectPointerType());
1475 goto CheckNoBasePath;
1478 assert(
getType()->isObjCObjectPointerType());
1480 goto CheckNoBasePath;
1483 assert(
getType()->isMemberPointerType());
1485 goto CheckNoBasePath;
1491 if (!
getType()->isPointerType()) {
1492 assert(
getType()->isObjCObjectPointerType() ==
1494 assert(
getType()->isBlockPointerType() ==
1497 goto CheckNoBasePath;
1500 assert(
getType()->isBlockPointerType());
1503 goto CheckNoBasePath;
1506 assert(
getType()->isBlockPointerType());
1508 goto CheckNoBasePath;
1511 assert(
getType()->isPointerType());
1513 goto CheckNoBasePath;
1516 assert(
getType()->isPointerType());
1518 assert(
getType()->getPointeeType().getAddressSpace() !=
1550 goto CheckNoBasePath;
1567 assert(
path_empty() &&
"Cast kind should not have a base path!");
1580 return "LValueBitCast";
1582 return "LValueToRValue";
1586 return "BaseToDerived";
1588 return "DerivedToBase";
1590 return "UncheckedDerivedToBase";
1596 return "ArrayToPointerDecay";
1598 return "FunctionToPointerDecay";
1600 return "NullToMemberPointer";
1602 return "NullToPointer";
1604 return "BaseToDerivedMemberPointer";
1606 return "DerivedToBaseMemberPointer";
1608 return "ReinterpretMemberPointer";
1610 return "UserDefinedConversion";
1612 return "ConstructorConversion";
1614 return "IntegralToPointer";
1616 return "PointerToIntegral";
1618 return "PointerToBoolean";
1622 return "VectorSplat";
1624 return "IntegralCast";
1626 return "IntegralToBoolean";
1628 return "IntegralToFloating";
1630 return "FloatingToIntegral";
1632 return "FloatingCast";
1634 return "FloatingToBoolean";
1636 return "MemberPointerToBoolean";
1638 return "CPointerToObjCPointerCast";
1640 return "BlockPointerToObjCPointerCast";
1642 return "AnyPointerToBlockPointerCast";
1644 return "ObjCObjectLValueCast";
1646 return "FloatingRealToComplex";
1648 return "FloatingComplexToReal";
1650 return "FloatingComplexToBoolean";
1652 return "FloatingComplexCast";
1654 return "FloatingComplexToIntegralComplex";
1656 return "IntegralRealToComplex";
1658 return "IntegralComplexToReal";
1660 return "IntegralComplexToBoolean";
1662 return "IntegralComplexCast";
1664 return "IntegralComplexToFloatingComplex";
1666 return "ARCConsumeObject";
1668 return "ARCProduceObject";
1670 return "ARCReclaimReturnedObject";
1672 return "ARCExtendBlockObject";
1674 return "AtomicToNonAtomic";
1676 return "NonAtomicToAtomic";
1678 return "CopyAndAutoreleaseBlockObject";
1680 return "BuiltinFnToFnPtr";
1682 return "ZeroToOCLEvent";
1684 return "AddressSpaceConversion";
1687 llvm_unreachable(
"Unhandled cast kind!");
1691 Expr *SubExpr =
nullptr;
1698 = dyn_cast<MaterializeTemporaryExpr>(SubExpr))
1699 SubExpr = Materialize->GetTemporaryExpr();
1703 SubExpr = Binder->getSubExpr();
1708 SubExpr = cast<CXXConstructExpr>(SubExpr)->getArg(0);
1710 SubExpr = cast<CXXMemberCallExpr>(SubExpr)->getImplicitObjectArgument();
1714 }
while ((E = dyn_cast<ImplicitCastExpr>(SubExpr)));
1720 switch (getStmtClass()) {
1721 #define ABSTRACT_STMT(x)
1722 #define CASTEXPR(Type, Base) \
1723 case Stmt::Type##Class: \
1724 return reinterpret_cast<CXXBaseSpecifier**>(static_cast<Type*>(this)+1);
1725 #define STMT(Type, Base)
1726 #include "clang/AST/StmtNodes.inc"
1728 llvm_unreachable(
"non-cast expressions not possible here");
1734 memcpy(path_buffer(), Path.data(), Path.size() *
sizeof(
CXXBaseSpecifier*));
1741 unsigned PathSize = (BasePath ? BasePath->size() : 0);
1751 unsigned PathSize) {
1763 unsigned PathSize = (BasePath ? BasePath->size() : 0);
1767 new (Buffer)
CStyleCastExpr(T, VK, K, Op, PathSize, WrittenTy, L, R);
1773 unsigned PathSize) {
1790 case BO_Shl:
return "<<";
1791 case BO_Shr:
return ">>";
1792 case BO_LT:
return "<";
1793 case BO_GT:
return ">";
1794 case BO_LE:
return "<=";
1795 case BO_GE:
return ">=";
1796 case BO_EQ:
return "==";
1797 case BO_NE:
return "!=";
1800 case BO_Or:
return "|";
1802 case BO_LOr:
return "||";
1817 llvm_unreachable(
"Invalid OpCode!");
1823 default: llvm_unreachable(
"Not an overloadable binary operator");
1824 case OO_Plus:
return BO_Add;
1825 case OO_Minus:
return BO_Sub;
1826 case OO_Star:
return BO_Mul;
1827 case OO_Slash:
return BO_Div;
1828 case OO_Percent:
return BO_Rem;
1829 case OO_Caret:
return BO_Xor;
1830 case OO_Amp:
return BO_And;
1831 case OO_Pipe:
return BO_Or;
1833 case OO_Less:
return BO_LT;
1834 case OO_Greater:
return BO_GT;
1843 case OO_LessLess:
return BO_Shl;
1844 case OO_GreaterGreater:
return BO_Shr;
1847 case OO_EqualEqual:
return BO_EQ;
1848 case OO_ExclaimEqual:
return BO_NE;
1849 case OO_LessEqual:
return BO_LE;
1850 case OO_GreaterEqual:
return BO_GE;
1851 case OO_AmpAmp:
return BO_LAnd;
1852 case OO_PipePipe:
return BO_LOr;
1861 OO_Star, OO_Slash, OO_Percent,
1863 OO_LessLess, OO_GreaterGreater,
1864 OO_Less, OO_Greater, OO_LessEqual, OO_GreaterEqual,
1865 OO_EqualEqual, OO_ExclaimEqual,
1871 OO_Equal, OO_StarEqual,
1872 OO_SlashEqual, OO_PercentEqual,
1873 OO_PlusEqual, OO_MinusEqual,
1874 OO_LessLessEqual, OO_GreaterGreaterEqual,
1875 OO_AmpEqual, OO_CaretEqual,
1879 return OverOps[Opc];
1886 InitExprs(C, initExprs.size()),
1887 LBraceLoc(lbraceloc), RBraceLoc(rbraceloc), AltForm(nullptr,
true)
1890 for (
unsigned I = 0; I != initExprs.size(); ++I) {
1892 ExprBits.TypeDependent =
true;
1894 ExprBits.ValueDependent =
true;
1896 ExprBits.InstantiationDependent =
true;
1898 ExprBits.ContainsUnexpandedParameterPack =
true;
1901 InitExprs.
insert(C, InitExprs.
end(), initExprs.begin(), initExprs.end());
1905 if (NumInits > InitExprs.
size())
1906 InitExprs.
reserve(C, NumInits);
1910 InitExprs.
resize(C, NumInits,
nullptr);
1914 if (Init >= InitExprs.
size()) {
1915 InitExprs.
insert(C, InitExprs.
end(), Init - InitExprs.
size() + 1,
nullptr);
1920 Expr *
Result = cast_or_null<Expr>(InitExprs[Init]);
1927 ArrayFillerOrUnionFieldInit = filler;
1930 for (
unsigned i = 0, e =
getNumInits(); i != e; ++i)
1931 if (inits[i] ==
nullptr)
1946 return isa<StringLiteral>(Init) || isa<ObjCEncodeExpr>(Init);
1951 return SyntacticForm->getLocStart();
1956 E = InitExprs.
end();
1959 Beg =
S->getLocStart();
1969 return SyntacticForm->getLocEnd();
1974 E = InitExprs.
rend();
1977 End =
S->getLocEnd();
1989 return cast<BlockPointerType>(
getType())
2020 switch (getStmtClass()) {
2026 R1 = getSourceRange();
2028 case ParenExprClass:
2029 return cast<ParenExpr>(
this)->getSubExpr()->
2031 case GenericSelectionExprClass:
2032 return cast<GenericSelectionExpr>(
this)->getResultExpr()->
2034 case ChooseExprClass:
2035 return cast<ChooseExpr>(
this)->getChosenSubExpr()->
2037 case UnaryOperatorClass: {
2057 .isVolatileQualified())
2068 case BinaryOperatorClass: {
2080 if (IE->getValue() == 0)
2095 R1 = BO->
getLHS()->getSourceRange();
2096 R2 = BO->
getRHS()->getSourceRange();
2099 case CompoundAssignOperatorClass:
2100 case VAArgExprClass:
2101 case AtomicExprClass:
2104 case ConditionalOperatorClass: {
2116 case MemberExprClass:
2118 Loc = cast<MemberExpr>(
this)->getMemberLoc();
2120 R2 = cast<MemberExpr>(
this)->getBase()->getSourceRange();
2123 case ArraySubscriptExprClass:
2125 Loc = cast<ArraySubscriptExpr>(
this)->getRBracketLoc();
2126 R1 = cast<ArraySubscriptExpr>(
this)->getLHS()->getSourceRange();
2127 R2 = cast<ArraySubscriptExpr>(
this)->getRHS()->getSourceRange();
2130 case CXXOperatorCallExprClass: {
2142 case OO_ExclaimEqual:
2145 case OO_GreaterEqual:
2159 case CXXMemberCallExprClass:
2160 case UserDefinedLiteralClass: {
2162 const CallExpr *CE = cast<CallExpr>(
this);
2166 : FD->hasAttr<WarnUnusedResultAttr>();
2173 if (HasWarnUnusedResultAttr ||
2174 FD->hasAttr<PureAttr>() || FD->hasAttr<ConstAttr>()) {
2181 CE->
getArg(NumArgs-1)->getLocEnd());
2189 case UnresolvedLookupExprClass:
2190 case CXXUnresolvedConstructExprClass:
2193 case CXXTemporaryObjectExprClass:
2194 case CXXConstructExprClass: {
2196 if (Type->hasAttr<WarnUnusedAttr>()) {
2198 Loc = getLocStart();
2199 R1 = getSourceRange();
2206 case ObjCMessageExprClass: {
2214 R1 = ME->getSourceRange();
2219 if (MD->hasAttr<WarnUnusedResultAttr>()) {
2228 case ObjCPropertyRefExprClass:
2231 R1 = getSourceRange();
2234 case PseudoObjectExprClass: {
2244 R1 = getSourceRange();
2248 case StmtExprClass: {
2254 const CompoundStmt *CS = cast<StmtExpr>(
this)->getSubStmt();
2257 return E->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx);
2259 if (
const Expr *E = dyn_cast<Expr>(Label->getSubStmt()))
2260 return E->isUnusedResultAWarning(WarnE, Loc, R1, R2, Ctx);
2266 Loc = cast<StmtExpr>(
this)->getLParenLoc();
2267 R1 = getSourceRange();
2270 case CXXFunctionalCastExprClass:
2271 case CStyleCastExprClass: {
2274 const CastExpr *CE = cast<CastExpr>(
this);
2280 if (!(DRE && isa<VarDecl>(DRE->
getDecl()) &&
2281 cast<VarDecl>(DRE->
getDecl())->hasLocalStorage())) {
2296 dyn_cast<CXXFunctionalCastExpr>(
this)) {
2297 Loc = CXXCE->getLocStart();
2298 R1 = CXXCE->getSubExpr()->getSourceRange();
2302 R1 = CStyleCE->
getSubExpr()->getSourceRange();
2306 case ImplicitCastExprClass: {
2307 const CastExpr *ICE = cast<ImplicitCastExpr>(
this);
2316 case CXXDefaultArgExprClass:
2317 return (cast<CXXDefaultArgExpr>(
this)
2319 case CXXDefaultInitExprClass:
2320 return (cast<CXXDefaultInitExpr>(
this)
2323 case CXXNewExprClass:
2326 case CXXDeleteExprClass:
2328 case CXXBindTemporaryExprClass:
2329 return (cast<CXXBindTemporaryExpr>(
this)
2331 case ExprWithCleanupsClass:
2332 return (cast<ExprWithCleanups>(
this)
2341 switch (E->getStmtClass()) {
2344 case ObjCIvarRefExprClass:
2346 case Expr::UnaryOperatorClass:
2347 return cast<UnaryOperator>(E)->getSubExpr()->isOBJCGCCandidate(Ctx);
2348 case ImplicitCastExprClass:
2349 return cast<ImplicitCastExpr>(E)->getSubExpr()->isOBJCGCCandidate(Ctx);
2350 case MaterializeTemporaryExprClass:
2351 return cast<MaterializeTemporaryExpr>(E)->GetTemporaryExpr()
2352 ->isOBJCGCCandidate(Ctx);
2353 case CStyleCastExprClass:
2354 return cast<CStyleCastExpr>(E)->getSubExpr()->isOBJCGCCandidate(Ctx);
2355 case DeclRefExprClass: {
2356 const Decl *D = cast<DeclRefExpr>(E)->getDecl();
2358 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
2359 if (VD->hasGlobalStorage())
2369 case MemberExprClass: {
2373 case ArraySubscriptExprClass:
2374 return cast<ArraySubscriptExpr>(E)->getBase()->isOBJCGCCandidate(Ctx);
2392 if (
const MemberExpr *mem = dyn_cast<MemberExpr>(expr)) {
2393 assert(isa<CXXMethodDecl>(mem->getMemberDecl()));
2394 return mem->getMemberDecl()->getType();
2404 assert(isa<UnresolvedMemberExpr>(expr) || isa<CXXPseudoDestructorExpr>(expr));
2412 E =
P->getSubExpr();
2417 E =
P->getSubExpr();
2422 if (!
P->isResultDependent()) {
2423 E =
P->getResultExpr();
2428 if (!
P->isConditionDependent()) {
2429 E =
P->getChosenSubExpr();
2443 if (
CastExpr *
P = dyn_cast<CastExpr>(E)) {
2444 E =
P->getSubExpr();
2448 = dyn_cast<MaterializeTemporaryExpr>(E)) {
2449 E = Materialize->GetTemporaryExpr();
2453 = dyn_cast<SubstNonTypeTemplateParmExpr>(E)) {
2454 E = NTTP->getReplacement();
2464 if (
CastExpr *
P = dyn_cast<CastExpr>(E)) {
2465 E =
P->getSubExpr();
2469 = dyn_cast<MaterializeTemporaryExpr>(E)) {
2470 E = Materialize->GetTemporaryExpr();
2474 = dyn_cast<SubstNonTypeTemplateParmExpr>(E)) {
2475 E = NTTP->getReplacement();
2490 if (
CastExpr *
P = dyn_cast<CastExpr>(E)) {
2492 E =
P->getSubExpr();
2496 = dyn_cast<MaterializeTemporaryExpr>(E)) {
2497 E = Materialize->GetTemporaryExpr();
2500 = dyn_cast<SubstNonTypeTemplateParmExpr>(E)) {
2501 E = NTTP->getReplacement();
2513 if (
CastExpr *CE = dyn_cast<CastExpr>(E)) {
2516 CE->getCastKind() ==
CK_NoOp) {
2517 E = CE->getSubExpr();
2531 E =
P->getSubExpr();
2535 = dyn_cast<MaterializeTemporaryExpr>(E)) {
2536 E = Materialize->GetTemporaryExpr();
2540 = dyn_cast<SubstNonTypeTemplateParmExpr>(E)) {
2541 E = NTTP->getReplacement();
2550 if (MCE->getMethodDecl() && isa<CXXConversionDecl>(MCE->getMethodDecl()))
2551 return MCE->getImplicitObjectArgument();
2564 if (
CastExpr *
P = dyn_cast<CastExpr>(E)) {
2567 Expr *SE =
P->getSubExpr();
2585 = dyn_cast<SubstNonTypeTemplateParmExpr>(E)) {
2586 E = NTTP->getReplacement();
2595 const Expr *E =
this;
2597 E = M->GetTemporaryExpr();
2600 E = ICE->getSubExprAsWritten();
2602 return isa<CXXDefaultArgExpr>(E);
2609 E = M->GetTemporaryExpr();
2612 if (ICE->getCastKind() ==
CK_NoOp)
2613 E = ICE->getSubExpr();
2619 E = BE->getSubExpr();
2622 if (ICE->getCastKind() ==
CK_NoOp)
2623 E = ICE->getSubExpr();
2642 if (!isa<ObjCPropertyRefExpr>(E))
2650 if (isa<ImplicitCastExpr>(E)) {
2651 switch (cast<ImplicitCastExpr>(E)->getCastKind()) {
2661 if (isa<MemberExpr>(E))
2665 if (BO->isPtrMemOp())
2669 if (isa<OpaqueValueExpr>(E))
2676 const Expr *E =
this;
2681 E =
Paren->getSubExpr();
2686 if (ICE->getCastKind() ==
CK_NoOp ||
2690 E = ICE->getSubExpr();
2695 if (
const UnaryOperator* UnOp = dyn_cast<UnaryOperator>(E)) {
2697 E = UnOp->getSubExpr();
2703 = dyn_cast<MaterializeTemporaryExpr>(E)) {
2704 E = M->GetTemporaryExpr();
2711 if (
const CXXThisExpr *This = dyn_cast<CXXThisExpr>(E))
2712 return This->isImplicit();
2720 for (
unsigned I = 0; I < Exprs.size(); ++I)
2728 const Expr **Culprit)
const {
2747 switch (getStmtClass()) {
2749 case StringLiteralClass:
2750 case ObjCEncodeExprClass:
2752 case CXXTemporaryObjectExprClass:
2753 case CXXConstructExprClass: {
2762 assert(CE->
getNumArgs() == 1 &&
"trivial ctor with > 1 argument");
2768 case CompoundLiteralExprClass: {
2772 const Expr *Exp = cast<CompoundLiteralExpr>(
this)->getInitializer();
2775 case DesignatedInitUpdateExprClass: {
2780 case InitListExprClass: {
2784 for (
unsigned i = 0; i < numInits; i++) {
2792 unsigned ElementNo = 0;
2794 for (
const auto *Field : RD->
fields()) {
2800 if (Field->isUnnamedBitfield())
2803 if (ElementNo < ILE->getNumInits()) {
2805 if (Field->isBitField()) {
2807 llvm::APSInt ResultTmp;
2825 case ImplicitValueInitExprClass:
2826 case NoInitExprClass:
2828 case ParenExprClass:
2829 return cast<ParenExpr>(
this)->getSubExpr()
2830 ->isConstantInitializer(Ctx, IsForRef, Culprit);
2831 case GenericSelectionExprClass:
2832 return cast<GenericSelectionExpr>(
this)->getResultExpr()
2833 ->isConstantInitializer(Ctx, IsForRef, Culprit);
2834 case ChooseExprClass:
2835 if (cast<ChooseExpr>(
this)->isConditionDependent()) {
2840 return cast<ChooseExpr>(
this)->getChosenSubExpr()
2842 case UnaryOperatorClass: {
2848 case CXXFunctionalCastExprClass:
2849 case CXXStaticCastExprClass:
2850 case ImplicitCastExprClass:
2851 case CStyleCastExprClass:
2852 case ObjCBridgedCastExprClass:
2853 case CXXDynamicCastExprClass:
2854 case CXXReinterpretCastExprClass:
2855 case CXXConstCastExprClass: {
2856 const CastExpr *CE = cast<CastExpr>(
this);
2869 case MaterializeTemporaryExprClass:
2870 return cast<MaterializeTemporaryExpr>(
this)->GetTemporaryExpr()
2871 ->isConstantInitializer(Ctx,
false, Culprit);
2873 case SubstNonTypeTemplateParmExprClass:
2874 return cast<SubstNonTypeTemplateParmExpr>(
this)->getReplacement()
2875 ->isConstantInitializer(Ctx,
false, Culprit);
2876 case CXXDefaultArgExprClass:
2877 return cast<CXXDefaultArgExpr>(
this)->getExpr()
2878 ->isConstantInitializer(Ctx,
false, Culprit);
2879 case CXXDefaultInitExprClass:
2880 return cast<CXXDefaultInitExpr>(
this)->getExpr()
2881 ->isConstantInitializer(Ctx,
false, Culprit);
2894 const bool IncludePossibleEffects;
2895 bool HasSideEffects;
2899 : Inherited(Context),
2900 IncludePossibleEffects(IncludePossible), HasSideEffects(
false) { }
2904 void VisitExpr(
const Expr *E) {
2905 if (!HasSideEffects &&
2907 HasSideEffects =
true;
2913 bool IncludePossibleEffects)
const {
2917 if (!IncludePossibleEffects &&
getExprLoc().isMacroID())
2921 return IncludePossibleEffects;
2923 switch (getStmtClass()) {
2925 #define ABSTRACT_STMT(Type)
2926 #define STMT(Type, Base) case Type##Class:
2927 #define EXPR(Type, Base)
2928 #include "clang/AST/StmtNodes.inc"
2929 llvm_unreachable(
"unexpected Expr kind");
2931 case DependentScopeDeclRefExprClass:
2932 case CXXUnresolvedConstructExprClass:
2933 case CXXDependentScopeMemberExprClass:
2934 case UnresolvedLookupExprClass:
2935 case UnresolvedMemberExprClass:
2936 case PackExpansionExprClass:
2937 case SubstNonTypeTemplateParmPackExprClass:
2938 case FunctionParmPackExprClass:
2940 case CXXFoldExprClass:
2941 llvm_unreachable(
"shouldn't see dependent / unresolved nodes here");
2943 case DeclRefExprClass:
2944 case ObjCIvarRefExprClass:
2945 case PredefinedExprClass:
2946 case IntegerLiteralClass:
2947 case FloatingLiteralClass:
2948 case ImaginaryLiteralClass:
2949 case StringLiteralClass:
2950 case CharacterLiteralClass:
2951 case OffsetOfExprClass:
2952 case ImplicitValueInitExprClass:
2953 case UnaryExprOrTypeTraitExprClass:
2954 case AddrLabelExprClass:
2955 case GNUNullExprClass:
2956 case NoInitExprClass:
2957 case CXXBoolLiteralExprClass:
2958 case CXXNullPtrLiteralExprClass:
2959 case CXXThisExprClass:
2960 case CXXScalarValueInitExprClass:
2961 case TypeTraitExprClass:
2962 case ArrayTypeTraitExprClass:
2963 case ExpressionTraitExprClass:
2964 case CXXNoexceptExprClass:
2965 case SizeOfPackExprClass:
2966 case ObjCStringLiteralClass:
2967 case ObjCEncodeExprClass:
2968 case ObjCBoolLiteralExprClass:
2969 case CXXUuidofExprClass:
2970 case OpaqueValueExprClass:
2975 case CXXOperatorCallExprClass:
2976 case CXXMemberCallExprClass:
2977 case CUDAKernelCallExprClass:
2978 case UserDefinedLiteralClass: {
2982 const Decl *FD = cast<CallExpr>(
this)->getCalleeDecl();
2983 bool IsPure = FD && (FD->
hasAttr<ConstAttr>() || FD->
hasAttr<PureAttr>());
2984 if (IsPure || !IncludePossibleEffects)
2989 case BlockExprClass:
2990 case CXXBindTemporaryExprClass:
2991 if (!IncludePossibleEffects)
2995 case MSPropertyRefExprClass:
2996 case CompoundAssignOperatorClass:
2997 case VAArgExprClass:
2998 case AtomicExprClass:
2999 case CXXThrowExprClass:
3000 case CXXNewExprClass:
3001 case CXXDeleteExprClass:
3002 case ExprWithCleanupsClass:
3006 case StmtExprClass: {
3008 SideEffectFinder
Finder(Ctx, IncludePossibleEffects);
3009 Finder.Visit(cast<StmtExpr>(
this)->getSubStmt());
3010 return Finder.hasSideEffects();
3013 case ParenExprClass:
3014 case ArraySubscriptExprClass:
3015 case MemberExprClass:
3016 case ConditionalOperatorClass:
3017 case BinaryConditionalOperatorClass:
3018 case CompoundLiteralExprClass:
3019 case ExtVectorElementExprClass:
3020 case DesignatedInitExprClass:
3021 case DesignatedInitUpdateExprClass:
3022 case ParenListExprClass:
3023 case CXXPseudoDestructorExprClass:
3024 case CXXStdInitializerListExprClass:
3025 case SubstNonTypeTemplateParmExprClass:
3026 case MaterializeTemporaryExprClass:
3027 case ShuffleVectorExprClass:
3028 case ConvertVectorExprClass:
3029 case AsTypeExprClass:
3033 case UnaryOperatorClass:
3034 if (cast<UnaryOperator>(
this)->isIncrementDecrementOp())
3038 case BinaryOperatorClass:
3039 if (cast<BinaryOperator>(
this)->isAssignmentOp())
3043 case InitListExprClass:
3045 if (
const Expr *E = cast<InitListExpr>(
this)->getArrayFiller())
3046 if (E->HasSideEffects(Ctx, IncludePossibleEffects))
3050 case GenericSelectionExprClass:
3051 return cast<GenericSelectionExpr>(
this)->getResultExpr()->
3054 case ChooseExprClass:
3055 return cast<ChooseExpr>(
this)->getChosenSubExpr()->HasSideEffects(
3056 Ctx, IncludePossibleEffects);
3058 case CXXDefaultArgExprClass:
3059 return cast<CXXDefaultArgExpr>(
this)->getExpr()->HasSideEffects(
3060 Ctx, IncludePossibleEffects);
3062 case CXXDefaultInitExprClass: {
3063 const FieldDecl *FD = cast<CXXDefaultInitExpr>(
this)->getField();
3065 return E->HasSideEffects(Ctx, IncludePossibleEffects);
3070 case CXXDynamicCastExprClass: {
3077 case ImplicitCastExprClass:
3078 case CStyleCastExprClass:
3079 case CXXStaticCastExprClass:
3080 case CXXReinterpretCastExprClass:
3081 case CXXConstCastExprClass:
3082 case CXXFunctionalCastExprClass: {
3087 if (!IncludePossibleEffects)
3090 const CastExpr *CE = cast<CastExpr>(
this);
3097 case CXXTypeidExprClass:
3100 return cast<CXXTypeidExpr>(
this)->isPotentiallyEvaluated();
3102 case CXXConstructExprClass:
3103 case CXXTemporaryObjectExprClass: {
3112 case LambdaExprClass: {
3113 const LambdaExpr *LE = cast<LambdaExpr>(
this);
3123 case PseudoObjectExprClass: {
3130 const Expr *Subexpr = *I;
3132 Subexpr = OVE->getSourceExpr();
3139 case ObjCBoxedExprClass:
3140 case ObjCArrayLiteralClass:
3141 case ObjCDictionaryLiteralClass:
3142 case ObjCSelectorExprClass:
3143 case ObjCProtocolExprClass:
3144 case ObjCIsaExprClass:
3145 case ObjCIndirectCopyRestoreExprClass:
3146 case ObjCSubscriptRefExprClass:
3147 case ObjCBridgedCastExprClass:
3148 case ObjCMessageExprClass:
3149 case ObjCPropertyRefExprClass:
3151 if (IncludePossibleEffects)
3159 cast<Expr>(SubStmt)->HasSideEffects(Ctx, IncludePossibleEffects))
3175 : Inherited(Context), NonTrivial(
false) { }
3177 bool hasNonTrivialCall()
const {
return NonTrivial; }
3179 void VisitCallExpr(
const CallExpr *E) {
3181 = dyn_cast_or_null<const CXXMethodDecl>(E->
getCalleeDecl())) {
3182 if (Method->isTrivial()) {
3184 Inherited::VisitStmt(E);
3195 Inherited::VisitStmt(E);
3204 Inherited::VisitStmt(E);
3214 NonTrivialCallFinder
Finder(Ctx);
3216 return Finder.hasNonTrivialCall();
3231 llvm_unreachable(
"Unexpected value dependent expression!");
3251 CE->getSubExpr()->getType()->isIntegerType())
3252 return CE->getSubExpr()->isNullPointerConstant(Ctx, NPC);
3255 }
else if (
const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(
this)) {
3257 return ICE->getSubExpr()->isNullPointerConstant(Ctx, NPC);
3258 }
else if (
const ParenExpr *PE = dyn_cast<ParenExpr>(
this)) {
3261 return PE->getSubExpr()->isNullPointerConstant(Ctx, NPC);
3263 dyn_cast<GenericSelectionExpr>(
this)) {
3264 if (GE->isResultDependent())
3266 return GE->getResultExpr()->isNullPointerConstant(Ctx, NPC);
3267 }
else if (
const ChooseExpr *CE = dyn_cast<ChooseExpr>(
this)) {
3268 if (CE->isConditionDependent())
3270 return CE->getChosenSubExpr()->isNullPointerConstant(Ctx, NPC);
3272 = dyn_cast<CXXDefaultArgExpr>(
this)) {
3274 return DefaultArg->getExpr()->isNullPointerConstant(Ctx, NPC);
3276 = dyn_cast<CXXDefaultInitExpr>(
this)) {
3278 return DefaultInit->getExpr()->isNullPointerConstant(Ctx, NPC);
3279 }
else if (isa<GNUNullExpr>(
this)) {
3283 = dyn_cast<MaterializeTemporaryExpr>(
this)) {
3284 return M->GetTemporaryExpr()->isNullPointerConstant(Ctx, NPC);
3285 }
else if (
const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(
this)) {
3286 if (
const Expr *Source = OVE->getSourceExpr())
3287 return Source->isNullPointerConstant(Ctx, NPC);
3291 if (
getType()->isNullPtrType())
3296 UT && UT->getDecl()->hasAttr<TransparentUnionAttr>())
3298 const Expr *InitExpr = CLE->getInitializer();
3299 if (
const InitListExpr *ILE = dyn_cast<InitListExpr>(InitExpr))
3303 if (!
getType()->isIntegerType() ||
3326 if (isa<IntegerLiteral>(
this))
3334 const Expr *E =
this;
3338 "expression is not a property reference");
3350 return cast<ObjCPropertyRefExpr>(E);
3382 if (
MemberExpr *MemRef = dyn_cast<MemberExpr>(E))
3383 if (
FieldDecl *Field = dyn_cast<FieldDecl>(MemRef->getMemberDecl()))
3384 if (Field->isBitField())
3388 if (
FieldDecl *Ivar = dyn_cast<FieldDecl>(IvarRef->getDecl()))
3389 if (Ivar->isBitField())
3392 if (
DeclRefExpr *DeclRef = dyn_cast<DeclRefExpr>(E))
3393 if (
FieldDecl *Field = dyn_cast<FieldDecl>(DeclRef->getDecl()))
3394 if (Field->isBitField())
3398 if (BinOp->isAssignmentOp() && BinOp->getLHS())
3401 if (BinOp->getOpcode() ==
BO_Comma && BinOp->getRHS())
3402 return BinOp->getRHS()->getSourceBitField();
3406 if (UnOp->isPrefix() && UnOp->isIncrementDecrementOp())
3407 return UnOp->getSubExpr()->getSourceBitField();
3417 ICE->getCastKind() ==
CK_NoOp)
3426 if (isa<ExtVectorElementExpr>(E))
3440 return VT->getNumElements();
3448 StringRef Comp = Accessor->
getName();
3451 if (Comp ==
"hi" || Comp ==
"lo" || Comp ==
"even" || Comp ==
"odd")
3455 if (Comp[0] ==
's' || Comp[0] ==
'S')
3456 Comp = Comp.substr(1);
3458 for (
unsigned i = 0, e = Comp.size(); i != e; ++i)
3459 if (Comp.substr(i + 1).find(Comp[i]) != StringRef::npos)
3468 StringRef Comp = Accessor->
getName();
3469 if (Comp[0] ==
's' || Comp[0] ==
'S')
3470 Comp = Comp.substr(1);
3472 bool isHi = Comp ==
"hi";
3473 bool isLo = Comp ==
"lo";
3474 bool isEven = Comp ==
"even";
3475 bool isOdd = Comp ==
"odd";
3491 Elts.push_back(Index);
3495 ObjCMessageExpr::ObjCMessageExpr(
QualType T,
3499 bool IsInstanceSuper,
3512 SelectorOrMethod(reinterpret_cast<uintptr_t>(Method? Method
3513 : Sel.getAsOpaquePtr())),
3514 Kind(IsInstanceSuper? SuperInstance : SuperClass),
3515 HasMethod(Method != nullptr), IsDelegateInitCall(
false),
3516 IsImplicit(isImplicit), SuperLoc(SuperLoc), LBracLoc(LBracLoc),
3519 initArgsAndSelLocs(Args, SelLocs, SelLocsK);
3523 ObjCMessageExpr::ObjCMessageExpr(
QualType T,
3534 :
Expr(ObjCMessageExprClass, T, VK,
OK_Ordinary, T->isDependentType(),
3535 T->isDependentType(), T->isInstantiationDependentType(),
3536 T->containsUnexpandedParameterPack()),
3537 SelectorOrMethod(reinterpret_cast<uintptr_t>(Method? Method
3538 : Sel.getAsOpaquePtr())),
3540 HasMethod(Method != nullptr), IsDelegateInitCall(
false),
3541 IsImplicit(isImplicit), LBracLoc(LBracLoc), RBracLoc(RBracLoc)
3543 initArgsAndSelLocs(Args, SelLocs, SelLocsK);
3544 setReceiverPointer(Receiver);
3547 ObjCMessageExpr::ObjCMessageExpr(
QualType T,
3558 :
Expr(ObjCMessageExprClass, T, VK,
OK_Ordinary, Receiver->isTypeDependent(),
3559 Receiver->isTypeDependent(),
3560 Receiver->isInstantiationDependent(),
3561 Receiver->containsUnexpandedParameterPack()),
3562 SelectorOrMethod(reinterpret_cast<uintptr_t>(Method? Method
3563 : Sel.getAsOpaquePtr())),
3565 HasMethod(Method != nullptr), IsDelegateInitCall(
false),
3566 IsImplicit(isImplicit), LBracLoc(LBracLoc), RBracLoc(RBracLoc)
3568 initArgsAndSelLocs(Args, SelLocs, SelLocsK);
3569 setReceiverPointer(Receiver);
3575 setNumArgs(Args.size());
3577 for (
unsigned I = 0; I != Args.size(); ++I) {
3579 ExprBits.TypeDependent =
true;
3581 ExprBits.ValueDependent =
true;
3583 ExprBits.InstantiationDependent =
true;
3585 ExprBits.ContainsUnexpandedParameterPack =
true;
3587 MyArgs[I] = Args[I];
3590 SelLocsKind = SelLocsK;
3593 std::copy(SelLocs.begin(), SelLocs.end(), getStoredSelLocs());
3601 bool IsInstanceSuper,
3610 "No selector locs for non-implicit message");
3614 Mem = alloc(Context, Args.size(), 0);
3616 Mem = alloc(Context, Args, RBracLoc, SelLocs, Sel, SelLocsK);
3617 return new (Mem)
ObjCMessageExpr(T, VK, LBracLoc, SuperLoc, IsInstanceSuper,
3618 SuperType, Sel, SelLocs, SelLocsK,
3619 Method, Args, RBracLoc, isImplicit);
3633 "No selector locs for non-implicit message");
3637 Mem = alloc(Context, Args.size(), 0);
3639 Mem = alloc(Context, Args, RBracLoc, SelLocs, Sel, SelLocsK);
3641 SelLocs, SelLocsK, Method, Args, RBracLoc,
3656 "No selector locs for non-implicit message");
3660 Mem = alloc(Context, Args.size(), 0);
3662 Mem = alloc(Context, Args, RBracLoc, SelLocs, Sel, SelLocsK);
3664 SelLocs, SelLocsK, Method, Args, RBracLoc,
3670 unsigned NumStoredSelLocs) {
3684 return alloc(C, Args.size(), NumStoredSelLocs);
3689 unsigned NumStoredSelLocs) {
3693 llvm::AlignOf<ObjCMessageExpr>::Alignment);
3715 llvm_unreachable(
"Invalid ReceiverKind!");
3720 return reinterpret_cast<const ObjCMethodDecl *
>(SelectorOrMethod)
3736 llvm_unreachable(
"unexpected receiver kind");
3743 return Ptr->getInterfaceDecl();
3746 return Ty->getInterface();
3766 return "__bridge_transfer";
3768 return "__bridge_retained";
3771 llvm_unreachable(
"Invalid BridgeKind!");
3778 Type->isDependentType(), Type->isDependentType(),
3779 Type->isInstantiationDependentType(),
3780 Type->containsUnexpandedParameterPack()),
3781 BuiltinLoc(BLoc), RParenLoc(RP), NumExprs(args.size())
3783 SubExprs =
new (
C)
Stmt*[args.size()];
3784 for (
unsigned i = 0; i != args.size(); i++) {
3786 ExprBits.TypeDependent =
true;
3788 ExprBits.ValueDependent =
true;
3790 ExprBits.InstantiationDependent =
true;
3792 ExprBits.ContainsUnexpandedParameterPack =
true;
3794 SubExprs[i] = args[i];
3801 this->NumExprs = Exprs.size();
3802 SubExprs =
new (
C)
Stmt*[NumExprs];
3803 memcpy(SubExprs, Exprs.data(),
sizeof(
Expr *) * Exprs.size());
3812 bool ContainsUnexpandedParameterPack,
3813 unsigned ResultIndex)
3814 :
Expr(GenericSelectionExprClass,
3815 AssocExprs[ResultIndex]->getType(),
3816 AssocExprs[ResultIndex]->getValueKind(),
3817 AssocExprs[ResultIndex]->getObjectKind(),
3818 AssocExprs[ResultIndex]->isTypeDependent(),
3819 AssocExprs[ResultIndex]->isValueDependent(),
3820 AssocExprs[ResultIndex]->isInstantiationDependent(),
3821 ContainsUnexpandedParameterPack),
3823 SubExprs(new (Context)
Stmt*[END_EXPR+AssocExprs.size()]),
3824 NumAssocs(AssocExprs.size()), ResultIndex(ResultIndex),
3825 GenericLoc(GenericLoc), DefaultLoc(DefaultLoc), RParenLoc(RParenLoc) {
3826 SubExprs[CONTROLLING] = ControllingExpr;
3827 assert(AssocTypes.size() == AssocExprs.size());
3828 std::copy(AssocTypes.begin(), AssocTypes.end(), this->AssocTypes);
3829 std::copy(AssocExprs.begin(), AssocExprs.end(), SubExprs+END_EXPR);
3838 bool ContainsUnexpandedParameterPack)
3839 :
Expr(GenericSelectionExprClass,
3840 Context.DependentTy,
3846 ContainsUnexpandedParameterPack),
3848 SubExprs(new (Context)
Stmt*[END_EXPR+AssocExprs.size()]),
3849 NumAssocs(AssocExprs.size()), ResultIndex(-1U), GenericLoc(GenericLoc),
3850 DefaultLoc(DefaultLoc), RParenLoc(RParenLoc) {
3851 SubExprs[CONTROLLING] = ControllingExpr;
3852 assert(AssocTypes.size() == AssocExprs.size());
3853 std::copy(AssocTypes.begin(), AssocTypes.end(), this->AssocTypes);
3854 std::copy(AssocExprs.begin(), AssocExprs.end(), SubExprs+END_EXPR);
3870 unsigned NumDesignators,
3876 :
Expr(DesignatedInitExprClass, Ty,
3881 EqualOrColonLoc(EqualOrColonLoc), GNUSyntax(GNUSyntax),
3882 NumDesignators(NumDesignators), NumSubExprs(IndexExprs.
size() + 1) {
3883 this->Designators =
new (
C)
Designator[NumDesignators];
3891 unsigned IndexIdx = 0;
3892 for (
unsigned I = 0; I != NumDesignators; ++I) {
3893 this->Designators[I] = Designators[I];
3897 Expr *Index = IndexExprs[IndexIdx];
3899 ExprBits.TypeDependent = ExprBits.ValueDependent =
true;
3901 ExprBits.InstantiationDependent =
true;
3904 ExprBits.ContainsUnexpandedParameterPack =
true;
3907 *Child++ = IndexExprs[IndexIdx++];
3910 Expr *Start = IndexExprs[IndexIdx];
3911 Expr *
End = IndexExprs[IndexIdx + 1];
3914 ExprBits.TypeDependent = ExprBits.ValueDependent =
true;
3915 ExprBits.InstantiationDependent =
true;
3918 ExprBits.InstantiationDependent =
true;
3924 ExprBits.ContainsUnexpandedParameterPack =
true;
3927 *Child++ = IndexExprs[IndexIdx++];
3928 *Child++ = IndexExprs[IndexIdx++];
3932 assert(IndexIdx == IndexExprs.size() &&
"Wrong number of index expressions");
3937 unsigned NumDesignators,
3940 bool UsesColonSyntax,
Expr *Init) {
3942 sizeof(
Stmt *) * (IndexExprs.size() + 1), 8);
3944 ColonOrEqualLoc, UsesColonSyntax,
3949 unsigned NumIndexExprs) {
3951 sizeof(
Stmt *) * (NumIndexExprs + 1), 8);
3957 unsigned NumDesigs) {
3959 NumDesignators = NumDesigs;
3960 for (
unsigned I = 0; I != NumDesigs; ++I)
3961 Designators[I] = Desigs[I];
3988 return getInit()->getLocEnd();
3992 assert(D.Kind == Designator::ArrayDesignator &&
"Requires array designator");
3993 Stmt *
const *SubExprs =
reinterpret_cast<Stmt *
const *
>(
this + 1);
3998 assert(D.Kind == Designator::ArrayRangeDesignator &&
3999 "Requires array range designator");
4000 Stmt *
const *SubExprs =
reinterpret_cast<Stmt *
const *
>(
this + 1);
4005 assert(D.Kind == Designator::ArrayRangeDesignator &&
4006 "Requires array range designator");
4007 Stmt *
const *SubExprs =
reinterpret_cast<Stmt *
const *
>(
this + 1);
4016 unsigned NumNewDesignators = Last - First;
4017 if (NumNewDesignators == 0) {
4018 std::copy_backward(Designators + Idx + 1,
4019 Designators + NumDesignators,
4021 --NumNewDesignators;
4023 }
else if (NumNewDesignators == 1) {
4024 Designators[Idx] = *First;
4029 =
new (
C)
Designator[NumDesignators - 1 + NumNewDesignators];
4030 std::copy(Designators, Designators + Idx, NewDesignators);
4031 std::copy(First, Last, NewDesignators + Idx);
4032 std::copy(Designators + Idx + 1, Designators + NumDesignators,
4033 NewDesignators + Idx + NumNewDesignators);
4034 Designators = NewDesignators;
4035 NumDesignators = NumDesignators - 1 + NumNewDesignators;
4042 BaseAndUpdaterExprs[0] = baseExpr;
4046 BaseAndUpdaterExprs[1] = ILE;
4050 return getBase()->getLocStart();
4054 return getBase()->getLocEnd();
4062 NumExprs(exprs.size()), LParenLoc(lparenloc), RParenLoc(rparenloc) {
4063 Exprs =
new (
C)
Stmt*[exprs.size()];
4064 for (
unsigned i = 0; i != exprs.size(); ++i) {
4066 ExprBits.TypeDependent =
true;
4068 ExprBits.ValueDependent =
true;
4070 ExprBits.InstantiationDependent =
true;
4072 ExprBits.ContainsUnexpandedParameterPack =
true;
4074 Exprs[i] = exprs[i];
4080 e = ewc->getSubExpr();
4082 e = m->GetTemporaryExpr();
4083 e = cast<CXXConstructExpr>(e)->getArg(0);
4085 e = ice->getSubExpr();
4086 return cast<OpaqueValueExpr>(e);
4091 unsigned numSemanticExprs) {
4093 (1 + numSemanticExprs) *
sizeof(
Expr*),
4094 llvm::alignOf<PseudoObjectExpr>());
4098 PseudoObjectExpr::PseudoObjectExpr(EmptyShell shell,
unsigned numSemanticExprs)
4099 :
Expr(PseudoObjectExprClass, shell) {
4100 PseudoObjectExprBits.NumSubExprs = numSemanticExprs + 1;
4105 unsigned resultIndex) {
4106 assert(syntax &&
"no syntactic expression!");
4107 assert(semantics.size() &&
"no semantic expressions!");
4115 assert(resultIndex < semantics.size());
4116 type = semantics[resultIndex]->getType();
4117 VK = semantics[resultIndex]->getValueKind();
4122 (1 + semantics.size()) *
sizeof(
Expr*),
4123 llvm::alignOf<PseudoObjectExpr>());
4130 unsigned resultIndex)
4133 PseudoObjectExprBits.NumSubExprs = semantics.size() + 1;
4134 PseudoObjectExprBits.ResultIndex = resultIndex + 1;
4136 for (
unsigned i = 0, e = semantics.size() + 1; i != e; ++i) {
4137 Expr *E = (i == 0 ? syntax : semantics[i-1]);
4138 getSubExprsBuffer()[i] = E;
4141 ExprBits.TypeDependent =
true;
4143 ExprBits.ValueDependent =
true;
4145 ExprBits.InstantiationDependent =
true;
4147 ExprBits.ContainsUnexpandedParameterPack =
true;
4149 if (isa<OpaqueValueExpr>(E))
4150 assert(cast<OpaqueValueExpr>(E)->getSourceExpr() !=
nullptr &&
4151 "opaque-value semantic expressions for pseudo-object "
4152 "operations must have sources");
4164 return cast<Expr>(I[idx]);
4181 return child_range(child_iterator(T), child_iterator());
4182 return child_range();
4184 return child_range(&Argument.Ex, &Argument.Ex + 1);
4191 begin =
reinterpret_cast<Stmt **
>(
this + 1);
4194 return child_range(begin,
4203 NumElements(Elements.size()), Range(SR), ArrayWithObjectsMethod(Method)
4205 Expr **SaveElements = getElements();
4206 for (
unsigned I = 0, N = Elements.size(); I != N; ++I) {
4207 if (Elements[I]->
isTypeDependent() || Elements[I]->isValueDependent())
4208 ExprBits.ValueDependent =
true;
4210 ExprBits.InstantiationDependent =
true;
4212 ExprBits.ContainsUnexpandedParameterPack =
true;
4214 SaveElements[I] = Elements[I];
4223 + Elements.size() *
sizeof(
Expr *));
4228 unsigned NumElements) {
4231 + NumElements *
sizeof(
Expr *));
4235 ObjCDictionaryLiteral::ObjCDictionaryLiteral(
4237 bool HasPackExpansions,
4242 NumElements(VK.size()), HasPackExpansions(HasPackExpansions), Range(SR),
4243 DictWithObjectsMethod(method)
4245 KeyValuePair *KeyValues = getKeyValues();
4246 ExpansionData *Expansions = getExpansionData();
4247 for (
unsigned I = 0; I < NumElements; I++) {
4248 if (VK[I].Key->isTypeDependent() || VK[I].Key->isValueDependent() ||
4249 VK[I].Value->isTypeDependent() || VK[I].Value->isValueDependent())
4250 ExprBits.ValueDependent =
true;
4251 if (VK[I].Key->isInstantiationDependent() ||
4252 VK[I].Value->isInstantiationDependent())
4253 ExprBits.InstantiationDependent =
true;
4254 if (VK[I].EllipsisLoc.isInvalid() &&
4255 (VK[I].Key->containsUnexpandedParameterPack() ||
4256 VK[I].Value->containsUnexpandedParameterPack()))
4257 ExprBits.ContainsUnexpandedParameterPack =
true;
4259 KeyValues[I].Key = VK[I].Key;
4260 KeyValues[I].Value = VK[I].Value;
4262 Expansions[I].EllipsisLoc = VK[I].EllipsisLoc;
4263 if (VK[I].NumExpansions)
4264 Expansions[I].NumExpansionsPlusOne = *VK[I].NumExpansions + 1;
4266 Expansions[I].NumExpansionsPlusOne = 0;
4274 bool HasPackExpansions,
4277 unsigned ExpansionsSize = 0;
4278 if (HasPackExpansions)
4279 ExpansionsSize =
sizeof(ExpansionData) * VK.size();
4282 sizeof(KeyValuePair) * VK.size() + ExpansionsSize);
4288 bool HasPackExpansions) {
4289 unsigned ExpansionsSize = 0;
4290 if (HasPackExpansions)
4291 ExpansionsSize =
sizeof(ExpansionData) * NumElements;
4293 sizeof(KeyValuePair) * NumElements + ExpansionsSize);
4307 getMethod, setMethod, RB);
4314 NumSubExprs(args.size()), BuiltinLoc(BLoc), RParenLoc(RP), Op(op)
4316 assert(args.size() ==
getNumSubExprs(op) &&
"wrong number of subexpressions");
4317 for (
unsigned i = 0; i != args.size(); i++) {
4319 ExprBits.TypeDependent =
true;
4321 ExprBits.ValueDependent =
true;
4323 ExprBits.InstantiationDependent =
true;
4325 ExprBits.ContainsUnexpandedParameterPack =
true;
4327 SubExprs[i] = args[i];
4333 case AO__c11_atomic_init:
4334 case AO__c11_atomic_load:
4335 case AO__atomic_load_n:
4338 case AO__c11_atomic_store:
4339 case AO__c11_atomic_exchange:
4340 case AO__atomic_load:
4341 case AO__atomic_store:
4342 case AO__atomic_store_n:
4343 case AO__atomic_exchange_n:
4344 case AO__c11_atomic_fetch_add:
4345 case AO__c11_atomic_fetch_sub:
4346 case AO__c11_atomic_fetch_and:
4347 case AO__c11_atomic_fetch_or:
4348 case AO__c11_atomic_fetch_xor:
4349 case AO__atomic_fetch_add:
4350 case AO__atomic_fetch_sub:
4351 case AO__atomic_fetch_and:
4352 case AO__atomic_fetch_or:
4353 case AO__atomic_fetch_xor:
4354 case AO__atomic_fetch_nand:
4355 case AO__atomic_add_fetch:
4356 case AO__atomic_sub_fetch:
4357 case AO__atomic_and_fetch:
4358 case AO__atomic_or_fetch:
4359 case AO__atomic_xor_fetch:
4360 case AO__atomic_nand_fetch:
4363 case AO__atomic_exchange:
4366 case AO__c11_atomic_compare_exchange_strong:
4367 case AO__c11_atomic_compare_exchange_weak:
4370 case AO__atomic_compare_exchange:
4371 case AO__atomic_compare_exchange_n:
4374 llvm_unreachable(
"unknown atomic op");
GenericSelectionExpr(const ASTContext &Context, SourceLocation GenericLoc, Expr *ControllingExpr, ArrayRef< TypeSourceInfo * > AssocTypes, ArrayRef< Expr * > AssocExprs, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool ContainsUnexpandedParameterPack, unsigned ResultIndex)
LValueClassification ClassifyLValue(ASTContext &Ctx) const
Reasons why an expression might not be an l-value.
A call to an overloaded operator written using operator syntax.
The receiver is the instance of the superclass object.
Represents a single C99 designator.
void setCastPath(const CXXCastPath &Path)
void setValueDependent(bool VD)
Set whether this expression is value-dependent or not.
Defines the clang::ASTContext interface.
unsigned getNumInits() const
bool containsDuplicateElements() const
containsDuplicateElements - Return true if any element access is repeated.
static std::string ComputeName(IdentType IT, const Decl *CurrentDecl)
CastKind getCastKind() const
ExprObjectKind getObjectKind() const
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
static void computeDeclRefDependence(const ASTContext &Ctx, NamedDecl *D, QualType T, bool &TypeDependent, bool &ValueDependent, bool &InstantiationDependent)
Compute the type-, value-, and instantiation-dependence of a declaration reference based on the decla...
The receiver is an object instance.
StringRef getName() const
Expr * getSyntacticForm()
void setArrayFiller(Expr *filler)
Smart pointer class that efficiently represents Objective-C method names.
ASTTemplateKWAndArgsInfo * getTemplateKWAndArgsInfo()
Return the optional template keyword and arguments info.
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates)...
bool isEvaluatable(const ASTContext &Ctx) const
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
static StringLiteral * CreateEmpty(const ASTContext &C, unsigned NumStrs)
Construct an empty string literal.
ObjCMethodFamily getMethodFamily() const
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
DeclarationNameInfo getMemberNameInfo() const
Retrieve the member declaration name info.
static Decl * castFromDeclContext(const DeclContext *)
unsigned FieldLoc
The location of the field name in the designated initializer.
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
bool hasUnusedResultAttr() const
Returns true if this function or its return type has the warn_unused_result attribute. If the return type has the attribute and this function is a method of the return type's class, then false will be returned to avoid spurious warnings on member methods such as assignment operators.
IdentifierInfo * getIdentifier() const
SourceLocation getLocEnd() const LLVM_READONLY
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID. ...
DesignatedInitUpdateExpr(const ASTContext &C, SourceLocation lBraceLoc, Expr *baseExprs, SourceLocation rBraceLoc)
SourceLocation getEndLoc() const
getEndLoc - Retrieve the location of the last token.
bool isArgumentType() const
Bridging via __bridge, which does nothing but reinterpret the bits.
unsigned getChar16Width() const
Expr * getInit() const
Retrieve the initializer value.
unsigned getIntWidth(QualType T) const
Defines the SourceManager interface.
reverse_iterator rbegin()
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ObjCMessageExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, SourceLocation LBracLoc, SourceLocation SuperLoc, bool IsInstanceSuper, QualType SuperType, Selector Sel, ArrayRef< SourceLocation > SelLocs, ObjCMethodDecl *Method, ArrayRef< Expr * > Args, SourceLocation RBracLoc, bool isImplicit)
Create a message send to super.
bool isRecordType() const
void setSemantics(const llvm::fltSemantics &Sem)
Set the APFloat semantics this literal uses.
unsigned size() const
Returns the number of designators in this initializer.
AccessSpecifier getAccess() const
Defines the C++ template declaration subclasses.
iterator insert(const ASTContext &C, iterator I, const T &Elt)
bool isEnumeralType() const
void getSelectorLocs(SmallVectorImpl< SourceLocation > &SelLocs) const
const char * getCastKindName() const
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
InitListExpr * getSyntacticForm() const
unsigned getNumSelectorLocs() const
Represents a call to a C++ constructor.
NamedDecl * getParam(unsigned Idx)
bool isBooleanType() const
A container of type source information.
SourceLocation getOperatorLoc() const
static StringLiteral * Create(const ASTContext &C, StringRef Str, StringKind Kind, bool Pascal, QualType Ty, const SourceLocation *Loc, unsigned NumStrs)
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
[ARC] Consumes a retainable object pointer that has just been produced, e.g. as the return value of a...
Describes the capture of a variable or of this, or of a C++1y init-capture.
static ObjCDictionaryLiteral * CreateEmpty(const ASTContext &C, unsigned NumElements, bool HasPackExpansions)
Represents a C++ constructor within a class.
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Expr * getInClassInitializer() const
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
Expr * ignoreParenBaseCasts() LLVM_READONLY
Ignore parentheses and derived-to-base casts.
bool hasExplicitTemplateArgs() const
Determines whether the member name was followed by an explicit template argument list.
void * getAsOpaquePtr() const
static OffsetOfExpr * CreateEmpty(const ASTContext &C, unsigned NumComps, unsigned NumExprs)
static const OpaqueValueExpr * findInCopyConstruct(const Expr *expr)
unsigned getChar32Width() const
const Expr * getCallee() const
MangleContext * createMangleContext()
AccessSpecifier getAccess() const
const FunctionProtoType * getFunctionType() const
getFunctionType - Return the underlying function type for this block.
void resizeInits(const ASTContext &Context, unsigned NumInits)
Specify the number of initializers.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
void setInit(unsigned Init, Expr *expr)
PredefinedExpr(SourceLocation L, QualType FNTy, IdentType IT, StringLiteral *SL)
CK_Dynamic - A C++ dynamic_cast.
Stores a list of template parameters for a TemplateDecl and its derived classes.
static DeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Construct an empty declaration reference expression.
SourceLocation getOperatorLoc() const
Returns the location of the operator symbol in the expression.
Describes how types, statements, expressions, and declarations should be printed. ...
static DesignatedInitExpr * Create(const ASTContext &C, Designator *Designators, unsigned NumDesignators, ArrayRef< Expr * > IndexExprs, SourceLocation EqualOrColonLoc, bool GNUSyntax, Expr *Init)
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
static bool isAssignmentOp(Opcode Opc)
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
unsigned path_size() const
Defines the clang::Expr interface and subclasses for C++ expressions.
Expr * getArrayIndex(const Designator &D) const
FieldDecl * getSourceBitField()
If this expression refers to a bit-field, retrieve the declaration of that bit-field.
static int getAccessorIdx(char c)
Represents a C99 designated initializer expression.
Represents a class template specialization, which refers to a class template with a given set of temp...
const Expr * operator*() const
QualType getReceiverType() const
Retrieve the receiver type to which this message is being directed.
StringRef getBufferData(FileID FID, bool *Invalid=nullptr) const
Return a StringRef to the source buffer data for the specified FileID.
ShuffleVectorExpr(const ASTContext &C, ArrayRef< Expr * > args, QualType Type, SourceLocation BLoc, SourceLocation RP)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
ObjCInterfaceDecl * getClassReceiver() const
Converts between different integral complex types. _Complex char -> _Complex long long _Complex unsig...
static ObjCArrayLiteral * Create(const ASTContext &C, ArrayRef< Expr * > Elements, QualType T, ObjCMethodDecl *Method, SourceRange SR)
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
bool isReferenceType() const
bool isImplicitCXXThis() const
Whether this expression is an implicit reference to 'this' in C++.
static ObjCMessageExpr * CreateEmpty(const ASTContext &Context, unsigned NumArgs, unsigned NumStoredSelLocs)
Create an empty Objective-C message expression, to be filled in by subsequent calls.
void setNumArgs(const ASTContext &C, unsigned NumArgs)
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
bool isUnevaluated(unsigned ID) const
Returns true if this builtin does not perform the side-effects of its arguments.
void Deallocate(void *Ptr) const
const Stmt * getBody() const
Converting between two Objective-C object types, which can occur when performing reference binding to...
unsigned getOffsetOfStringByte(const Token &TheTok, unsigned ByteNo) const
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
[ARC] Causes a value of block type to be copied to the heap, if it is not already there...
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)
CallExpr(const ASTContext &C, StmtClass SC, Expr *fn, unsigned NumPreArgs, ArrayRef< Expr * > args, QualType t, ExprValueKind VK, SourceLocation rparenloc)
ObjCSubscriptRefExpr(Expr *base, Expr *key, QualType T, ExprValueKind VK, ExprObjectKind OK, ObjCMethodDecl *getMethod, ObjCMethodDecl *setMethod, SourceLocation RB)
Stmt * getBody() const override
bool refersToVectorElement() const
Returns whether this expression refers to a vector element.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
void setComponent(unsigned Idx, OffsetOfNode ON)
bool isExplicitSpecialization() const
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
SelectorLocationsKind hasStandardSelectorLocs(Selector Sel, ArrayRef< SourceLocation > SelLocs, ArrayRef< Expr * > Args, SourceLocation EndLoc)
Returns true if all SelLocs are in a "standard" location.
const ObjCPropertyRefExpr * getObjCProperty() const
If this expression is an l-value for an Objective C property, find the underlying property reference ...
SourceLocation getRParenLoc() const
static OffsetOfExpr * Create(const ASTContext &C, QualType type, SourceLocation OperatorLoc, TypeSourceInfo *tsi, ArrayRef< OffsetOfNode > comps, ArrayRef< Expr * > exprs, SourceLocation RParenLoc)
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
struct FieldDesignator Field
A field designator, e.g., ".x".
SourceLocation getSuperLoc() const
Retrieve the location of the 'super' keyword for a class or instance message to 'super', otherwise an invalid source location.
const Expr *const * const_semantics_iterator
Provides information about a function template specialization, which is a FunctionDecl that has been ...
Converts a floating point complex to bool by comparing against 0+0i.
Describes an C or C++ initializer list.
const TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
uint32_t getCodeUnit(size_t i) const
void setValue(const ASTContext &C, const llvm::APInt &Val)
SelectorLocationsKind
Whether all locations of the selector identifiers are in a "standard" position.
const TargetInfo & getTargetInfo() const
An lvalue ref-qualifier was provided (&).
Expr * operator[](size_t idx)
bool isSpecificPlaceholderType(unsigned K) const
isSpecificPlaceholderType - Test for a specific placeholder type.
const LangOptions & getLangOpts() const
ObjCBridgeCastKind getBridgeKind() const
Determine which kind of bridge is being performed via this cast.
Capturing by copy (a.k.a., by value)
unsigned getLength() const
DeclarationNameInfo getNameInfo() const
QualType getReturnType() const
QualType getSuperType() const
Retrieve the type referred to by 'super'.
bool isSuperReceiver() const
const CXXRecordDecl * getParent() const
field_range fields() const
NullPointerConstantValueDependence
Enumeration used to describe how isNullPointerConstant() should cope with value-dependent expressions...
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of lambda captures.
semantics_iterator semantics_end()
A builtin binary operation expression such as "x + y" or "x <= y".
const Expr * skipRValueSubobjectAdjustments(SmallVectorImpl< const Expr * > &CommaLHS, SmallVectorImpl< SubobjectAdjustment > &Adjustments) const
Selector getSelector() const
bool isValueDependent() const
RecordDecl * getDecl() const
FunctionDecl * getTemplateInstantiationPattern() const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
bool isInstantiationDependent() const
Whether this nested name specifier involves a template parameter.
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > IL, Expr *Step, Expr *CalcStep)
Creates clause with a list of variables VL and a linear step Step.
Expr * IgnoreParenCasts() LLVM_READONLY
QualType getTypeAsWritten() const
static ObjCSubscriptRefExpr * Create(const ASTContext &C, Expr *base, Expr *key, QualType T, ObjCMethodDecl *getMethod, ObjCMethodDecl *setMethod, SourceLocation RB)
StringRef getBridgeKindName() const
Retrieve the kind of bridge being performed as a string.
static bool isBooleanType(QualType Ty)
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
An adjustment to be made to the temporary created when emitting a reference binding, which accesses a particular subobject of that temporary.
std::reverse_iterator< const_iterator > const_reverse_iterator
Represents binding an expression to a temporary.
CXXTemporary * getTemporary()
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
unsigned getBuiltinCallee() const
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'.
An ordinary object is located at an address in memory.
const Expr * getBase() const
This represents the body of a CapturedStmt, and serves as its DeclContext.
Represents an ObjC class declaration.
Bridging via __bridge_transfer, which transfers ownership of an Objective-C pointer into ARC...
static SourceLocation AdvanceToTokenCharacter(SourceLocation TokStart, unsigned Character, const SourceManager &SM, const LangOptions &LangOpts)
Expression is a GNU-style __null constant.
unsigned getWCharWidth() const
A default argument (C++ [dcl.fct.default]).
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
void setIntValue(const ASTContext &C, const llvm::APInt &Val)
uint64_t * pVal
Used to store the >64 bits integer value.
Represents the this expression in C++.
const ArrayType * getAsArrayTypeUnsafe() const
llvm::APInt getValue() const
IdentifierInfo * getFieldName() const
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
bool isInstanceMessage() const
Determine whether this is an instance message to either a computed object or to super.
Expr * IgnoreParenNoopCasts(ASTContext &Ctx) LLVM_READONLY
Causes a block literal to by copied to the heap and then autoreleased.
bool isOBJCGCCandidate(ASTContext &Ctx) const
CastKind
CastKind - The kind of operation required for a conversion.
SourceRange getDesignatorsSourceRange() const
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat)
Specifies that the expression should never be value-dependent.
NamedDecl * getDecl() const
A field in a dependent type, known only by its name.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
ID
Defines the set of possible language-specific address spaces.
QualType getPointeeType() const
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
Converts between different floating point complex types. _Complex float -> _Complex double...
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
Exposes information about the current target.
InitListExpr(const ASTContext &C, SourceLocation lbraceloc, ArrayRef< Expr * > initExprs, SourceLocation rbraceloc)
const ObjCMethodDecl * getMethodDecl() const
designators_iterator designators_begin()
bool isObjCSelfExpr() const
Check if this expression is the ObjC 'self' implicit parameter.
void setString(const ASTContext &C, StringRef Str, StringKind Kind, bool IsPascal)
Sets the string data to the given string data.
SourceLocation getLocStart() const LLVM_READONLY
bool isKnownToHaveBooleanValue() const
void setDesignators(const ASTContext &C, const Designator *Desigs, unsigned NumDesigs)
SourceLocation getLocStart() const LLVM_READONLY
StringRef getName() const
Return the actual identifier string.
Converts an integral complex to an integral real of the source's element type by discarding the imagi...
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
void outputString(raw_ostream &OS) const
SourceRange getReceiverRange() const
Source range of the receiver.
double getValueAsApproximateDouble() const
SourceLocation getLocEnd() const LLVM_READONLY
void setTypeDependent(bool TD)
Set whether this expression is type-dependent or not.
bool isUnusedResultAWarning(const Expr *&WarnExpr, SourceLocation &Loc, SourceRange &R1, SourceRange &R2, ASTContext &Ctx) const
Represents a C++ destructor within a class.
SourceRange getSourceRange() const
SourceLocation getLocEnd() const LLVM_READONLY
const ParmVarDecl * getParamDecl(unsigned i) const
Expr * getArrayRangeStart(const Designator &D) const
DeclContext * getDeclContext()
ObjCInterfaceDecl * getReceiverInterface() const
Retrieve the Objective-C interface to which this message is being directed, if known.
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given unary opcode. ...
Expr ** getArgs()
Retrieve the arguments to this message, not including the receiver.
ImplicitParamDecl * getSelfDecl() const
Classification Classify(ASTContext &Ctx) const
Classify - Classify this expression according to the C++11 expression taxonomy.
static FloatingLiteral * Create(const ASTContext &C, const llvm::APFloat &V, bool isexact, QualType Type, SourceLocation L)
static ObjCDictionaryLiteral * Create(const ASTContext &C, ArrayRef< ObjCDictionaryElement > VK, bool HasPackExpansions, QualType T, ObjCMethodDecl *method, SourceRange SR)
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
SourceLocation getLocEnd() const LLVM_READONLY
Expr * getSubExpr() const
bool isDependentType() const
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool EvaluateAsInt(llvm::APSInt &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects) const
QualType getCXXNameType() const
An expression that sends a message to the given Objective-C object or class.
Converts from an integral complex to a floating complex. _Complex unsigned -> _Complex float...
Expr * getSubExprAsWritten()
Retrieve the cast subexpression as it was written in the source code, looking through any implicit ca...
DeclarationName getDeclName() const
Represents a reference to a non-type template parameter that has been substituted with a template arg...
The result type of a method or function.
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name, with source-location information.
void getEncodedElementAccess(SmallVectorImpl< unsigned > &Elts) const
getEncodedElementAccess - We encode the fields as a llvm ConstantArray.
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocationOfByte(unsigned ByteNo, const SourceManager &SM, const LangOptions &Features, const TargetInfo &Target) const
const Expr * operator->() const
InitListExpr * getUpdater() const
bool isArrayRangeDesignator() const
SourceLocation getCaretLocation() const
Expr * IgnoreCasts() LLVM_READONLY
Ignore casts. Strip off any CastExprs, returning their operand.
bool isBoundMemberFunction(ASTContext &Ctx) const
Returns true if this expression is a bound member function.
const llvm::fltSemantics & getSemantics() const
Return the APFloat semantics this literal uses.
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
Expr * IgnoreConversionOperator() LLVM_READONLY
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
unsigned DotLoc
The location of the '.' in the designated initializer.
UnaryExprOrTypeTraitExpr(UnaryExprOrTypeTrait ExprKind, TypeSourceInfo *TInfo, QualType resultType, SourceLocation op, SourceLocation rp)
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
ASTMatchFinder *const Finder
void ExpandDesignator(const ASTContext &C, unsigned Idx, const Designator *First, const Designator *Last)
Replaces the designator at index Idx with the series of designators in [First, Last).
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
Expr * getArrayRangeEnd(const Designator &D) const
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
unsigned getNumParams() const
Expression is not a Null pointer constant.
bool isImplicitAccess() const
Determine whether the base of this explicit is implicit.
bool isValid() const
Return true if this is a valid SourceLocation object.
FieldDecl * getField() const
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
ASTContext & getASTContext() const LLVM_READONLY
static QualType getUnderlyingType(const SubRegion *R)
llvm::APSInt EvaluateKnownConstInt(const ASTContext &Ctx, SmallVectorImpl< PartialDiagnosticAt > *Diag=nullptr) const
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Represents a static or instance method of a struct/union/class.
QualType getReceiverType(const ASTContext &ctx) const
Determine the type of the base, regardless of the kind of receiver.
void print(const PrintingPolicy &Policy, raw_ostream &Out) const
Print this template argument to the given output stream.
TypeSourceInfo * getClassReceiverTypeInfo() const
Returns a type-source information of a class message send, or NULL if the message is not a class mess...
const CXXRecordDecl * getBestDynamicClassType() const
For an expression of class type or pointer to class type, return the most derived class decl the expr...
const ConstantArrayType * getAsConstantArrayType(QualType T) const
SourceLocation getStrTokenLoc(unsigned TokNum) const
uint64_t VAL
Used to store the <= 64 bits integer value.
bool isIntegerConstantExpr(llvm::APSInt &Result, const ASTContext &Ctx, SourceLocation *Loc=nullptr, bool isEvaluated=true) const
Specifies that a value-dependent expression should be considered to never be a null pointer constant...
Expr * updateInit(const ASTContext &C, unsigned Init, Expr *expr)
Updates the initializer at index Init with the new expression expr, and returns the old expression at...
bool isUnevaluatedBuiltinCall(const ASTContext &Ctx) const
Returns true if this is a call to a builtin which does not evaluate side-effects within its arguments...
StringLiteral * getFunctionName()
RefQualifierKind
The kind of C++0x ref-qualifier associated with a function type, which determines whether a member fu...
Converts from an integral real to an integral complex whose element type matches the source...
ParenListExpr(const ASTContext &C, SourceLocation lparenloc, ArrayRef< Expr * > exprs, SourceLocation rparenloc)
static QualType findBoundMemberType(const Expr *expr)
Given an expression of bound-member type, find the type of the member. Returns null if this is an ove...
Expr ** getInits()
Retrieve the set of initializers.
bool isTypeDependent() const
Expr * operator->() const
static DesignatedInitExpr * CreateEmpty(const ASTContext &C, unsigned NumIndexExprs)
bool isVectorType() const
unsigned getBuiltinID() const
Returns a value indicating whether this function corresponds to a builtin function.
An rvalue ref-qualifier was provided (&&).
SourceLocation getLocStart() const LLVM_READONLY
const Expr * getBase() const
unsigned LBracketLoc
The location of the '[' starting the array range designator.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
SourceLocation getLocStart() const LLVM_READONLY
void sawArrayRangeDesignator(bool ARD=true)
bool isCXX98IntegralConstantExpr(const ASTContext &Ctx) const
QualType getType() const
Return the type wrapped by this type source info.
static MemberExpr * Create(const ASTContext &C, Expr *base, bool isarrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *memberdecl, DeclAccessPair founddecl, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *targs, QualType ty, ExprValueKind VK, ExprObjectKind OK)
SourceLocation getExprLoc() const LLVM_READONLY
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Represents a C11 generic selection.
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
QualType getCallReturnType(const ASTContext &Ctx) const
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T-> getSizeExpr()))
Converts a floating point complex to floating point real of the source's element type. Just discards the imaginary component. _Complex long double -> long double.
SourceLocation getLParenLoc() const
StringRef getOpcodeStr() const
static std::size_t sizeFor(unsigned NumTemplateArgs)
void setExprs(const ASTContext &C, ArrayRef< Expr * > Exprs)
SourceLocation getLocStart() const LLVM_READONLY
EvalResult is a struct with detailed info about an evaluated expression.
Converts an integral complex to bool by comparing against 0+0i.
bool hasSideEffects(Expr *E, ASTContext &Ctx)
SourceLocation getSelectorLoc(unsigned Index) const
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return 0.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
static LLVM_READONLY bool isPrintable(unsigned char c)
bool isTemporaryObject(ASTContext &Ctx, const CXXRecordDecl *TempTy) const
Determine whether the result of this expression is a temporary object of the given class type...
AtomicExpr(SourceLocation BLoc, ArrayRef< Expr * > args, QualType t, AtomicOp op, SourceLocation RP)
unsigned getCharWidth() const
A field designator, e.g., ".x".
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
The same as PrettyFunction, except that the 'virtual' keyword is omitted for virtual member functions...
bool isClassReceiver() const
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
Kind getKind() const
Determine what kind of offsetof node this is.
SourceLocation getLocStart() const LLVM_READONLY
Expression is a Null pointer constant built from a zero integer expression that is not a simple...
void resize(const ASTContext &C, unsigned N, const T &NV)
void setInstantiationDependent(bool ID)
Set whether this expression is instantiation-dependent or not.
StringKind getKind() const
Expression is a C++11 nullptr.
semantics_iterator semantics_begin()
unsigned getNumArgs() const
A conversion of a floating point real to a floating point complex of the original type...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
ConstEvaluatedExprVisitor - This class visits 'const Expr *'s.
Bridging via __bridge_retain, which makes an ARC object available as a +1 C pointer.
unsigned getNumArgs() const
unsigned getNumConcatenated() const
static PseudoObjectExpr * Create(const ASTContext &Context, Expr *syntactic, ArrayRef< Expr * > semantic, unsigned resultIndex)
llvm::APFloat getValue() const
[ARC] Reclaim a retainable object pointer object that may have been produced and autoreleased as part...
Expr * IgnoreParenImpCasts() LLVM_READONLY
FieldDecl * getField() const
For a field offsetof node, returns the field.
bool isConstantInitializer(ASTContext &Ctx, bool ForRef, const Expr **Culprit=nullptr) const
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier, e.g., N::foo.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
struct ArrayOrRangeDesignator ArrayOrRange
An array or GNU array-range designator, e.g., "[9]" or "[10..15]".
Not an overloaded operator.
MemberExpr(Expr *base, bool isarrow, SourceLocation operatorloc, ValueDecl *memberdecl, const DeclarationNameInfo &NameInfo, QualType ty, ExprValueKind VK, ExprObjectKind OK)
static const TypeInfo & getInfo(unsigned id)
SourceLocation getCaretLocation() const
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
SourceLocation getLocEnd() const LLVM_READONLY
static StringRef getIdentTypeName(IdentType IT)
void setIndexExpr(unsigned Idx, Expr *E)
static CStyleCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *BasePath, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation R)
[ARC] Produces a retainable object pointer so that it may be consumed, e.g. by being passed to a cons...
static ImplicitCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize)
SourceLocation getLocStart() const LLVM_READONLY
bool isFunctionType() const
Expr * IgnoreParenLValueCasts() LLVM_READONLY
Converts from T to _Atomic(T).
Expr * getArg(unsigned Arg)
Return the specified argument.
CXXConstructorDecl * getConstructor() const
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Converts from a floating complex to an integral complex. _Complex float -> _Complex int...
QualType getSuperReceiverType() const
SourceLocation getLocEnd() const LLVM_READONLY
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver. ...
Represents a base class of a C++ class.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
A use of a default initializer in a constructor or in aggregate initialization.
A template argument list.
static CStyleCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize)
static const Expr * skipTemporaryBindingsNoOpCastsAndParens(const Expr *E)
Skip over any no-op casts and any temporary-binding expressions.
SourceLocation getLocEnd() const LLVM_READONLY
void reserve(const ASTContext &C, unsigned N)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
Expression is a Null pointer constant built from a literal zero.
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
bool hasArrayFiller() const
Return true if this is an array initializer and its array "filler" has been set.
Represents a C++ struct/union/class.
bool hasNonTrivialCall(const ASTContext &Ctx) const
Determine whether this expression involves a call to any function that is not trivial.
void initializeFrom(SourceLocation TemplateKWLoc, const TemplateArgumentListInfo &List)
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
void * Allocate(size_t Size, unsigned Align=8) const
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
bool isImplicit() const
Indicates whether the message send was implicitly generated by the implementation. If false, it was written explicitly in the source code.
Builtin::Context & BuiltinInfo
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
unsigned getNumSubExprs()
const Expr * operator[](size_t idx) const
Converts from _Atomic(T) to T.
bool hasExplicitTemplateArgs() const
Determines whether this declaration reference was followed by an explicit template argument list...
Defines the clang::TargetInfo interface.
unsigned GetStringLength() const
Designator * getDesignator(unsigned Idx)
static bool hasAnyTypeDependentArguments(ArrayRef< Expr * > Exprs)
void reserveInits(const ASTContext &C, unsigned NumInits)
Reserve space for some number of initializers.
bool isIncompleteArrayType() const
bool isStringLiteralInit() const
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
QualType getElementType() const
bool hasQualifiers() const
Determine whether this type has any qualifiers.
SourceLocation getLocForStartOfFile(FileID FID) const
Return the source location corresponding to the first byte of the specified file. ...
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
const Expr * getInit(unsigned Init) const
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
static ObjCArrayLiteral * CreateEmpty(const ASTContext &C, unsigned NumElements)
bool isFieldDesignator() const
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
An l-value expression is a reference to an object with independent storage.
A trivial tuple used to represent a source range.
static StringRef getOpcodeStr(Opcode Op)
unsigned getNumElements() const
getNumElements - Get the number of components being selected.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
bool EvaluateAsLValue(EvalResult &Result, const ASTContext &Ctx) const
The receiver is a superclass.
unsigned getNumPreArgs() const
bool isExplicitSpecialization() const
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
bool isIntegralType(ASTContext &Ctx) const
Determine whether this type is an integral type.
This class handles loading and caching of source files into memory.
const CXXDestructorDecl * getDestructor() const
bool isArrayDesignator() const
Defines enum values for all the target-independent builtin functions.
NullPointerConstantKind
Enumeration used to describe the kind of Null pointer constant returned from isNullPointerConstant()...
bool isIntegerType() const
Expr * IgnoreParens() LLVM_READONLY
StreamedQualTypeHelper stream(const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine()) const
bool isPointerType() const
SourceRange getSourceRange() const LLVM_READONLY
QualType getArgumentType() const
SourceLocation getLocStart() const LLVM_READONLY