36 if (
const DeclRefExpr *dre = dyn_cast<DeclRefExpr>(e)) {
37 const VarDecl *
var = dyn_cast<VarDecl>(dre->getDecl());
38 return (var &&
var->hasAttr<BlocksAttr>());
47 if (op->isAssignmentOp() || op->isPtrMemOp())
51 if (op->getOpcode() == BO_Comma)
59 dyn_cast<AbstractConditionalOperator>(e)) {
65 if (
const Expr *src = op->getSourceExpr())
72 }
else if (
const CastExpr *
cast = dyn_cast<CastExpr>(e)) {
73 if (
cast->getCastKind() == CK_LValueToRValue)
79 }
else if (
const UnaryOperator *uop = dyn_cast<UnaryOperator>(e)) {
83 }
else if (
const MemberExpr *mem = dyn_cast<MemberExpr>(e)) {
94class AggExprEmitter :
public StmtVisitor<AggExprEmitter> {
105 void withReturnValueSlot(
const Expr *e,
106 llvm::function_ref<RValue(ReturnValueSlot)> fn);
108 AggValueSlot ensureSlot(mlir::Location loc, QualType t) {
109 if (!dest.isIgnored())
111 return cgf.createAggTemp(t, loc,
"agg.tmp.ensured");
114 void ensureDest(mlir::Location loc, QualType ty) {
115 if (!dest.isIgnored())
117 dest = cgf.createAggTemp(ty, loc,
"agg.tmp.ensured");
121 AggExprEmitter(CIRGenFunction &cgf, AggValueSlot dest)
122 : cgf(cgf), dest(dest) {}
127 void emitAggLoadOfLValue(
const Expr *e);
129 void emitArrayInit(Address destPtr, cir::ArrayType arrayTy, QualType arrayQTy,
130 Expr *exprToVisit, ArrayRef<Expr *> args,
134 void emitFinalDestCopy(QualType
type,
const LValue &src);
136 void emitCopy(QualType
type,
const AggValueSlot &dest,
137 const AggValueSlot &src);
139 void emitInitializationToLValue(Expr *e, LValue lv);
141 void emitNullInitializationToLValue(mlir::Location loc, LValue lv);
143 void Visit(Expr *e) { StmtVisitor<AggExprEmitter>::Visit(e); }
145 void VisitArraySubscriptExpr(ArraySubscriptExpr *e) {
146 emitAggLoadOfLValue(e);
149 void VisitCallExpr(
const CallExpr *e);
150 void VisitStmtExpr(
const StmtExpr *e) {
151 CIRGenFunction::StmtExprEvaluation eval(cgf);
154 (void)cgf.emitCompoundStmt(*e->
getSubStmt(), &retAlloca, dest);
157 void VisitBinAssign(
const BinaryOperator *e) {
160 assert(cgf.getContext().hasSameUnqualifiedType(e->
getLHS()->
getType(),
162 "Invalid assignment");
167 "block var reference with side effects");
171 LValue lhs = cgf.emitLValue(e->
getLHS());
187 cgf.emitAggExpr(e->
getRHS(), lhsSlot);
190 emitFinalDestCopy(e->
getType(), lhs);
192 if (!dest.isIgnored() && !dest.isExternallyDestructed() &&
198 void VisitDeclRefExpr(DeclRefExpr *e) { emitAggLoadOfLValue(e); }
200 void VisitInitListExpr(InitListExpr *e);
201 void VisitCXXConstructExpr(
const CXXConstructExpr *e);
203 void visitCXXParenListOrInitListExpr(Expr *e, ArrayRef<Expr *> args,
204 FieldDecl *initializedFieldInUnion,
206 void VisitCXXDefaultInitExpr(CXXDefaultInitExpr *die) {
207 CIRGenFunction::CXXDefaultInitExprScope Scope(cgf, die);
210 void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *e) {
213 bool wasExternallyDestructed = dest.isExternallyDestructed();
217 dest.setExternallyDestructed();
222 if (!wasExternallyDestructed)
226 void VisitExprWithCleanups(ExprWithCleanups *e);
231 case CK_LValueToRValue:
236 "AggExprEmitter: volatile lvalue-to-rvalue cast");
239 case CK_UserDefinedConversion:
240 case CK_ConstructorConversion:
243 "Implicit cast types must be compatible");
248 std::string(
"AggExprEmitter: VisitCastExpr: ") +
253 void VisitStmt(Stmt *
s) {
254 cgf.cgm.errorNYI(
s->getSourceRange(),
255 std::string(
"AggExprEmitter::VisitStmt: ") +
256 s->getStmtClassName());
258 void VisitParenExpr(ParenExpr *pe) { Visit(pe->
getSubExpr()); }
259 void VisitGenericSelectionExpr(GenericSelectionExpr *ge) {
262 void VisitCoawaitExpr(CoawaitExpr *e) {
263 cgf.cgm.errorNYI(e->
getSourceRange(),
"AggExprEmitter: VisitCoawaitExpr");
265 void VisitCoyieldExpr(CoyieldExpr *e) {
266 cgf.cgm.errorNYI(e->
getSourceRange(),
"AggExprEmitter: VisitCoyieldExpr");
268 void VisitUnaryCoawait(UnaryOperator *e) {
269 cgf.cgm.errorNYI(e->
getSourceRange(),
"AggExprEmitter: VisitUnaryCoawait");
271 void VisitUnaryExtension(UnaryOperator *e) { Visit(e->
getSubExpr()); }
272 void VisitSubstNonTypeTemplateParmExpr(SubstNonTypeTemplateParmExpr *e) {
274 "AggExprEmitter: VisitSubstNonTypeTemplateParmExpr");
276 void VisitConstantExpr(ConstantExpr *e) {
277 cgf.cgm.errorNYI(e->
getSourceRange(),
"AggExprEmitter: VisitConstantExpr");
279 void VisitMemberExpr(MemberExpr *e) { emitAggLoadOfLValue(e); }
280 void VisitUnaryDeref(UnaryOperator *e) { emitAggLoadOfLValue(e); }
281 void VisitStringLiteral(StringLiteral *e) { emitAggLoadOfLValue(e); }
282 void VisitCompoundLiteralExpr(CompoundLiteralExpr *e);
284 void VisitPredefinedExpr(
const PredefinedExpr *e) {
286 "AggExprEmitter: VisitPredefinedExpr");
288 void VisitBinaryOperator(
const BinaryOperator *e) {
290 "AggExprEmitter: VisitBinaryOperator");
292 void VisitPointerToDataMemberBinaryOperator(
const BinaryOperator *e) {
294 "AggExprEmitter: VisitPointerToDataMemberBinaryOperator");
296 void VisitBinComma(
const BinaryOperator *e) {
297 cgf.emitIgnoredExpr(e->
getLHS());
300 void VisitBinCmp(
const BinaryOperator *e) {
301 cgf.cgm.errorNYI(e->
getSourceRange(),
"AggExprEmitter: VisitBinCmp");
303 void VisitCXXRewrittenBinaryOperator(CXXRewrittenBinaryOperator *e) {
305 "AggExprEmitter: VisitCXXRewrittenBinaryOperator");
307 void VisitObjCMessageExpr(ObjCMessageExpr *e) {
309 "AggExprEmitter: VisitObjCMessageExpr");
311 void VisitObjCIVarRefExpr(ObjCIvarRefExpr *e) {
313 "AggExprEmitter: VisitObjCIVarRefExpr");
316 void VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *e) {
318 LValue destLV = cgf.makeAddrLValue(dest.getAddress(), e->
getType());
319 emitInitializationToLValue(e->
getBase(), destLV);
322 void VisitAbstractConditionalOperator(
const AbstractConditionalOperator *e) {
324 "AggExprEmitter: VisitAbstractConditionalOperator");
327 void VisitCXXParenListInitExpr(CXXParenListInitExpr *e) {
333 void VisitArrayInitLoopExpr(
const ArrayInitLoopExpr *e,
334 llvm::Value *outerBegin =
nullptr) {
336 "AggExprEmitter: VisitArrayInitLoopExpr");
338 void VisitImplicitValueInitExpr(ImplicitValueInitExpr *e) {
340 "AggExprEmitter: VisitImplicitValueInitExpr");
342 void VisitNoInitExpr(NoInitExpr *e) {
343 cgf.cgm.errorNYI(e->
getSourceRange(),
"AggExprEmitter: VisitNoInitExpr");
345 void VisitCXXDefaultArgExpr(CXXDefaultArgExpr *dae) {
347 "AggExprEmitter: VisitCXXDefaultArgExpr");
349 void VisitCXXInheritedCtorInitExpr(
const CXXInheritedCtorInitExpr *e) {
351 "AggExprEmitter: VisitCXXInheritedCtorInitExpr");
353 void VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *e) {
355 "AggExprEmitter: VisitCXXStdInitializerListExpr");
357 void VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *e) {
359 "AggExprEmitter: VisitCXXScalarValueInitExpr");
361 void VisitCXXTypeidExpr(CXXTypeidExpr *e) {
362 cgf.cgm.errorNYI(e->
getSourceRange(),
"AggExprEmitter: VisitCXXTypeidExpr");
364 void VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *e) {
367 void VisitOpaqueValueExpr(OpaqueValueExpr *e) {
369 "AggExprEmitter: VisitOpaqueValueExpr");
372 void VisitPseudoObjectExpr(PseudoObjectExpr *e) {
374 "AggExprEmitter: VisitPseudoObjectExpr");
377 void VisitVAArgExpr(VAArgExpr *e) {
378 cgf.cgm.errorNYI(e->
getSourceRange(),
"AggExprEmitter: VisitVAArgExpr");
381 void VisitCXXThrowExpr(
const CXXThrowExpr *e) {
382 cgf.cgm.errorNYI(e->
getSourceRange(),
"AggExprEmitter: VisitCXXThrowExpr");
384 void VisitAtomicExpr(AtomicExpr *e) {
385 cgf.cgm.errorNYI(e->
getSourceRange(),
"AggExprEmitter: VisitAtomicExpr");
398 if (
auto *ile = dyn_cast<InitListExpr>(e)) {
399 if (ile->getNumInits())
404 if (
const auto *cons = dyn_cast_or_null<CXXConstructExpr>(e))
405 return cons->getConstructor()->isDefaultConstructor() &&
406 cons->getConstructor()->isTrivial();
413void AggExprEmitter::emitAggLoadOfLValue(
const Expr *e) {
419 emitFinalDestCopy(e->
getType(), lv);
422void AggExprEmitter::VisitCompoundLiteralExpr(CompoundLiteralExpr *e) {
426 emitAggLoadOfLValue(e);
447void AggExprEmitter::emitArrayInit(Address destPtr, cir::ArrayType arrayTy,
448 QualType arrayQTy, Expr *e,
449 ArrayRef<Expr *> args, Expr *arrayFiller) {
453 const uint64_t numInitElements = args.size();
455 const QualType elementType =
459 cgf.
cgm.
errorNYI(loc,
"initialized array requires destruction");
465 const mlir::Type cirElementType = cgf.
convertType(elementType);
466 const cir::PointerType cirElementPtrType =
469 auto begin = cir::CastOp::create(builder, loc, cirElementPtrType,
470 cir::CastKind::array_to_ptrdecay,
473 const CharUnits elementSize =
475 const CharUnits elementAlign =
483 mlir::Value element = begin;
490 for (uint64_t i = 0; i != numInitElements; ++i) {
497 const Address address = Address(element, cirElementType, elementAlign);
498 const LValue elementLV = cgf.
makeAddrLValue(address, elementType);
499 emitInitializationToLValue(args[i], elementLV);
502 const uint64_t numArrayElements = arrayTy.getSize();
510 if (numInitElements != numArrayElements &&
511 !(dest.
isZeroed() && hasTrivialFiller &&
514 if (numInitElements) {
516 element = cir::PtrStrideOp::create(builder, loc, cirElementPtrType,
528 cir::ConstantOp numArrayElementsConst = builder.
getConstInt(
529 loc, mlir::cast<cir::IntType>(cgf.
ptrDiffTy), numArrayElements);
530 mlir::Value end = cir::PtrStrideOp::create(builder, loc, cirElementPtrType,
531 begin, numArrayElementsConst);
536 [&](mlir::OpBuilder &
b, mlir::Location loc) {
537 cir::LoadOp currentElement = builder.
createLoad(loc, tmpAddr);
539 cir::CmpOp cmp = cir::CmpOp::create(
540 builder, loc, boolTy, cir::CmpOpKind::ne, currentElement, end);
544 [&](mlir::OpBuilder &
b, mlir::Location loc) {
545 cir::LoadOp currentElement = builder.
createLoad(loc, tmpAddr);
551 Address(currentElement, cirElementType, elementAlign),
554 emitInitializationToLValue(arrayFiller, elementLV);
556 emitNullInitializationToLValue(loc, elementLV);
560 cgf.
cgm.
errorNYI(loc,
"update destructed array element for EH");
566 loc, mlir::cast<cir::IntType>(cgf.
ptrDiffTy), 1);
567 auto nextElement = cir::PtrStrideOp::create(
568 builder, loc, cirElementPtrType, currentElement, one);
577void AggExprEmitter::emitFinalDestCopy(QualType
type,
const LValue &src) {
592 emitCopy(
type, dest, srcAgg);
599void AggExprEmitter::emitCopy(QualType
type,
const AggValueSlot &dest,
600 const AggValueSlot &src) {
613void AggExprEmitter::emitInitializationToLValue(Expr *e, LValue lv) {
614 const QualType
type = lv.getType();
620 return emitNullInitializationToLValue(loc, lv);
626 if (
type->isReferenceType()) {
651void AggExprEmitter::VisitCXXConstructExpr(
const CXXConstructExpr *e) {
656void AggExprEmitter::emitNullInitializationToLValue(mlir::Location loc,
658 const QualType
type = lv.getType();
683void AggExprEmitter::VisitLambdaExpr(
LambdaExpr *e) {
686 [[maybe_unused]] LValue slotLV =
693 for (
auto [curField, capture, captureInit] : llvm::zip(
696 llvm::StringRef fieldName = curField->getName();
697 if (capture.capturesVariable()) {
698 assert(!curField->isBitField() &&
"lambdas don't have bitfield members!");
699 ValueDecl *v = capture.getCapturedVar();
702 }
else if (capture.capturesThis()) {
712 if (curField->hasCapturedVLAType())
715 emitInitializationToLValue(captureInit, lv);
719 curField->getType().isDestructedType())
724void AggExprEmitter::VisitExprWithCleanups(ExprWithCleanups *e) {
725 CIRGenFunction::RunCleanupsScope cleanups(cgf);
729void AggExprEmitter::VisitCallExpr(
const CallExpr *e) {
736 e, [&](ReturnValueSlot slot) {
return cgf.
emitCallExpr(e, slot); });
739void AggExprEmitter::withReturnValueSlot(
740 const Expr *e, llvm::function_ref<RValue(ReturnValueSlot)> fn) {
744 bool requiresDestruction =
746 if (requiresDestruction)
749 "withReturnValueSlot: return value requiring destruction is NYI");
764 fn(ReturnValueSlot(retAddr));
767void AggExprEmitter::VisitInitListExpr(InitListExpr *e) {
769 llvm_unreachable(
"GNU array range designator extension");
774 visitCXXParenListOrInitListExpr(
778void AggExprEmitter::visitCXXParenListOrInitListExpr(
779 Expr *e, ArrayRef<Expr *> args, FieldDecl *initializedFieldInUnion,
782 const AggValueSlot dest =
786 cir::ArrayType arrayTy =
793 "visitCXXParenListOrInitListExpr variable array type");
799 "visitCXXParenListOrInitListExpr array type");
809 unsigned numInitElements = args.size();
816 unsigned curInitIndex = 0;
819 if (
auto *cxxrd = dyn_cast<CXXRecordDecl>(record)) {
820 assert(numInitElements >= cxxrd->getNumBases() &&
821 "missing initializer for base class");
822 if (cxxrd->getNumBases() > 0) {
824 "visitCXXParenListOrInitListExpr base class init");
831 if (record->isUnion()) {
833 "visitCXXParenListOrInitListExpr union type");
839 for (
const FieldDecl *field : record->fields()) {
841 if (field->getType()->isIncompleteArrayType())
845 if (field->isUnnamedBitField())
851 if (curInitIndex == numInitElements && dest.
isZeroed() &&
859 if (curInitIndex < numInitElements) {
861 CIRGenFunction::SourceLocRAIIObject loc{
862 cgf, cgf.
getLoc(record->getSourceRange())};
863 emitInitializationToLValue(args[curInitIndex++], lv);
872 if (field->getType().isDestructedType()) {
874 "visitCXXParenListOrInitListExpr destructor");
898 getContext().getASTRecordLayout(baseRD).getSize() <=
907 AggExprEmitter(*
this, slot).Visit(
const_cast<Expr *
>(e));
922 assert((record->hasTrivialCopyConstructor() ||
923 record->hasTrivialCopyAssignment() ||
924 record->hasTrivialMoveConstructor() ||
925 record->hasTrivialMoveAssignment() ||
926 record->hasAttr<TrivialABIAttr>() || record->isUnion()) &&
927 "Trying to aggregate-copy a type without a trivial copy/move "
928 "constructor or assignment operator");
930 if (record->isEmpty())
953 typeInfo =
getContext().getTypeInfoDataSizeInChars(ty);
955 typeInfo =
getContext().getTypeInfoInChars(ty);
965 cgm.errorNYI(
"emitAggregateCopy: GC");
967 [[maybe_unused]] cir::CopyOp copyOp =
static bool isBlockVarRef(const Expr *E)
Is the value of the given expression possibly a reference to or into a __block variable?
static bool isTrivialFiller(Expr *e)
__device__ __2f16 float __ockl_bool s
cir::ConditionOp createCondition(mlir::Value condition)
Create a loop condition.
cir::PtrStrideOp createPtrStride(mlir::Location loc, mlir::Value base, mlir::Value stride)
cir::PointerType getPointerTo(mlir::Type ty)
cir::DoWhileOp createDoWhile(mlir::Location loc, llvm::function_ref< void(mlir::OpBuilder &, mlir::Location)> condBuilder, llvm::function_ref< void(mlir::OpBuilder &, mlir::Location)> bodyBuilder)
Create a do-while operation.
cir::ConstantOp getConstantInt(mlir::Location loc, mlir::Type ty, int64_t value)
cir::YieldOp createYield(mlir::Location loc, mlir::ValueRange value={})
Create a yield operation.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
uint64_t getFieldOffset(unsigned FieldNo) const
getFieldOffset - Get the offset of the given field index, in bits.
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
QualType getElementType() const
A builtin binary operation expression such as "x + y" or "x <= y".
mlir::Value getPointer() const
mlir::Type getElementType() const
clang::CharUnits getAlignment() const
IsZeroed_t isZeroed() const
Overlap_t mayOverlap() const
IsDestructed_t isExternallyDestructed() const
static AggValueSlot forLValue(const LValue &LV, IsDestructed_t isDestructed, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed)
Address getAddress() const
void setExternallyDestructed(bool destructed=true)
IsAliased_t isPotentiallyAliased() const
void setVolatile(bool flag)
cir::ConstantOp getConstInt(mlir::Location loc, llvm::APSInt intVal)
cir::LoadOp createLoad(mlir::Location loc, Address addr, bool isVolatile=false)
static bool hasScalarEvaluationKind(clang::QualType type)
mlir::Type convertType(clang::QualType t)
static cir::TypeEvaluationKind getEvaluationKind(clang::QualType type)
Return the cir::TypeEvaluationKind of QualType type.
CIRGenTypes & getTypes() const
const clang::LangOptions & getLangOpts() const
cir::AllocaOp createTempAlloca(mlir::Type ty, mlir::Location loc, const Twine &name="tmp", mlir::Value arraySize=nullptr, bool insertIntoFnEntryBlock=false)
This creates an alloca and inserts it into the entry block if ArraySize is nullptr,...
RValue emitCallExpr(const clang::CallExpr *e, ReturnValueSlot returnValue=ReturnValueSlot())
LValue emitLValue(const clang::Expr *e)
Emit code to compute a designator that specifies the location of the expression.
void emitAggregateCopy(LValue dest, LValue src, QualType eltTy, AggValueSlot::Overlap_t mayOverlap, bool isVolatile=false)
Emit an aggregate copy.
void emitStoreOfScalar(mlir::Value value, Address addr, bool isVolatile, clang::QualType ty, bool isInit=false, bool isNontemporal=false)
mlir::Location getLoc(clang::SourceLocation srcLoc)
Helpers to convert Clang's SourceLocation to a MLIR Location.
void emitNullInitialization(mlir::Location loc, Address destPtr, QualType ty)
RValue emitReferenceBindingToExpr(const Expr *e)
Emits a reference binding to the passed in expression.
AggValueSlot::Overlap_t getOverlapForFieldInit(const FieldDecl *fd)
void emitCXXConstructExpr(const clang::CXXConstructExpr *e, AggValueSlot dest)
LValue emitAggExprToLValue(const Expr *e)
static bool hasAggregateEvaluationKind(clang::QualType type)
void emitScalarInit(const clang::Expr *init, mlir::Location loc, LValue lvalue, bool capturedByInit=false)
LValue emitLValueForFieldInitialization(LValue base, const clang::FieldDecl *field, llvm::StringRef fieldName)
Like emitLValueForField, excpet that if the Field is a reference, this will return the address of the...
mlir::Value emitScalarExpr(const clang::Expr *e)
Emit the computation of the specified expression of scalar type.
CIRGenBuilderTy & getBuilder()
AggValueSlot::Overlap_t getOverlapForBaseInit(const CXXRecordDecl *rd, const CXXRecordDecl *baseRD, bool isVirtual)
Determine whether a base class initialization may overlap some other object.
void emitComplexExprIntoLValue(const Expr *e, LValue dest, bool isInit)
LValue makeAddrLValue(Address addr, QualType ty, AlignmentSource source=AlignmentSource::Type)
mlir::Value emitStoreThroughBitfieldLValue(RValue src, LValue dstresult)
std::optional< mlir::Location > currSrcLoc
Use to track source locations across nested visitor traversals.
clang::ASTContext & getContext() const
void emitStoreThroughLValue(RValue src, LValue dst, bool isInit=false)
Store the specified rvalue into the specified lvalue, where both are guaranteed to the have the same ...
Address createMemTemp(QualType t, mlir::Location loc, const Twine &name="tmp", Address *alloca=nullptr, mlir::OpBuilder::InsertPoint ip={})
Create a temporary memory object of the given type, with appropriate alignmen and cast it to the defa...
void emitAggExpr(const clang::Expr *e, AggValueSlot slot)
DiagnosticBuilder errorNYI(SourceLocation, llvm::StringRef)
Helpers to emit "not yet implemented" error diagnostics.
const clang::LangOptions & getLangOpts() const
mlir::Value emitNullConstant(QualType t, mlir::Location loc)
Return the result of value-initializing the given type, i.e.
llvm::DenseMap< const clang::FieldDecl *, llvm::StringRef > lambdaFieldToName
Keep a map between lambda fields and names, this needs to be per module since lambdas might get gener...
bool isZeroInitializable(clang::QualType ty)
Return whether a type can be zero-initialized (in the C++ sense) with an LLVM zeroinitializer.
Address getAddress() const
static RValue get(mlir::Value v)
CXXTemporary * getTemporary()
const Expr * getSubExpr() const
Expr * getExpr()
Get the initialization expression that will be used.
MutableArrayRef< Expr * > getInitExprs()
FieldDecl * getInitializedFieldInUnion()
Represents a C++ struct/union/class.
SourceRange getSourceRange() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range of the expression.
SourceRange getSourceRange() const LLVM_READONLY
QualType getCallReturnType(const ASTContext &Ctx) const
getCallReturnType - Get the return type of the call expr.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
CastKind getCastKind() const
static const char * getCastKindName(CastKind CK)
CharUnits alignmentOfArrayElement(CharUnits elementSize) const
Given that this is the alignment of the first element of an array, return the minimum alignment of an...
Expr * getChosenSubExpr() const
getChosenSubExpr - Return the subexpression chosen according to the condition.
const Expr * getInitializer() const
A reference to a declared variable, function, enum, etc.
InitListExpr * getUpdater() const
This represents one expression.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses 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...
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Represents a member of a struct/union/class.
unsigned getFieldIndex() const
Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::get...
const RecordDecl * getParent() const
Returns the parent of this field declaration, which is the struct in which this field is defined.
const Expr * getSubExpr() const
Expr * getResultExpr()
Return the result expression of this controlling expression.
bool isTransparent() const
Is this a transparent initializer list (that is, an InitListExpr that is purely syntactic,...
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
bool hadArrayRangeDesignator() const
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
const Expr * getInit(unsigned Init) const
ArrayRef< Expr * > inits()
llvm::iterator_range< capture_init_iterator > capture_inits()
Retrieve the initialization expressions for this lambda's captures.
capture_range captures() const
Retrieve this lambda's captures.
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
const Expr * getSubExpr() const
A (possibly-)qualified type.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
Represents a struct/union/class.
field_range fields() const
CompoundStmt * getSubStmt()
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isConstantArrayType() const
bool isReferenceType() const
bool isVariableArrayType() const
RecordDecl * castAsRecordDecl() const
bool isAnyComplexType() const
bool isRecordType() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Expr * getSubExpr() const
Represents a variable declaration or definition.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
constexpr Variable var(Literal L)
Returns the variable of L.
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
U cast(CodeGen::Address addr)
static bool emitLifetimeMarkers()
static bool aggValueSlotDestructedFlag()
static bool aggValueSlotGC()
static bool aggValueSlotAlias()
static bool opLoadStoreAtomic()
static bool aggEmitFinalDestCopyRValue()
static bool aggValueSlotVolatile()
static bool opScopeCleanupRegion()
static bool atomicTypes()
static bool cudaSupport()
static bool requiresCleanups()
clang::CharUnits getPointerAlign() const