clang 20.0.0git
CGCXXABI.cpp
Go to the documentation of this file.
1//===----- CGCXXABI.cpp - Interface to C++ ABIs ---------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This provides an abstract class for C++ code generation. Concrete subclasses
10// of this implement code generation for specific C++ ABIs.
11//
12//===----------------------------------------------------------------------===//
13
14#include "CGCXXABI.h"
15#include "CGCleanup.h"
16#include "clang/AST/Attr.h"
17
18using namespace clang;
19using namespace CodeGen;
20
22
25 CGF.CXXABIThisValue, CGF.CXXABIThisDecl->getType()->getPointeeType(),
26 CGF.CXXABIThisAlignment);
27}
28
30 DiagnosticsEngine &Diags = CGF.CGM.getDiags();
31 unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
32 "cannot yet compile %0 in this ABI");
34 DiagID)
35 << S;
36}
37
39 return llvm::Constant::getNullValue(CGM.getTypes().ConvertType(T));
40}
41
42llvm::Type *
45}
46
48 CodeGenFunction &CGF, const Expr *E, Address This,
49 llvm::Value *&ThisPtrForCall,
50 llvm::Value *MemPtr, const MemberPointerType *MPT) {
51 ErrorUnsupportedABI(CGF, "calls through member pointers");
52
53 const auto *RD =
54 cast<CXXRecordDecl>(MPT->getClass()->castAs<RecordType>()->getDecl());
55 ThisPtrForCall =
57 const FunctionProtoType *FPT =
59 llvm::Constant *FnPtr = llvm::Constant::getNullValue(
60 llvm::PointerType::getUnqual(CGM.getLLVMContext()));
61 return CGCallee::forDirect(FnPtr, FPT);
62}
63
64llvm::Value *
66 Address Base, llvm::Value *MemPtr,
67 const MemberPointerType *MPT) {
68 ErrorUnsupportedABI(CGF, "loads of member pointers");
69 llvm::Type *Ty =
70 llvm::PointerType::get(CGF.getLLVMContext(), Base.getAddressSpace());
71 return llvm::Constant::getNullValue(Ty);
72}
73
75 const CastExpr *E,
76 llvm::Value *Src) {
77 ErrorUnsupportedABI(CGF, "member function pointer conversions");
79}
80
82 llvm::Constant *Src) {
84}
85
86llvm::Value *
88 llvm::Value *L,
89 llvm::Value *R,
90 const MemberPointerType *MPT,
91 bool Inequality) {
92 ErrorUnsupportedABI(CGF, "member function pointer comparison");
93 return CGF.Builder.getFalse();
94}
95
96llvm::Value *
98 llvm::Value *MemPtr,
99 const MemberPointerType *MPT) {
100 ErrorUnsupportedABI(CGF, "member function pointer null testing");
101 return CGF.Builder.getFalse();
102}
103
104llvm::Constant *
106 return GetBogusMemberPointer(QualType(MPT, 0));
107}
108
111 MD->getType(), MD->getParent()->getTypeForDecl()));
112}
113
115 CharUnits offset) {
116 return GetBogusMemberPointer(QualType(MPT, 0));
117}
118
119llvm::Constant *CGCXXABI::EmitMemberPointer(const APValue &MP, QualType MPT) {
120 return GetBogusMemberPointer(MPT);
121}
122
124 // Fake answer.
125 return true;
126}
127
129 const CXXMethodDecl *MD = cast<CXXMethodDecl>(CGF.CurGD.getDecl());
130
131 // FIXME: I'm not entirely sure I like using a fake decl just for code
132 // generation. Maybe we can come up with a better way?
133 auto *ThisDecl =
135 &CGM.getContext().Idents.get("this"),
137 params.push_back(ThisDecl);
138 CGF.CXXABIThisDecl = ThisDecl;
139
140 // Compute the presumed alignment of 'this', which basically comes
141 // down to whether we know it's a complete object or not.
142 auto &Layout = CGF.getContext().getASTRecordLayout(MD->getParent());
143 if (MD->getParent()->getNumVBases() == 0 || // avoid vcall in common case
144 MD->getParent()->isEffectivelyFinal() ||
146 CGF.CXXABIThisAlignment = Layout.getAlignment();
147 } else {
148 CGF.CXXABIThisAlignment = Layout.getNonVirtualAlignment();
149 }
150}
151
153 return CGF.Builder.CreateLoad(CGF.GetAddrOfLocalVar(getThisDecl(CGF)),
154 "this");
155}
156
157void CGCXXABI::setCXXABIThisValue(CodeGenFunction &CGF, llvm::Value *ThisPtr) {
158 /// Initialize the 'this' slot.
159 assert(getThisDecl(CGF) && "no 'this' variable for function");
160 CGF.CXXABIThisValue = ThisPtr;
161}
162
164 if (VD->needsDestruction(getContext()))
165 return true;
166
167 // If the variable has an incomplete class type (or array thereof), it
168 // might need destruction.
169 const Type *T = VD->getType()->getBaseElementTypeUnsafe();
170 if (T->getAs<RecordType>() && T->isIncompleteType())
171 return true;
172
173 return false;
174}
175
177 const VarDecl *VD, bool InspectInitForWeakDef) const {
178 VD = VD->getMostRecentDecl();
179 if (VD->hasAttr<ConstInitAttr>())
180 return true;
181
182 // All later checks examine the initializer specified on the variable. If
183 // the variable is weak, such examination would not be correct.
184 if (!InspectInitForWeakDef && (VD->isWeak() || VD->hasAttr<SelectAnyAttr>()))
185 return false;
186
187 const VarDecl *InitDecl = VD->getInitializingDeclaration();
188 if (!InitDecl)
189 return false;
190
191 // If there's no initializer to run, this is constant initialization.
192 if (!InitDecl->hasInit())
193 return true;
194
195 // If we have the only definition, we don't need a thread wrapper if we
196 // will emit the value as a constant.
197 if (isUniqueGVALinkage(getContext().GetGVALinkageForVariable(VD)))
198 return !mayNeedDestruction(VD) && InitDecl->evaluateValue();
199
200 // Otherwise, we need a thread wrapper unless we know that every
201 // translation unit will emit the value as a constant. We rely on the
202 // variable being constant-initialized in every translation unit if it's
203 // constant-initialized in any translation unit, which isn't actually
204 // guaranteed by the standard but is necessary for sanity.
205 return InitDecl->hasConstantInitialization();
206}
207
209 RValue RV, QualType ResultType) {
210 assert(!CGF.hasAggregateEvaluationKind(ResultType) &&
211 "cannot handle aggregates");
212 CGF.EmitReturnOfRValue(RV, ResultType);
213}
214
217 return CharUnits::Zero();
218 return getArrayCookieSizeImpl(expr->getAllocatedType());
219}
220
222 // BOGUS
223 return CharUnits::Zero();
224}
225
227 Address NewPtr,
228 llvm::Value *NumElements,
229 const CXXNewExpr *expr,
230 QualType ElementType) {
231 // Should never be called.
232 ErrorUnsupportedABI(CGF, "array cookie initialization");
233 return Address::invalid();
234}
235
237 QualType elementType) {
238 // If the class's usual deallocation function takes two arguments,
239 // it needs a cookie.
240 if (expr->doesUsualArrayDeleteWantSize())
241 return true;
242
243 return elementType.isDestructedType();
244}
245
247 // If the class's usual deallocation function takes two arguments,
248 // it needs a cookie.
249 if (expr->doesUsualArrayDeleteWantSize())
250 return true;
251
252 return expr->getAllocatedType().isDestructedType();
253}
254
256 const CXXDeleteExpr *expr, QualType eltTy,
257 llvm::Value *&numElements,
258 llvm::Value *&allocPtr, CharUnits &cookieSize) {
259 // Derive a char* in the same address space as the pointer.
260 ptr = ptr.withElementType(CGF.Int8Ty);
261
262 // If we don't need an array cookie, bail out early.
263 if (!requiresArrayCookie(expr, eltTy)) {
264 allocPtr = ptr.emitRawPointer(CGF);
265 numElements = nullptr;
266 cookieSize = CharUnits::Zero();
267 return;
268 }
269
270 cookieSize = getArrayCookieSizeImpl(eltTy);
271 Address allocAddr = CGF.Builder.CreateConstInBoundsByteGEP(ptr, -cookieSize);
272 allocPtr = allocAddr.emitRawPointer(CGF);
273 numElements = readArrayCookieImpl(CGF, allocAddr, cookieSize);
274}
275
277 Address ptr,
278 CharUnits cookieSize) {
279 ErrorUnsupportedABI(CGF, "reading a new[] cookie");
280 return llvm::ConstantInt::get(CGF.SizeTy, 0);
281}
282
283/// Returns the adjustment, in bytes, required for the given
284/// member-pointer operation. Returns null if no adjustment is
285/// required.
287 assert(E->getCastKind() == CK_DerivedToBaseMemberPointer ||
288 E->getCastKind() == CK_BaseToDerivedMemberPointer);
289
290 QualType derivedType;
291 if (E->getCastKind() == CK_DerivedToBaseMemberPointer)
292 derivedType = E->getSubExpr()->getType();
293 else
294 derivedType = E->getType();
295
296 const CXXRecordDecl *derivedClass =
297 derivedType->castAs<MemberPointerType>()->getClass()->getAsCXXRecordDecl();
298
299 return CGM.GetNonVirtualBaseClassOffset(derivedClass,
300 E->path_begin(),
301 E->path_end());
302}
303
304llvm::BasicBlock *
306 const CXXRecordDecl *RD) {
308 llvm_unreachable("shouldn't be called in this ABI");
309
310 ErrorUnsupportedABI(CGF, "complete object detection in ctor");
311 return nullptr;
312}
313
314void CGCXXABI::setCXXDestructorDLLStorage(llvm::GlobalValue *GV,
315 const CXXDestructorDecl *Dtor,
316 CXXDtorType DT) const {
317 // Assume the base C++ ABI has no special rules for destructor variants.
318 CGM.setDLLImportDLLExport(GV, Dtor);
319}
320
321llvm::GlobalValue::LinkageTypes CGCXXABI::getCXXDestructorLinkage(
322 GVALinkage Linkage, const CXXDestructorDecl *Dtor, CXXDtorType DT) const {
323 // Delegate back to CGM by default.
325}
326
328 return false;
329}
330
331llvm::CallInst *
333 llvm::Value *Exn) {
334 // Just call std::terminate and ignore the violating exception.
336}
337
339 return CatchTypeInfo{nullptr, 0};
340}
341
342std::vector<CharUnits> CGCXXABI::getVBPtrOffsets(const CXXRecordDecl *RD) {
343 return std::vector<CharUnits>();
344}
345
348 bool ForVirtualBase, bool Delegating, CallArgList &Args) {
349 AddedStructorArgs AddedArgs =
350 getImplicitConstructorArgs(CGF, D, Type, ForVirtualBase, Delegating);
351 for (size_t i = 0; i < AddedArgs.Prefix.size(); ++i) {
352 Args.insert(Args.begin() + 1 + i,
353 CallArg(RValue::get(AddedArgs.Prefix[i].Value),
354 AddedArgs.Prefix[i].Type));
355 }
356 for (const auto &arg : AddedArgs.Suffix) {
357 Args.add(RValue::get(arg.Value), arg.Type);
358 }
359 return AddedStructorArgCounts(AddedArgs.Prefix.size(),
360 AddedArgs.Suffix.size());
361}
const Decl * D
Expr * E
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition: APValue.h:122
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
QualType getRecordType(const RecordDecl *Decl) const
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D,...
FullSourceLoc getFullLoc(SourceLocation Loc) const
Definition: ASTContext.h:817
IdentifierTable & Idents
Definition: ASTContext.h:660
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2539
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2497
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2803
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2064
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
Definition: DeclCXX.h:2190
QualType getThisType() const
Return the type of the this pointer.
Definition: DeclCXX.cpp:2603
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition: ExprCXX.h:2240
Represents a C++ struct/union/class.
Definition: DeclCXX.h:258
bool isEffectivelyFinal() const
Determine whether it's impossible for a class to be derived from this class.
Definition: DeclCXX.cpp:2153
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
Definition: DeclCXX.h:635
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3498
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
Definition: CharUnits.h:53
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...
Definition: Address.h:128
static Address invalid()
Definition: Address.h:176
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
Return the pointer contained in this class after authenticating it and adding offset to it if necessa...
Definition: Address.h:251
Address withElementType(llvm::Type *ElemTy) const
Return address with different element type, but same pointer and alignment.
Definition: Address.h:274
Address CreateConstInBoundsByteGEP(Address Addr, CharUnits Offset, const llvm::Twine &Name="")
Given a pointer to i8, adjust it by a given constant offset.
Definition: CGBuilder.h:304
llvm::LoadInst * CreateLoad(Address Addr, const llvm::Twine &Name="")
Definition: CGBuilder.h:107
llvm::Constant * getMemberPointerAdjustment(const CastExpr *E)
A utility method for computing the offset required for the given base-to-derived or derived-to-base m...
Definition: CGCXXABI.cpp:286
virtual std::vector< CharUnits > getVBPtrOffsets(const CXXRecordDecl *RD)
Gets the offsets of all the virtual base pointers in a given class.
Definition: CGCXXABI.cpp:342
virtual void ReadArrayCookie(CodeGenFunction &CGF, Address Ptr, const CXXDeleteExpr *expr, QualType ElementType, llvm::Value *&NumElements, llvm::Value *&AllocPtr, CharUnits &CookieSize)
Reads the array cookie associated with the given pointer, if it has one.
Definition: CGCXXABI.cpp:255
CodeGenModule & CGM
Definition: CGCXXABI.h:47
virtual void setCXXDestructorDLLStorage(llvm::GlobalValue *GV, const CXXDestructorDecl *Dtor, CXXDtorType DT) const
Definition: CGCXXABI.cpp:314
virtual bool NeedsVTTParameter(GlobalDecl GD)
Return whether the given global decl needs a VTT parameter.
Definition: CGCXXABI.cpp:327
virtual llvm::CallInst * emitTerminateForUnexpectedException(CodeGenFunction &CGF, llvm::Value *Exn)
Definition: CGCXXABI.cpp:332
ImplicitParamDecl * getThisDecl(CodeGenFunction &CGF)
Definition: CGCXXABI.h:54
virtual llvm::Type * ConvertMemberPointerType(const MemberPointerType *MPT)
Find the LLVM type used to represent the given member pointer type.
Definition: CGCXXABI.cpp:43
virtual llvm::Constant * EmitNullMemberPointer(const MemberPointerType *MPT)
Create a null member pointer of the given type.
Definition: CGCXXABI.cpp:105
virtual CharUnits getArrayCookieSizeImpl(QualType elementType)
Returns the extra size required in order to store the array cookie for the given type.
Definition: CGCXXABI.cpp:221
virtual void EmitReturnFromThunk(CodeGenFunction &CGF, RValue RV, QualType ResultType)
Definition: CGCXXABI.cpp:208
void buildThisParam(CodeGenFunction &CGF, FunctionArgList &Params)
Build a parameter variable suitable for 'this'.
Definition: CGCXXABI.cpp:128
virtual llvm::Value * EmitMemberPointerIsNotNull(CodeGenFunction &CGF, llvm::Value *MemPtr, const MemberPointerType *MPT)
Determine if a member pointer is non-null. Returns an i1.
Definition: CGCXXABI.cpp:97
bool isEmittedWithConstantInitializer(const VarDecl *VD, bool InspectInitForWeakDef=false) const
Determine whether we will definitely emit this variable with a constant initializer,...
Definition: CGCXXABI.cpp:176
virtual llvm::Value * EmitMemberPointerComparison(CodeGenFunction &CGF, llvm::Value *L, llvm::Value *R, const MemberPointerType *MPT, bool Inequality)
Emit a comparison between two member pointers. Returns an i1.
Definition: CGCXXABI.cpp:87
virtual llvm::Constant * EmitMemberPointer(const APValue &MP, QualType MPT)
Create a member pointer for the given member pointer constant.
Definition: CGCXXABI.cpp:119
Address getThisAddress(CodeGenFunction &CGF)
Definition: CGCXXABI.cpp:23
virtual llvm::Value * readArrayCookieImpl(CodeGenFunction &IGF, Address ptr, CharUnits cookieSize)
Reads the array cookie for an allocation which is known to have one.
Definition: CGCXXABI.cpp:276
virtual llvm::Value * EmitMemberDataPointerAddress(CodeGenFunction &CGF, const Expr *E, Address Base, llvm::Value *MemPtr, const MemberPointerType *MPT)
Calculate an l-value from an object and a data member pointer.
Definition: CGCXXABI.cpp:65
virtual bool requiresArrayCookie(const CXXDeleteExpr *E, QualType eltType)
Definition: CGCXXABI.cpp:236
virtual CatchTypeInfo getCatchAllTypeInfo()
Definition: CGCXXABI.cpp:338
bool mayNeedDestruction(const VarDecl *VD) const
Definition: CGCXXABI.cpp:163
virtual llvm::BasicBlock * EmitCtorCompleteObjectHandler(CodeGenFunction &CGF, const CXXRecordDecl *RD)
Definition: CGCXXABI.cpp:305
virtual bool isThisCompleteObject(GlobalDecl GD) const =0
Determine whether there's something special about the rules of the ABI tell us that 'this' is a compl...
void setCXXABIThisValue(CodeGenFunction &CGF, llvm::Value *ThisPtr)
Definition: CGCXXABI.cpp:157
llvm::Value * loadIncomingCXXThis(CodeGenFunction &CGF)
Loads the incoming C++ this pointer as it was passed by the caller.
Definition: CGCXXABI.cpp:152
void ErrorUnsupportedABI(CodeGenFunction &CGF, StringRef S)
Issue a diagnostic about unsupported features in the ABI.
Definition: CGCXXABI.cpp:29
virtual llvm::Constant * EmitMemberDataPointer(const MemberPointerType *MPT, CharUnits offset)
Create a member pointer for the given field.
Definition: CGCXXABI.cpp:114
llvm::Constant * GetBogusMemberPointer(QualType T)
Get a null value for unsupported member pointers.
Definition: CGCXXABI.cpp:38
virtual CGCallee EmitLoadOfMemberFunctionPointer(CodeGenFunction &CGF, const Expr *E, Address This, llvm::Value *&ThisPtrForCall, llvm::Value *MemPtr, const MemberPointerType *MPT)
Load a member function from an object and a member function pointer.
Definition: CGCXXABI.cpp:47
virtual CharUnits GetArrayCookieSize(const CXXNewExpr *expr)
Returns the extra size required in order to store the array cookie for the given new-expression.
Definition: CGCXXABI.cpp:215
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...
Definition: CGCXXABI.cpp:123
AddedStructorArgCounts addImplicitConstructorArgs(CodeGenFunction &CGF, const CXXConstructorDecl *D, CXXCtorType Type, bool ForVirtualBase, bool Delegating, CallArgList &Args)
Add any ABI-specific implicit arguments needed to call a constructor.
Definition: CGCXXABI.cpp:346
virtual llvm::Value * EmitMemberPointerConversion(CodeGenFunction &CGF, const CastExpr *E, llvm::Value *Src)
Perform a derived-to-base, base-to-derived, or bitcast member pointer conversion.
Definition: CGCXXABI.cpp:74
virtual llvm::Constant * EmitMemberFunctionPointer(const CXXMethodDecl *MD)
Create a member pointer for the given method.
Definition: CGCXXABI.cpp:109
virtual llvm::GlobalValue::LinkageTypes getCXXDestructorLinkage(GVALinkage Linkage, const CXXDestructorDecl *Dtor, CXXDtorType DT) const
Definition: CGCXXABI.cpp:321
virtual Address InitializeArrayCookie(CodeGenFunction &CGF, Address NewPtr, llvm::Value *NumElements, const CXXNewExpr *expr, QualType ElementType)
Initialize the array cookie for the given allocation.
Definition: CGCXXABI.cpp:226
ASTContext & getContext() const
Definition: CGCXXABI.h:81
virtual AddedStructorArgs getImplicitConstructorArgs(CodeGenFunction &CGF, const CXXConstructorDecl *D, CXXCtorType Type, bool ForVirtualBase, bool Delegating)=0
All available information about a concrete callee.
Definition: CGCall.h:63
static CGCallee forDirect(llvm::Constant *functionPtr, const CGCalleeInfo &abstractInfo=CGCalleeInfo())
Definition: CGCall.h:137
CallArgList - Type for representing both the value and type of arguments in a call.
Definition: CGCall.h:274
void add(RValue rvalue, QualType type)
Definition: CGCall.h:298
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
GlobalDecl CurGD
CurGD - The GlobalDecl for the current function being compiled.
llvm::Value * getAsNaturalPointerTo(Address Addr, QualType PointeeType)
Address makeNaturalAddressForPointer(llvm::Value *Ptr, QualType T, CharUnits Alignment=CharUnits::Zero(), bool ForPointeeType=false, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr, KnownNonNull_t IsKnownNonNull=NotKnownNonNull)
Construct an address with the natural alignment of T.
const Decl * CurCodeDecl
CurCodeDecl - This is the inner-most code context, which includes blocks.
llvm::CallInst * EmitNounwindRuntimeCall(llvm::FunctionCallee callee, const Twine &name="")
static bool hasAggregateEvaluationKind(QualType T)
Address GetAddrOfLocalVar(const VarDecl *VD)
GetAddrOfLocalVar - Return the address of a local variable.
llvm::LLVMContext & getLLVMContext()
DiagnosticsEngine & getDiags() const
llvm::GlobalValue::LinkageTypes getLLVMLinkageForDeclarator(const DeclaratorDecl *D, GVALinkage Linkage)
Returns LLVM linkage for a declarator.
const TargetInfo & getTarget() const
llvm::Constant * GetNonVirtualBaseClassOffset(const CXXRecordDecl *ClassDecl, CastExpr::path_const_iterator PathBegin, CastExpr::path_const_iterator PathEnd)
Returns the offset from a derived class to a class.
Definition: CGClass.cpp:201
ASTContext & getContext() const
llvm::FunctionCallee getTerminateFn()
Get the declaration of std::terminate for the platform.
Definition: CGException.cpp:63
llvm::LLVMContext & getLLVMContext()
void setDLLImportDLLExport(llvm::GlobalValue *GV, GlobalDecl D) const
llvm::Type * ConvertType(QualType T)
ConvertType - Convert type T into a llvm::Type.
FunctionArgList - Type for representing both the decl and type of parameters to a function.
Definition: CGCall.h:368
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
Definition: CGValue.h:42
static RValue get(llvm::Value *V)
Definition: CGValue.h:98
SourceLocation getLocation() const
Definition: DeclBase.h:446
bool hasAttr() const
Definition: DeclBase.h:584
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:192
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Definition: Diagnostic.h:1547
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
Definition: Diagnostic.h:873
This represents one expression.
Definition: Expr.h:110
QualType getType() const
Definition: Expr.h:142
Represents a prototype with parameter type info, e.g.
Definition: Type.h:5002
GlobalDecl - represents a global declaration.
Definition: GlobalDecl.h:56
const Decl * getDecl() const
Definition: GlobalDecl.h:103
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
static ImplicitParamDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, ImplicitParamKind ParamKind)
Create implicit parameter.
Definition: Decl.cpp:5378
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:3508
QualType getPointeeType() const
Definition: Type.h:3524
const Type * getClass() const
Definition: Type.h:3538
A (possibly-)qualified type.
Definition: Type.h:941
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
Definition: Type.h:1542
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:5965
RecordDecl * getDecl() const
Definition: Type.h:5975
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
Definition: Redeclarable.h:227
bool hasConstructorVariants() const
Does this ABI have different entrypoints for complete-object and base-subobject constructors?
Definition: TargetCXXABI.h:194
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
Definition: TargetInfo.h:1327
const Type * getTypeForDecl() const
Definition: Decl.h:3391
The base class of the type hierarchy.
Definition: Type.h:1829
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Definition: Type.cpp:1882
const T * castAs() const
Member-template castAs<specific type>.
Definition: Type.h:8607
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
Definition: Type.cpp:705
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
Definition: Type.h:8490
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
Definition: Type.cpp:2362
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:8540
QualType getType() const
Definition: Decl.h:678
bool isWeak() const
Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr.
Definition: Decl.cpp:5364
Represents a variable declaration or definition.
Definition: Decl.h:879
bool hasInit() const
Definition: Decl.cpp:2380
APValue * evaluateValue() const
Attempt to evaluate the value of the initializer attached to this declaration, and produce notes expl...
Definition: Decl.cpp:2539
bool hasConstantInitialization() const
Determine whether this variable has constant initialization.
Definition: Decl.cpp:2612
QualType::DestructionKind needsDestruction(const ASTContext &Ctx) const
Would the destruction of this variable have any effect, and if so, what kind?
Definition: Decl.cpp:2808
VarDecl * getInitializingDeclaration()
Get the initializing declaration of this variable, if any.
Definition: Decl.cpp:2411
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
The JSON file list parser is used to communicate input to InstallAPI.
CXXCtorType
C++ constructor types.
Definition: ABI.h:24
GVALinkage
A more specific kind of linkage than enum Linkage.
Definition: Linkage.h:72
bool isUniqueGVALinkage(GVALinkage L)
Do we know that this will be the only definition of this symbol (excluding inlining-only definitions)...
Definition: Linkage.h:86
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
Definition: Linkage.h:24
CXXDtorType
C++ destructor types.
Definition: ABI.h:33
const FunctionProtoType * T
@ CXXThis
Parameter for C++ 'this' argument.
Similar to AddedStructorArgs, but only notes the number of additional arguments.
Definition: CGCXXABI.h:350
Additional implicit arguments to add to the beginning (Prefix) and end (Suffix) of a constructor / de...
Definition: CGCXXABI.h:330
The MS C++ ABI needs a pointer to RTTI data plus some flags to describe the type of a catch handler,...
Definition: CGCleanup.h:39
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64