clang: lib/CodeGen/CodeGenTypes.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
26#include "llvm/IR/DataLayout.h"
27#include "llvm/IR/DerivedTypes.h"
28#include "llvm/IR/Module.h"
29
30using namespace clang;
31using namespace CodeGen;
32
34 : CGM(cgm), Context(cgm.getContext()), TheModule(cgm.getModule()),
35 Target(cgm.getTarget()) {
36 SkippedLayout = false;
37 LongDoubleReferenced = false;
38}
39
41 for (llvm::FoldingSet::iterator
42 I = FunctionInfos.begin(), E = FunctionInfos.end(); I != E; )
43 delete &*I++;
44}
45
47
50}
51
53 llvm::StructType *Ty,
54 StringRef suffix) {
56 llvm::raw_svector_ostream OS(TypeName);
58
59
60
61
65
66
67
69
70
73 else
76
77
78 if (TDD->getDeclContext())
79 TDD->printQualifiedName(OS, Policy);
80 else
81 TDD->printName(OS);
82 } else
83 OS << "anon";
84
85 if (!suffix.empty())
86 OS << suffix;
87
88 Ty->setName(OS.str());
89}
90
91
92
93
94
95
96
97
98
99
100
101
108 }
109
111
112
114 auto *FixedVT = castllvm::FixedVectorType(R);
115
116 uint64_t BytePadded = std::max<uint64_t>(FixedVT->getNumElements(), 8);
117 return llvm::IntegerType::get(FixedVT->getContext(), BytePadded);
118 }
119
120
121
122
123
124
125
126
127
128
129
130
131
132
135 return llvm::ArrayType::get(CGM.Int8Ty,
139 }
140
141 if (R->isIntegerTy(1))
144
145
146 return R;
147}
148
150 llvm::Type *LLVMTy) {
151 if (!LLVMTy)
153
157 return ASTSize != LLVMSize;
158}
159
161 llvm::Type *LLVMTy) {
162 if (!LLVMTy)
164
166 return llvm::Type::getIntNTy(
168
169 if (LLVMTy->isIntegerTy(1))
172
175
176 return LLVMTy;
177}
178
179
180
182 llvm::DenseMap<const Type*, llvm::StructType *>::const_iterator I =
183 RecordDeclTypes.find(Ty);
184 return I != RecordDeclTypes.end() && !I->second->isOpaque();
185}
186
187
188
189
191
192
195
196
198 if (!TT) return true;
199
200
202}
203
204
205
206
207
208
209
212 return false;
213
214 if (const FunctionProtoType *FPT = dyn_cast(FT))
215 for (unsigned i = 0, e = FPT->getNumParams(); i != e; i++)
217 return false;
218
219 return true;
220}
221
222
223
225
226
227
228 if (const EnumDecl *ED = dyn_cast(TD)) {
229
230 if (TypeCache.count(ED->getTypeForDecl())) {
231
232
233
234 if ((ED->getIntegerType())->isIntegerTy(32))
235 TypeCache.clear();
236 }
237
238
240 DI->completeType(ED);
241 return;
242 }
243
244
245
246 const RecordDecl *RD = cast(TD);
248
249
250
253
254
255
257 DI->completeType(RD);
258}
259
263
264 const Type *Ty = T.getTypePtr();
265 if (RecordsWithOpaqueMemberPointers.count(Ty)) {
266 TypeCache.clear();
267 RecordsWithOpaqueMemberPointers.clear();
268 }
269}
270
272 const llvm::fltSemantics &format,
273 bool UseNativeHalf = false) {
274 if (&format == &llvm::APFloat::IEEEhalf()) {
275 if (UseNativeHalf)
276 return llvm::Type::getHalfTy(VMContext);
277 else
278 return llvm::Type::getInt16Ty(VMContext);
279 }
280 if (&format == &llvm::APFloat::BFloat())
281 return llvm::Type::getBFloatTy(VMContext);
282 if (&format == &llvm::APFloat::IEEEsingle())
283 return llvm::Type::getFloatTy(VMContext);
284 if (&format == &llvm::APFloat::IEEEdouble())
285 return llvm::Type::getDoubleTy(VMContext);
286 if (&format == &llvm::APFloat::IEEEquad())
287 return llvm::Type::getFP128Ty(VMContext);
288 if (&format == &llvm::APFloat::PPCDoubleDouble())
289 return llvm::Type::getPPC_FP128Ty(VMContext);
290 if (&format == &llvm::APFloat::x87DoubleExtended())
291 return llvm::Type::getX86_FP80Ty(VMContext);
292 llvm_unreachable("Unknown float format!");
293}
294
295llvm::Type *CodeGenTypes::ConvertFunctionTypeInternal(QualType QFT) {
298
299
300
302
303
304
305
308 if (const FunctionProtoType *FPT = dyn_cast(FT))
309 for (unsigned i = 0, e = FPT->getNumParams(); i != e; i++)
312
313 SkippedLayout = true;
314
315
317 }
318
319
320
322 if (const FunctionProtoType *FPT = dyn_cast(FT)) {
325 } else {
329 }
330
331 llvm::Type *ResultType = nullptr;
332
333
334 if (FunctionsBeingProcessed.count(FI)) {
335
336 ResultType = llvm::StructType::get(getLLVMContext());
337 SkippedLayout = true;
338 } else {
339
340
342 }
343
344 return ResultType;
345}
346
347
350
351 const Type *Ty = T.getTypePtr();
352
353
354
355 if (Context.getLangOpts().CUDAIsDevice) {
359 return Ty;
363 return Ty;
364 }
365 }
366
367
368 if (const RecordType *RT = dyn_cast(Ty))
370
371 llvm::Type *CachedType = nullptr;
372 auto TCI = TypeCache.find(Ty);
373 if (TCI != TypeCache.end())
374 CachedType = TCI->second;
375
376
377#ifndef EXPENSIVE_CHECKS
378 if (CachedType)
379 return CachedType;
380#endif
381
382
383 llvm::Type *ResultType = nullptr;
385 case Type::Record:
386#define TYPE(Class, Base)
387#define ABSTRACT_TYPE(Class, Base)
388#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
389#define DEPENDENT_TYPE(Class, Base) case Type::Class:
390#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
391#include "clang/AST/TypeNodes.inc"
392 llvm_unreachable("Non-canonical or dependent types aren't possible.");
393
394 case Type::Builtin: {
395 switch (cast(Ty)->getKind()) {
396 case BuiltinType::Void:
397 case BuiltinType::ObjCId:
398 case BuiltinType::ObjCClass:
399 case BuiltinType::ObjCSel:
400
401
402 ResultType = llvm::Type::getInt8Ty(getLLVMContext());
403 break;
404
405 case BuiltinType::Bool:
406
407 ResultType = llvm::Type::getInt1Ty(getLLVMContext());
408 break;
409
410 case BuiltinType::Char_S:
411 case BuiltinType::Char_U:
412 case BuiltinType::SChar:
413 case BuiltinType::UChar:
414 case BuiltinType::Short:
415 case BuiltinType::UShort:
416 case BuiltinType::Int:
417 case BuiltinType::UInt:
418 case BuiltinType::Long:
419 case BuiltinType::ULong:
420 case BuiltinType::LongLong:
421 case BuiltinType::ULongLong:
422 case BuiltinType::WChar_S:
423 case BuiltinType::WChar_U:
424 case BuiltinType::Char8:
425 case BuiltinType::Char16:
426 case BuiltinType::Char32:
427 case BuiltinType::ShortAccum:
428 case BuiltinType::Accum:
429 case BuiltinType::LongAccum:
430 case BuiltinType::UShortAccum:
431 case BuiltinType::UAccum:
432 case BuiltinType::ULongAccum:
433 case BuiltinType::ShortFract:
434 case BuiltinType::Fract:
435 case BuiltinType::LongFract:
436 case BuiltinType::UShortFract:
437 case BuiltinType::UFract:
438 case BuiltinType::ULongFract:
439 case BuiltinType::SatShortAccum:
440 case BuiltinType::SatAccum:
441 case BuiltinType::SatLongAccum:
442 case BuiltinType::SatUShortAccum:
443 case BuiltinType::SatUAccum:
444 case BuiltinType::SatULongAccum:
445 case BuiltinType::SatShortFract:
446 case BuiltinType::SatFract:
447 case BuiltinType::SatLongFract:
448 case BuiltinType::SatUShortFract:
449 case BuiltinType::SatUFract:
450 case BuiltinType::SatULongFract:
451 ResultType = llvm::IntegerType::get(getLLVMContext(),
452 static_cast<unsigned>(Context.getTypeSize(T)));
453 break;
454
455 case BuiltinType::Float16:
456 ResultType =
458 true);
459 break;
460
461 case BuiltinType::Half:
462
467 break;
468 case BuiltinType::LongDouble:
469 LongDoubleReferenced = true;
470 [[fallthrough]];
471 case BuiltinType::BFloat16:
472 case BuiltinType::Float:
473 case BuiltinType::Double:
474 case BuiltinType::Float128:
475 case BuiltinType::Ibm128:
478 false);
479 break;
480
481 case BuiltinType::NullPtr:
482
483 ResultType = llvm::PointerType::getUnqual(getLLVMContext());
484 break;
485
486 case BuiltinType::UInt128:
487 case BuiltinType::Int128:
488 ResultType = llvm::IntegerType::get(getLLVMContext(), 128);
489 break;
490
491#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
492 case BuiltinType::Id:
493#include "clang/Basic/OpenCLImageTypes.def"
494#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
495 case BuiltinType::Id:
496#include "clang/Basic/OpenCLExtensionTypes.def"
497 case BuiltinType::OCLSampler:
498 case BuiltinType::OCLEvent:
499 case BuiltinType::OCLClkEvent:
500 case BuiltinType::OCLQueue:
501 case BuiltinType::OCLReserveID:
503 break;
504#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
505 case BuiltinType::Id:
506#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId) \
507 case BuiltinType::Id:
508#define AARCH64_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
509 case BuiltinType::Id:
510#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId)
511#include "clang/Basic/AArch64SVEACLETypes.def"
512 {
515 auto VTy =
518 default:
519 llvm_unreachable("Expected 1, 2, 3 or 4 vectors!");
520 case 1:
521 return VTy;
522 case 2:
523 return llvm::StructType::get(VTy, VTy);
524 case 3:
525 return llvm::StructType::get(VTy, VTy, VTy);
526 case 4:
527 return llvm::StructType::get(VTy, VTy, VTy, VTy);
528 }
529 }
530 case BuiltinType::SveCount:
531 return llvm::TargetExtType::get(getLLVMContext(), "aarch64.svcount");
532#define PPC_VECTOR_TYPE(Name, Id, Size) \
533 case BuiltinType::Id: \
534 ResultType = \
535 llvm::FixedVectorType::get(ConvertType(Context.BoolTy), Size); \
536 break;
537#include "clang/Basic/PPCTypes.def"
538#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
539#include "clang/Basic/RISCVVTypes.def"
540 {
544 unsigned I8EltCount =
545 Info.EC.getKnownMinValue() *
547 return llvm::TargetExtType::get(
549 llvm::ScalableVectorType::get(
550 llvm::Type::getInt8Ty(getLLVMContext()), I8EltCount),
552 }
554 Info.EC.getKnownMinValue());
555 }
556#define WASM_REF_TYPE(Name, MangledName, Id, SingletonId, AS) \
557 case BuiltinType::Id: { \
558 if (BuiltinType::Id == BuiltinType::WasmExternRef) \
559 ResultType = CGM.getTargetCodeGenInfo().getWasmExternrefReferenceType(); \
560 else \
561 llvm_unreachable("Unexpected wasm reference builtin type!"); \
562 } break;
563#include "clang/Basic/WebAssemblyReferenceTypes.def"
564#define AMDGPU_OPAQUE_PTR_TYPE(Name, Id, SingletonId, Width, Align, AS) \
565 case BuiltinType::Id: \
566 return llvm::PointerType::get(getLLVMContext(), AS);
567#define AMDGPU_NAMED_BARRIER_TYPE(Name, Id, SingletonId, Width, Align, Scope) \
568 case BuiltinType::Id: \
569 return llvm::TargetExtType::get(getLLVMContext(), "amdgcn.named.barrier", \
570 {}, {Scope});
571#include "clang/Basic/AMDGPUTypes.def"
572#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
573#include "clang/Basic/HLSLIntangibleTypes.def"
575 break;
576 case BuiltinType::Dependent:
577#define BUILTIN_TYPE(Id, SingletonId)
578#define PLACEHOLDER_TYPE(Id, SingletonId) \
579 case BuiltinType::Id:
580#include "clang/AST/BuiltinTypes.def"
581 llvm_unreachable("Unexpected placeholder builtin type!");
582 }
583 break;
584 }
585 case Type::Auto:
586 case Type::DeducedTemplateSpecialization:
587 llvm_unreachable("Unexpected undeduced type!");
588 case Type::Complex: {
589 llvm::Type *EltTy = ConvertType(cast(Ty)->getElementType());
590 ResultType = llvm::StructType::get(EltTy, EltTy);
591 break;
592 }
593 case Type::LValueReference:
594 case Type::RValueReference: {
595 const ReferenceType *RTy = cast(Ty);
598 ResultType = llvm::PointerType::get(getLLVMContext(), AS);
599 break;
600 }
601 case Type::Pointer: {
602 const PointerType *PTy = cast(Ty);
605 ResultType = llvm::PointerType::get(getLLVMContext(), AS);
606 break;
607 }
608
609 case Type::VariableArray: {
612 "FIXME: We only handle trivial array types so far!");
613
614
616 break;
617 }
618 case Type::IncompleteArray: {
621 "FIXME: We only handle trivial array types so far!");
622
623
625 if (!ResultType->isSized()) {
626 SkippedLayout = true;
627 ResultType = llvm::Type::getInt8Ty(getLLVMContext());
628 }
629 ResultType = llvm::ArrayType::get(ResultType, 0);
630 break;
631 }
632 case Type::ArrayParameter:
633 case Type::ConstantArray: {
636
637
638
639 if (!EltTy->isSized()) {
640 SkippedLayout = true;
642 }
643
644 ResultType = llvm::ArrayType::get(EltTy, A->getZExtSize());
645 break;
646 }
647 case Type::ExtVector:
648 case Type::Vector: {
649 const auto *VT = cast(Ty);
650
651 llvm::Type *IRElemTy = VT->isExtVectorBoolType()
654 ResultType = llvm::FixedVectorType::get(IRElemTy, VT->getNumElements());
655 break;
656 }
657 case Type::ConstantMatrix: {
659 ResultType =
662 break;
663 }
664 case Type::FunctionNoProto:
665 case Type::FunctionProto:
666 ResultType = ConvertFunctionTypeInternal(T);
667 break;
668 case Type::ObjCObject:
669 ResultType = ConvertType(cast(Ty)->getBaseType());
670 break;
671
672 case Type::ObjCInterface: {
673
674
675
676 llvm::Type *&T = InterfaceTypes[cast(Ty)];
677 if ()
679 ResultType = T;
680 break;
681 }
682
683 case Type::ObjCObjectPointer:
684 ResultType = llvm::PointerType::getUnqual(getLLVMContext());
685 break;
686
687 case Type::Enum: {
688 const EnumDecl *ED = cast(Ty)->getDecl();
691
692
693
694 ResultType = llvm::Type::getInt32Ty(getLLVMContext());
695 break;
696 }
697
698 case Type::BlockPointer: {
699
700
701
702
703
704
707 ResultType = llvm::PointerType::get(getLLVMContext(), AS);
708 break;
709 }
710
711 case Type::MemberPointer: {
712 auto *MPTy = cast(Ty);
713 if (().isMemberPointerConvertible(MPTy)) {
714 auto *C = MPTy->getClass();
715 auto Insertion = RecordsWithOpaqueMemberPointers.insert({C, nullptr});
716 if (Insertion.second)
717 Insertion.first->second = llvm::StructType::create(getLLVMContext());
718 ResultType = Insertion.first->second;
719 } else {
721 }
722 break;
723 }
724
725 case Type::Atomic: {
726 QualType valueType = cast(Ty)->getValueType();
728
729
730 uint64_t valueSize = Context.getTypeSize(valueType);
731 uint64_t atomicSize = Context.getTypeSize(Ty);
732 if (valueSize != atomicSize) {
733 assert(valueSize < atomicSize);
734 llvm::Type *elts[] = {
735 ResultType,
736 llvm::ArrayType::get(CGM.Int8Ty, (atomicSize - valueSize) / 8)
737 };
738 ResultType =
740 }
741 break;
742 }
743 case Type::Pipe: {
745 break;
746 }
747 case Type::BitInt: {
748 const auto &EIT = cast(Ty);
749 ResultType = llvm::Type::getIntNTy(getLLVMContext(), EIT->getNumBits());
750 break;
751 }
752 case Type::HLSLAttributedResource:
754 break;
755 }
756
757 assert(ResultType && "Didn't convert a type?");
758 assert((!CachedType || CachedType == ResultType) &&
759 "Cached type doesn't match computed type");
760
761 TypeCache[Ty] = ResultType;
762 return ResultType;
763}
764
767}
768
771}
772
773
775
776
778
779 llvm::StructType *&Entry = RecordDeclTypes[Key];
780
781
782 if (!Entry) {
785 }
786 llvm::StructType *Ty = Entry;
787
788
789
792 return Ty;
793
794
795 if (const CXXRecordDecl *CRD = dyn_cast(RD)) {
796 for (const auto &I : CRD->bases()) {
797 if (I.isVirtual()) continue;
799 }
800 }
801
802
804 CGRecordLayouts[Key] = std::move(Layout);
805
806
807
808
809 if (SkippedLayout)
810 TypeCache.clear();
811
812 return Ty;
813}
814
815
819
820 auto I = CGRecordLayouts.find(Key);
821 if (I != CGRecordLayouts.end())
822 return *I->second;
823
825
826
827 I = CGRecordLayouts.find(Key);
828
829 assert(I != CGRecordLayouts.end() &&
830 "Unable to find record layout information for type");
831 return *I->second;
832}
833
837}
838
842
844 if (isa(AT))
845 return true;
846 if (const auto *CAT = dyn_cast(AT))
848 return true;
850 }
851
852
853
855 const RecordDecl *RD = RT->getDecl();
857 }
858
859
862
863
864 return true;
865}
866
869}
870
872
873
874
875
879}
Defines the clang::ASTContext interface.
static llvm::Type * getTypeForFormat(llvm::LLVMContext &VMContext, const llvm::fltSemantics &format, bool UseNativeHalf=false)
static Decl::Kind getKind(const Decl *D)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
llvm::MachO::Target Target
static CharUnits getTypeAllocSize(CodeGenModule &CGM, llvm::Type *type)
BuiltinVectorTypeInfo getBuiltinVectorTypeInfo(const BuiltinType *VecTy) const
Returns the element type, element count and number of vectors (in case of tuple) for a builtin vector...
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
QualType getRecordType(const RecordDecl *Decl) const
uint64_t getTargetNullPointerValue(QualType QT) const
Get target-dependent integer value for null pointer which is used for constant folding.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
const LangOptions & getLangOpts() const
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
const clang::PrintingPolicy & getPrintingPolicy() const
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
const TargetInfo & getTargetInfo() const
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
unsigned getTargetAddressSpace(LangAS AS) const
QualType getElementType() const
unsigned getIndexTypeCVRQualifiers() const
Represents a C++ struct/union/class.
Represents a canonical, potentially-qualified type.
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
CharUnits - This is an opaque type for sizes expressed in character units.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
Implements C++ ABI-specific code generation functions.
virtual bool isMemberPointerConvertible(const MemberPointerType *MPT) const
Return whether or not a member pointers type is convertible to an IR type.
virtual llvm::Type * ConvertMemberPointerType(const MemberPointerType *MPT)
Find the LLVM type used to represent the given member pointer type.
virtual bool isZeroInitializable(const MemberPointerType *MPT)
Return true if the given member pointer can be zero-initialized (in the C++ sense) with an LLVM zeroi...
This class gathers all debug information during compilation and is responsible for emitting to llvm g...
CGFunctionInfo - Class to encapsulate the information about a function definition.
llvm::Type * convertHLSLSpecificType(const Type *T)
virtual llvm::Type * getPipeType(const PipeType *T, StringRef Name, llvm::Type *&PipeTy)
virtual llvm::Type * convertOpenCLSpecificType(const Type *T)
CGRecordLayout - This class handles struct and union layout info while lowering AST types to LLVM typ...
bool isZeroInitializable() const
Check whether this struct can be C++ zero-initialized with a zeroinitializer.
This class organizes the cross-function state that is used while generating LLVM code.
CGHLSLRuntime & getHLSLRuntime()
Return a reference to the configured HLSL runtime.
CGDebugInfo * getModuleDebugInfo()
bool isPaddedAtomicType(QualType type)
CGOpenCLRuntime & getOpenCLRuntime()
Return a reference to the configured OpenCL runtime.
CGCXXABI & getCXXABI() const
const TargetCodeGenInfo & getTargetCodeGenInfo()
const CodeGenOptions & getCodeGenOpts() const
CodeGenTypes(CodeGenModule &cgm)
llvm::Type * ConvertType(QualType T)
ConvertType - Convert type T into a llvm::Type.
CGCXXABI & getCXXABI() const
bool isPointerZeroInitializable(QualType T)
Check if the pointer type can be zero-initialized (in the C++ sense) with an LLVM zeroinitializer.
const CodeGenOptions & getCodeGenOpts() const
ASTContext & getContext() const
const CGFunctionInfo & arrangeFreeFunctionType(CanQual< FunctionProtoType > Ty)
Arrange the argument and result information for a value of the given freestanding function type.
llvm::FunctionType * GetFunctionType(const CGFunctionInfo &Info)
GetFunctionType - Get the LLVM function type for.
bool isFuncTypeConvertible(const FunctionType *FT)
isFuncTypeConvertible - Utility to check whether a function type can be converted to an LLVM type (i....
std::unique_ptr< CGRecordLayout > ComputeRecordLayout(const RecordDecl *D, llvm::StructType *Ty)
Compute a new LLVM record layout object for the given record.
llvm::Type * convertTypeForLoadStore(QualType T, llvm::Type *LLVMTy=nullptr)
Given that T is a scalar type, return the IR type that should be used for load and store operations.
const CGRecordLayout & getCGRecordLayout(const RecordDecl *)
getCGRecordLayout - Return record layout info for the given record decl.
unsigned getTargetAddressSpace(QualType T) const
llvm::StructType * ConvertRecordDeclType(const RecordDecl *TD)
ConvertRecordDeclType - Lay out a tagged decl type like struct or union.
void RefreshTypeCacheForClass(const CXXRecordDecl *RD)
Remove stale types from the type cache when an inheritance model gets assigned to a class.
bool isRecordLayoutComplete(const Type *Ty) const
isRecordLayoutComplete - Return true if the specified type is already completely laid out.
llvm::Type * ConvertTypeForMem(QualType T)
ConvertTypeForMem - Convert type T into a llvm::Type.
CodeGenModule & getCGM() const
void UpdateCompletedType(const TagDecl *TD)
UpdateCompletedType - When we find the full definition for a TagDecl, replace the 'opaque' type we pr...
llvm::LLVMContext & getLLVMContext()
bool typeRequiresSplitIntoByteArray(QualType ASTTy, llvm::Type *LLVMTy=nullptr)
Check whether the given type needs to be laid out in memory using an opaque byte-array type because i...
const llvm::DataLayout & getDataLayout() const
bool isFuncParamTypeConvertible(QualType Ty)
isFuncParamTypeConvertible - Return true if the specified type in a function parameter or result posi...
bool isZeroInitializable(QualType T)
IsZeroInitializable - Return whether a type can be zero-initialized (in the C++ sense) with an LLVM z...
void addRecordTypeName(const RecordDecl *RD, llvm::StructType *Ty, StringRef suffix)
addRecordTypeName - Compute a name from the given record decl with an optional suffix and name the gi...
virtual llvm::Type * getCUDADeviceBuiltinSurfaceDeviceType() const
Return the device-side type for the CUDA device builtin surface type.
virtual llvm::Type * getCUDADeviceBuiltinTextureDeviceType() const
Return the device-side type for the CUDA device builtin texture type.
Represents the canonical version of C arrays with a specified constant size.
uint64_t getZExtSize() const
Return the size zero-extended as a uint64_t.
Represents a concrete matrix type with constant number of rows and columns.
unsigned getNumColumns() const
Returns the number of columns in the matrix.
unsigned getNumRows() const
Returns the number of rows in the matrix.
ASTContext & getASTContext() const LLVM_READONLY
DeclContext * getDeclContext()
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
FunctionType - C99 6.7.5.3 - Function Declarators.
QualType getReturnType() const
Represents a C array with an unspecified size.
QualType getElementType() const
Returns type of the elements being stored in the matrix.
A pointer to member type per C++ 8.3.3 - Pointers to members.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
void printQualifiedName(raw_ostream &OS) const
Returns a human-readable qualified name for this declaration, like A::B::i, for i being member of nam...
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
A (possibly-)qualified type.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
LangAS getAddressSpace() const
Return the address space of this type.
Represents a struct/union/class.
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeType() const
Represents the declaration of a struct/union/class/enum.
StringRef getKindName() const
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
TypedefNameDecl * getTypedefNameForAnonDecl() const
void printName(raw_ostream &OS, const PrintingPolicy &Policy) const override
Pretty-print the unqualified name of this declaration.
bool isDependentType() const
Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...
virtual bool useFP16ConversionIntrinsics() const
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
The base class of the type hierarchy.
bool isBlockPointerType() const
bool isConstantMatrixType() const
bool isCUDADeviceBuiltinSurfaceType() const
Check if the type is the CUDA device builtin surface type.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isExtVectorBoolType() const
bool isBitIntType() const
bool isCUDADeviceBuiltinTextureType() const
Check if the type is the CUDA device builtin texture type.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isFunctionType() const
bool isAnyPointerType() const
TypeClass getTypeClass() const
const T * getAs() const
Member-template getAs'.
Base class for declarations which introduce a typedef-name.
Represents a C array with a specified size that is not an integer-constant-expression.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
Describes how types, statements, expressions, and declarations should be printed.
unsigned SuppressInlineNamespace
Suppress printing parts of scope specifiers that correspond to inline namespaces.