;
44 const Expr*
E=
this;
49 if(
auto*BO = dyn_cast<BinaryOperator>(
E)) {
50 if(BO->getOpcode() == BO_Comma) {
57 if(
auto*MTE = dyn_cast<MaterializeTemporaryExpr>(
E)) {
58 E= MTE->getSubExpr();
79 returncast<CXXRecordDecl>(
D);
85 const Expr*
E=
this;
89 if(
const auto*CE = dyn_cast<CastExpr>(
E)) {
90 if((CE->getCastKind() == CK_DerivedToBase ||
91CE->getCastKind() == CK_UncheckedDerivedToBase) &&
100 if(CE->getCastKind() == CK_NoOp) {
101 E= CE->getSubExpr();
104}
else if(
const auto*ME = dyn_cast<MemberExpr>(
E)) {
105 if(!ME->isArrow()) {
106assert(ME->getBase()->getType()->getAsRecordDecl());
107 if(
const auto*Field = dyn_cast<FieldDecl>(ME->getMemberDecl())) {
108 if(!Field->isBitField() && !Field->getType()->isReferenceType()) {
115}
else if(
const auto*BO = dyn_cast<BinaryOperator>(
E)) {
116 if(BO->getOpcode() == BO_PtrMemD) {
117assert(BO->getRHS()->isPRValue());
123 if(BO->getOpcode() == BO_Comma) {
124CommaLHSs.push_back(BO->getLHS());
145 switch(UO->getOpcode()) {
147 returnUO->getSubExpr()->isKnownToHaveBooleanValue(Semantic);
159 returnCE->getSubExpr()->isKnownToHaveBooleanValue(Semantic);
162 switch(BO->getOpcode()) {
163 default:
return false;
178 returnBO->getLHS()->isKnownToHaveBooleanValue(Semantic) &&
179BO->getRHS()->isKnownToHaveBooleanValue(Semantic);
183 returnBO->getRHS()->isKnownToHaveBooleanValue(Semantic);
188 returnCO->getTrueExpr()->isKnownToHaveBooleanValue(Semantic) &&
189CO->getFalseExpr()->isKnownToHaveBooleanValue(Semantic);
191 if(isa<ObjCBoolLiteralExpr>(
E))
194 if(
const auto*OVE = dyn_cast<OpaqueValueExpr>(
E))
195 returnOVE->getSourceExpr()->isKnownToHaveBooleanValue(Semantic);
198 if(!Semantic && FD->getType()->isUnsignedIntegerType() &&
199!FD->getBitWidth()->isValueDependent() && FD->getBitWidthValue() == 1)
208 boolIgnoreTemplateOrMacroSubstitution)
const{
210 const Decl*
D=
nullptr;
212 if(
const auto*ME = dyn_cast<MemberExpr>(
E))
213 D= ME->getMemberDecl();
214 else if(
const auto*DRE = dyn_cast<DeclRefExpr>(
E))
216 else if(
const auto*IRE = dyn_cast<ObjCIvarRefExpr>(
E))
220StrictFlexArraysLevel,
221IgnoreTemplateOrMacroSubstitution);
231 if(
Value.isMemberPointer())
232 return Value.getMemberPointerDecl();
234 if(
Value.isLValue() &&
Value.getLValueOffset().isZero())
248 template<
classE,
classT>
251 return static_cast<const E*
>(
expr)->getExprLoc();
261 return static_cast<const E*
>(
expr)->getBeginLoc();
266 if(isa<EnumType>(
getType()))
269 const auto*ED = cast<EnumDecl>(ECD->getDeclContext());
270 if(ED->isCompleteDefinition())
279#define ABSTRACT_STMT(type) 280#define STMT(type, base) \ 281 case Stmt::type##Class: break; 282#define EXPR(type, base) \ 283 case Stmt::type##Class: return getExprLocImpl<type>(this, &type::getExprLoc); 284#include "clang/AST/StmtNodes.inc" 286llvm_unreachable(
"unknown expression kind");
297 "Invalid StorageKind Value");
307 if(!
Value.getInt().needsCleanup())
323 boolIsImmediateInvocation)
324:
FullExpr(ConstantExprClass, SubExpr) {
333::new (getTrailingObjects<APValue>())
APValue();
338 boolIsImmediateInvocation) {
339assert(!isa<ConstantExpr>(
E));
342 unsignedSize = totalSizeToAlloc<APValue, uint64_t>(
346 return new(Mem)
ConstantExpr(
E, StorageKind, IsImmediateInvocation);
357ConstantExpr::ConstantExpr(EmptyShell
Empty,
363::new (getTrailingObjects<APValue>())
APValue();
370 unsignedSize = totalSizeToAlloc<APValue, uint64_t>(
379 "Invalid storage for this value kind");
385Int64Result() = *
Value.getInt().getRawData();
394APValueResult() = std::move(
Value);
397llvm_unreachable(
"Invalid ResultKind Bits");
403 returnAPValueResult().
getInt();
405 returnllvm::APSInt(llvm::APInt(
ConstantExprBits.BitWidth, Int64Result()),
408llvm_unreachable(
"invalid Accessor");
416 returnAPValueResult();
426llvm_unreachable(
"invalid ResultKind");
430 boolRefersToEnclosingVariableOrCapture,
QualType T,
440RefersToEnclosingVariableOrCapture;
441 DeclRefExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter =
false;
448DeclRefExpr::DeclRefExpr(
const ASTContext&Ctx,
451 boolRefersToEnclosingVariableOrCapture,
460 new(getTrailingObjects<NestedNameSpecifierLoc>())
464*getTrailingObjects<NamedDecl *>() = FoundD;
466= (TemplateArgs || TemplateKWLoc.
isValid()) ? 1 : 0;
468RefersToEnclosingVariableOrCapture;
469 DeclRefExprBits.CapturedByCopyInLambdaWithExplicitObjectParameter =
false;
472 autoDeps = TemplateArgumentDependence::None;
473getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
474TemplateKWLoc, *TemplateArgs, getTrailingObjects<TemplateArgumentLoc>(),
476assert(!(Deps & TemplateArgumentDependence::Dependent) &&
477 "built a DeclRefExpr with dependent template args");
478}
else if(TemplateKWLoc.
isValid()) {
479getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
490 boolRefersToEnclosingVariableOrCapture,
495 return Create(Context, QualifierLoc, TemplateKWLoc,
D,
496RefersToEnclosingVariableOrCapture,
498 T, VK, FoundD, TemplateArgs, NOUR);
504 boolRefersToEnclosingVariableOrCapture,
514 boolHasTemplateKWAndArgsInfo = TemplateArgs || TemplateKWLoc.
isValid();
518QualifierLoc ? 1 : 0, FoundD ? 1 : 0,
519HasTemplateKWAndArgsInfo ? 1 : 0,
520TemplateArgs ? TemplateArgs->
size() : 0);
523 return new(Mem)
DeclRefExpr(Context, QualifierLoc, TemplateKWLoc,
D,
524RefersToEnclosingVariableOrCapture, NameInfo,
525FoundD, TemplateArgs,
T, VK, NOUR);
531 boolHasTemplateKWAndArgsInfo,
532 unsignedNumTemplateArgs) {
533assert(NumTemplateArgs == 0 || HasTemplateKWAndArgsInfo);
537HasQualifier ? 1 : 0, HasFoundDecl ? 1 : 0, HasTemplateKWAndArgsInfo,
545 if(
getType()->isUndeducedType())
561SYCLUniqueStableNameExpr::SYCLUniqueStableNameExpr(
SourceLocationOpLoc,
567OpLoc(OpLoc), LParen(LParen), RParen(RParen) {
568setTypeSourceInfo(TSI);
572SYCLUniqueStableNameExpr::SYCLUniqueStableNameExpr(EmptyShell
Empty,
599 const NamedDecl*ND) -> std::optional<unsigned> {
600 if(
const auto*RD = dyn_cast<CXXRecordDecl>(ND))
601 returnRD->getDeviceLambdaManglingNumber();
610llvm::raw_string_ostream Out(Buffer);
611Ctx->mangleCanonicalTypeName(Ty, Out);
621assert((getIdentKind() == IK) &&
622 "IdentKind do not fit in PredefinedExprBitfields!");
623 boolHasFunctionName = SL !=
nullptr;
632PredefinedExpr::PredefinedExpr(EmptyShell
Empty,
boolHasFunctionName)
640 boolHasFunctionName = SL !=
nullptr;
641 void*Mem = Ctx.
Allocate(totalSizeToAlloc<Stmt *>(HasFunctionName),
647 boolHasFunctionName) {
648 void*Mem = Ctx.
Allocate(totalSizeToAlloc<Stmt *>(HasFunctionName),
658 return "__FUNCTION__";
660 return "__FUNCDNAME__";
662 return "L__FUNCTION__";
664 return "__PRETTY_FUNCTION__";
666 return "__FUNCSIG__";
668 return "L__FUNCSIG__";
672llvm_unreachable(
"Unknown ident kind for PredefinedExpr");
678 const Decl*CurrentDecl,
679 boolForceElaboratedPrinting) {
683 if(
const NamedDecl*ND = dyn_cast<NamedDecl>(CurrentDecl)) {
684std::unique_ptr<MangleContext> MC;
687 if(MC->shouldMangleDeclName(ND)) {
689llvm::raw_svector_ostream Out(Buffer);
695 else if(ND->hasAttr<CUDAGlobalAttr>())
699MC->mangleName(GD, Out);
701 if(!Buffer.empty() && Buffer.front() ==
'\01')
702 returnstd::string(Buffer.substr(1));
703 returnstd::string(Buffer);
705 returnstd::string(ND->getIdentifier()->getName());
709 if(isa<BlockDecl>(CurrentDecl)) {
714 if(DC->isFileContext())
718llvm::raw_svector_ostream Out(Buffer);
719 if(
auto*DCBlock = dyn_cast<BlockDecl>(DC))
722 else if(
auto*DCDecl = dyn_cast<Decl>(DC))
723Out <<
ComputeName(IK, DCDecl) <<
"_block_invoke";
724 returnstd::string(Out.str());
726 if(
const FunctionDecl*FD = dyn_cast<FunctionDecl>(CurrentDecl)) {
728 boolIsFuncOrFunctionInNonMSVCCompatEnv =
730IK == PredefinedIdentKind ::Function) &&
732 boolIsLFunctionInMSVCCommpatEnv =
734 boolIsFuncOrFunctionOrLFunctionOrFuncDName =
739 if((ForceElaboratedPrinting &&
740(IsFuncOrFunctionInNonMSVCCompatEnv || IsLFunctionInMSVCCommpatEnv)) ||
741(!ForceElaboratedPrinting && IsFuncOrFunctionOrLFunctionOrFuncDName))
742 returnFD->getNameAsString();
745llvm::raw_svector_ostream Out(Name);
747 if(
const CXXMethodDecl*MD = dyn_cast<CXXMethodDecl>(FD)) {
756PrettyCallbacks(
const LangOptions&LO) : LO(LO) {}
757std::string remapPath(StringRef
Path)
const override{
760 returnstd::string(p);
772llvm::raw_string_ostream POut(Proto);
781 const Type*Ty =
Decl->getType().getTypePtrOrNull();
787 if(FD->hasWrittenPrototype())
788FT = dyn_cast<FunctionProtoType>(AFT);
793 case CC_C: POut <<
"__cdecl ";
break;
804FD->printQualifiedName(POut, Policy);
808 returnstd::string(Name);
813 for(
unsignedi = 0, e =
Decl->getNumParams(); i != e; ++i) {
814 if(i) POut <<
", ";
815POut <<
Decl->getParamDecl(i)->getType().stream(Policy);
818 if(FT->isVariadic()) {
819 if(FD->getNumParams()) POut <<
", ";
824!
Decl->getNumParams()) {
830 if(
const CXXMethodDecl*MD = dyn_cast<CXXMethodDecl>(FD)) {
831assert(FT &&
"We must have a written prototype in this case.");
834 if(FT->isVolatile())
835POut <<
" volatile";
846 while(isa_and_nonnull<NamedDecl>(Ctx)) {
848= dyn_cast<ClassTemplateSpecializationDecl>(Ctx);
850Specs.push_back(Spec);
851Ctx = Ctx->getParent();
854std::string TemplateParams;
855llvm::raw_string_ostream TOut(TemplateParams);
858 D->getSpecializedTemplate()->getTemplateParameters();
860assert(Params->
size() == Args.
size());
861 for(
unsignedi = 0, numParams = Params->
size(); i != numParams; ++i) {
863 if(Param.empty())
continue;
864TOut << Param <<
" = ";
873= FD->getTemplateSpecializationInfo();
878assert(Params->
size() == Args->
size());
879 for(
unsignedi = 0, e = Params->
size(); i != e; ++i) {
881 if(Param.empty())
continue;
882TOut << Param <<
" = ";
883Args->
get(i).
print(Policy, TOut,
true);
888 if(!TemplateParams.empty()) {
890TemplateParams.resize(TemplateParams.size() - 2);
891POut <<
" ["<< TemplateParams <<
"]";
899Proto =
"auto "+ Proto;
900 else if(FT && FT->getReturnType()->getAs<
DecltypeType>())
905 else if(!isa<CXXConstructorDecl>(FD) && !isa<CXXDestructorDecl>(FD))
910 returnstd::string(Name);
912 if(
const CapturedDecl*CD = dyn_cast<CapturedDecl>(CurrentDecl)) {
916 if(DC->isFunctionOrMethod() && (DC->getDeclKind() != Decl::Captured)) {
920llvm_unreachable(
"CapturedDecl not inside a function or method");
922 if(
const ObjCMethodDecl*MD = dyn_cast<ObjCMethodDecl>(CurrentDecl)) {
924llvm::raw_svector_ostream Out(Name);
925Out << (MD->isInstanceMethod() ?
'-':
'+');
934dyn_cast<ObjCCategoryImplDecl>(MD->getDeclContext()))
935Out <<
'('<< *CID <<
')';
938MD->getSelector().print(Out);
941 returnstd::string(Name);
943 if(isa<TranslationUnitDecl>(CurrentDecl) &&
952 constllvm::APInt &Val) {
954 C.Deallocate(
pVal);
956BitWidth = Val.getBitWidth();
957 unsignedNumWords = Val.getNumWords();
958 constuint64_t* Words = Val.getRawData();
960 pVal=
new(
C) uint64_t[NumWords];
961std::copy(Words, Words + NumWords,
pVal);
962}
else if(NumWords == 1)
968IntegerLiteral::IntegerLiteral(
const ASTContext&
C,
constllvm::APInt &
V,
971assert(
type->isIntegerType() &&
"Illegal type in IntegerLiteral");
972assert(
V.getBitWidth() ==
C.getIntWidth(
type) &&
973 "Integer type is not the correct size for constant.");
989FixedPointLiteral::FixedPointLiteral(
const ASTContext&
C,
constllvm::APInt &
V,
994assert(
type->isFixedPointType() &&
"Illegal type in FixedPointLiteral");
995assert(
V.getBitWidth() ==
C.getTypeInfo(
type).Width &&
996 "Fixed point type is not the correct size for constant.");
1002 constllvm::APInt &
V,
1020S, llvm::APSInt::getUnsigned(
getValue().getZExtValue()), Scale);
1021 returnstd::string(S);
1043StringRef Escaped = escapeCStyle<EscapeChar::Single>(Val);
1044 if(!Escaped.empty()) {
1045OS <<
"'"<< Escaped <<
"'";
1053 if(Val < 256 &&
isPrintable((
unsigned char)Val))
1054OS <<
"'"<< (char)Val <<
"'";
1056OS <<
"'\\x"<< llvm::format(
"%02x", Val) <<
"'";
1057 else if(Val <= 0xFFFF)
1058OS <<
"'\\u"<< llvm::format(
"%04x", Val) <<
"'";
1060OS <<
"'\\U"<< llvm::format(
"%08x", Val) <<
"'";
1064FloatingLiteral::FloatingLiteral(
const ASTContext&
C,
constllvm::APFloat &
V,
1067setSemantics(
V.getSemantics());
1073FloatingLiteral::FloatingLiteral(
const ASTContext&
C, EmptyShell
Empty)
1075setRawSemantics(llvm::APFloatBase::S_IEEEhalf);
1096 V.convert(llvm::APFloat::IEEEdouble(), llvm::APFloat::rmNearestTiesToEven,
1098 return V.convertToDouble();
1103 unsignedCharByteWidth = 0;
1107CharByteWidth =
Target.getCharWidth();
1110CharByteWidth =
Target.getWCharWidth();
1113CharByteWidth =
Target.getChar16Width();
1116CharByteWidth =
Target.getChar32Width();
1119 return sizeof(char);
1121assert((CharByteWidth & 7) == 0 &&
"Assumes character size is byte multiple");
1123assert((CharByteWidth == 1 || CharByteWidth == 2 || CharByteWidth == 4) &&
1124 "The only supported character byte widths are 1,2 and 4!");
1125 returnCharByteWidth;
1128StringLiteral::StringLiteral(
const ASTContext&Ctx, StringRef Str,
1131 unsignedNumConcatenated)
1134 unsignedLength = Str.size();
1141 "StringLiteral must be of constant array type!");
1142 unsignedCharByteWidth = mapCharByteWidth(Ctx.
getTargetInfo(), Kind);
1143 unsignedByteLength = Str.size();
1144assert((ByteLength % CharByteWidth == 0) &&
1145 "The size of the data must be a multiple of CharByteWidth!");
1150 switch(CharByteWidth) {
1152Length = ByteLength;
1155Length = ByteLength / 2;
1158Length = ByteLength / 4;
1161llvm_unreachable(
"Unsupported character width!");
1167assert(!Pascal &&
"Can't make an unevaluated Pascal string");
1172*getTrailingObjects<unsigned>() = Length;
1176std::memcpy(getTrailingObjects<SourceLocation>(), Loc,
1180std::memcpy(getTrailingObjects<char>(), Str.data(), Str.size());
1185StringLiteral::StringLiteral(EmptyShell
Empty,
unsignedNumConcatenated,
1186 unsignedLength,
unsignedCharByteWidth)
1190*getTrailingObjects<unsigned>() = Length;
1196 unsignedNumConcatenated) {
1197 void*Mem = Ctx.
Allocate(totalSizeToAlloc<unsigned, SourceLocation, char>(
11981, NumConcatenated, Str.size()),
1205 unsignedNumConcatenated,
1207 unsignedCharByteWidth) {
1208 void*Mem = Ctx.
Allocate(totalSizeToAlloc<unsigned, SourceLocation, char>(
12091, NumConcatenated, Length * CharByteWidth),
1234 static const charHex[] =
"0123456789ABCDEF";
1237 for(
unsignedI = 0, N =
getLength(); I != N; ++I) {
1239StringRef Escaped = escapeCStyle<EscapeChar::Double>(Char);
1240 if(Escaped.empty()) {
1246Char >= 0xd800 && Char <= 0xdbff) {
1248 if(Trail >= 0xdc00 && Trail <= 0xdfff) {
1249Char = 0x10000 + ((Char - 0xd800) << 10) + (Trail - 0xdc00);
1259(Char >= 0xd800 && Char <= 0xdfff) || Char >= 0x110000) {
1263 while((Char >> Shift) == 0)
1265 for(
; Shift >= 0; Shift -= 4)
1266OS << Hex[(Char >> Shift) & 15];
1273<< Hex[(Char >> 20) & 15]
1274<< Hex[(Char >> 16) & 15];
1277OS << Hex[(Char >> 12) & 15]
1278<< Hex[(Char >> 8) & 15]
1279<< Hex[(Char >> 4) & 15]
1280<< Hex[(Char >> 0) & 15];
1286 if(LastSlashX + 1 == I) {
1288 case '0':
case '1':
case '2':
case '3':
case '4':
1289 case '5':
case '6':
case '7':
case '8':
case '9':
1290 case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
1291 case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
1296assert(Char <= 0xff &&
1297 "Characters above 0xff should already have been handled.");
1303<< (char)(
'0'+ ((Char >> 6) & 7))
1304<< (char)(
'0'+ ((Char >> 3) & 7))
1305<< (char)(
'0'+ ((Char >> 0) & 7));
1334 unsigned*StartTokenByteOffset)
const{
1338 "Only narrow string literals are currently supported");
1343 unsignedStringOffset = 0;
1345TokNo = *StartToken;
1346 if(StartTokenByteOffset) {
1347StringOffset = *StartTokenByteOffset;
1348ByteNo -= StringOffset;
1360std::pair<FileID, unsigned> LocInfo =
1361 SM.getDecomposedLoc(StrTokSpellingLoc);
1363StringRef Buffer =
SM.getBufferData(LocInfo.first, &
Invalid);
1365 if(StartTokenByteOffset !=
nullptr)
1366*StartTokenByteOffset = StringOffset;
1367 if(StartToken !=
nullptr)
1368*StartToken = TokNo;
1369 returnStrTokSpellingLoc;
1372 const char*StrData = Buffer.data()+LocInfo.second;
1375 LexerTheLexer(
SM.getLocForStartOfFile(LocInfo.first), Features,
1376Buffer.begin(), StrData, Buffer.end());
1385 if(ByteNo < TokNumBytes ||
1391 if(StartTokenByteOffset !=
nullptr)
1392*StartTokenByteOffset = StringOffset;
1393 if(StartToken !=
nullptr)
1394*StartToken = TokNo;
1399StringOffset += TokNumBytes;
1401ByteNo -= TokNumBytes;
1409#define UNARY_OPERATION(Name, Spelling) case UO_##Name: return Spelling; 1410#include "clang/AST/OperationKinds.def" 1412llvm_unreachable(
"Unknown unary operator");
1418 default: llvm_unreachable(
"No unary operator for overloaded function");
1419 caseOO_PlusPlus:
returnPostfix ? UO_PostInc : UO_PreInc;
1420 caseOO_MinusMinus:
returnPostfix ? UO_PostDec : UO_PreDec;
1421 caseOO_Amp:
returnUO_AddrOf;
1422 caseOO_Star:
returnUO_Deref;
1423 caseOO_Plus:
returnUO_Plus;
1424 caseOO_Minus:
returnUO_Minus;
1425 caseOO_Tilde:
returnUO_Not;
1426 caseOO_Exclaim:
returnUO_LNot;
1427 caseOO_Coawait:
returnUO_Coawait;
1433 caseUO_PostInc:
caseUO_PreInc:
returnOO_PlusPlus;
1434 caseUO_PostDec:
caseUO_PreDec:
returnOO_MinusMinus;
1435 caseUO_AddrOf:
returnOO_Amp;
1436 caseUO_Deref:
returnOO_Star;
1437 caseUO_Plus:
returnOO_Plus;
1438 caseUO_Minus:
returnOO_Minus;
1439 caseUO_Not:
returnOO_Tilde;
1440 caseUO_LNot:
returnOO_Exclaim;
1441 caseUO_Coawait:
returnOO_Coawait;
1456NumArgs = std::max<unsigned>(Args.size(), MinNumArgs);
1457 unsignedNumPreArgs = PreArgs.size();
1459assert((NumPreArgs ==
getNumPreArgs()) &&
"NumPreArgs overflow!");
1461 unsignedOffsetToTrailingObjects = offsetToTrailingObjects(SC);
1462 CallExprBits.OffsetToTrailingObjects = OffsetToTrailingObjects;
1463assert((
CallExprBits.OffsetToTrailingObjects == OffsetToTrailingObjects) &&
1464 "OffsetToTrailingObjects overflow!");
1469 for(
unsignedI = 0; I != NumPreArgs; ++I)
1471 for(
unsignedI = 0; I != Args.size(); ++I)
1473 for(
unsignedI = Args.size(); I != NumArgs; ++I)
1488assert((NumPreArgs ==
getNumPreArgs()) &&
"NumPreArgs overflow!");
1490 unsignedOffsetToTrailingObjects = offsetToTrailingObjects(SC);
1491 CallExprBits.OffsetToTrailingObjects = OffsetToTrailingObjects;
1492assert((
CallExprBits.OffsetToTrailingObjects == OffsetToTrailingObjects) &&
1493 "OffsetToTrailingObjects overflow!");
1503 unsignedNumArgs = std::max<unsigned>(Args.size(), MinNumArgs);
1508 return new(Mem)
CallExpr(CallExprClass, Fn,
{}, Args, Ty, VK,
1509RParenLoc, FPFeatures, MinNumArgs,
UsesADL);
1516 "Misaligned memory in CallExpr::CreateTemporary!");
1517 return new(Mem)
CallExpr(CallExprClass, Fn,
{},
{}, Ty,
1524 unsignedSizeOfTrailingObjects =
1529 CallExpr(CallExprClass,
0, NumArgs, HasFPFeatures,
Empty);
1532unsignedCallExpr::offsetToTrailingObjects(StmtClass SC) {
1536 caseCXXOperatorCallExprClass:
1538 caseCXXMemberCallExprClass:
1540 caseUserDefinedLiteralClass:
1542 caseCUDAKernelCallExprClass:
1545llvm_unreachable(
"unexpected class deriving from CallExpr!");
1552 while(
auto*NTTP = dyn_cast<SubstNonTypeTemplateParmExpr>(CEE))
1557 if(
auto*BO = dyn_cast<BinaryOperator>(CEE)) {
1558 if(BO->isPtrMemOp()) {
1562}
else if(
auto*UO = dyn_cast<UnaryOperator>(CEE)) {
1563 if(UO->getOpcode() == UO_Deref || UO->getOpcode() == UO_AddrOf ||
1564UO->getOpcode() == UO_Plus) {
1572 if(
auto*DRE = dyn_cast<DeclRefExpr>(CEE))
1573 returnDRE->getDecl();
1574 if(
auto*ME = dyn_cast<MemberExpr>(CEE))
1575 returnME->getMemberDecl();
1576 if(
auto*BE = dyn_cast<BlockExpr>(CEE))
1577 returnBE->getBlockDecl();
1585 returnFDecl ? FDecl->getBuiltinID() : 0;
1596 QualTypeCalleeType = Callee->getType();
1602 if(isa<CXXPseudoDestructorExpr>(Callee->IgnoreParens()))
1605 if(isa<UnresolvedMemberExpr>(Callee->IgnoreParens()))
1610assert(!CalleeType.
isNull());
1624std::pair<const NamedDecl *, const Attr *>
1628 if(
const auto*A =
D->
getAttr<WarnUnusedResultAttr>())
1629 return{
nullptr, A};
1634 if(
const auto*A = TD->getAttr<WarnUnusedResultAttr>())
1638TD = TD->desugar()->getAs<TypedefType>())
1639 if(
const auto*A = TD->getDecl()->getAttr<WarnUnusedResultAttr>())
1640 return{TD->getDecl(), A};
1641 return{
nullptr,
nullptr};
1645 if(
const auto*OCE = dyn_cast<CXXOperatorCallExpr>(
this))
1646 returnOCE->getBeginLoc();
1648 if(
const auto*Method =
1649dyn_cast_if_present<const CXXMethodDecl>(
getCalleeDecl());
1650Method && Method->isExplicitObjectMemberFunction()) {
1662 if(
const auto*OCE = dyn_cast<CXXOperatorCallExpr>(
this))
1663 returnOCE->getEndLoc();
1677 void*Mem =
C.Allocate(
1678totalSizeToAlloc<OffsetOfNode, Expr *>(comps.size(), exprs.size()));
1685 unsignednumComps,
unsignednumExprs) {
1687 C.Allocate(totalSizeToAlloc<OffsetOfNode, Expr *>(numComps, numExprs));
1696OperatorLoc(OperatorLoc), RParenLoc(RParenLoc), TSInfo(tsi),
1697NumComps(comps.size()), NumExprs(exprs.size()) {
1698 for(
unsignedi = 0; i != comps.size(); ++i)
1700 for(
unsignedi = 0; i != exprs.size(); ++i)
1718OpLoc(op), RParenLoc(rp) {
1719assert(ExprKind <=
UETT_Last&&
"invalid enum value!");
1722 "UnaryExprOrTypeTraitExprBits.Kind overflow!");
1736:
Expr(MemberExprClass,
T, VK, OK),
Base(
Base), MemberDecl(MemberDecl),
1737MemberDNLoc(NameInfo.
getInfo()), MemberLoc(NameInfo.getLoc()) {
1738assert(!NameInfo.
getName() ||
1743FoundDecl.getDecl() != MemberDecl ||
1746TemplateArgs || TemplateKWLoc.
isValid();
1752 new(getTrailingObjects<NestedNameSpecifierLoc>())
1755*getTrailingObjects<DeclAccessPair>() = FoundDecl;
1757 autoDeps = TemplateArgumentDependence::None;
1758getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
1759TemplateKWLoc, *TemplateArgs, getTrailingObjects<TemplateArgumentLoc>(),
1761}
else if(TemplateKWLoc.
isValid()) {
1762getTrailingObjects<ASTTemplateKWAndArgsInfo>()->initializeFrom(
1775 boolHasFoundDecl = FoundDecl.getDecl() != MemberDecl ||
1777 boolHasTemplateKWAndArgsInfo = TemplateArgs || TemplateKWLoc.
isValid();
1781HasQualifier, HasFoundDecl, HasTemplateKWAndArgsInfo,
1782TemplateArgs ? TemplateArgs->
size() : 0);
1784 void*Mem =
C.Allocate(Size,
alignof(
MemberExpr));
1785 return new(Mem)
MemberExpr(
Base, IsArrow, OperatorLoc, QualifierLoc,
1786TemplateKWLoc, MemberDecl, FoundDecl, NameInfo,
1787TemplateArgs,
T, VK, OK, NOUR);
1791 boolHasQualifier,
boolHasFoundDecl,
1792 boolHasTemplateKWAndArgsInfo,
1793 unsignedNumTemplateArgs) {
1794assert((!NumTemplateArgs || HasTemplateKWAndArgsInfo) &&
1795 "template args but no template arg info?");
1799HasQualifier, HasFoundDecl, HasTemplateKWAndArgsInfo,
1807 if(
getType()->isUndeducedType())
1823 returnBaseStartLoc;
1835boolCastExpr::CastConsistency()
const{
1837 caseCK_DerivedToBase:
1838 caseCK_UncheckedDerivedToBase:
1839 caseCK_DerivedToBaseMemberPointer:
1840 caseCK_BaseToDerived:
1841 caseCK_BaseToDerivedMemberPointer:
1842assert(!
path_empty() &&
"Cast kind should have a base path!");
1845 caseCK_CPointerToObjCPointerCast:
1846assert(
getType()->isObjCObjectPointerType());
1848 gotoCheckNoBasePath;
1850 caseCK_BlockPointerToObjCPointerCast:
1851assert(
getType()->isObjCObjectPointerType());
1853 gotoCheckNoBasePath;
1855 caseCK_ReinterpretMemberPointer:
1856assert(
getType()->isMemberPointerType());
1858 gotoCheckNoBasePath;
1864 if(!
getType()->isPointerType()) {
1865assert(
getType()->isObjCObjectPointerType() ==
1867assert(
getType()->isBlockPointerType() ==
1870 gotoCheckNoBasePath;
1872 caseCK_AnyPointerToBlockPointerCast:
1873assert(
getType()->isBlockPointerType());
1876 gotoCheckNoBasePath;
1878 caseCK_CopyAndAutoreleaseBlockObject:
1879assert(
getType()->isBlockPointerType());
1881 gotoCheckNoBasePath;
1883 caseCK_FunctionToPointerDecay:
1884assert(
getType()->isPointerType());
1886 gotoCheckNoBasePath;
1888 caseCK_AddressSpaceConversion: {
1897(!Ty.
isNull() && !SETy.isNull() &&
1899 gotoCheckNoBasePath;
1904 caseCK_ArrayToPointerDecay:
1905 caseCK_NullToMemberPointer:
1906 caseCK_NullToPointer:
1907 caseCK_ConstructorConversion:
1908 caseCK_IntegralToPointer:
1909 caseCK_PointerToIntegral:
1911 caseCK_VectorSplat:
1912 caseCK_IntegralCast:
1913 caseCK_BooleanToSignedIntegral:
1914 caseCK_IntegralToFloating:
1915 caseCK_FloatingToIntegral:
1916 caseCK_FloatingCast:
1917 caseCK_ObjCObjectLValueCast:
1918 caseCK_FloatingRealToComplex:
1919 caseCK_FloatingComplexToReal:
1920 caseCK_FloatingComplexCast:
1921 caseCK_FloatingComplexToIntegralComplex:
1922 caseCK_IntegralRealToComplex:
1923 caseCK_IntegralComplexToReal:
1924 caseCK_IntegralComplexCast:
1925 caseCK_IntegralComplexToFloatingComplex:
1926 caseCK_ARCProduceObject:
1927 caseCK_ARCConsumeObject:
1928 caseCK_ARCReclaimReturnedObject:
1929 caseCK_ARCExtendBlockObject:
1930 caseCK_ZeroToOCLOpaqueType:
1931 caseCK_IntToOCLSampler:
1932 caseCK_FloatingToFixedPoint:
1933 caseCK_FixedPointToFloating:
1934 caseCK_FixedPointCast:
1935 caseCK_FixedPointToIntegral:
1936 caseCK_IntegralToFixedPoint:
1939 gotoCheckNoBasePath;
1942 caseCK_LValueToRValue:
1944 caseCK_AtomicToNonAtomic:
1945 caseCK_NonAtomicToAtomic:
1946 caseCK_PointerToBoolean:
1947 caseCK_IntegralToBoolean:
1948 caseCK_FloatingToBoolean:
1949 caseCK_MemberPointerToBoolean:
1950 caseCK_FloatingComplexToBoolean:
1951 caseCK_IntegralComplexToBoolean:
1952 caseCK_LValueBitCast:
1953 caseCK_LValueToRValueBitCast:
1954 caseCK_UserDefinedConversion:
1955 caseCK_BuiltinFnToFnPtr:
1956 caseCK_FixedPointToBoolean:
1957 caseCK_HLSLArrayRValue:
1958 caseCK_HLSLVectorTruncation:
1960assert(
path_empty() &&
"Cast kind should not have a base path!");
1968#define CAST_OPERATION(Name) case CK_##Name: return #Name; 1969#include "clang/AST/OperationKinds.def" 1971llvm_unreachable(
"Unhandled cast kind!");
1977static Expr*ignoreImplicitSemaNodes(
Expr*
E) {
1978 if(
auto*Materialize = dyn_cast<MaterializeTemporaryExpr>(
E))
1979 returnMaterialize->getSubExpr();
1981 if(
auto*Binder = dyn_cast<CXXBindTemporaryExpr>(
E))
1982 returnBinder->getSubExpr();
1984 if(
auto*Full = dyn_cast<FullExpr>(
E))
1985 returnFull->getSubExpr();
1987 if(
auto*CPLIE = dyn_cast<CXXParenListInitExpr>(
E);
1988CPLIE && CPLIE->getInitExprs().size() == 1)
1989 returnCPLIE->getInitExprs()[0];
1996 const Expr*SubExpr =
nullptr;
1998 for(
const CastExpr*
E=
this;
E;
E= dyn_cast<ImplicitCastExpr>(SubExpr)) {
2003 if(
E->getCastKind() == CK_ConstructorConversion) {
2004SubExpr =
IgnoreExprNodes(cast<CXXConstructExpr>(SubExpr)->getArg(0),
2005ignoreImplicitSemaNodes);
2006}
else if(
E->getCastKind() == CK_UserDefinedConversion) {
2007assert((isa<CallExpr, BlockExpr>(SubExpr)) &&
2008 "Unexpected SubExpr for CK_UserDefinedConversion.");
2009 if(
auto*MCE = dyn_cast<CXXMemberCallExpr>(SubExpr))
2010SubExpr = MCE->getImplicitObjectArgument();
2014 return const_cast<Expr*
>(SubExpr);
2018 const Expr*SubExpr =
nullptr;
2020 for(
const CastExpr*
E=
this;
E;
E= dyn_cast<ImplicitCastExpr>(SubExpr)) {
2023 if(
E->getCastKind() == CK_ConstructorConversion)
2024 returncast<CXXConstructExpr>(SubExpr)->getConstructor();
2026 if(
E->getCastKind() == CK_UserDefinedConversion) {
2027 if(
auto*MCE = dyn_cast<CXXMemberCallExpr>(SubExpr))
2028 returnMCE->getMethodDecl();
2037#define ABSTRACT_STMT(x) 2038#define CASTEXPR(Type, Base) \ 2039 case Stmt::Type##Class: \ 2040 return static_cast<Type *>(this)->getTrailingObjects<CXXBaseSpecifier *>(); 2041#define STMT(Type, Base) 2042#include "clang/AST/StmtNodes.inc" 2044llvm_unreachable(
"non-cast expressions not possible here");
2059Field != FieldEnd; ++Field) {
2061!Field->isUnnamedBitField()) {
2071 caseImplicitCastExprClass:
2073->getTrailingObjects<FPOptionsOverride>();
2074 caseCStyleCastExprClass:
2076->getTrailingObjects<FPOptionsOverride>();
2077 caseCXXFunctionalCastExprClass:
2079->getTrailingObjects<FPOptionsOverride>();
2080 caseCXXStaticCastExprClass:
2082->getTrailingObjects<FPOptionsOverride>();
2084llvm_unreachable(
"Cast does not have FPFeatures");
2093 unsignedPathSize = (BasePath ? BasePath->size() : 0);
2095 C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *, FPOptionsOverride>(
2099assert((Kind != CK_LValueToRValue ||
2101 "invalid type for lvalue-to-rvalue conversion");
2105std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
2112 boolHasFPFeatures) {
2114 C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *, FPOptionsOverride>(
2115PathSize, HasFPFeatures));
2125 unsignedPathSize = (BasePath ? BasePath->size() : 0);
2127 C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *, FPOptionsOverride>(
2130 new(Buffer)
CStyleCastExpr(
T, VK, K, Op, PathSize, FPO, WrittenTy, L, R);
2132std::uninitialized_copy_n(BasePath->data(), BasePath->size(),
2139 boolHasFPFeatures) {
2141 C.Allocate(totalSizeToAlloc<CXXBaseSpecifier *, FPOptionsOverride>(
2142PathSize, HasFPFeatures));
2150#define BINARY_OPERATION(Name, Spelling) case BO_##Name: return Spelling; 2151#include "clang/AST/OperationKinds.def" 2153llvm_unreachable(
"Invalid OpCode!");
2159 default: llvm_unreachable(
"Not an overloadable binary operator");
2160 caseOO_Plus:
returnBO_Add;
2161 caseOO_Minus:
returnBO_Sub;
2162 caseOO_Star:
returnBO_Mul;
2163 caseOO_Slash:
returnBO_Div;
2164 caseOO_Percent:
returnBO_Rem;
2165 caseOO_Caret:
returnBO_Xor;
2166 caseOO_Amp:
returnBO_And;
2167 caseOO_Pipe:
returnBO_Or;
2168 caseOO_Equal:
returnBO_Assign;
2169 caseOO_Spaceship:
returnBO_Cmp;
2170 caseOO_Less:
returnBO_LT;
2171 caseOO_Greater:
returnBO_GT;
2172 caseOO_PlusEqual:
returnBO_AddAssign;
2173 caseOO_MinusEqual:
returnBO_SubAssign;
2174 caseOO_StarEqual:
returnBO_MulAssign;
2175 caseOO_SlashEqual:
returnBO_DivAssign;
2176 caseOO_PercentEqual:
returnBO_RemAssign;
2177 caseOO_CaretEqual:
returnBO_XorAssign;
2178 caseOO_AmpEqual:
returnBO_AndAssign;
2179 caseOO_PipeEqual:
returnBO_OrAssign;
2180 caseOO_LessLess:
returnBO_Shl;
2181 caseOO_GreaterGreater:
returnBO_Shr;
2182 caseOO_LessLessEqual:
returnBO_ShlAssign;
2183 caseOO_GreaterGreaterEqual:
returnBO_ShrAssign;
2184 caseOO_EqualEqual:
returnBO_EQ;
2185 caseOO_ExclaimEqual:
returnBO_NE;
2186 caseOO_LessEqual:
returnBO_LE;
2187 caseOO_GreaterEqual:
returnBO_GE;
2188 caseOO_AmpAmp:
returnBO_LAnd;
2189 caseOO_PipePipe:
returnBO_LOr;
2190 caseOO_Comma:
returnBO_Comma;
2191 caseOO_ArrowStar:
returnBO_PtrMemI;
2198OO_Star, OO_Slash, OO_Percent,
2200OO_LessLess, OO_GreaterGreater,
2202OO_Less, OO_Greater, OO_LessEqual, OO_GreaterEqual,
2203OO_EqualEqual, OO_ExclaimEqual,
2209OO_Equal, OO_StarEqual,
2210OO_SlashEqual, OO_PercentEqual,
2211OO_PlusEqual, OO_MinusEqual,
2212OO_LessLessEqual, OO_GreaterGreaterEqual,
2213OO_AmpEqual, OO_CaretEqual,
2217 returnOverOps[Opc];
2259BuiltinLoc(BLoc), RParenLoc(RParenLoc), ParentContext(ParentContext) {
2263? ExprDependence::Value
2264: ExprDependence::None);
2270 return "__builtin_FILE";
2272 return "__builtin_FILE_NAME";
2274 return "__builtin_FUNCTION";
2276 return "__builtin_FUNCSIG";
2278 return "__builtin_LINE";
2280 return "__builtin_COLUMN";
2282 return "__builtin_source_location";
2284llvm_unreachable(
"unexpected IdentKind!");
2288 const Expr*DefaultExpr)
const{
2292 if(
const auto*DIE = dyn_cast_if_present<CXXDefaultInitExpr>(DefaultExpr)) {
2293 Loc= DIE->getUsedLocation();
2294Context = DIE->getUsedContext();
2295}
else if(
const auto*DAE =
2296dyn_cast_if_present<CXXDefaultArgExpr>(DefaultExpr)) {
2297 Loc= DAE->getUsedLocation();
2298Context = DAE->getUsedContext();
2309 if(
const auto*
D= dyn_cast<CXXMethodDecl>(Context);
2311Context =
D->getParent()->getParent();
2316 autoMakeStringLiteral = [&](StringRef Tmp) {
2320LValuePathEntry
Path[1] = {LValuePathEntry::ArrayIndex(0)};
2331 returnMakeStringLiteral(
FileName);
2337 returnMakeStringLiteral(
Path);
2341 const auto*CurDecl = dyn_cast<Decl>(Context);
2345 returnMakeStringLiteral(
2365StringRef Name = F->getName();
2366 if(Name ==
"_M_file_name") {
2370 Value.getStructField(F->getFieldIndex()) = MakeStringLiteral(
Path);
2371}
else if(Name ==
"_M_function_name") {
2374 const auto*CurDecl = dyn_cast<Decl>(Context);
2375 Value.getStructField(F->getFieldIndex()) = MakeStringLiteral(
2376CurDecl && !isa<TranslationUnitDecl>(CurDecl)
2380}
else if(Name ==
"_M_line") {
2382 Value.getStructField(F->getFieldIndex()) =
APValue(IntVal);
2383}
else if(Name ==
"_M_column") {
2385 Value.getStructField(F->getFieldIndex()) =
APValue(IntVal);
2396llvm_unreachable(
"unhandled case");
2401 unsignedNumOfElements)
2404NumOfElements(NumOfElements) {
2413InitExprs(
C, initExprs.size()), LBraceLoc(lbraceloc),
2414RBraceLoc(rbraceloc), AltForm(nullptr,
true) {
2416InitExprs.
insert(
C, InitExprs.
end(), initExprs.begin(), initExprs.end());
2422 if(NumInits > InitExprs.
size())
2423InitExprs.
reserve(
C, NumInits);
2427InitExprs.
resize(
C, NumInits,
nullptr);
2444ArrayFillerOrUnionFieldInit = filler;
2447 for(
unsignedi = 0, e =
getNumInits(); i != e; ++i)
2448 if(
inits[i] ==
nullptr)
2462 Init=
Init->IgnoreParenImpCasts();
2463 returnisa<StringLiteral>(
Init) || isa<ObjCEncodeExpr>(
Init);
2467assert(
isSemanticForm() &&
"syntactic form never semantically transparent");
2471assert(
getNumInits() == 1 &&
"multiple inits in glvalue init list");
2490assert(
isSyntacticForm() &&
"only test syntactic form as zero initializer");
2497 returnLit && Lit->
getValue() == 0;
2502 returnSyntacticForm->getBeginLoc();
2507 E= InitExprs.
end();
2509 if(
Stmt*S = *I) {
2510Beg = S->getBeginLoc();
2520 returnSyntacticForm->getEndLoc();
2522 if(End.isInvalid()) {
2524 for(
Stmt*S : llvm::reverse(InitExprs)) {
2526End = S->getEndLoc();
2538 returncast<BlockPointerType>(
getType())
2569 if(isa<DeclRefExpr>(
E))
2573 if(isa<ArraySubscriptExpr>(
E))
2577 if(isa<MemberExpr>(
E))
2581 if(
auto*UO = dyn_cast<UnaryOperator>(
E))
2582 if(UO->getOpcode() == UO_Deref)
2585 if(
auto*BO = dyn_cast<BinaryOperator>(
E)) {
2587 if(BO->isPtrMemOp())
2591 if(BO->getOpcode() == BO_Comma)
2592 returnBO->getRHS()->isReadIfDiscardedInCPlusPlus11();
2597 if(
auto*CO = dyn_cast<ConditionalOperator>(
E))
2598 returnCO->getTrueExpr()->isReadIfDiscardedInCPlusPlus11() &&
2599CO->getFalseExpr()->isReadIfDiscardedInCPlusPlus11();
2602dyn_cast<BinaryConditionalOperator>(
E)) {
2603 if(
auto*OVE = dyn_cast<OpaqueValueExpr>(BCO->getTrueExpr()))
2604 returnOVE->getSourceExpr()->isReadIfDiscardedInCPlusPlus11() &&
2605BCO->getFalseExpr()->isReadIfDiscardedInCPlusPlus11();
2609 if(isa<ObjCIvarRefExpr>(
E))
2611 if(
const auto*POE = dyn_cast<PseudoObjectExpr>(
E)) {
2612 if(isa<ObjCPropertyRefExpr, ObjCSubscriptRefExpr>(POE->getSyntacticForm()))
2633 if(
getType()->isVoidType())
2639 caseParenExprClass:
2640 returncast<ParenExpr>(
this)->getSubExpr()->
2642 caseGenericSelectionExprClass:
2643 returncast<GenericSelectionExpr>(
this)->getResultExpr()->
2645 caseCoawaitExprClass:
2646 caseCoyieldExprClass:
2647 returncast<CoroutineSuspendExpr>(
this)->getResumeExpr()->
2649 caseChooseExprClass:
2650 returncast<ChooseExpr>(
this)->getChosenSubExpr()->
2652 caseUnaryOperatorClass: {
2686 caseBinaryOperatorClass: {
2698 if(IE->getValue() == 0)
2717 caseCompoundAssignOperatorClass:
2718 caseVAArgExprClass:
2719 caseAtomicExprClass:
2722 caseConditionalOperatorClass: {
2726 const auto*Exp = cast<ConditionalOperator>(
this);
2727 returnExp->getLHS()->isUnusedResultAWarning(WarnE,
Loc, R1, R2, Ctx) &&
2728Exp->getRHS()->isUnusedResultAWarning(WarnE,
Loc, R1, R2, Ctx);
2730 caseBinaryConditionalOperatorClass: {
2731 const auto*Exp = cast<BinaryConditionalOperator>(
this);
2732 returnExp->getFalseExpr()->isUnusedResultAWarning(WarnE,
Loc, R1, R2, Ctx);
2735 caseMemberExprClass:
2737 Loc= cast<MemberExpr>(
this)->getMemberLoc();
2739R2 = cast<MemberExpr>(
this)->getBase()->getSourceRange();
2742 caseArraySubscriptExprClass:
2744 Loc= cast<ArraySubscriptExpr>(
this)->getRBracketLoc();
2745R1 = cast<ArraySubscriptExpr>(
this)->getLHS()->getSourceRange();
2746R2 = cast<ArraySubscriptExpr>(
this)->getRHS()->getSourceRange();
2749 caseCXXOperatorCallExprClass: {
2761 caseOO_ExclaimEqual:
2764 caseOO_GreaterEqual:
2779 caseCXXMemberCallExprClass:
2780 caseUserDefinedLiteralClass: {
2782 const CallExpr*CE = cast<CallExpr>(
this);
2790FD->hasAttr<PureAttr>() || FD->hasAttr<ConstAttr>()) {
2805 caseUnresolvedLookupExprClass:
2806 caseCXXUnresolvedConstructExprClass:
2807 caseRecoveryExprClass:
2810 caseCXXTemporaryObjectExprClass:
2811 caseCXXConstructExprClass: {
2813 const auto*WarnURAttr =
Type->getAttr<WarnUnusedResultAttr>();
2815(WarnURAttr && WarnURAttr->IsCXX11NoDiscard())) {
2823 const auto*CE = cast<CXXConstructExpr>(
this);
2825 const auto*WarnURAttr = Ctor->getAttr<WarnUnusedResultAttr>();
2826 if(WarnURAttr && WarnURAttr->IsCXX11NoDiscard()) {
2831 if(
unsignedNumArgs = CE->getNumArgs())
2833CE->getArg(NumArgs - 1)->getEndLoc());
2841 caseObjCMessageExprClass: {
2854 if(MD->hasAttr<WarnUnusedResultAttr>()) {
2863 caseObjCPropertyRefExprClass:
2864 caseObjCSubscriptRefExprClass:
2870 casePseudoObjectExprClass: {
2871 const auto*POE = cast<PseudoObjectExpr>(
this);
2874 if(isa<ObjCPropertyRefExpr, ObjCSubscriptRefExpr>(
2875POE->getSyntacticForm())) {
2883 if(
auto*BO = dyn_cast<BinaryOperator>(POE->getSyntacticForm()))
2884 if(BO->isAssignmentOp())
2886 if(
auto*UO = dyn_cast<UnaryOperator>(POE->getSyntacticForm()))
2887 if(UO->isIncrementDecrementOp())
2892 return Result&&
Result->isUnusedResultAWarning(WarnE,
Loc, R1, R2, Ctx);
2895 caseStmtExprClass: {
2901 const CompoundStmt*CS = cast<StmtExpr>(
this)->getSubStmt();
2906 if(
const Expr*
E= dyn_cast<Expr>(
Label->getSubStmt()))
2910 if(
getType()->isVoidType())
2913 Loc= cast<StmtExpr>(
this)->getLParenLoc();
2917 caseCXXFunctionalCastExprClass:
2918 caseCStyleCastExprClass: {
2925 const CastExpr*CE = cast<CastExpr>(
this);
2932 if(
auto*DRE = dyn_cast<DeclRefExpr>(SubE))
2933 if(
auto*VD = dyn_cast<VarDecl>(DRE->getDecl()))
2934 if(!VD->isExternallyVisible())
2950 if(CE->
getCastKind() == CK_ConstructorConversion)
2957dyn_cast<CXXFunctionalCastExpr>(
this)) {
2958 Loc= CXXCE->getBeginLoc();
2959R1 = CXXCE->getSubExpr()->getSourceRange();
2967 caseImplicitCastExprClass: {
2968 const CastExpr*ICE = cast<ImplicitCastExpr>(
this);
2977 caseCXXDefaultArgExprClass:
2978 return(cast<CXXDefaultArgExpr>(
this)
2980 caseCXXDefaultInitExprClass:
2981 return(cast<CXXDefaultInitExpr>(
this)
2984 caseCXXNewExprClass:
2987 caseCXXDeleteExprClass:
2989 caseMaterializeTemporaryExprClass:
2990 returncast<MaterializeTemporaryExpr>(
this)
2992->isUnusedResultAWarning(WarnE,
Loc, R1, R2, Ctx);
2993 caseCXXBindTemporaryExprClass:
2994 returncast<CXXBindTemporaryExpr>(
this)->getSubExpr()
2995->isUnusedResultAWarning(WarnE,
Loc, R1, R2, Ctx);
2996 caseExprWithCleanupsClass:
2997 returncast<ExprWithCleanups>(
this)->getSubExpr()
2998->isUnusedResultAWarning(WarnE,
Loc, R1, R2, Ctx);
2999 caseOpaqueValueExprClass:
3000 returncast<OpaqueValueExpr>(
this)->getSourceExpr()->isUnusedResultAWarning(
3001WarnE,
Loc, R1, R2, Ctx);
3012 caseObjCIvarRefExprClass:
3014 caseExpr::UnaryOperatorClass:
3015 returncast<UnaryOperator>(
E)->getSubExpr()->isOBJCGCCandidate(Ctx);
3016 caseImplicitCastExprClass:
3017 returncast<ImplicitCastExpr>(
E)->getSubExpr()->isOBJCGCCandidate(Ctx);
3018 caseMaterializeTemporaryExprClass:
3019 returncast<MaterializeTemporaryExpr>(
E)->getSubExpr()->isOBJCGCCandidate(
3021 caseCStyleCastExprClass:
3022 returncast<CStyleCastExpr>(
E)->getSubExpr()->isOBJCGCCandidate(Ctx);
3023 caseDeclRefExprClass: {
3024 const Decl*
D= cast<DeclRefExpr>(
E)->getDecl();
3026 if(
const VarDecl*VD = dyn_cast<VarDecl>(
D)) {
3027 if(VD->hasGlobalStorage())
3037 caseMemberExprClass: {
3041 caseArraySubscriptExprClass:
3042 returncast<ArraySubscriptExpr>(
E)->getBase()->isOBJCGCCandidate(Ctx);
3053assert(
expr->hasPlaceholderType(BuiltinType::BoundMember));
3061assert(isa<CXXMethodDecl>(mem->getMemberDecl()));
3062 returnmem->getMemberDecl()->getType();
3068assert(
type->isFunctionType());
3072assert(isa<UnresolvedMemberExpr>(
expr) || isa<CXXPseudoDestructorExpr>(
expr));
3106 if(
auto*MCE = dyn_cast<CXXMemberCallExpr>(
this)) {
3107 if(isa_and_nonnull<CXXConversionDecl>(MCE->getMethodDecl()))
3108 returnMCE->getImplicitObjectArgument();
3124 autoIgnoreNoopCastsSingleStep = [&Ctx](
Expr*
E) {
3125 if(
auto*CE = dyn_cast<CastExpr>(
E)) {
3128 Expr*SubExpr = CE->getSubExpr();
3129 boolIsIdentityCast =
3138 if(IsIdentityCast || IsSameWidthCast)
3140}
else if(
auto*NTTP = dyn_cast<SubstNonTypeTemplateParmExpr>(
E))
3141 returnNTTP->getReplacement();
3146IgnoreNoopCastsSingleStep);
3151 if(
auto*Cast = dyn_cast<CXXFunctionalCastExpr>(
E)) {
3152 auto*SE = Cast->getSubExpr();
3157 if(
auto*
C= dyn_cast<CXXConstructExpr>(
E)) {
3158 autoNumArgs =
C->getNumArgs();
3160(NumArgs > 1 && isa<CXXDefaultArgExpr>(
C->getArg(1)))) {
3161 Expr*A =
C->getArg(0);
3168 autoIgnoreImplicitMemberCallSingleStep = [](
Expr*
E) {
3169 if(
auto*
C= dyn_cast<CXXMemberCallExpr>(
E)) {
3170 Expr*ExprNode =
C->getImplicitObjectArgument();
3174 if(
auto*PE = dyn_cast<ParenExpr>(ExprNode)) {
3175 if(PE->getSourceRange() ==
C->getSourceRange()) {
3176 returncast<Expr>(PE);
3188IgnoreImplicitMemberCallSingleStep);
3192 const Expr*
E=
this;
3194 E= M->getSubExpr();
3197 E= ICE->getSubExprAsWritten();
3199 returnisa<CXXDefaultArgExpr>(
E);
3206 E= M->getSubExpr();
3209 if(ICE->getCastKind() == CK_NoOp)
3210 E= ICE->getSubExpr();
3216 E= BE->getSubExpr();
3219 if(ICE->getCastKind() == CK_NoOp)
3220 E= ICE->getSubExpr();
3231 if(!
C.hasSameUnqualifiedType(
getType(),
C.getTypeDeclType(TempTy)))
3239 if(!isa<ObjCPropertyRefExpr>(
E))
3247 if(isa<ImplicitCastExpr>(
E)) {
3248 switch(cast<ImplicitCastExpr>(
E)->getCastKind()) {
3249 caseCK_DerivedToBase:
3250 caseCK_UncheckedDerivedToBase:
3258 if(isa<MemberExpr>(
E))
3262 if(BO->isPtrMemOp())
3266 if(isa<OpaqueValueExpr>(
E))
3273 const Expr*
E=
this;
3278 E=
Paren->getSubExpr();
3283 if(ICE->getCastKind() == CK_NoOp ||
3284ICE->getCastKind() == CK_LValueToRValue ||
3285ICE->getCastKind() == CK_DerivedToBase ||
3286ICE->getCastKind() == CK_UncheckedDerivedToBase) {
3287 E= ICE->getSubExpr();
3292 if(
const UnaryOperator* UnOp = dyn_cast<UnaryOperator>(
E)) {
3293 if(UnOp->getOpcode() == UO_Extension) {
3294 E= UnOp->getSubExpr();
3300= dyn_cast<MaterializeTemporaryExpr>(
E)) {
3301 E= M->getSubExpr();
3308 if(
const CXXThisExpr*This = dyn_cast<CXXThisExpr>(
E))
3309 returnThis->isImplicit();
3317 for(
unsignedI = 0; I < Exprs.size(); ++I)
3325 const Expr**Culprit)
const{
3327 "Expression evaluator can't be called on a dependent expression.");
3339 if(
auto*EWC = dyn_cast<ExprWithCleanups>(
this))
3340 returnEWC->getSubExpr()->isConstantInitializer(Ctx,
true, Culprit);
3341 if(
auto*MTE = dyn_cast<MaterializeTemporaryExpr>(
this))
3342 returnMTE->getSubExpr()->isConstantInitializer(Ctx,
false, Culprit);
3353 caseStmt::ExprWithCleanupsClass:
3355Ctx, IsForRef, Culprit);
3356 caseStringLiteralClass:
3357 caseObjCEncodeExprClass:
3359 caseCXXTemporaryObjectExprClass:
3360 caseCXXConstructExprClass: {
3369assert(CE->
getNumArgs() == 1 &&
"trivial ctor with > 1 argument");
3375 caseConstantExprClass: {
3378 const Expr*Exp = cast<ConstantExpr>(
this)->getSubExpr();
3381 caseCompoundLiteralExprClass: {
3385 const Expr*Exp = cast<CompoundLiteralExpr>(
this)->getInitializer();
3388 caseDesignatedInitUpdateExprClass: {
3393 caseInitListExprClass: {
3401assert(ILE->
isSemanticForm() &&
"InitListExpr must be in semantic form");
3404 for(
unsignedi = 0; i < numInits; i++) {
3412 unsignedElementNo = 0;
3417 if(
const auto*CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
3418 for(
unsignedi = 0, e = CXXRD->getNumBases(); i < e; i++) {
3419 if(ElementNo < ILE->getNumInits()) {
3427 for(
const auto*Field : RD->
fields()) {
3433 if(Field->isUnnamedBitField())
3436 if(ElementNo < ILE->getNumInits()) {
3438 if(Field->isBitField()) {
3447 boolRefType = Field->getType()->isReferenceType();
3458 caseImplicitValueInitExprClass:
3459 caseNoInitExprClass:
3461 caseParenExprClass:
3462 returncast<ParenExpr>(
this)->getSubExpr()
3463->isConstantInitializer(Ctx, IsForRef, Culprit);
3464 caseGenericSelectionExprClass:
3465 returncast<GenericSelectionExpr>(
this)->getResultExpr()
3466->isConstantInitializer(Ctx, IsForRef, Culprit);
3467 caseChooseExprClass:
3468 if(cast<ChooseExpr>(
this)->isConditionDependent()) {
3473 returncast<ChooseExpr>(
this)->getChosenSubExpr()
3475 caseUnaryOperatorClass: {
3481 casePackIndexingExprClass: {
3482 returncast<PackIndexingExpr>(
this)
3484->isConstantInitializer(Ctx,
false, Culprit);
3486 caseCXXFunctionalCastExprClass:
3487 caseCXXStaticCastExprClass:
3488 caseImplicitCastExprClass:
3489 caseCStyleCastExprClass:
3490 caseObjCBridgedCastExprClass:
3491 caseCXXDynamicCastExprClass:
3492 caseCXXReinterpretCastExprClass:
3493 caseCXXAddrspaceCastExprClass:
3494 caseCXXConstCastExprClass: {
3495 const CastExpr*CE = cast<CastExpr>(
this);
3501CE->
getCastKind() == CK_ConstructorConversion ||
3510 caseMaterializeTemporaryExprClass:
3511 returncast<MaterializeTemporaryExpr>(
this)
3513->isConstantInitializer(Ctx,
false, Culprit);
3515 caseSubstNonTypeTemplateParmExprClass:
3516 returncast<SubstNonTypeTemplateParmExpr>(
this)->getReplacement()
3517->isConstantInitializer(Ctx,
false, Culprit);
3518 caseCXXDefaultArgExprClass:
3519 returncast<CXXDefaultArgExpr>(
this)->getExpr()
3520->isConstantInitializer(Ctx,
false, Culprit);
3521 caseCXXDefaultInitExprClass:
3522 returncast<CXXDefaultInitExpr>(
this)->getExpr()
3523->isConstantInitializer(Ctx,
false, Culprit);
3537 if(BuiltinID != Builtin::BI__assume &&
3538BuiltinID != Builtin::BI__builtin_assume)
3555 const boolIncludePossibleEffects;
3556 boolHasSideEffects;
3559 explicitSideEffectFinder(
const ASTContext&Context,
boolIncludePossible)
3560: Inherited(Context),
3561IncludePossibleEffects(IncludePossible), HasSideEffects(
false) { }
3563 boolhasSideEffects()
const{
returnHasSideEffects; }
3565 voidVisitDecl(
const Decl*
D) {
3571 if(
auto*VD = dyn_cast<VarDecl>(
D)) {
3573 if(IncludePossibleEffects && VD->isThisDeclarationADefinition() &&
3574VD->needsDestruction(Context))
3575HasSideEffects =
true;
3579 voidVisitDeclStmt(
const DeclStmt*DS) {
3580 for(
auto*
D: DS->
decls())
3582Inherited::VisitDeclStmt(DS);
3585 voidVisitExpr(
const Expr*
E) {
3586 if(!HasSideEffects &&
3588HasSideEffects =
true;
3594 boolIncludePossibleEffects)
const{
3598 if(!IncludePossibleEffects &&
getExprLoc().isMacroID())
3603 #define ABSTRACT_STMT(Type) 3604 #define STMT(Type, Base) case Type##Class: 3605 #define EXPR(Type, Base) 3606 #include "clang/AST/StmtNodes.inc" 3607llvm_unreachable(
"unexpected Expr kind");
3609 caseDependentScopeDeclRefExprClass:
3610 caseCXXUnresolvedConstructExprClass:
3611 caseCXXDependentScopeMemberExprClass:
3612 caseUnresolvedLookupExprClass:
3613 caseUnresolvedMemberExprClass:
3614 casePackExpansionExprClass:
3615 caseSubstNonTypeTemplateParmPackExprClass:
3616 caseFunctionParmPackExprClass:
3618 caseRecoveryExprClass:
3619 caseCXXFoldExprClass:
3621 returnIncludePossibleEffects;
3623 caseDeclRefExprClass:
3624 caseObjCIvarRefExprClass:
3625 casePredefinedExprClass:
3626 caseIntegerLiteralClass:
3627 caseFixedPointLiteralClass:
3628 caseFloatingLiteralClass:
3629 caseImaginaryLiteralClass:
3630 caseStringLiteralClass:
3631 caseCharacterLiteralClass:
3632 caseOffsetOfExprClass:
3633 caseImplicitValueInitExprClass:
3634 caseUnaryExprOrTypeTraitExprClass:
3635 caseAddrLabelExprClass:
3636 caseGNUNullExprClass:
3637 caseArrayInitIndexExprClass:
3638 caseNoInitExprClass:
3639 caseCXXBoolLiteralExprClass:
3640 caseCXXNullPtrLiteralExprClass:
3641 caseCXXThisExprClass:
3642 caseCXXScalarValueInitExprClass:
3643 caseTypeTraitExprClass:
3644 caseArrayTypeTraitExprClass:
3645 caseExpressionTraitExprClass:
3646 caseCXXNoexceptExprClass:
3647 caseSizeOfPackExprClass:
3648 caseObjCStringLiteralClass:
3649 caseObjCEncodeExprClass:
3650 caseObjCBoolLiteralExprClass:
3651 caseObjCAvailabilityCheckExprClass:
3652 caseCXXUuidofExprClass:
3653 caseOpaqueValueExprClass:
3654 caseSourceLocExprClass:
3655 caseEmbedExprClass:
3656 caseConceptSpecializationExprClass:
3657 caseRequiresExprClass:
3658 caseSYCLUniqueStableNameExprClass:
3659 casePackIndexingExprClass:
3660 caseHLSLOutArgExprClass:
3661 caseOpenACCAsteriskSizeExprClass:
3662 caseResolvedUnexpandedPackExprClass:
3666 caseConstantExprClass:
3668 returncast<ConstantExpr>(
this)->getSubExpr()->HasSideEffects(
3669Ctx, IncludePossibleEffects);
3672 caseCXXOperatorCallExprClass:
3673 caseCXXMemberCallExprClass:
3674 caseCUDAKernelCallExprClass:
3675 caseUserDefinedLiteralClass: {
3679 const Decl*FD = cast<CallExpr>(
this)->getCalleeDecl();
3680 boolIsPure = FD && (FD->
hasAttr<ConstAttr>() || FD->
hasAttr<PureAttr>());
3681 if(IsPure || !IncludePossibleEffects)
3686 caseBlockExprClass:
3687 caseCXXBindTemporaryExprClass:
3688 if(!IncludePossibleEffects)
3692 caseMSPropertyRefExprClass:
3693 caseMSPropertySubscriptExprClass:
3694 caseCompoundAssignOperatorClass:
3695 caseVAArgExprClass:
3696 caseAtomicExprClass:
3697 caseCXXThrowExprClass:
3698 caseCXXNewExprClass:
3699 caseCXXDeleteExprClass:
3700 caseCoawaitExprClass:
3701 caseDependentCoawaitExprClass:
3702 caseCoyieldExprClass:
3706 caseStmtExprClass: {
3708SideEffectFinder Finder(Ctx, IncludePossibleEffects);
3709Finder.Visit(cast<StmtExpr>(
this)->getSubStmt());
3710 returnFinder.hasSideEffects();
3713 caseExprWithCleanupsClass:
3714 if(IncludePossibleEffects)
3715 if(cast<ExprWithCleanups>(
this)->cleanupsHaveSideEffects())
3719 caseParenExprClass:
3720 caseArraySubscriptExprClass:
3721 caseMatrixSubscriptExprClass:
3722 caseArraySectionExprClass:
3723 caseOMPArrayShapingExprClass:
3724 caseOMPIteratorExprClass:
3725 caseMemberExprClass:
3726 caseConditionalOperatorClass:
3727 caseBinaryConditionalOperatorClass:
3728 caseCompoundLiteralExprClass:
3729 caseExtVectorElementExprClass:
3730 caseDesignatedInitExprClass:
3731 caseDesignatedInitUpdateExprClass:
3732 caseArrayInitLoopExprClass:
3733 caseParenListExprClass:
3734 caseCXXPseudoDestructorExprClass:
3735 caseCXXRewrittenBinaryOperatorClass:
3736 caseCXXStdInitializerListExprClass:
3737 caseSubstNonTypeTemplateParmExprClass:
3738 caseMaterializeTemporaryExprClass:
3739 caseShuffleVectorExprClass:
3740 caseConvertVectorExprClass:
3741 caseAsTypeExprClass:
3742 caseCXXParenListInitExprClass:
3746 caseUnaryOperatorClass:
3747 if(cast<UnaryOperator>(
this)->isIncrementDecrementOp())
3751 caseBinaryOperatorClass:
3752 if(cast<BinaryOperator>(
this)->isAssignmentOp())
3756 caseInitListExprClass:
3758 if(
const Expr*
E= cast<InitListExpr>(
this)->getArrayFiller())
3763 caseGenericSelectionExprClass:
3764 returncast<GenericSelectionExpr>(
this)->getResultExpr()->
3767 caseChooseExprClass:
3768 returncast<ChooseExpr>(
this)->getChosenSubExpr()->HasSideEffects(
3769Ctx, IncludePossibleEffects);
3771 caseCXXDefaultArgExprClass:
3772 returncast<CXXDefaultArgExpr>(
this)->getExpr()->HasSideEffects(
3773Ctx, IncludePossibleEffects);
3775 caseCXXDefaultInitExprClass: {
3776 const FieldDecl*FD = cast<CXXDefaultInitExpr>(
this)->getField();
3783 caseCXXDynamicCastExprClass: {
3791 caseImplicitCastExprClass:
3792 caseCStyleCastExprClass:
3793 caseCXXStaticCastExprClass:
3794 caseCXXReinterpretCastExprClass:
3795 caseCXXConstCastExprClass:
3796 caseCXXAddrspaceCastExprClass:
3797 caseCXXFunctionalCastExprClass:
3798 caseBuiltinBitCastExprClass: {
3803 if(!IncludePossibleEffects)
3806 const CastExpr*CE = cast<CastExpr>(
this);
3813 caseCXXTypeidExprClass: {
3814 const auto*TE = cast<CXXTypeidExpr>(
this);
3815 if(!TE->isPotentiallyEvaluated())
3820 if(IncludePossibleEffects && TE->hasNullCheck())
3826 caseCXXConstructExprClass:
3827 caseCXXTemporaryObjectExprClass: {
3836 caseCXXInheritedCtorInitExprClass: {
3837 const auto*ICIE = cast<CXXInheritedCtorInitExpr>(
this);
3838 if(!ICIE->getConstructor()->isTrivial() && IncludePossibleEffects)
3843 caseLambdaExprClass: {
3844 const LambdaExpr*LE = cast<LambdaExpr>(
this);
3845 for(
Expr*
E: LE->capture_inits())
3851 casePseudoObjectExprClass: {
3858 const Expr*Subexpr = *I;
3860Subexpr = OVE->getSourceExpr();
3867 caseObjCBoxedExprClass:
3868 caseObjCArrayLiteralClass:
3869 caseObjCDictionaryLiteralClass:
3870 caseObjCSelectorExprClass:
3871 caseObjCProtocolExprClass:
3872 caseObjCIsaExprClass:
3873 caseObjCIndirectCopyRestoreExprClass:
3874 caseObjCSubscriptRefExprClass:
3875 caseObjCBridgedCastExprClass:
3876 caseObjCMessageExprClass:
3877 caseObjCPropertyRefExprClass:
3879 if(IncludePossibleEffects)
3887cast<Expr>(SubStmt)->
HasSideEffects(Ctx, IncludePossibleEffects))
3894 if(
auto Call= dyn_cast<CallExpr>(
this))
3895 return Call->getFPFeaturesInEffect(LO);
3896 if(
autoUO = dyn_cast<UnaryOperator>(
this))
3897 returnUO->getFPFeaturesInEffect(LO);
3898 if(
autoBO = dyn_cast<BinaryOperator>(
this))
3899 returnBO->getFPFeaturesInEffect(LO);
3900 if(
autoCast = dyn_cast<CastExpr>(
this))
3901 returnCast->getFPFeaturesInEffect(LO);
3914 explicitNonTrivialCallFinder(
const ASTContext&Context)
3915: Inherited(Context), NonTrivial(
false) { }
3917 boolhasNonTrivialCall()
const{
returnNonTrivial; }
3919 voidVisitCallExpr(
const CallExpr*
E) {
3921= dyn_cast_or_null<const CXXMethodDecl>(
E->getCalleeDecl())) {
3922 if(Method->isTrivial()) {
3924Inherited::VisitStmt(
E);
3933 if(
E->getConstructor()->isTrivial()) {
3935Inherited::VisitStmt(
E);
3946 E->getTemporary()->getDestructor()) {
3947 if(DtorDecl->isTrivial()) {
3948Inherited::VisitStmt(
E);
3959NonTrivialCallFinder Finder(Ctx);
3960Finder.Visit(
this);
3961 returnFinder.hasNonTrivialCall();
3979llvm_unreachable(
"Unexpected value dependent expression!");
4007CE->getSubExpr()->getType()->isIntegerType())
4008 returnCE->getSubExpr()->isNullPointerConstant(Ctx, NPC);
4011}
else if(
const ImplicitCastExpr*ICE = dyn_cast<ImplicitCastExpr>(
this)) {
4013 returnICE->getSubExpr()->isNullPointerConstant(Ctx, NPC);
4014}
else if(
const ParenExpr*PE = dyn_cast<ParenExpr>(
this)) {
4017 returnPE->getSubExpr()->isNullPointerConstant(Ctx, NPC);
4019dyn_cast<GenericSelectionExpr>(
this)) {
4020 if(GE->isResultDependent())
4022 returnGE->getResultExpr()->isNullPointerConstant(Ctx, NPC);
4023}
else if(
const ChooseExpr*CE = dyn_cast<ChooseExpr>(
this)) {
4024 if(CE->isConditionDependent())
4026 returnCE->getChosenSubExpr()->isNullPointerConstant(Ctx, NPC);
4028= dyn_cast<CXXDefaultArgExpr>(
this)) {
4030 returnDefaultArg->getExpr()->isNullPointerConstant(Ctx, NPC);
4032= dyn_cast<CXXDefaultInitExpr>(
this)) {
4034 returnDefaultInit->getExpr()->isNullPointerConstant(Ctx, NPC);
4035}
else if(isa<GNUNullExpr>(
this)) {
4039= dyn_cast<MaterializeTemporaryExpr>(
this)) {
4040 returnM->getSubExpr()->isNullPointerConstant(Ctx, NPC);
4041}
else if(
const OpaqueValueExpr*OVE = dyn_cast<OpaqueValueExpr>(
this)) {
4042 if(
const Expr*Source = OVE->getSourceExpr())
4043 returnSource->isNullPointerConstant(Ctx, NPC);
4052 if(
getType()->isNullPtrType())
4057UT && UT->getDecl()->hasAttr<TransparentUnionAttr>())
4059 const Expr*InitExpr = CLE->getInitializer();
4060 if(
const InitListExpr*ILE = dyn_cast<InitListExpr>(InitExpr))
4064 if(!
getType()->isIntegerType() ||
4087 if(isa<IntegerLiteral>(
this))
4095 const Expr*
E=
this;
4098 "expression is not a property reference");
4101 if(BO->getOpcode() == BO_Comma) {
4110 returncast<ObjCPropertyRefExpr>(
E);
4135 if(ICE->getCastKind() == CK_LValueToRValue ||
4136(ICE->isGLValue() && ICE->getCastKind() == CK_NoOp))
4142 if(
MemberExpr*MemRef = dyn_cast<MemberExpr>(
E))
4143 if(
FieldDecl*Field = dyn_cast<FieldDecl>(MemRef->getMemberDecl()))
4144 if(Field->isBitField())
4153 if(
DeclRefExpr*DeclRef = dyn_cast<DeclRefExpr>(
E)) {
4154 if(
FieldDecl*Field = dyn_cast<FieldDecl>(DeclRef->getDecl()))
4155 if(Field->isBitField())
4158 if(
BindingDecl*BD = dyn_cast<BindingDecl>(DeclRef->getDecl()))
4159 if(
Expr*
E= BD->getBinding())
4164 if(BinOp->isAssignmentOp() && BinOp->getLHS())
4165 returnBinOp->getLHS()->getSourceBitField();
4167 if(BinOp->getOpcode() == BO_Comma && BinOp->getRHS())
4168 returnBinOp->getRHS()->getSourceBitField();
4172 if(UnOp->isPrefix() && UnOp->isIncrementDecrementOp())
4173 returnUnOp->getSubExpr()->getSourceBitField();
4180 if(
auto*DRE = dyn_cast<DeclRefExpr>(
E))
4181 returndyn_cast<EnumConstantDecl>(DRE->getDecl());
4190 if(ICE->isGLValue() && ICE->getCastKind() == CK_NoOp)
4199 if(isa<ExtVectorElementExpr>(
E))
4202 if(
auto*DRE = dyn_cast<DeclRefExpr>(
E))
4203 if(
auto*BD = dyn_cast<BindingDecl>(DRE->getDecl()))
4204 if(
auto*
E= BD->getBinding())
4213 if(
const DeclRefExpr*DRE = dyn_cast<DeclRefExpr>(
E))
4214 if(
const auto*VD = dyn_cast<VarDecl>(DRE->getDecl()))
4216VD->hasAttr<AsmLabelAttr>() && !VD->isLocalVarDecl())
4232 caseCXXThisExprClass:
4234 caseDeclRefExprClass: {
4237 const auto*DRE1 = cast<DeclRefExpr>(E1);
4238 const auto*DRE2 = cast<DeclRefExpr>(E2);
4239 returnDRE1->isPRValue() && DRE2->isPRValue() &&
4240DRE1->getDecl() == DRE2->getDecl();
4242 caseImplicitCastExprClass: {
4245 const auto*ICE1 = dyn_cast<ImplicitCastExpr>(E1);
4246 const auto*ICE2 = dyn_cast<ImplicitCastExpr>(E2);
4249 if(ICE1->getCastKind() != ICE2->getCastKind())
4254 if(ICE1->getCastKind() == CK_LValueToRValue ||
4255ICE1->getCastKind() == CK_ArrayToPointerDecay ||
4256ICE1->getCastKind() == CK_FunctionToPointerDecay) {
4261 const auto*DRE1 = dyn_cast<DeclRefExpr>(E1);
4262 const auto*DRE2 = dyn_cast<DeclRefExpr>(E2);
4266 const auto*Ivar1 = dyn_cast<ObjCIvarRefExpr>(E1);
4267 const auto*Ivar2 = dyn_cast<ObjCIvarRefExpr>(E2);
4268 if(Ivar1 && Ivar2) {
4269 returnIvar1->isFreeIvar() && Ivar2->isFreeIvar() &&
4273 const auto*Array1 = dyn_cast<ArraySubscriptExpr>(E1);
4274 const auto*Array2 = dyn_cast<ArraySubscriptExpr>(E2);
4275 if(Array1 && Array2) {
4279 autoIdx1 = Array1->getIdx();
4280 autoIdx2 = Array2->getIdx();
4281 const autoInteger1 = dyn_cast<IntegerLiteral>(Idx1);
4282 const autoInteger2 = dyn_cast<IntegerLiteral>(Idx2);
4283 if(Integer1 && Integer2) {
4284 if(!llvm::APInt::isSameValue(Integer1->getValue(),
4285Integer2->getValue()))
4296 while(isa<MemberExpr>(E1) && isa<MemberExpr>(E2)) {
4297 const auto*ME1 = cast<MemberExpr>(E1);
4298 const auto*ME2 = cast<MemberExpr>(E2);
4301 if(
const auto*
D= dyn_cast<VarDecl>(ME1->getMemberDecl()))
4302 if(
D->isStaticDataMember())
4308 if(isa<CXXThisExpr>(E1) && isa<CXXThisExpr>(E2))
4314 if(
const auto*DRE = dyn_cast<DeclRefExpr>(
E))
4315 returnDRE->getDecl();
4316 if(
const auto*ME = dyn_cast<MemberExpr>(
E))
4317 returnME->getMemberDecl();
4336 returnVT->getNumElements();
4344StringRef Comp = Accessor->
getName();
4347 if(Comp ==
"hi"|| Comp ==
"lo"|| Comp ==
"even"|| Comp ==
"odd")
4351 if(Comp[0] ==
's'|| Comp[0] ==
'S')
4352Comp = Comp.substr(1);
4354 for(
unsignedi = 0, e = Comp.size(); i != e; ++i)
4355 if(Comp.substr(i + 1).contains(Comp[i]))
4364StringRef Comp = Accessor->
getName();
4365 boolisNumericAccessor =
false;
4366 if(Comp[0] ==
's'|| Comp[0] ==
'S') {
4367Comp = Comp.substr(1);
4368isNumericAccessor =
true;
4371 boolisHi = Comp ==
"hi";
4372 boolisLo = Comp ==
"lo";
4373 boolisEven = Comp ==
"even";
4374 boolisOdd = Comp ==
"odd";
4390Elts.push_back(Index);
4398BuiltinLoc(BLoc), RParenLoc(RP), NumExprs(args.size()) {
4399SubExprs =
new(
C)
Stmt*[args.size()];
4400 for(
unsignedi = 0; i != args.size(); i++)
4401SubExprs[i] = args[i];
4407 if(SubExprs)
C.Deallocate(SubExprs);
4409this->NumExprs = Exprs.size();
4410SubExprs =
new(
C)
Stmt*[NumExprs];
4411 memcpy(SubExprs, Exprs.data(),
sizeof(
Expr*) * Exprs.size());
4414GenericSelectionExpr::GenericSelectionExpr(
4418 boolContainsUnexpandedParameterPack,
unsignedResultIndex)
4419:
Expr(GenericSelectionExprClass, AssocExprs[ResultIndex]->getType(),
4420AssocExprs[ResultIndex]->getValueKind(),
4421AssocExprs[ResultIndex]->getObjectKind()),
4422NumAssocs(AssocExprs.size()), ResultIndex(ResultIndex),
4423IsExprPredicate(
true), DefaultLoc(DefaultLoc), RParenLoc(RParenLoc) {
4424assert(AssocTypes.size() == AssocExprs.size() &&
4425 "Must have the same number of association expressions" 4426 " and TypeSourceInfo!");
4427assert(ResultIndex < NumAssocs &&
"ResultIndex is out-of-bounds!");
4430getTrailingObjects<Stmt *>()[getIndexOfControllingExpression()] =
4432std::copy(AssocExprs.begin(), AssocExprs.end(),
4433getTrailingObjects<Stmt *>() + getIndexOfStartOfAssociatedExprs());
4434std::copy(AssocTypes.begin(), AssocTypes.end(),
4435getTrailingObjects<TypeSourceInfo *>() +
4436getIndexOfStartOfAssociatedTypes());
4441GenericSelectionExpr::GenericSelectionExpr(
4446 unsignedResultIndex)
4447:
Expr(GenericSelectionExprClass, AssocExprs[ResultIndex]->getType(),
4448AssocExprs[ResultIndex]->getValueKind(),
4449AssocExprs[ResultIndex]->getObjectKind()),
4450NumAssocs(AssocExprs.size()), ResultIndex(ResultIndex),
4451IsExprPredicate(
false), DefaultLoc(DefaultLoc), RParenLoc(RParenLoc) {
4452assert(AssocTypes.size() == AssocExprs.size() &&
4453 "Must have the same number of association expressions" 4454 " and TypeSourceInfo!");
4455assert(ResultIndex < NumAssocs &&
"ResultIndex is out-of-bounds!");
4458getTrailingObjects<TypeSourceInfo *>()[getIndexOfControllingType()] =
4460std::copy(AssocExprs.begin(), AssocExprs.end(),
4461getTrailingObjects<Stmt *>() + getIndexOfStartOfAssociatedExprs());
4462std::copy(AssocTypes.begin(), AssocTypes.end(),
4463getTrailingObjects<TypeSourceInfo *>() +
4464getIndexOfStartOfAssociatedTypes());
4469GenericSelectionExpr::GenericSelectionExpr(
4473 boolContainsUnexpandedParameterPack)
4474:
Expr(GenericSelectionExprClass, Context.DependentTy,
VK_PRValue,
4476NumAssocs(AssocExprs.size()), ResultIndex(ResultDependentIndex),
4477IsExprPredicate(
true), DefaultLoc(DefaultLoc), RParenLoc(RParenLoc) {
4478assert(AssocTypes.size() == AssocExprs.size() &&
4479 "Must have the same number of association expressions" 4480 " and TypeSourceInfo!");
4483getTrailingObjects<Stmt *>()[getIndexOfControllingExpression()] =
4485std::copy(AssocExprs.begin(), AssocExprs.end(),
4486getTrailingObjects<Stmt *>() + getIndexOfStartOfAssociatedExprs());
4487std::copy(AssocTypes.begin(), AssocTypes.end(),
4488getTrailingObjects<TypeSourceInfo *>() +
4489getIndexOfStartOfAssociatedTypes());
4494GenericSelectionExpr::GenericSelectionExpr(
4499:
Expr(GenericSelectionExprClass, Context.DependentTy,
VK_PRValue,
4501NumAssocs(AssocExprs.size()), ResultIndex(ResultDependentIndex),
4502IsExprPredicate(
false), DefaultLoc(DefaultLoc), RParenLoc(RParenLoc) {
4503assert(AssocTypes.size() == AssocExprs.size() &&
4504 "Must have the same number of association expressions" 4505 " and TypeSourceInfo!");
4508getTrailingObjects<TypeSourceInfo *>()[getIndexOfControllingType()] =
4510std::copy(AssocExprs.begin(), AssocExprs.end(),
4511getTrailingObjects<Stmt *>() + getIndexOfStartOfAssociatedExprs());
4512std::copy(AssocTypes.begin(), AssocTypes.end(),
4513getTrailingObjects<TypeSourceInfo *>() +
4514getIndexOfStartOfAssociatedTypes());
4519GenericSelectionExpr::GenericSelectionExpr(EmptyShell
Empty,
unsignedNumAssocs)
4520:
Expr(GenericSelectionExprClass,
Empty), NumAssocs(NumAssocs) {}
4526 boolContainsUnexpandedParameterPack,
unsignedResultIndex) {
4527 unsignedNumAssocs = AssocExprs.size();
4529totalSizeToAlloc<Stmt *, TypeSourceInfo *>(1 + NumAssocs, NumAssocs),
4532Context, GenericLoc, ControllingExpr, AssocTypes, AssocExprs, DefaultLoc,
4533RParenLoc, ContainsUnexpandedParameterPack, ResultIndex);
4540 boolContainsUnexpandedParameterPack) {
4541 unsignedNumAssocs = AssocExprs.size();
4543totalSizeToAlloc<Stmt *, TypeSourceInfo *>(1 + NumAssocs, NumAssocs),
4546Context, GenericLoc, ControllingExpr, AssocTypes, AssocExprs, DefaultLoc,
4547RParenLoc, ContainsUnexpandedParameterPack);
4555 unsignedResultIndex) {
4556 unsignedNumAssocs = AssocExprs.size();
4558totalSizeToAlloc<Stmt *, TypeSourceInfo *>(1 + NumAssocs, NumAssocs),
4561Context, GenericLoc, ControllingType, AssocTypes, AssocExprs, DefaultLoc,
4562RParenLoc, ContainsUnexpandedParameterPack, ResultIndex);
4569 SourceLocationRParenLoc,
boolContainsUnexpandedParameterPack) {
4570 unsignedNumAssocs = AssocExprs.size();
4572totalSizeToAlloc<Stmt *, TypeSourceInfo *>(1 + NumAssocs, NumAssocs),
4575Context, GenericLoc, ControllingType, AssocTypes, AssocExprs, DefaultLoc,
4576RParenLoc, ContainsUnexpandedParameterPack);
4581 unsignedNumAssocs) {
4583totalSizeToAlloc<Stmt *, TypeSourceInfo *>(1 + NumAssocs, NumAssocs),
4606EqualOrColonLoc(EqualOrColonLoc), GNUSyntax(GNUSyntax),
4607NumDesignators(Designators.
size()), NumSubExprs(IndexExprs.
size() + 1) {
4608this->Designators =
new(
C)
Designator[NumDesignators];
4616 unsignedIndexIdx = 0;
4617 for(
unsignedI = 0; I != NumDesignators; ++I) {
4618this->Designators[I] = Designators[I];
4621*Child++ = IndexExprs[IndexIdx++];
4624*Child++ = IndexExprs[IndexIdx++];
4625*Child++ = IndexExprs[IndexIdx++];
4629assert(IndexIdx == IndexExprs.size() &&
"Wrong number of index expressions");
4638 boolUsesColonSyntax,
Expr*
Init) {
4639 void*Mem =
C.Allocate(totalSizeToAlloc<Stmt *>(IndexExprs.size() + 1),
4642ColonOrEqualLoc, UsesColonSyntax,
4647 unsignedNumIndexExprs) {
4648 void*Mem =
C.Allocate(totalSizeToAlloc<Stmt *>(NumIndexExprs + 1),
4655 unsignedNumDesigs) {
4657NumDesignators = NumDesigs;
4658 for(
unsignedI = 0; I != NumDesigs; ++I)
4659Designators[I] = Desigs[I];
4673 if(
First.isFieldDesignator()) {
4676 for(
unsigned inti = 0; i < DIE->size(); i++) {
4684 return First.getLBracketLoc();
4692assert(
D.isArrayDesignator() &&
"Requires array designator");
4697assert(
D.isArrayRangeDesignator() &&
"Requires array range designator");
4702assert(
D.isArrayRangeDesignator() &&
"Requires array range designator");
4711 unsignedNumNewDesignators =
Last-
First;
4712 if(NumNewDesignators == 0) {
4713std::copy_backward(Designators + Idx + 1,
4714Designators + NumDesignators,
4716--NumNewDesignators;
4719 if(NumNewDesignators == 1) {
4720Designators[Idx] = *
First;
4725=
new(
C)
Designator[NumDesignators - 1 + NumNewDesignators];
4726std::copy(Designators, Designators + Idx, NewDesignators);
4727std::copy(
First,
Last, NewDesignators + Idx);
4728std::copy(Designators + Idx + 1, Designators + NumDesignators,
4729NewDesignators + Idx + NumNewDesignators);
4730Designators = NewDesignators;
4731NumDesignators = NumDesignators - 1 + NumNewDesignators;
4740BaseAndUpdaterExprs[0] = baseExpr;
4744BaseAndUpdaterExprs[1] = ILE;
4761LParenLoc(LParenLoc), RParenLoc(RParenLoc) {
4764 for(
unsignedI = 0, N = Exprs.size(); I != N; ++I)
4765getTrailingObjects<Stmt *>()[I] = Exprs[I];
4769ParenListExpr::ParenListExpr(EmptyShell
Empty,
unsignedNumExprs)
4778 void*Mem = Ctx.
Allocate(totalSizeToAlloc<Stmt *>(Exprs.size()),
4780 return new(Mem)
ParenListExpr(LParenLoc, Exprs, RParenLoc);
4784 unsignedNumExprs) {
4794staticstd::optional<BinaryOperator *>
4797 if(
E->getOpcode() == BO_LT) {
4799ComparedTo =
E->getRHS();
4800}
else if(
E->getOpcode() == BO_GT) {
4802ComparedTo =
E->getLHS();
4807 const Expr*AddLHS =
nullptr, *AddRHS =
nullptr;
4810 if(BO && BO->
getOpcode() == clang::BO_Add) {
4816 if(!AddLHS || !AddRHS)
4819 const Decl*LHSDecl, *RHSDecl, *OtherDecl;
4822RHSDecl = AddRHS->IgnoreParenImpCasts()->getReferencedDeclOfCallee();
4828 if(!LHSDecl && !RHSDecl)
4831 if((LHSDecl && LHSDecl == OtherDecl && LHSDecl != RHSDecl) ||
4832(RHSDecl && RHSDecl == OtherDecl && RHSDecl != LHSDecl))
4844 if(!
Result.has_value())
4854 Result.value()->setExcludedOverflowPattern(
true);
4861:
Expr(BinaryOperatorClass, ResTy, VK, OK) {
4864 "Use CompoundAssignOperator for compound assignments");
4867SubExprs[LHS] = lhs;
4868SubExprs[RHS] = rhs;
4880:
Expr(CompoundAssignOperatorClass, ResTy, VK, OK) {
4884 "Use CompoundAssignOperator for compound assignments");
4886SubExprs[LHS] = lhs;
4887SubExprs[RHS] = rhs;
4895 boolHasFPFeatures) {
4912 BinaryOperator(
C, lhs, rhs, opc, ResTy, VK, OK, opLoc, FPFeatures);
4935CompLHSType, CompResultType);
4939 boolhasFPFeatures) {
4940 void*Mem =
C.Allocate(totalSizeToAlloc<FPOptionsOverride>(hasFPFeatures),
4949:
Expr(UnaryOperatorClass,
type, VK, OK), Val(input) {
4965 unsignedSize = totalSizeToAlloc<FPOptionsOverride>(HasFPFeatures);
4973e = ewc->getSubExpr();
4975e = m->getSubExpr();
4976e = cast<CXXConstructExpr>(e)->getArg(0);
4978e = ice->getSubExpr();
4979 returncast<OpaqueValueExpr>(e);
4984 unsignednumSemanticExprs) {
4986Context.
Allocate(totalSizeToAlloc<Expr *>(1 + numSemanticExprs),
4991PseudoObjectExpr::PseudoObjectExpr(EmptyShell shell,
unsignednumSemanticExprs)
4992:
Expr(PseudoObjectExprClass, shell) {
4998 unsignedresultIndex) {
4999assert(syntax &&
"no syntactic expression!");
5000assert(
semantics.size() &&
"no semantic expressions!");
5008assert(resultIndex <
semantics.size());
5010VK =
semantics[resultIndex]->getValueKind();
5014 void*buffer =
C.Allocate(totalSizeToAlloc<Expr *>(
semantics.size() + 1),
5022 unsignedresultIndex)
5027 for(
unsignedi = 0, e =
semantics.size() + 1; i != e; ++i) {
5029getSubExprsBuffer()[i] =
E;
5031 if(isa<OpaqueValueExpr>(
E))
5032assert(cast<OpaqueValueExpr>(
E)->getSourceExpr() !=
nullptr&&
5033 "opaque-value semantic expressions for pseudo-object " 5034 "operations must have sources");
5067NumSubExprs(args.size()), BuiltinLoc(BLoc), RParenLoc(RP), Op(op) {
5068assert(args.size() ==
getNumSubExprs(op) &&
"wrong number of subexpressions");
5069 for(
unsignedi = 0; i != args.size(); i++)
5070SubExprs[i] = args[i];
5076 caseAO__c11_atomic_init:
5077 caseAO__opencl_atomic_init:
5078 caseAO__c11_atomic_load:
5079 caseAO__atomic_load_n:
5080 caseAO__atomic_test_and_set:
5081 caseAO__atomic_clear:
5084 caseAO__scoped_atomic_load_n:
5085 caseAO__opencl_atomic_load:
5086 caseAO__hip_atomic_load:
5087 caseAO__c11_atomic_store:
5088 caseAO__c11_atomic_exchange:
5089 caseAO__atomic_load:
5090 caseAO__atomic_store:
5091 caseAO__atomic_store_n:
5092 caseAO__atomic_exchange_n:
5093 caseAO__c11_atomic_fetch_add:
5094 caseAO__c11_atomic_fetch_sub:
5095 caseAO__c11_atomic_fetch_and:
5096 caseAO__c11_atomic_fetch_or:
5097 caseAO__c11_atomic_fetch_xor:
5098 caseAO__c11_atomic_fetch_nand:
5099 caseAO__c11_atomic_fetch_max:
5100 caseAO__c11_atomic_fetch_min:
5101 caseAO__atomic_fetch_add:
5102 caseAO__atomic_fetch_sub:
5103 caseAO__atomic_fetch_and:
5104 caseAO__atomic_fetch_or:
5105 caseAO__atomic_fetch_xor:
5106 caseAO__atomic_fetch_nand:
5107 caseAO__atomic_add_fetch:
5108 caseAO__atomic_sub_fetch:
5109 caseAO__atomic_and_fetch:
5110 caseAO__atomic_or_fetch:
5111 caseAO__atomic_xor_fetch:
5112 caseAO__atomic_nand_fetch:
5113 caseAO__atomic_min_fetch:
5114 caseAO__atomic_max_fetch:
5115 caseAO__atomic_fetch_min:
5116 caseAO__atomic_fetch_max:
5119 caseAO__scoped_atomic_load:
5120 caseAO__scoped_atomic_store:
5121 caseAO__scoped_atomic_store_n:
5122 caseAO__scoped_atomic_fetch_add:
5123 caseAO__scoped_atomic_fetch_sub:
5124 caseAO__scoped_atomic_fetch_and:
5125 caseAO__scoped_atomic_fetch_or:
5126 caseAO__scoped_atomic_fetch_xor:
5127 caseAO__scoped_atomic_fetch_nand:
5128 caseAO__scoped_atomic_add_fetch:
5129 caseAO__scoped_atomic_sub_fetch:
5130 caseAO__scoped_atomic_and_fetch:
5131 caseAO__scoped_atomic_or_fetch:
5132 caseAO__scoped_atomic_xor_fetch:
5133 caseAO__scoped_atomic_nand_fetch:
5134 caseAO__scoped_atomic_min_fetch:
5135 caseAO__scoped_atomic_max_fetch:
5136 caseAO__scoped_atomic_fetch_min:
5137 caseAO__scoped_atomic_fetch_max:
5138 caseAO__scoped_atomic_exchange_n:
5139 caseAO__hip_atomic_exchange:
5140 caseAO__hip_atomic_fetch_add:
5141 caseAO__hip_atomic_fetch_sub:
5142 caseAO__hip_atomic_fetch_and:
5143 caseAO__hip_atomic_fetch_or:
5144 caseAO__hip_atomic_fetch_xor:
5145 caseAO__hip_atomic_fetch_min:
5146 caseAO__hip_atomic_fetch_max:
5147 caseAO__opencl_atomic_store:
5148 caseAO__hip_atomic_store:
5149 caseAO__opencl_atomic_exchange:
5150 caseAO__opencl_atomic_fetch_add:
5151 caseAO__opencl_atomic_fetch_sub:
5152 caseAO__opencl_atomic_fetch_and:
5153 caseAO__opencl_atomic_fetch_or:
5154 caseAO__opencl_atomic_fetch_xor:
5155 caseAO__opencl_atomic_fetch_min:
5156 caseAO__opencl_atomic_fetch_max:
5157 caseAO__atomic_exchange:
5160 caseAO__scoped_atomic_exchange:
5161 caseAO__c11_atomic_compare_exchange_strong:
5162 caseAO__c11_atomic_compare_exchange_weak:
5164 caseAO__hip_atomic_compare_exchange_strong:
5165 caseAO__opencl_atomic_compare_exchange_strong:
5166 caseAO__opencl_atomic_compare_exchange_weak:
5167 caseAO__hip_atomic_compare_exchange_weak:
5168 caseAO__atomic_compare_exchange:
5169 caseAO__atomic_compare_exchange_n:
5172 caseAO__scoped_atomic_compare_exchange:
5173 caseAO__scoped_atomic_compare_exchange_n:
5176llvm_unreachable(
"unknown atomic op");
5182 returnAT->getValueType();
5187 unsignedArraySectionCount = 0;
5188 while(
auto*OASE = dyn_cast<ArraySectionExpr>(
Base->IgnoreParens())) {
5189 Base= OASE->getBase();
5190++ArraySectionCount;
5193dyn_cast<ArraySubscriptExpr>(
Base->IgnoreParenImpCasts())) {
5194 Base= ASE->getBase();
5195++ArraySectionCount;
5197 Base=
Base->IgnoreParenImpCasts();
5198 autoOriginalTy =
Base->getType();
5199 if(
auto*DRE = dyn_cast<DeclRefExpr>(
Base))
5200 if(
auto*PVD = dyn_cast<ParmVarDecl>(DRE->getDecl()))
5201OriginalTy = PVD->getOriginalType().getNonReferenceType();
5203 for(
unsignedCnt = 0; Cnt < ArraySectionCount; ++Cnt) {
5204 if(OriginalTy->isAnyPointerType())
5205OriginalTy = OriginalTy->getPointeeType();
5206 else if(OriginalTy->isArrayType())
5207OriginalTy = OriginalTy->castAsArrayTypeUnsafe()->getElementType();
5216:
Expr(RecoveryExprClass,
T.getNonReferenceType(),
5217 T->isDependentType() ?
VK_LValue: getValueKindForType(
T),
5219BeginLoc(BeginLoc), EndLoc(EndLoc), NumExprs(SubExprs.size()) {
5220assert(!
T.isNull());
5221assert(!llvm::is_contained(SubExprs,
nullptr));
5223llvm::copy(SubExprs, getTrailingObjects<Expr *>());
5231 void*Mem = Ctx.
Allocate(totalSizeToAlloc<Expr *>(SubExprs.size()),
5233 return new(Mem)
RecoveryExpr(Ctx,
T, BeginLoc, EndLoc, SubExprs);
5237 void*Mem = Ctx.
Allocate(totalSizeToAlloc<Expr *>(NumSubExprs),
5244NumDims == Dims.size() &&
5245 "Preallocated number of dimensions is different from the provided one.");
5246llvm::copy(Dims, getTrailingObjects<Expr *>());
5251NumDims == BR.size() &&
5252 "Preallocated number of dimensions is different from the provided one.");
5253llvm::copy(BR, getTrailingObjects<SourceRange>());
5256OMPArrayShapingExpr::OMPArrayShapingExpr(
QualTypeExprTy,
Expr*Op,
5260RPLoc(R), NumDims(Dims.size()) {
5262setDimensions(Dims);
5271assert(Dims.size() == BracketRanges.size() &&
5272 "Different number of dimensions and brackets ranges.");
5274totalSizeToAlloc<Expr *, SourceRange>(Dims.size() + 1, Dims.size()),
5277 E->setBracketsRanges(BracketRanges);
5284totalSizeToAlloc<Expr *, SourceRange>(NumDims + 1, NumDims),
5289voidOMPIteratorExpr::setIteratorDeclaration(
unsignedI,
Decl*
D) {
5290assert(I < NumIterators &&
5291 "Idx is greater or equal the number of iterators definitions.");
5292getTrailingObjects<Decl *>()[I] =
D;
5296assert(I < NumIterators &&
5297 "Idx is greater or equal the number of iterators definitions.");
5299 SourceLocation>()[I *
static_cast<int>(RangeLocOffset::Total) +
5300 static_cast<int>(RangeLocOffset::AssignLoc)] =
Loc;
5303voidOMPIteratorExpr::setIteratorRange(
unsignedI,
Expr*
Begin,
5307assert(I < NumIterators &&
5308 "Idx is greater or equal the number of iterators definitions.");
5309getTrailingObjects<Expr *>()[I *
static_cast<int>(RangeExprOffset::Total) +
5310 static_cast<int>(RangeExprOffset::Begin)] =
5312getTrailingObjects<Expr *>()[I *
static_cast<int>(RangeExprOffset::Total) +
5313 static_cast<int>(RangeExprOffset::End)] = End;
5314getTrailingObjects<Expr *>()[I *
static_cast<int>(RangeExprOffset::Total) +
5315 static_cast<int>(RangeExprOffset::Step)] = Step;
5317 SourceLocation>()[I *
static_cast<int>(RangeLocOffset::Total) +
5318 static_cast<int>(RangeLocOffset::FirstColonLoc)] =
5321 SourceLocation>()[I *
static_cast<int>(RangeLocOffset::Total) +
5322 static_cast<int>(RangeLocOffset::SecondColonLoc)] =
5327 returngetTrailingObjects<Decl *>()[I];
5333getTrailingObjects<Expr *>()[I *
static_cast<int>(
5334RangeExprOffset::Total) +
5335 static_cast<int>(RangeExprOffset::Begin)];
5337getTrailingObjects<Expr *>()[I *
static_cast<int>(
5338RangeExprOffset::Total) +
5339 static_cast<int>(RangeExprOffset::End)];
5341getTrailingObjects<Expr *>()[I *
static_cast<int>(
5342RangeExprOffset::Total) +
5343 static_cast<int>(RangeExprOffset::Step)];
5348 returngetTrailingObjects<
5349 SourceLocation>()[I *
static_cast<int>(RangeLocOffset::Total) +
5350 static_cast<int>(RangeLocOffset::AssignLoc)];
5354 returngetTrailingObjects<
5355 SourceLocation>()[I *
static_cast<int>(RangeLocOffset::Total) +
5356 static_cast<int>(RangeLocOffset::FirstColonLoc)];
5360 returngetTrailingObjects<
5361 SourceLocation>()[I *
static_cast<int>(RangeLocOffset::Total) +
5362 static_cast<int>(RangeLocOffset::SecondColonLoc)];
5366getTrailingObjects<OMPIteratorHelperData>()[I] =
D;
5370 returngetTrailingObjects<OMPIteratorHelperData>()[I];
5374 returngetTrailingObjects<OMPIteratorHelperData>()[I];
5377OMPIteratorExpr::OMPIteratorExpr(
5382IteratorKwLoc(IteratorKwLoc), LPLoc(L), RPLoc(R),
5383NumIterators(
Data.size()) {
5384 for(
unsignedI = 0,
E=
Data.size(); I <
E; ++I) {
5385 constIteratorDefinition &
D=
Data[I];
5386setIteratorDeclaration(I,
D.IteratorDecl);
5387setAssignmentLoc(I,
D.AssignmentLoc);
5388setIteratorRange(I,
D.Range.Begin,
D.ColonLoc,
D.Range.End,
5389 D.SecondColonLoc,
D.Range.Step);
5390setHelper(I, Helpers[I]);
5401assert(
Data.size() == Helpers.size() &&
5402 "Data and helpers must have the same size.");
5404totalSizeToAlloc<Decl *, Expr *, SourceLocation, OMPIteratorHelperData>(
5405 Data.size(),
Data.size() *
static_cast<int>(RangeExprOffset::Total),
5406 Data.size() *
static_cast<int>(RangeLocOffset::Total),
5413 unsignedNumIterators) {
5415totalSizeToAlloc<Decl *, Expr *, SourceLocation, OMPIteratorHelperData>(
5416NumIterators, NumIterators *
static_cast<int>(RangeExprOffset::Total),
5417NumIterators *
static_cast<int>(RangeLocOffset::Total), NumIterators),
Defines the clang::ASTContext interface.
This file provides some common utility functions for processing Lambda related AST Constructs.
static bool isBooleanType(QualType Ty)
static Expr * IgnoreImplicitConstructorSingleStep(Expr *E)
Defines enum values for all the target-independent builtin functions.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
static const Expr * skipTemporaryBindingsNoOpCastsAndParens(const Expr *E)
Skip over any no-op casts and any temporary-binding expressions.
static void AssertResultStorageKind(ConstantResultStorageKind Kind)
static void computeOverflowPatternExclusion(const ASTContext &Ctx, const BinaryOperator *E)
Compute and set the OverflowPatternExclusion bit based on whether the BinaryOperator expression match...
static std::optional< BinaryOperator * > getOverflowPatternBinOp(const BinaryOperator *E)
Certain overflow-dependent code patterns can have their integer overflow sanitization disabled.
llvm::MachO::Target Target
Defines the clang::Preprocessor interface.
static QualType getUnderlyingType(const SubRegion *R)
static bool isRecordType(QualType T)
Defines the SourceManager interface.
static QualType getPointeeType(const MemRegion *R)
static const TypeInfo & getInfo(unsigned id)
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
void setValue(const ASTContext &C, const llvm::APInt &Val)
llvm::APInt getValue() const
uint64_t * pVal
Used to store the >64 bits integer value.
uint64_t VAL
Used to store the <= 64 bits integer value.
void setIntValue(const ASTContext &C, const llvm::APInt &Val)
A non-discriminated union of a base, field, or array index.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
static APValue IndeterminateValue()
@ Indeterminate
This object has an indeterminate value (C++ [basic.indet]).
@ None
There is no such object (it's outside its lifetime).
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
SourceManager & getSourceManager()
const ConstantArrayType * getAsConstantArrayType(QualType T) const
MangleContext * createMangleContext(const TargetInfo *T=nullptr)
If T is null pointer, assume the target in ASTContext.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
Builtin::Context & BuiltinInfo
const LangOptions & getLangOpts() const
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
LangAS getDefaultOpenCLPointeeAddrSpace()
Returns default address space based on OpenCL version and enabled features.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
void * Allocate(size_t Size, unsigned Align=8) const
CanQualType UnsignedIntTy
llvm::APSInt MakeIntValue(uint64_t Value, QualType Type) const
Make an APSInt of the appropriate width and signedness for the given Value and integer Type.
StringLiteral * getPredefinedStringLiteralFromCache(StringRef Key) const
Return a string representing the human readable name for the specified function declaration or file n...
DiagnosticsEngine & getDiagnostics() const
UnnamedGlobalConstantDecl * getUnnamedGlobalConstantDecl(QualType Ty, const APValue &Value) const
Return a declaration for a uniquified anonymous global constant corresponding to a given APValue.
const TargetInfo & getTargetInfo() const
void addDestruction(T *Ptr) const
If T isn't trivially destructible, calls AddDeallocation to register it for destruction.
void resize(const ASTContext &C, unsigned N, const T &NV)
iterator insert(const ASTContext &C, iterator I, const T &Elt)
void reserve(const ASTContext &C, unsigned N)
static QualType getBaseOriginalType(const Expr *Base)
Return original type of the base expression for array section.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
QualType getElementType() const
QualType getValueType() const
AtomicExpr(SourceLocation BLoc, ArrayRef< Expr * > args, QualType t, AtomicOp op, SourceLocation RP)
unsigned getNumSubExprs() const
A builtin binary operation expression such as "x + y" or "x <= y".
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
StringRef getOpcodeStr() const
SourceLocation getOperatorLoc() const
bool hasStoredFPFeatures() const
bool isCompoundAssignmentOp() const
static unsigned sizeOfTrailingObjects(bool HasFPFeatures)
Return the size in bytes needed for the trailing objects.
static BinaryOperator * Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures)
static BinaryOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
static bool isAssignmentOp(Opcode Opc)
static bool isNullPointerArithmeticExtension(ASTContext &Ctx, Opcode Opc, const Expr *LHS, const Expr *RHS)
Return true if a binary operator using the specified opcode and operands would match the 'p = (i8*)nu...
void setStoredFPFeatures(FPOptionsOverride F)
Set FPFeatures in trailing storage, used only by Serialization.
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
BinaryOperator(const ASTContext &Ctx, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures)
Build a binary operator, assuming that appropriate storage has been allocated for the trailing object...
A binding in a decomposition declaration.
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
SourceLocation getCaretLocation() const
SourceLocation getCaretLocation() const
const Stmt * getBody() const
const FunctionProtoType * getFunctionType() const
getFunctionType - Return the underlying function type for this block.
bool isUnevaluated(unsigned ID) const
Returns true if this builtin does not perform the side-effects of its arguments.
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
static CStyleCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
static CStyleCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *BasePath, FPOptionsOverride FPO, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation R)
SourceLocation getLParenLoc() const
Represents a call to a CUDA kernel function.
Represents a base class of a C++ class.
Represents binding an expression to a temporary.
Represents a call to a C++ constructor.
Expr * getArg(unsigned Arg)
Return the specified argument.
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Represents a C++ constructor within a class.
A default argument (C++ [dcl.fct.default]).
A use of a default initializer in a constructor or in aggregate initialization.
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Represents a call to a member function that may be written either with member call syntax (e....
Represents a static or instance method of a struct/union/class.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
A call to an overloaded operator written using operator syntax.
SourceLocation getOperatorLoc() const
Returns the location of the operator symbol in the expression.
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
SourceRange getSourceRange() const
Represents a C++ struct/union/class.
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
A C++ static_cast expression (C++ [expr.static.cast]).
Represents the this expression in C++.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
bool hasStoredFPFeatures() const
static unsigned sizeOfTrailingObjects(unsigned NumPreArgs, unsigned NumArgs, bool HasFPFeatures)
Return the size in bytes needed for the trailing objects.
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
std::pair< const NamedDecl *, const Attr * > getUnusedResultAttr(const ASTContext &Ctx) const
Returns the WarnUnusedResultAttr that is either declared on the called function, or its return type d...
SourceLocation getBeginLoc() const LLVM_READONLY
unsigned getBuiltinCallee() const
getBuiltinCallee - If this is a call to a builtin, return the builtin ID of the callee.
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
static CallExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, bool HasFPFeatures, EmptyShell Empty)
Create an empty call expression, for deserialization.
bool isCallToStdMove() const
SourceLocation getEndLoc() const LLVM_READONLY
void setPreArg(unsigned I, Stmt *PreArg)
void computeDependence()
Compute and set dependence bits.
void setStoredFPFeatures(FPOptionsOverride F)
Set FPOptionsOverride in trailing storage. Used only by Serialization.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
CallExpr(StmtClass SC, Expr *Fn, ArrayRef< Expr * > PreArgs, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs, ADLCallKind UsesADL)
Build a call expression, assuming that appropriate storage has been allocated for the trailing object...
SourceLocation getRParenLoc() const
static constexpr ADLCallKind UsesADL
static CallExpr * CreateTemporary(void *Mem, Expr *Fn, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, ADLCallKind UsesADL=NotADL)
Create a temporary call expression with no arguments in the memory pointed to by Mem.
bool isBuiltinAssumeFalse(const ASTContext &Ctx) const
Return true if this is a call to __assume() or __builtin_assume() with a non-value-dependent constant...
QualType getCallReturnType(const ASTContext &Ctx) const
getCallReturnType - Get the return type of the call expr.
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...
unsigned getNumPreArgs() const
bool hasUnusedResultAttr(const ASTContext &Ctx) const
Returns true if this call expression should warn on unused results.
QualType withConst() const
Retrieves a version of this type with const applied.
bool isVolatileQualified() const
Represents the body of a CapturedStmt, and serves as its DeclContext.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
FPOptionsOverride * getTrailingFPFeatures()
Return a pointer to the trailing FPOptions.
NamedDecl * getConversionFunction() const
If this cast applies a user-defined conversion, retrieve the conversion function that it invokes.
Expr * getSubExprAsWritten()
Retrieve the cast subexpression as it was written in the source code, looking through any implicit ca...
CastKind getCastKind() const
bool hasStoredFPFeatures() const
static const FieldDecl * getTargetFieldForToUnionCast(QualType unionType, QualType opType)
const char * getCastKindName() const
SourceLocation getEnd() const
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
void setValue(unsigned Val)
static void print(unsigned val, CharacterLiteralKind Kind, raw_ostream &OS)
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Represents a class template specialization, which refers to a class template with a given set of temp...
bool isExplicitSpecialization() const
CompoundAssignOperator - For compound assignments (e.g.
static CompoundAssignOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
static CompoundAssignOperator * Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures, QualType CompLHSType=QualType(), QualType CompResultType=QualType())
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
ConditionalOperator - The ?: ternary operator.
ConstEvaluatedExprVisitor - This class visits 'const Expr *'s.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
APValue getAPValueResult() const
static ConstantResultStorageKind getStorageKind(const APValue &Value)
void MoveIntoResult(APValue &Value, const ASTContext &Context)
llvm::APSInt getResultAsAPSInt() const
ConstantResultStorageKind getResultStorageKind() const
static ConstantExpr * Create(const ASTContext &Context, Expr *E, const APValue &Result)
static ConstantExpr * CreateEmpty(const ASTContext &Context, ConstantResultStorageKind StorageKind)
A POD class for pairing a NamedDecl* with an access specifier.
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
A reference to a declared variable, function, enum, etc.
bool hasExplicitTemplateArgs() const
Determines whether this declaration reference was followed by an explicit template argument list.
void setDecl(ValueDecl *NewD)
static DeclRefExpr * CreateEmpty(const ASTContext &Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
Construct an empty declaration reference expression.
SourceLocation getBeginLoc() const LLVM_READONLY
DeclarationNameInfo getNameInfo() const
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, NonOdrUseReason NOUR=NOUR_None)
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier,...
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name,...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
ASTContext & getASTContext() const LLVM_READONLY
static Decl * castFromDeclContext(const DeclContext *)
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
static bool isFlexibleArrayMemberLike(ASTContext &Context, const Decl *D, QualType Ty, LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel, bool IgnoreTemplateOrMacroSubstitution)
Whether it resembles a flexible array member.
DeclarationNameLoc - Additional source/type location info for a declaration name.
Represents the type decltype(expr) (C++11).
Represents a single C99 designator.
SourceRange getSourceRange() const LLVM_READONLY
bool isFieldDesignator() const
SourceLocation getBeginLoc() const LLVM_READONLY
struct FieldDesignatorInfo FieldInfo
A field designator, e.g., ".x".
bool isArrayRangeDesignator() const
FieldDecl * getFieldDecl() const
bool isArrayDesignator() const
SourceLocation getFieldLoc() const
const IdentifierInfo * getFieldName() const
SourceLocation getDotLoc() const
Represents a C99 designated initializer expression.
static DesignatedInitExpr * CreateEmpty(const ASTContext &C, unsigned NumIndexExprs)
Expr * getArrayRangeEnd(const Designator &D) const
Expr * getSubExpr(unsigned Idx) const
SourceRange getDesignatorsSourceRange() const
Expr * getArrayRangeStart(const Designator &D) const
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).
static DesignatedInitExpr * Create(const ASTContext &C, llvm::ArrayRef< Designator > Designators, ArrayRef< Expr * > IndexExprs, SourceLocation EqualOrColonLoc, bool GNUSyntax, Expr *Init)
Expr * getArrayIndex(const Designator &D) const
Designator * getDesignator(unsigned Idx)
Expr * getInit() const
Retrieve the initializer value.
unsigned size() const
Returns the number of designators in this initializer.
SourceLocation getBeginLoc() const LLVM_READONLY
void setDesignators(const ASTContext &C, const Designator *Desigs, unsigned NumDesigs)
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
DesignatedInitUpdateExpr(const ASTContext &C, SourceLocation lBraceLoc, Expr *baseExprs, SourceLocation rBraceLoc)
SourceLocation getEndLoc() const LLVM_READONLY
InitListExpr * getUpdater() const
EmbedExpr(const ASTContext &Ctx, SourceLocation Loc, EmbedDataStorage *Data, unsigned Begin, unsigned NumOfElements)
An instance of this object exists for each enum constant that is defined.
ExplicitCastExpr - An explicit cast written in the source code.
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
Represents an expression â generally a full-expression â that introduces cleanups to be run at the en...
This represents one expression.
bool EvaluateAsInt(EvalResult &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects, bool InConstantContext=false) const
EvaluateAsInt - Return true if this is a constant which we can fold and convert to an integer,...
EnumConstantDecl * getEnumConstantDecl()
If this expression refers to an enum constant, retrieve its declaration.
bool isReadIfDiscardedInCPlusPlus11() const
Determine whether an lvalue-to-rvalue conversion should implicitly be applied to this expression if i...
Expr * IgnoreParenNoopCasts(const ASTContext &Ctx) LLVM_READONLY
Skip past any parentheses and casts which do not change the value (including ptr->int casts of the sa...
@ SE_AllowUndefinedBehavior
Allow UB that we can give a value, but not arbitrary unmodeled side effects.
static QualType findBoundMemberType(const Expr *expr)
Given an expression of bound-member type, find the type of the member.
bool isImplicitCXXThis() const
Whether this expression is an implicit reference to 'this' in C++.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
bool isUnusedResultAWarning(const Expr *&WarnExpr, SourceLocation &Loc, SourceRange &R1, SourceRange &R2, ASTContext &Ctx) const
isUnusedResultAWarning - Return true if this immediate expression should be warned about if the resul...
LValueClassification ClassifyLValue(ASTContext &Ctx) const
Reasons why an expression might not be an l-value.
bool isValueDependent() const
Determines whether the value of this expression depends on.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool refersToVectorElement() const
Returns whether this expression refers to a vector element.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
llvm::APSInt EvaluateKnownConstInt(const ASTContext &Ctx, SmallVectorImpl< PartialDiagnosticAt > *Diag=nullptr) const
EvaluateKnownConstInt - Call EvaluateAsRValue and return the folded integer.
Expr * IgnoreParenLValueCasts() LLVM_READONLY
Skip past any parentheses and lvalue casts which might surround this expression until reaching a fixe...
FPOptions getFPFeaturesInEffect(const LangOptions &LO) const
Returns the set of floating point options that apply to this expression.
const CXXRecordDecl * getBestDynamicClassType() const
For an expression of class type or pointer to class type, return the most derived class decl the expr...
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
Expr * IgnoreConversionOperatorSingleStep() LLVM_READONLY
Skip conversion operators.
bool containsErrors() const
Whether this expression contains subexpressions which had errors, e.g.
bool isObjCSelfExpr() const
Check if this expression is the ObjC 'self' implicit parameter.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
bool EvaluateAsLValue(EvalResult &Result, const ASTContext &Ctx, bool InConstantContext=false) const
EvaluateAsLValue - Evaluate an expression to see if we can fold it to an lvalue with link time known ...
bool isEvaluatable(const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects) const
isEvaluatable - Call EvaluateAsRValue to see if this expression can be constant folded without side-e...
Expr * IgnoreParenBaseCasts() LLVM_READONLY
Skip past any parentheses and derived-to-base casts until reaching a fixed point.
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language.
static bool hasAnyTypeDependentArguments(ArrayRef< Expr * > Exprs)
hasAnyTypeDependentArguments - Determines if any of the expressions in Exprs is type-dependent.
FieldDecl * getSourceBitField()
If this expression refers to a bit-field, retrieve the declaration of that bit-field.
NullPointerConstantValueDependence
Enumeration used to describe how isNullPointerConstant() should cope with value-dependent expressions...
@ NPC_ValueDependentIsNull
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
@ NPC_NeverValueDependent
Specifies that the expression should never be value-dependent.
@ NPC_ValueDependentIsNotNull
Specifies that a value-dependent expression should be considered to never be a null pointer constant.
Expr * IgnoreUnlessSpelledInSource()
Skip past any invisible AST nodes which might surround this statement, such as ExprWithCleanups or Im...
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Expr * IgnoreCasts() LLVM_READONLY
Skip past any casts which might surround this expression until reaching a fixed point.
Decl * getReferencedDeclOfCallee()
Expr * IgnoreImplicitAsWritten() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
bool EvaluateAsConstantExpr(EvalResult &Result, const ASTContext &Ctx, ConstantExprKind Kind=ConstantExprKind::Normal) const
Evaluate an expression that is required to be a constant expression.
const Expr * getBestDynamicClassTypeExpr() const
Get the inner expression that determines the best dynamic class.
bool isIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point.
NullPointerConstantKind
Enumeration used to describe the kind of Null pointer constant returned from isNullPointerConstant().
@ NPCK_ZeroExpression
Expression is a Null pointer constant built from a zero integer expression that is not a simple,...
@ NPCK_ZeroLiteral
Expression is a Null pointer constant built from a literal zero.
@ NPCK_CXX11_nullptr
Expression is a C++11 nullptr.
@ NPCK_GNUNull
Expression is a GNU-style __null constant.
@ NPCK_NotNull
Expression is not a Null pointer constant.
bool EvaluateAsBooleanCondition(bool &Result, const ASTContext &Ctx, bool InConstantContext=false) const
EvaluateAsBooleanCondition - Return true if this is a constant which we can fold and convert to a boo...
bool isTemporaryObject(ASTContext &Ctx, const CXXRecordDecl *TempTy) const
Determine whether the result of this expression is a temporary object of the given class type.
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant.
QualType getEnumCoercedType(const ASTContext &Ctx) const
If this expression is an enumeration constant, return the enumeration type under which said constant ...
bool isBoundMemberFunction(ASTContext &Ctx) const
Returns true if this expression is a bound member function.
bool isConstantInitializer(ASTContext &Ctx, bool ForRef, const Expr **Culprit=nullptr) const
isConstantInitializer - Returns true if this expression can be emitted to IR as a constant,...
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
static bool isSameComparisonOperand(const Expr *E1, const Expr *E2)
Checks that the two Expr's will refer to the same value as a comparison operand.
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
bool isFlexibleArrayMemberLike(ASTContext &Context, LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel, bool IgnoreTemplateOrMacroSubstitution=false) const
Check whether this array fits the idiom of a flexible array member, depending on the value of -fstric...
Classification Classify(ASTContext &Ctx) const
Classify - Classify this expression according to the C++11 expression taxonomy.
bool hasNonTrivialCall(const ASTContext &Ctx) const
Determine whether this expression involves a call to any function that is not trivial.
bool refersToGlobalRegisterVar() const
Returns whether this expression refers to a global register variable.
bool isCXX98IntegralConstantExpr(const ASTContext &Ctx) const
isCXX98IntegralConstantExpr - Return true if this expression is an integral constant expression in C+...
const ValueDecl * getAsBuiltinConstantDeclRef(const ASTContext &Context) const
If this expression is an unambiguous reference to a single declaration, in the style of __builtin_fun...
bool isOBJCGCCandidate(ASTContext &Ctx) const
isOBJCGCCandidate - Return true if this expression may be used in a read/ write barrier.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
const Expr * skipRValueSubobjectAdjustments() const
bool isKnownToHaveBooleanValue(bool Semantic=true) const
isKnownToHaveBooleanValue - Return true if this is an integer expression that is known to return 0 or...
void setDependence(ExprDependence Deps)
Each concrete expr subclass is expected to compute its dependence and call this in the constructor.
const ObjCPropertyRefExpr * getObjCProperty() const
If this expression is an l-value for an Objective C property, find the underlying property reference ...
bool containsDuplicateElements() const
containsDuplicateElements - Return true if any element access is repeated.
bool isArrow() const
isArrow - Return true if the base expression is a pointer to vector, return false if the base express...
void getEncodedElementAccess(SmallVectorImpl< uint32_t > &Elts) const
getEncodedElementAccess - Encode the elements accessed into an llvm aggregate Constant of ConstantInt...
const Expr * getBase() const
unsigned getNumElements() const
getNumElements - Get the number of components being selected.
static int getAccessorIdx(char c, bool isNumericAccessor)
Represents difference between two FPOptions values.
bool requiresTrailingStorage() const
static FPOptions defaultWithoutTrailingStorage(const LangOptions &LO)
Return the default value of FPOptions that's used when trailing storage isn't required.
Represents a member of a struct/union/class.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set.
bool isBitField() const
Determines whether this field is a bitfield.
static FixedPointLiteral * Create(const ASTContext &C, EmptyShell Empty)
Returns an empty fixed-point literal.
std::string getValueAsString(unsigned Radix) const
static FixedPointLiteral * CreateFromRawInt(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l, unsigned Scale)
static FloatingLiteral * Create(const ASTContext &C, const llvm::APFloat &V, bool isexact, QualType Type, SourceLocation L)
double getValueAsApproximateDouble() const
getValueAsApproximateDouble - This returns the value as an inaccurate double.
llvm::APFloat getValue() const
FullExpr - Represents a "full-expression" node.
Represents a function declaration or definition.
FunctionDecl * getTemplateInstantiationPattern(bool ForDefinition=true) const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Represents a prototype with parameter type info, e.g.
Provides information about a function template specialization, which is a FunctionDecl that has been ...
bool isExplicitSpecialization() const
TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
FunctionType - C99 6.7.5.3 - Function Declarators.
CallingConv getCallConv() const
QualType getReturnType() const
Represents a C11 generic selection.
static GenericSelectionExpr * Create(const ASTContext &Context, SourceLocation GenericLoc, Expr *ControllingExpr, ArrayRef< TypeSourceInfo * > AssocTypes, ArrayRef< Expr * > AssocExprs, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool ContainsUnexpandedParameterPack, unsigned ResultIndex)
Create a non-result-dependent generic selection expression accepting an expression predicate.
static GenericSelectionExpr * CreateEmpty(const ASTContext &Context, unsigned NumAssocs)
Create an empty generic selection expression for deserialization.
GlobalDecl - represents a global declaration.
This class represents temporary values used to represent inout and out arguments in HLSL.
static HLSLOutArgExpr * CreateEmpty(const ASTContext &Ctx)
static HLSLOutArgExpr * Create(const ASTContext &C, QualType Ty, OpaqueValueExpr *Base, OpaqueValueExpr *OpV, Expr *WB, bool IsInOut)
One of these records is kept for each identifier that is lexed.
StringRef getName() const
Return the actual identifier string.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat, FPOptionsOverride FPO)
static ImplicitCastExpr * CreateEmpty(const ASTContext &Context, unsigned PathSize, bool HasFPFeatures)
Describes an C or C++ initializer list.
bool hasArrayFiller() const
Return true if this is an array initializer and its array "filler" has been set.
InitListExpr(const ASTContext &C, SourceLocation lbraceloc, ArrayRef< Expr * > initExprs, SourceLocation rbraceloc)
bool isTransparent() const
Is this a transparent initializer list (that is, an InitListExpr that is purely syntactic,...
void resizeInits(const ASTContext &Context, unsigned NumInits)
Specify the number of initializers.
bool isStringLiteralInit() const
Is this an initializer for an array of characters, initialized by a string literal or an @encode?
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
unsigned getNumInits() const
SourceLocation getBeginLoc() const LLVM_READONLY
bool isSemanticForm() const
void setInit(unsigned Init, Expr *expr)
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...
void setArrayFiller(Expr *filler)
InitListExpr * getSyntacticForm() const
const Expr * getInit(unsigned Init) const
bool isIdiomaticZeroInitializer(const LangOptions &LangOpts) const
Is this the zero initializer {0} in a language which considers it idiomatic?
SourceLocation getEndLoc() const LLVM_READONLY
bool isSyntacticForm() const
ArrayRef< Expr * > inits()
void sawArrayRangeDesignator(bool ARD=true)
Expr ** getInits()
Retrieve the set of initializers.
void reserveInits(const ASTContext &C, unsigned NumInits)
Reserve space for some number of initializers.
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'.
static ItaniumMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags, bool IsAux=false)
LabelStmt - Represents a label, which has a substatement.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
StrictFlexArraysLevelKind
@ AddUnsignedOverflowTest
if (a + b < a)
@ AddSignedOverflowTest
if (a + b < a)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool isOverflowPatternExcluded(OverflowPatternExclusionKind Kind) const
void remapPathPrefix(SmallVectorImpl< char > &Path) const
Remap path prefix according to -fmacro-prefix-path option.
Lexer - This provides a simple interface that turns a text buffer into a stream of tokens.
bool LexFromRawLexer(Token &Result)
LexFromRawLexer - Lex a token from a designated raw lexer (one with no associated preprocessor object...
static SourceLocation AdvanceToTokenCharacter(SourceLocation TokStart, unsigned Characters, const SourceManager &SM, const LangOptions &LangOpts)
AdvanceToTokenCharacter - If the current SourceLocation specifies a location at the start of a token,...
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
static MemberExpr * CreateEmpty(const ASTContext &Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned NumTemplateArgs)
void setMemberDecl(ValueDecl *D)
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name,...
bool hasExplicitTemplateArgs() const
Determines whether the member name was followed by an explicit template argument list.
bool hasQualifier() const
Determines whether this member expression actually had a C++ nested-name-specifier prior to the name ...
static MemberExpr * Create(const ASTContext &C, Expr *Base, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *MemberDecl, DeclAccessPair FoundDecl, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs, QualType T, ExprValueKind VK, ExprObjectKind OK, NonOdrUseReason NOUR)
bool isImplicitAccess() const
Determine whether the base of this explicit is implicit.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
DeclarationNameInfo getMemberNameInfo() const
Retrieve the member declaration name info.
A pointer to member type per C++ 8.3.3 - Pointers to members.
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
A C++ nested-name-specifier augmented with source location information.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
bool hasQualifier() const
Evaluates true when this nested-name-specifier location is non-empty.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
static OMPArrayShapingExpr * CreateEmpty(const ASTContext &Context, unsigned NumDims)
static OMPArrayShapingExpr * Create(const ASTContext &Context, QualType T, Expr *Op, SourceLocation L, SourceLocation R, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > BracketRanges)
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
static OMPIteratorExpr * Create(const ASTContext &Context, QualType T, SourceLocation IteratorKwLoc, SourceLocation L, SourceLocation R, ArrayRef< IteratorDefinition > Data, ArrayRef< OMPIteratorHelperData > Helpers)
static OMPIteratorExpr * CreateEmpty(const ASTContext &Context, unsigned NumIterators)
SourceLocation getSecondColonLoc(unsigned I) const
Gets the location of the second ':' (if any) in the range for the given iteratori definition.
SourceLocation getColonLoc(unsigned I) const
Gets the location of the first ':' in the range for the given iterator definition.
IteratorRange getIteratorRange(unsigned I)
Gets the iterator range for the given iterator.
OMPIteratorHelperData & getHelper(unsigned I)
Fetches helper data for the specified iteration space.
SourceLocation getAssignLoc(unsigned I) const
Gets the location of '=' for the given iterator definition.
Decl * getIteratorDecl(unsigned I)
Gets the iterator declaration for the given iterator.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Represents an ObjC class declaration.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
ObjCMethodFamily getMethodFamily() const
bool isInstanceMessage() const
Determine whether this is an instance message to either a computed object or to super.
const ObjCMethodDecl * getMethodDecl() const
ObjCMethodDecl - Represents an instance or class method declaration.
ImplicitParamDecl * getSelfDecl() const
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
static OffsetOfExpr * CreateEmpty(const ASTContext &C, unsigned NumComps, unsigned NumExprs)
static OffsetOfExpr * Create(const ASTContext &C, QualType type, SourceLocation OperatorLoc, TypeSourceInfo *tsi, ArrayRef< OffsetOfNode > comps, ArrayRef< Expr * > exprs, SourceLocation RParenLoc)
void setIndexExpr(unsigned Idx, Expr *E)
void setComponent(unsigned Idx, OffsetOfNode ON)
FieldDecl * getField() const
For a field offsetof node, returns the field.
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
@ Identifier
A field in a dependent type, known only by its name.
Kind getKind() const
Determine what kind of offsetof node this is.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
static const OpaqueValueExpr * findInCopyConstruct(const Expr *expr)
Given an expression which invokes a copy constructor â i.e.
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
static OpenACCAsteriskSizeExpr * Create(const ASTContext &C, SourceLocation Loc)
static OpenACCAsteriskSizeExpr * CreateEmpty(const ASTContext &C)
ParenExpr - This represents a parenthesized expression, e.g.
static ParenListExpr * CreateEmpty(const ASTContext &Ctx, unsigned NumExprs)
Create an empty paren list.
static ParenListExpr * Create(const ASTContext &Ctx, SourceLocation LParenLoc, ArrayRef< Expr * > Exprs, SourceLocation RParenLoc)
Create a paren list.
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
[C99 6.4.2.2] - A predefined identifier such as func.
static PredefinedExpr * Create(const ASTContext &Ctx, SourceLocation L, QualType FNTy, PredefinedIdentKind IK, bool IsTransparent, StringLiteral *SL)
Create a PredefinedExpr.
StringRef getIdentKindName() const
static PredefinedExpr * CreateEmpty(const ASTContext &Ctx, bool HasFunctionName)
Create an empty PredefinedExpr.
static std::string ComputeName(PredefinedIdentKind IK, const Decl *CurrentDecl, bool ForceElaboratedPrinting=false)
static void processPathToFileName(SmallVectorImpl< char > &FileName, const PresumedLoc &PLoc, const LangOptions &LangOpts, const TargetInfo &TI)
static void processPathForFileMacro(SmallVectorImpl< char > &Path, const LangOptions &LangOpts, const TargetInfo &TI)
Represents an unpacked "presumed" location which can be presented to the user.
unsigned getColumn() const
Return the presumed column number of this location.
const char * getFilename() const
Return the presumed filename of this location.
unsigned getLine() const
Return the presumed line number of this location.
Callbacks to use to customize the behavior of the pretty-printer.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
semantics_iterator semantics_end()
semantics_iterator semantics_begin()
const Expr *const * const_semantics_iterator
static PseudoObjectExpr * Create(const ASTContext &Context, Expr *syntactic, ArrayRef< Expr * > semantic, unsigned resultIndex)
ArrayRef< Expr * > semantics()
A (possibly-)qualified type.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
LangAS getAddressSpace() const
Return the address space of this type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
QualType getCanonicalType() const
The collection of all-type qualifiers we support.
void removeAddressSpace()
Represents a struct/union/class.
field_iterator field_end() const
field_range fields() const
field_iterator field_begin() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
static RecoveryExpr * Create(ASTContext &Ctx, QualType T, SourceLocation BeginLoc, SourceLocation EndLoc, ArrayRef< Expr * > SubExprs)
static RecoveryExpr * CreateEmpty(ASTContext &Ctx, unsigned NumSubExprs)
TypeSourceInfo * getTypeSourceInfo()
static SYCLUniqueStableNameExpr * Create(const ASTContext &Ctx, SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
std::string ComputeName(ASTContext &Context) const
static SYCLUniqueStableNameExpr * CreateEmpty(const ASTContext &Ctx)
void setExprs(const ASTContext &C, ArrayRef< Expr * > Exprs)
ShuffleVectorExpr(const ASTContext &C, ArrayRef< Expr * > args, QualType Type, SourceLocation BLoc, SourceLocation RP)
APValue EvaluateInContext(const ASTContext &Ctx, const Expr *DefaultExpr) const
Return the result of evaluating this SourceLocExpr in the specified (and possibly null) default argum...
SourceLocExpr(const ASTContext &Ctx, SourceLocIdentKind Type, QualType ResultTy, SourceLocation BLoc, SourceLocation RParenLoc, DeclContext *Context)
SourceLocation getLocation() const
const DeclContext * getParentContext() const
If the SourceLocExpr has been resolved return the subexpression representing the resolved value.
StringRef getBuiltinStr() const
Return a string representing the name of the specific builtin function.
static bool MayBeDependent(SourceLocIdentKind Kind)
SourceLocIdentKind getIdentKind() const
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
This class handles loading and caching of source files into memory.
PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives=true) const
Returns the "presumed" location of a SourceLocation specifies.
CharSourceRange getExpansionRange(SourceLocation Loc) const
Given a SourceLocation object, return the range of tokens covered by the expansion in the ultimate fi...
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits
GenericSelectionExprBitfields GenericSelectionExprBits
ParenListExprBitfields ParenListExprBits
CallExprBitfields CallExprBits
FloatingLiteralBitfields FloatingLiteralBits
child_iterator child_begin()
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
UnaryOperatorBitfields UnaryOperatorBits
SourceLocExprBitfields SourceLocExprBits
ConstantExprBitfields ConstantExprBits
llvm::iterator_range< child_iterator > child_range
StringLiteralBitfields StringLiteralBits
MemberExprBitfields MemberExprBits
DeclRefExprBitfields DeclRefExprBits
ConstStmtIterator const_child_iterator
PredefinedExprBitfields PredefinedExprBits
SourceLocation getBeginLoc() const LLVM_READONLY
BinaryOperatorBitfields BinaryOperatorBits
PseudoObjectExprBitfields PseudoObjectExprBits
llvm::iterator_range< const_child_iterator > const_child_range
StringLiteralParser - This decodes string escape characters and performs wide string analysis and Tra...
unsigned getOffsetOfStringByte(const Token &TheTok, unsigned ByteNo) const
getOffsetOfStringByte - This function returns the offset of the specified byte of the string data rep...
unsigned GetStringLength() const
StringLiteral - This represents a string literal expression, e.g.
SourceLocation getStrTokenLoc(unsigned TokNum) const
Get one of the string literal token.
unsigned getLength() const
StringLiteralKind getKind() const
SourceLocation getLocationOfByte(unsigned ByteNo, const SourceManager &SM, const LangOptions &Features, const TargetInfo &Target, unsigned *StartToken=nullptr, unsigned *StartTokenByteOffset=nullptr) const
getLocationOfByte - Return a source location that points to the specified byte of this string literal...
uint32_t getCodeUnit(size_t i) const
void outputString(raw_ostream &OS) const
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringLiteralKind Kind, bool Pascal, QualType Ty, const SourceLocation *Loc, unsigned NumConcatenated)
This is the "fully general" constructor that allows representation of strings formed from multiple co...
static StringLiteral * CreateEmpty(const ASTContext &Ctx, unsigned NumConcatenated, unsigned Length, unsigned CharByteWidth)
Construct an empty string literal.
unsigned getNumConcatenated() const
getNumConcatenated - Get the number of string literal tokens that were concatenated in translation ph...
Represents the declaration of a struct/union/class/enum.
Exposes information about the current target.
A convenient class for passing around template argument information.
A template argument list.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
Location wrapper for a TemplateArgument.
void print(const PrintingPolicy &Policy, raw_ostream &Out, bool IncludeType) const
Print this template argument to the given output stream.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
static bool shouldIncludeTypeForArgument(const PrintingPolicy &Policy, const TemplateParameterList *TPL, unsigned Idx)
Token - This structure provides full information about a lexed token.
A container of type source information.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBooleanType() const
bool hasAttr(attr::Kind AK) const
Determine whether this type had the specified attribute applied to it (looking through top-level type...
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isPointerType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const T * castAs() const
Member-template castAs<specific type>.
bool isSpecificPlaceholderType(unsigned K) const
Test for a specific placeholder type.
bool isReferenceType() const
const CXXRecordDecl * getPointeeCXXRecordDecl() const
If this is a pointer or reference to a RecordType, return the CXXRecordDecl that the type refers to.
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
bool isVectorType() const
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
const T * getAs() const
Member-template getAs<specific type>'.
bool isNullPtrType() const
bool isRecordType() const
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
QualType getArgumentType() const
bool isArgumentType() const
UnaryExprOrTypeTraitExpr(UnaryExprOrTypeTrait ExprKind, TypeSourceInfo *TInfo, QualType resultType, SourceLocation op, SourceLocation rp)
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Expr * getSubExpr() const
bool hasStoredFPFeatures() const
Is FPFeatures in Trailing Storage?
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given unary opcode.
static UnaryOperator * Create(const ASTContext &C, Expr *input, Opcode opc, QualType type, ExprValueKind VK, ExprObjectKind OK, SourceLocation l, bool CanOverflow, FPOptionsOverride FPFeatures)
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix)
Retrieve the unary opcode that corresponds to the given overloaded operator.
void setStoredFPFeatures(FPOptionsOverride F)
Set FPFeatures in trailing storage, used by Serialization & ASTImporter.
UnaryOperator(const ASTContext &Ctx, Expr *input, Opcode opc, QualType type, ExprValueKind VK, ExprObjectKind OK, SourceLocation l, bool CanOverflow, FPOptionsOverride FPFeatures)
static UnaryOperator * CreateEmpty(const ASTContext &C, bool hasFPFeatures)
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to,...
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
Represents a C array with a specified size that is not an integer-constant-expression.
Represents a GCC generic vector type.
Defines the clang::TargetInfo interface.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
ConstantResultStorageKind
Describes the kind of result that can be tail-allocated.
@ Ctor_Base
Base object ctor.
LLVM_READONLY bool isPrintable(unsigned char c)
Return true if this character is an ASCII printable character; that is, a character that should take ...
Expr * IgnoreExprNodes(Expr *E, FnTys &&... Fns)
Given an expression E and functions Fn_1,...,Fn_n : Expr * -> Expr *, Recursively apply each of the f...
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
StmtIterator cast_away_const(const ConstStmtIterator &RHS)
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
@ OK_Ordinary
An ordinary object is located at an address in memory.
ExprDependence computeDependence(FullExpr *E)
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
Expr * IgnoreImplicitCastsExtraSingleStep(Expr *E)
bool isLambdaCallOperator(const CXXMethodDecl *MD)
@ Result
The result type of a method or function.
Expr * IgnoreImplicitCastsSingleStep(Expr *E)
@ Dtor_Base
Base object dtor.
CastKind
CastKind - The kind of operation required for a conversion.
void FixedPointValueToString(SmallVectorImpl< char > &Str, llvm::APSInt Val, unsigned Scale)
Expr * IgnoreImplicitSingleStep(Expr *E)
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
Expr * IgnoreParensSingleStep(Expr *E)
const FunctionProtoType * T
Expr * IgnoreImplicitAsWrittenSingleStep(Expr *E)
Expr * IgnoreCastsSingleStep(Expr *E)
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
Expr * IgnoreLValueCastsSingleStep(Expr *E)
bool isLambdaMethod(const DeclContext *DC)
Expr * IgnoreParensOnlySingleStep(Expr *E)
@ PrettyFunctionNoVirtual
The same as PrettyFunction, except that the 'virtual' keyword is omitted for virtual member functions...
Expr * IgnoreBaseCastsSingleStep(Expr *E)
NonOdrUseReason
The reason why a DeclRefExpr does not constitute an odr-use.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
SourceLocation getBeginLoc() const
getBeginLoc - Retrieve the location of the first token.
SourceLocation getEndLoc() const LLVM_READONLY
Stores data related to a single #embed directive.
EvalResult is a struct with detailed info about an evaluated expression.
APValue Val
Val - This is the value the expression can be folded to.
Iterator range representation begin:end[:step].
Helper expressions and declaration for OMPIteratorExpr class for each iteration space.
Describes how types, statements, expressions, and declarations should be printed.
unsigned SuppressTagKeyword
Whether type printing should skip printing the tag keyword.
const PrintingCallbacks * Callbacks
Callbacks to use to allow the behavior of printing to be customized.
A placeholder type used to construct an empty shell of a type, that will be filled in later (e....
An adjustment to be made to the temporary created when emitting a reference binding,...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4