;
33 const Expr*falseExpr);
38assert(!TR->
isReferenceType() &&
"Expressions can't have reference type.");
79 returnClassification(kind, modifiable);
105llvm_unreachable(
"Invalid value category of implicit cast.");
114#define ABSTRACT_STMT(Kind) 115#define STMT(Kind, Base) case Expr::Kind##Class: 116#define EXPR(Kind, Base) 117#include "clang/AST/StmtNodes.inc" 118llvm_unreachable(
"cannot classify a statement");
121 caseExpr::ObjCIsaExprClass:
123 caseExpr::ObjCSubscriptRefExprClass:
124 caseExpr::ObjCPropertyRefExprClass:
126 caseExpr::CXXTypeidExprClass:
127 caseExpr::CXXUuidofExprClass:
130 caseExpr::UnresolvedLookupExprClass:
131 caseExpr::UnresolvedMemberExprClass:
132 caseExpr::TypoExprClass:
133 caseExpr::DependentCoawaitExprClass:
134 caseExpr::CXXDependentScopeMemberExprClass:
135 caseExpr::DependentScopeDeclRefExprClass:
138 caseExpr::ObjCIvarRefExprClass:
139 caseExpr::FunctionParmPackExprClass:
140 caseExpr::MSPropertyRefExprClass:
141 caseExpr::MSPropertySubscriptExprClass:
142 caseExpr::ArraySectionExprClass:
143 caseExpr::OMPArrayShapingExprClass:
144 caseExpr::OMPIteratorExprClass:
145 caseExpr::HLSLOutArgExprClass:
149 caseExpr::StringLiteralClass:
151 caseExpr::ObjCEncodeExprClass:
159 caseExpr::PredefinedExprClass: {
160 auto*PE = cast<PredefinedExpr>(
E);
162 if(PE->isTransparent())
170 caseExpr::CompoundLiteralExprClass:
174 caseExpr::CXXBoolLiteralExprClass:
175 caseExpr::CXXPseudoDestructorExprClass:
176 caseExpr::UnaryExprOrTypeTraitExprClass:
177 caseExpr::CXXNewExprClass:
178 caseExpr::CXXNullPtrLiteralExprClass:
179 caseExpr::ImaginaryLiteralClass:
180 caseExpr::GNUNullExprClass:
181 caseExpr::OffsetOfExprClass:
182 caseExpr::CXXThrowExprClass:
183 caseExpr::ShuffleVectorExprClass:
184 caseExpr::ConvertVectorExprClass:
185 caseExpr::IntegerLiteralClass:
186 caseExpr::FixedPointLiteralClass:
187 caseExpr::CharacterLiteralClass:
188 caseExpr::AddrLabelExprClass:
189 caseExpr::CXXDeleteExprClass:
190 caseExpr::ImplicitValueInitExprClass:
191 caseExpr::BlockExprClass:
192 caseExpr::FloatingLiteralClass:
193 caseExpr::CXXNoexceptExprClass:
194 caseExpr::CXXScalarValueInitExprClass:
195 caseExpr::TypeTraitExprClass:
196 caseExpr::ArrayTypeTraitExprClass:
197 caseExpr::ExpressionTraitExprClass:
198 caseExpr::ObjCSelectorExprClass:
199 caseExpr::ObjCProtocolExprClass:
200 caseExpr::ObjCStringLiteralClass:
201 caseExpr::ObjCBoxedExprClass:
202 caseExpr::ObjCArrayLiteralClass:
203 caseExpr::ObjCDictionaryLiteralClass:
204 caseExpr::ObjCBoolLiteralExprClass:
205 caseExpr::ObjCAvailabilityCheckExprClass:
206 caseExpr::ParenListExprClass:
207 caseExpr::SizeOfPackExprClass:
208 caseExpr::SubstNonTypeTemplateParmPackExprClass:
209 caseExpr::AsTypeExprClass:
210 caseExpr::ObjCIndirectCopyRestoreExprClass:
211 caseExpr::AtomicExprClass:
212 caseExpr::CXXFoldExprClass:
213 caseExpr::ArrayInitLoopExprClass:
214 caseExpr::ArrayInitIndexExprClass:
215 caseExpr::NoInitExprClass:
216 caseExpr::DesignatedInitUpdateExprClass:
217 caseExpr::SourceLocExprClass:
218 caseExpr::ConceptSpecializationExprClass:
219 caseExpr::RequiresExprClass:
222 caseExpr::EmbedExprClass:
228 caseExpr::CXXThisExprClass:
231 caseExpr::ConstantExprClass:
235 caseExpr::SubstNonTypeTemplateParmExprClass:
237cast<SubstNonTypeTemplateParmExpr>(
E)->getReplacement());
239 caseExpr::PackIndexingExprClass: {
242 if(cast<PackIndexingExpr>(
E)->isInstantiationDependent())
251 caseExpr::ArraySubscriptExprClass:
252 if(cast<ArraySubscriptExpr>(
E)->getBase()->getType()->isVectorType())
254 if(Lang.CPlusPlus11) {
257 auto*
Base= cast<ArraySubscriptExpr>(
E)->getBase()->IgnoreImpCasts();
258 if(
Base->getType()->isArrayType())
264 caseExpr::MatrixSubscriptExprClass:
269 caseExpr::DeclRefExprClass:
271 returnisa<FunctionDecl>(cast<DeclRefExpr>(
E)->getDecl())
273 return ClassifyDecl(Ctx, cast<DeclRefExpr>(
E)->getDecl());
276 caseExpr::MemberExprClass:
279 caseExpr::UnaryOperatorClass:
280 switch(cast<UnaryOperator>(
E)->getOpcode()) {
299 if(isa<ObjCPropertyRefExpr>(Op))
315 caseExpr::RecoveryExprClass:
316 caseExpr::OpaqueValueExprClass:
320 caseExpr::PseudoObjectExprClass:
322cast<PseudoObjectExpr>(
E)->getValueKind());
326 caseExpr::ImplicitCastExprClass:
331 caseExpr::ParenExprClass:
337 caseExpr::GenericSelectionExprClass:
338 if(cast<GenericSelectionExpr>(
E)->isResultDependent())
342 caseExpr::BinaryOperatorClass:
343 caseExpr::CompoundAssignOperatorClass:
349 caseExpr::CallExprClass:
350 caseExpr::CXXOperatorCallExprClass:
351 caseExpr::CXXMemberCallExprClass:
352 caseExpr::UserDefinedLiteralClass:
353 caseExpr::CUDAKernelCallExprClass:
356 caseExpr::CXXRewrittenBinaryOperatorClass:
358Ctx, cast<CXXRewrittenBinaryOperator>(
E)->getSemanticForm());
361 caseExpr::ChooseExprClass:
366 caseExpr::ExtVectorElementExprClass:
367 if(cast<ExtVectorElementExpr>(
E)->containsDuplicateElements())
369 if(cast<ExtVectorElementExpr>(
E)->isArrow())
374 caseExpr::CXXDefaultArgExprClass:
378 caseExpr::CXXDefaultInitExprClass:
382 caseExpr::CXXBindTemporaryExprClass:
386 caseExpr::ExprWithCleanupsClass:
390 caseExpr::CStyleCastExprClass:
391 caseExpr::CXXFunctionalCastExprClass:
392 caseExpr::CXXStaticCastExprClass:
393 caseExpr::CXXDynamicCastExprClass:
394 caseExpr::CXXReinterpretCastExprClass:
395 caseExpr::CXXConstCastExprClass:
396 caseExpr::CXXAddrspaceCastExprClass:
397 caseExpr::ObjCBridgedCastExprClass:
398 caseExpr::BuiltinBitCastExprClass:
401 return ClassifyUnnamed(Ctx, cast<ExplicitCastExpr>(
E)->getTypeAsWritten());
403 caseExpr::CXXUnresolvedConstructExprClass:
405cast<CXXUnresolvedConstructExpr>(
E)->getTypeAsWritten());
407 caseExpr::BinaryConditionalOperatorClass: {
409 const auto*co = cast<BinaryConditionalOperator>(
E);
413 caseExpr::ConditionalOperatorClass: {
416 const auto*co = cast<ConditionalOperator>(
E);
422 caseExpr::ObjCMessageExprClass:
424cast<ObjCMessageExpr>(
E)->getMethodDecl()) {
431 caseExpr::CXXConstructExprClass:
432 caseExpr::CXXInheritedCtorInitExprClass:
433 caseExpr::CXXTemporaryObjectExprClass:
434 caseExpr::LambdaExprClass:
435 caseExpr::CXXStdInitializerListExprClass:
438 caseExpr::VAArgExprClass:
441 caseExpr::DesignatedInitExprClass:
444 caseExpr::StmtExprClass: {
446 if(
const auto*LastExpr = dyn_cast_or_null<Expr>(S->body_back()))
451 caseExpr::PackExpansionExprClass:
454 caseExpr::ResolvedUnexpandedPackExprClass: {
455 if(cast<ResolvedUnexpandedPackExpr>(
E)->getNumExprs() > 0)
457Ctx, cast<ResolvedUnexpandedPackExpr>(
E)->getExpansion(0));
461 caseExpr::MaterializeTemporaryExprClass:
462 returncast<MaterializeTemporaryExpr>(
E)->isBoundToLvalueReference()
466 caseExpr::InitListExprClass:
473assert(cast<InitListExpr>(
E)->getNumInits() == 1 &&
474 "Only 1-element init lists can be glvalues.");
477 caseExpr::CoawaitExprClass:
478 caseExpr::CoyieldExprClass:
480 caseExpr::SYCLUniqueStableNameExprClass:
481 caseExpr::OpenACCAsteriskSizeExprClass:
485 caseExpr::CXXParenListInitExprClass:
486 if(isa<ArrayType>(
E->
getType()))
491llvm_unreachable(
"unhandled expression kind in classification");
505 if(
const auto*M = dyn_cast<CXXMethodDecl>(
D)) {
506 if(M->isImplicitObjectMemberFunction())
514 if(
const auto*NTTParm = dyn_cast<NonTypeTemplateParmDecl>(
D))
515islvalue = NTTParm->getType()->isReferenceType() ||
516NTTParm->getType()->isRecordType();
522(isa<FunctionDecl, MSPropertyDecl, FunctionTemplateDecl>(
D)));
549 return(isa<FunctionDecl>(
E->getMemberDecl())
561 if(isa<ObjCPropertyRefExpr>(
Base))
570 if(
const auto*
Value= dyn_cast<ValueDecl>(
Member))
576 if(isa<VarDecl>(
Member) &&
Member->getDeclContext()->isRecord())
582 if(isa<FieldDecl>(
Member)) {
587 if(isa<ObjCPropertyRefExpr>(
Base))
596 if(
const auto*Method = dyn_cast<CXXMethodDecl>(
Member)) {
597 if(Method->isStatic())
599 if(Method->isImplicitObjectMemberFunction())
611 "This is only relevant for C++.");
614 if(
E->isAssignmentOp())
620 if(
E->getOpcode() == BO_Comma)
626 if(
E->getOpcode() == BO_PtrMemD)
634 if(
E->getOpcode() == BO_PtrMemI)
647 "This is only relevant for C++.");
652 if(
True->getType()->isVoidType() ||
False->getType()->isVoidType()) {
656 boolTrueIsThrow = isa<CXXThrowExpr>(
True->IgnoreParenImpCasts());
657 boolFalseIsThrow = isa<CXXThrowExpr>(
False->IgnoreParenImpCasts());
658 if(
const Expr*NonThrow = TrueIsThrow ? (FalseIsThrow ?
nullptr:
False)
659: (FalseIsThrow ?
True:
nullptr))
683 if(
const auto*CE = dyn_cast<ExplicitCastExpr>(
E->
IgnoreParens())) {
684 if(CE->getSubExpr()->IgnoreParenImpCasts()->isLValue()) {
685 Loc= CE->getExprLoc();
700 if(
const auto*
Expr= dyn_cast<ObjCPropertyRefExpr>(
E)) {
701 if(
Expr->isImplicitProperty() &&
702 Expr->getImplicitPropertySetter() ==
nullptr)
715 if(CT->isArrayType() &&
716!(Ctx.
getLangOpts().HLSL && CT->isConstantArrayType()))
719 if(CT->isIncompleteType())
724 if(R->hasConstFields())
746llvm_unreachable(
"Unhandled kind");
771 case Cl::CM_Untested: llvm_unreachable(
"Did not test modifiability");
773 case Cl::CM_RValue: llvm_unreachable(
"CM_RValue and CL_LValue don't match");
776llvm_unreachable(
"CM_LValueCast and CL_LValue don't match");
784llvm_unreachable(
"Unhandled modifiable type");
Defines the clang::ASTContext interface.
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 Cl::Kinds ClassifyUnnamed(ASTContext &Ctx, QualType T)
ClassifyUnnamed - Return the classification of an expression yielding an unnamed value of the given t...
static Cl::Kinds ClassifyConditional(ASTContext &Ctx, const Expr *trueExpr, const Expr *falseExpr)
static Cl::Kinds ClassifyDecl(ASTContext &Ctx, const Decl *D)
ClassifyDecl - Return the classification of an expression referencing the given declaration.
static Cl::Kinds ClassifyMemberExpr(ASTContext &Ctx, const MemberExpr *E)
static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E)
static Cl::Kinds ClassifyExprValueKind(const LangOptions &Lang, const Expr *E, ExprValueKind Kind)
static Cl::ModifiableType IsModifiable(ASTContext &Ctx, const Expr *E, Cl::Kinds Kind, SourceLocation &Loc)
static Cl::Kinds ClassifyTemporary(QualType T)
Classify an expression which creates a temporary, based on its type.
static Cl::Kinds ClassifyBinaryOp(ASTContext &Ctx, const BinaryOperator *E)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
const LangOptions & getLangOpts() const
A builtin binary operation expression such as "x + y" or "x <= y".
A binding in a decomposition declaration.
bool isConstQualified() const
Qualifiers getQualifiers() const
Retrieve all qualifiers.
CanProxy< U > getAs() const
Retrieve a canonical type pointer with a different static type, upcasting or downcasting as needed.
CompoundStmt - This represents a group of statements like { stmt stmt }.
Decl - This represents one declaration (or definition), e.g.
The return type of classify().
ModifiableType
The results of modification testing.
ModifiableType getModifiable() const
Kinds
The various classification results. Most of these mean prvalue.
@ CL_SubObjCPropertySetting
@ CL_DuplicateVectorComponents
This represents one expression.
@ LV_DuplicateVectorComponents
@ LV_InvalidMessageExpression
@ LV_SubObjCPropertySetting
Classification ClassifyModifiable(ASTContext &Ctx, SourceLocation &Loc) const
ClassifyModifiable - Classify this expression according to the C++11 expression taxonomy,...
isModifiableLvalueResult isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc=nullptr) const
isModifiableLvalue - C99 6.3.2.1: an lvalue that does not have array type, does not have an incomplet...
LValueClassification ClassifyLValue(ASTContext &Ctx) const
Reasons why an expression might not be an l-value.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression 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.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
@ MLV_DuplicateVectorComponents
@ MLV_InvalidMessageExpression
@ MLV_ConstQualifiedField
@ MLV_SubObjCPropertySetting
Classification Classify(ASTContext &Ctx) const
Classify - Classify this expression according to the C++11 expression taxonomy.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
Represents a member of a struct/union/class.
Represents a field injected from an anonymous union/struct into the parent scope.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
This represents a decl that may have a name.
ObjCMethodDecl - Represents an instance or class method declaration.
A (possibly-)qualified type.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
LangAS getAddressSpace() const
An rvalue reference type, per C++11 [dcl.ref].
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Encodes a location in the source.
StmtClass getStmtClass() const
StringLiteral - This represents a string literal expression, e.g.
A template parameter object.
bool isReferenceType() const
bool isLValueReferenceType() const
bool isFunctionType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
Represents a variable declaration or definition.
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
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_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
const FunctionProtoType * T
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