18#include "mlir/IR/Attributes.h"
19#include "mlir/IR/BuiltinAttributeInterfaces.h"
20#include "mlir/IR/BuiltinAttributes.h"
31#include "llvm/ADT/STLExtras.h"
32#include "llvm/ADT/Sequence.h"
33#include "llvm/Support/ErrorHandling.h"
50 :
public StmtVisitor<ConstExprEmitter, mlir::Attribute, QualType> {
56 : cgm(emitter.cgm), emitter(emitter) {}
65 if (mlir::Attribute result = emitter.tryEmitConstantExpr(ce))
94 if (isa<ExplicitCastExpr>(e))
96 "ConstExprEmitter::VisitCastExpr explicit cast");
102 case CK_AddressSpaceConversion:
103 case CK_ReinterpretMemberPointer:
104 case CK_DerivedToBaseMemberPointer:
105 case CK_BaseToDerivedMemberPointer:
109 case CK_LValueToRValue:
110 case CK_AtomicToNonAtomic:
111 case CK_NonAtomicToAtomic:
113 case CK_ConstructorConversion:
114 return Visit(subExpr, destType);
116 case CK_IntToOCLSampler:
117 llvm_unreachable(
"global sampler variables are not generated");
120 llvm_unreachable(
"saw dependent cast!");
122 case CK_BuiltinFnToFnPtr:
123 llvm_unreachable(
"builtin functions are handled elsewhere");
126 case CK_ObjCObjectLValueCast:
127 case CK_ARCProduceObject:
128 case CK_ARCConsumeObject:
129 case CK_ARCReclaimReturnedObject:
130 case CK_ARCExtendBlockObject:
131 case CK_CopyAndAutoreleaseBlockObject:
139 case CK_LValueBitCast:
140 case CK_LValueToRValueBitCast:
141 case CK_NullToMemberPointer:
142 case CK_UserDefinedConversion:
143 case CK_CPointerToObjCPointerCast:
144 case CK_BlockPointerToObjCPointerCast:
145 case CK_AnyPointerToBlockPointerCast:
146 case CK_ArrayToPointerDecay:
147 case CK_FunctionToPointerDecay:
148 case CK_BaseToDerived:
149 case CK_DerivedToBase:
150 case CK_UncheckedDerivedToBase:
151 case CK_MemberPointerToBoolean:
153 case CK_FloatingRealToComplex:
154 case CK_FloatingComplexToReal:
155 case CK_FloatingComplexToBoolean:
156 case CK_FloatingComplexCast:
157 case CK_FloatingComplexToIntegralComplex:
158 case CK_IntegralRealToComplex:
159 case CK_IntegralComplexToReal:
160 case CK_IntegralComplexToBoolean:
161 case CK_IntegralComplexCast:
162 case CK_IntegralComplexToFloatingComplex:
163 case CK_PointerToIntegral:
164 case CK_PointerToBoolean:
165 case CK_NullToPointer:
166 case CK_IntegralCast:
167 case CK_BooleanToSignedIntegral:
168 case CK_IntegralToPointer:
169 case CK_IntegralToBoolean:
170 case CK_IntegralToFloating:
171 case CK_FloatingToIntegral:
172 case CK_FloatingToBoolean:
173 case CK_FloatingCast:
174 case CK_FloatingToFixedPoint:
175 case CK_FixedPointToFloating:
176 case CK_FixedPointCast:
177 case CK_FixedPointToBoolean:
178 case CK_FixedPointToIntegral:
179 case CK_IntegralToFixedPoint:
180 case CK_ZeroToOCLOpaqueType:
182 case CK_HLSLArrayRValue:
183 case CK_HLSLVectorTruncation:
184 case CK_HLSLElementwiseCast:
185 case CK_HLSLAggregateSplatCast:
188 llvm_unreachable(
"Invalid CastKind");
193 "ConstExprEmitter::VisitCXXDefaultInitExpr");
210 "ConstExprEmitter::VisitImplicitValueInitExpr");
247 "ConstExprEmitter::VisitDesignatedInitUpdateExpr");
278 type.getQualifiers());
283static mlir::Attribute
285 mlir::Type commonElementType,
unsigned arrayBound,
287 mlir::TypedAttr filler) {
290 unsigned nonzeroLength = arrayBound;
291 if (elements.size() < nonzeroLength && builder.
isNullValue(filler))
292 nonzeroLength = elements.size();
294 if (nonzeroLength == elements.size()) {
295 while (nonzeroLength > 0 &&
300 if (nonzeroLength == 0)
301 return cir::ZeroAttr::get(desiredType);
303 const unsigned trailingZeroes = arrayBound - nonzeroLength;
306 if (trailingZeroes >= 8) {
307 assert(elements.size() >= nonzeroLength &&
308 "missing initializer for non-zero element");
310 if (commonElementType && nonzeroLength >= 8) {
315 eles.reserve(nonzeroLength);
316 for (
const auto &element : elements)
317 eles.push_back(element);
318 auto initial = cir::ConstArrayAttr::get(
319 cir::ArrayType::get(commonElementType, nonzeroLength),
320 mlir::ArrayAttr::get(builder.getContext(), eles));
322 elements[0] = initial;
326 elements.resize(nonzeroLength + 1);
329 mlir::Type fillerType =
332 : mlir::cast<cir::ArrayType>(desiredType).getElementType();
333 fillerType = cir::ArrayType::get(fillerType, trailingZeroes);
334 elements.back() = cir::ZeroAttr::get(fillerType);
335 commonElementType =
nullptr;
336 }
else if (elements.size() != arrayBound) {
337 elements.resize(arrayBound, filler);
339 if (filler.getType() != commonElementType)
340 commonElementType = {};
343 if (commonElementType) {
345 eles.reserve(elements.size());
347 for (
const auto &element : elements)
348 eles.push_back(element);
350 return cir::ConstArrayAttr::get(
351 cir::ArrayType::get(commonElementType, arrayBound),
352 mlir::ArrayAttr::get(builder.getContext(), eles));
356 eles.reserve(elements.size());
357 for (
auto const &element : elements)
358 eles.push_back(element);
360 auto arrAttr = mlir::ArrayAttr::get(builder.getContext(), eles);
371struct ConstantLValue {
372 llvm::PointerUnion<mlir::Value, mlir::Attribute> value;
373 bool hasOffsetApplied;
375 ConstantLValue(std::nullptr_t)
376 : value(nullptr), hasOffsetApplied(
false) {}
377 ConstantLValue(cir::GlobalViewAttr address)
378 : value(address), hasOffsetApplied(
false) {}
380 ConstantLValue() : value(nullptr), hasOffsetApplied(
false) {}
384class ConstantLValueEmitter
397 : cgm(emitter.cgm), emitter(emitter), value(value), destType(destType) {}
399 mlir::Attribute tryEmit();
402 mlir::Attribute tryEmitAbsolute(mlir::Type destTy);
405 ConstantLValue VisitStmt(
const Stmt *
s) {
return nullptr; }
406 ConstantLValue VisitConstantExpr(
const ConstantExpr *e);
414 ConstantLValue VisitCallExpr(
const CallExpr *e);
415 ConstantLValue VisitBlockExpr(
const BlockExpr *e);
421 mlir::ArrayAttr getOffset(mlir::Type ty) {
429 for (int64_t i : idxVec) {
430 mlir::IntegerAttr intAttr = cgm.
getBuilder().getI32IntegerAttr(i);
431 indices.push_back(intAttr);
436 return cgm.
getBuilder().getArrayAttr(indices);
440 ConstantLValue applyOffset(ConstantLValue &
c) {
442 if (
auto attr = mlir::dyn_cast<mlir::Attribute>(
c.value)) {
443 if (
auto gv = mlir::dyn_cast<cir::GlobalViewAttr>(attr)) {
444 auto baseTy = mlir::cast<cir::PointerType>(gv.getType()).getPointee();
446 assert(!gv.getIndices() &&
"Global view is already indexed");
447 return cir::GlobalViewAttr::get(destTy, gv.getSymbol(),
450 llvm_unreachable(
"Unsupported attribute type to offset");
453 cgm.
errorNYI(
"ConstantLValue: non-attribute offset");
460mlir::Attribute ConstantLValueEmitter::tryEmit() {
471 assert(mlir::isa<cir::PointerType>(destTy));
476 return tryEmitAbsolute(destTy);
479 ConstantLValue result = tryEmitBase(base);
482 llvm::PointerUnion<mlir::Value, mlir::Attribute> &value = result.value;
487 if (!result.hasOffsetApplied)
488 value = applyOffset(result).value;
492 if (mlir::isa<cir::PointerType>(destTy)) {
493 if (
auto attr = mlir::dyn_cast<mlir::Attribute>(value))
495 cgm.
errorNYI(
"ConstantLValueEmitter: non-attribute pointer");
499 cgm.
errorNYI(
"ConstantLValueEmitter: other?");
505mlir::Attribute ConstantLValueEmitter::tryEmitAbsolute(mlir::Type destTy) {
507 auto destPtrTy = mlir::cast<cir::PointerType>(destTy);
509 destPtrTy, value.getLValueOffset().getQuantity());
518 d = cast<ValueDecl>(d->getMostRecentDecl());
520 if (d->hasAttr<WeakRefAttr>()) {
522 "ConstantLValueEmitter: emit pointer base for weakref");
526 if (
auto *fd = dyn_cast<FunctionDecl>(d)) {
529 mlir::MLIRContext *mlirContext = builder.getContext();
530 return cir::GlobalViewAttr::get(
532 mlir::FlatSymbolRefAttr::get(mlirContext, fop.getSymNameAttr()));
535 if (
auto *vd = dyn_cast<VarDecl>(d)) {
537 if (!vd->hasLocalStorage()) {
538 if (vd->isFileVarDecl() || vd->hasExternalStorage())
541 if (vd->isLocalVarDecl()) {
543 "ConstantLValueEmitter: local var decl");
554 "ConstantLValueEmitter: unhandled value decl");
560 cgm.
errorNYI(
"ConstantLValueEmitter: typeid");
565 return Visit(base.
get<
const Expr *>());
568ConstantLValue ConstantLValueEmitter::VisitConstantExpr(
const ConstantExpr *e) {
580ConstantLValueEmitter::VisitStringLiteral(
const StringLiteral *e) {
585ConstantLValueEmitter::VisitObjCEncodeExpr(
const ObjCEncodeExpr *e) {
593 "ConstantLValueEmitter: objc string literal");
598ConstantLValueEmitter::VisitObjCBoxedExpr(
const ObjCBoxedExpr *e) {
604ConstantLValueEmitter::VisitPredefinedExpr(
const PredefinedExpr *e) {
610ConstantLValueEmitter::VisitAddrLabelExpr(
const AddrLabelExpr *e) {
615ConstantLValue ConstantLValueEmitter::VisitCallExpr(
const CallExpr *e) {
620ConstantLValue ConstantLValueEmitter::VisitBlockExpr(
const BlockExpr *e) {
626ConstantLValueEmitter::VisitCXXTypeidExpr(
const CXXTypeidExpr *e) {
631ConstantLValue ConstantLValueEmitter::VisitMaterializeTemporaryExpr(
634 "ConstantLValueEmitter: materialize temporary expr");
643 initializeNonAbstract();
648 assert(initializedNonAbstract &&
649 "finalizing emitter that was used for abstract emission?");
650 assert(!finalized &&
"finalizing emitter multiple times");
651 assert(!gv.isDeclaration());
660 AbstractStateRAII state(*
this,
true);
665 assert((!initializedNonAbstract || finalized || failed) &&
666 "not finalized after being initialized for non-abstract emission");
676 if (
const auto *e = dyn_cast_or_null<CXXConstructExpr>(d.
getInit())) {
684 if (cxxrd->getNumBases() != 0) {
687 cgm.
errorNYI(
"tryEmitPrivateForVarInit: cxx record with bases");
694 "tryEmitPrivateForVarInit: non-zero-initializable cxx record");
705 assert(e &&
"No initializer to emit");
711 if (mlir::Attribute
c = ConstExprEmitter(*this).Visit(
const_cast<Expr *
>(e),
744 AbstractStateRAII state{*
this,
true};
745 mlir::Attribute
c = mlir::cast<mlir::Attribute>(
tryEmitPrivate(e, destType));
748 "emitAbstract failed, emit null constaant");
755 AbstractStateRAII state(*
this,
true);
758 cgm.
errorNYI(loc,
"emitAbstract failed, emit null constaant");
775 assert(!destType->
isVoidType() &&
"can't emit a void constant");
777 if (mlir::Attribute
c =
778 ConstExprEmitter(*this).Visit(
const_cast<Expr *
>(e), destType))
779 return llvm::dyn_cast<mlir::TypedAttr>(
c);
783 bool success =
false;
793 return llvm::dyn_cast<mlir::TypedAttr>(
c);
805 cgm.
errorNYI(
"ConstExprEmitter::tryEmitPrivate none or indeterminate");
809 if (mlir::isa<cir::BoolType>(ty))
811 assert(mlir::isa<cir::IntType>(ty) &&
"expected integral type");
812 return cir::IntAttr::get(ty, value.
getInt());
815 const llvm::APFloat &init = value.
getFloat();
816 if (&init.getSemantics() == &llvm::APFloat::IEEEhalf() &&
819 cgm.
errorNYI(
"ConstExprEmitter::tryEmitPrivate half");
824 assert(mlir::isa<cir::FPTypeInterface>(ty) &&
825 "expected floating-point type");
826 return cir::FPAttr::get(ty, init);
834 mlir::Attribute filler;
843 elements.reserve(numInitElts + 1);
845 elements.reserve(numInitElts);
847 mlir::Type commonElementType;
848 for (
unsigned i = 0; i < numInitElts; ++i) {
850 const mlir::Attribute element =
855 const mlir::TypedAttr elementTyped = mlir::cast<mlir::TypedAttr>(element);
857 commonElementType = elementTyped.getType();
858 else if (elementTyped.getType() != commonElementType) {
859 commonElementType = {};
862 elements.push_back(elementTyped);
865 mlir::TypedAttr typedFiller = llvm::cast_or_null<mlir::TypedAttr>(filler);
866 if (filler && !typedFiller)
867 cgm.
errorNYI(
"array filler should always be typed");
871 elements, typedFiller);
879 elements.reserve(numElements);
881 for (
unsigned i = 0; i < numElements; ++i) {
882 const mlir::Attribute element =
886 elements.push_back(element);
889 const auto desiredVecTy =
892 return cir::ConstVectorAttr::get(
894 mlir::ArrayAttr::get(
cgm.
getBuilder().getContext(), elements));
897 cgm.
errorNYI(
"ConstExprEmitter::tryEmitPrivate member pointer");
901 return ConstantLValueEmitter(*
this, value, destType).tryEmit();
904 cgm.
errorNYI(
"ConstExprEmitter::tryEmitPrivate struct or union");
910 mlir::dyn_cast<cir::ComplexType>(desiredType);
912 mlir::Type complexElemTy =
complexType.getElementType();
913 if (isa<cir::IntType>(complexElemTy)) {
916 return builder.getAttr<cir::ConstComplexAttr>(
917 complexType, cir::IntAttr::get(complexElemTy, real),
918 cir::IntAttr::get(complexElemTy, imag));
921 assert(isa<cir::FPTypeInterface>(complexElemTy) &&
922 "expected floating-point type");
925 return builder.getAttr<cir::ConstComplexAttr>(
926 complexType, cir::FPAttr::get(complexElemTy, real),
927 cir::FPAttr::get(complexElemTy, imag));
932 "ConstExprEmitter::tryEmitPrivate fixed point, addr label diff");
935 llvm_unreachable(
"Unknown APValue kind");
943 if (
getTypes().isZeroInitializable(t))
947 errorNYI(
"CIRGenModule::emitNullConstant ConstantArrayType");
951 errorNYI(
"CIRGenModule::emitNullConstant RecordType");
954 "Should only see pointers to data members here!");
956 errorNYI(
"CIRGenModule::emitNullConstant unsupported type");
Defines the clang::ASTContext interface.
Defines enum values for all the target-independent builtin functions.
static mlir::Attribute emitArrayConstant(CIRGenModule &cgm, mlir::Type desiredType, mlir::Type commonElementType, unsigned arrayBound, SmallVectorImpl< mlir::TypedAttr > &elements, mlir::TypedAttr filler)
static QualType getNonMemoryType(CIRGenModule &cgm, QualType type)
Defines various enumerations that describe declaration and type specifiers.
__device__ __2f16 float __ockl_bool s
__device__ __2f16 float c
mlir::Attribute VisitSubstNonTypeTemplateParmExpr(SubstNonTypeTemplateParmExpr *pe, QualType t)
mlir::Attribute VisitCXXConstructExpr(CXXConstructExpr *e, QualType ty)
mlir::Attribute VisitInitListExpr(InitListExpr *ile, QualType t)
mlir::Attribute VisitCXXDefaultInitExpr(CXXDefaultInitExpr *die, QualType t)
mlir::Attribute VisitCastExpr(CastExpr *e, QualType destType)
mlir::Attribute VisitExprWithCleanups(ExprWithCleanups *e, QualType t)
mlir::Attribute VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *e, QualType destType)
mlir::Attribute VisitUnaryExtension(const UnaryOperator *e, QualType t)
mlir::Attribute VisitStringLiteral(StringLiteral *e, QualType t)
mlir::Attribute VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *e, QualType t)
mlir::Attribute VisitParenExpr(ParenExpr *pe, QualType t)
mlir::Attribute VisitImplicitValueInitExpr(ImplicitValueInitExpr *E, QualType T)
mlir::Attribute VisitConstantExpr(ConstantExpr *ce, QualType t)
mlir::Attribute VisitChooseExpr(ChooseExpr *ce, QualType t)
ConstExprEmitter(ConstantEmitter &emitter)
mlir::Attribute VisitGenericSelectionExpr(GenericSelectionExpr *ge, QualType t)
mlir::Attribute VisitCompoundLiteralExpr(CompoundLiteralExpr *e, QualType t)
mlir::Attribute VisitStmt(Stmt *S, QualType T)
mlir::Type convertType(QualType t)
mlir::Attribute VisitObjCEncodeExpr(ObjCEncodeExpr *e, QualType t)
cir::ConstantOp getNullValue(mlir::Type ty, mlir::Location loc)
cir::BoolAttr getCIRBoolAttr(bool state)
cir::PointerType getPointerTo(mlir::Type ty)
mlir::TypedAttr getConstPtrAttr(mlir::Type type, int64_t value)
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
bool hasArrayFiller() const
const LValueBase getLValueBase() const
APValue & getArrayInitializedElt(unsigned I)
APSInt & getComplexIntImag()
ValueKind getKind() const
unsigned getArrayInitializedElts() const
CharUnits & getLValueOffset()
APValue & getVectorElt(unsigned I)
APValue & getArrayFiller()
unsigned getVectorLength() const
unsigned getArraySize() const
@ Indeterminate
This object has an indeterminate value (C++ [basic.indet]).
@ None
There is no such object (it's outside its lifetime).
APSInt & getComplexIntReal()
APFloat & getComplexFloatImag()
APFloat & getComplexFloatReal()
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
const LangOptions & getLangOpts() const
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
const TargetInfo & getTargetInfo() const
AddrLabelExpr - The GNU address of label extension, representing &&label.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
QualType getElementType() const
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
cir::ConstRecordAttr getAnonConstRecord(mlir::ArrayAttr arrayAttr, bool packed=false, bool padded=false, mlir::Type ty={})
cir::ConstantOp getNullPtr(mlir::Type ty, mlir::Location loc)
bool isNullValue(mlir::Attribute attr) const
void computeGlobalViewIndicesFromFlatOffset(int64_t offset, mlir::Type ty, cir::CIRDataLayout layout, llvm::SmallVectorImpl< int64_t > &indices)
This class organizes the cross-function state that is used while generating CIR code.
DiagnosticBuilder errorNYI(SourceLocation, llvm::StringRef)
Helpers to emit "not yet implemented" error diagnostics.
clang::ASTContext & getASTContext() const
mlir::Type convertType(clang::QualType type)
CIRGenBuilderTy & getBuilder()
cir::FuncOp getAddrOfFunction(clang::GlobalDecl gd, mlir::Type funcType=nullptr, bool forVTable=false, bool dontDefer=false, ForDefinition_t isForDefinition=NotForDefinition)
Return the address of the given function.
cir::GlobalViewAttr getAddrOfGlobalVarAttr(const VarDecl *d)
Return the mlir::GlobalViewAttr for the address of the given global.
mlir::Value emitNullConstant(QualType t, mlir::Location loc)
Return the result of value-initializing the given type, i.e.
mlir::ModuleOp getModule() const
cir::GlobalViewAttr getAddrOfConstantStringFromLiteral(const StringLiteral *s, llvm::StringRef name=".str")
Return a global symbol reference to a constant array for the given string literal.
mlir::Attribute getConstantArrayFromStringLiteral(const StringLiteral *e)
Return a constant array for the given string.
bool isZeroInitializable(clang::QualType ty)
Return whether a type can be zero-initialized (in the C++ sense) with an LLVM zeroinitializer.
mlir::Type convertTypeForMem(clang::QualType, bool forBitField=false)
Convert type T into an mlir::Type.
void finalize(cir::GlobalOp gv)
mlir::Attribute emitForMemory(mlir::Attribute c, QualType destType)
mlir::TypedAttr tryEmitPrivate(const Expr *e, QualType destType)
mlir::Attribute tryEmitPrivateForVarInit(const VarDecl &d)
mlir::Attribute emitAbstract(const Expr *e, QualType destType)
Emit the result of the given expression as an abstract constant, asserting that it succeeded.
mlir::Attribute tryEmitPrivateForMemory(const APValue &value, QualType t)
mlir::Attribute tryEmitForInitializer(const VarDecl &d)
Try to emit the initializer of the given declaration as an abstract constant.
mlir::Attribute tryEmitAbstractForInitializer(const VarDecl &d)
Try to emit the initializer of the given declaration as an abstract constant.
mlir::Attribute tryEmitConstantExpr(const ConstantExpr *ce)
Represents a call to a C++ constructor.
SourceLocation getBeginLoc() const LLVM_READONLY
Represents a C++ constructor within a class.
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
A use of a default initializer in a constructor or in aggregate initialization.
SourceLocation getBeginLoc() const
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
SourceRange getSourceRange() const LLVM_READONLY
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
CastKind getCastKind() const
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Expr * getChosenSubExpr() const
getChosenSubExpr - Return the subexpression chosen according to the condition.
CompoundLiteralExpr - [C99 6.5.2.5].
const Expr * getInitializer() const
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
APValue getAPValueResult() const
SourceLocation getBeginLoc() const LLVM_READONLY
bool hasAPValueResult() const
SourceLocation getBeginLoc() const LLVM_READONLY
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
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 EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx, bool InConstantContext=false) const
EvaluateAsRValue - Return true if this is a constant which we can fold to an rvalue using any crazy t...
const Expr * getSubExpr() const
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Represents a C11 generic selection.
Expr * getResultExpr()
Return the result expression of this controlling expression.
Represents an implicitly-generated value initialization of an object of a given type.
Describes an C or C++ initializer list.
bool isTransparent() const
Is this a transparent initializer list (that is, an InitListExpr that is purely syntactic,...
SourceLocation getBeginLoc() const LLVM_READONLY
const Expr * getInit(unsigned Init) const
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue.
ObjCBoxedExpr - used for generalized expression boxing.
SourceRange getSourceRange() const LLVM_READONLY
ObjCEncodeExpr, used for @encode in Objective-C.
SourceLocation getBeginLoc() const LLVM_READONLY
ObjCStringLiteral, used for Objective-C string literals i.e.
ParenExpr - This represents a parenthesized expression, e.g.
const Expr * getSubExpr() const
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
A (possibly-)qualified type.
Encodes a location in the source.
StmtVisitorBase - This class implements a simple visitor for Stmt subclasses.
RetTy Visit(PTR(Stmt) S, ParamTys... P)
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Stmt - This represents one statement.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
StringLiteral - This represents a string literal expression, e.g.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Expr * getReplacement() const
virtual bool useFP16ConversionIntrinsics() const
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
Symbolic representation of typeid(T) for some type T.
CXXRecordDecl * castAsCXXRecordDecl() const
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
bool isMemberDataPointerType() const
bool isVectorType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Expr * getSubExpr() const
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.
APValue * evaluateValue() const
Attempt to evaluate the value of the initializer attached to this declaration, and produce notes expl...
bool hasConstantInitialization() const
Determine whether this variable has constant initialization.
const Expr * getInit() const
bool hasLocalStorage() const
Returns true if a variable with function scope is a non-static local variable.
Represents a GCC generic vector type.
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< ComplexType > complexType
Matches C99 complex types.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
static bool constEmitterArrayILE()
static bool constEmitterVectorILE()
EvalResult is a struct with detailed info about an evaluated expression.
APValue Val
Val - This is the value the expression can be folded to.
bool hasSideEffects() const