clang  14.0.0git
CGCXX.cpp
Go to the documentation of this file.
1 //===--- CGCXX.cpp - Emit LLVM Code for declarations ----------------------===//
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 contains code dealing with C++ code generation.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 // We might split this into multiple files if it gets too unwieldy
14 
15 #include "CGCXXABI.h"
16 #include "CodeGenFunction.h"
17 #include "CodeGenModule.h"
18 #include "clang/AST/ASTContext.h"
19 #include "clang/AST/Attr.h"
20 #include "clang/AST/Decl.h"
21 #include "clang/AST/DeclCXX.h"
22 #include "clang/AST/DeclObjC.h"
23 #include "clang/AST/Mangle.h"
24 #include "clang/AST/RecordLayout.h"
25 #include "clang/AST/StmtCXX.h"
27 #include "llvm/ADT/StringExtras.h"
28 using namespace clang;
29 using namespace CodeGen;
30 
31 
32 /// Try to emit a base destructor as an alias to its primary
33 /// base-class destructor.
35  if (!getCodeGenOpts().CXXCtorDtorAliases)
36  return true;
37 
38  // Producing an alias to a base class ctor/dtor can degrade debug quality
39  // as the debugger cannot tell them apart.
40  if (getCodeGenOpts().OptimizationLevel == 0)
41  return true;
42 
43  // If sanitizing memory to check for use-after-dtor, do not emit as
44  // an alias, unless this class owns no members.
45  if (getCodeGenOpts().SanitizeMemoryUseAfterDtor &&
46  !D->getParent()->field_empty())
47  return true;
48 
49  // If the destructor doesn't have a trivial body, we have to emit it
50  // separately.
51  if (!D->hasTrivialBody())
52  return true;
53 
54  const CXXRecordDecl *Class = D->getParent();
55 
56  // We are going to instrument this destructor, so give up even if it is
57  // currently empty.
58  if (Class->mayInsertExtraPadding())
59  return true;
60 
61  // If we need to manipulate a VTT parameter, give up.
62  if (Class->getNumVBases()) {
63  // Extra Credit: passing extra parameters is perfectly safe
64  // in many calling conventions, so only bail out if the ctor's
65  // calling convention is nonstandard.
66  return true;
67  }
68 
69  // If any field has a non-trivial destructor, we have to emit the
70  // destructor separately.
71  for (const auto *I : Class->fields())
72  if (I->getType().isDestructedType())
73  return true;
74 
75  // Try to find a unique base class with a non-trivial destructor.
76  const CXXRecordDecl *UniqueBase = nullptr;
77  for (const auto &I : Class->bases()) {
78 
79  // We're in the base destructor, so skip virtual bases.
80  if (I.isVirtual()) continue;
81 
82  // Skip base classes with trivial destructors.
83  const auto *Base =
84  cast<CXXRecordDecl>(I.getType()->castAs<RecordType>()->getDecl());
85  if (Base->hasTrivialDestructor()) continue;
86 
87  // If we've already found a base class with a non-trivial
88  // destructor, give up.
89  if (UniqueBase) return true;
90  UniqueBase = Base;
91  }
92 
93  // If we didn't find any bases with a non-trivial destructor, then
94  // the base destructor is actually effectively trivial, which can
95  // happen if it was needlessly user-defined or if there are virtual
96  // bases with non-trivial destructors.
97  if (!UniqueBase)
98  return true;
99 
100  // If the base is at a non-zero offset, give up.
101  const ASTRecordLayout &ClassLayout = Context.getASTRecordLayout(Class);
102  if (!ClassLayout.getBaseClassOffset(UniqueBase).isZero())
103  return true;
104 
105  // Give up if the calling conventions don't match. We could update the call,
106  // but it is probably not worth it.
107  const CXXDestructorDecl *BaseD = UniqueBase->getDestructor();
108  if (BaseD->getType()->castAs<FunctionType>()->getCallConv() !=
110  return true;
111 
113  GlobalDecl TargetDecl(BaseD, Dtor_Base);
114 
115  // The alias will use the linkage of the referent. If we can't
116  // support aliases with that linkage, fail.
117  llvm::GlobalValue::LinkageTypes Linkage = getFunctionLinkage(AliasDecl);
118 
119  // We can't use an alias if the linkage is not valid for one.
120  if (!llvm::GlobalAlias::isValidLinkage(Linkage))
121  return true;
122 
123  llvm::GlobalValue::LinkageTypes TargetLinkage =
124  getFunctionLinkage(TargetDecl);
125 
126  // Check if we have it already.
127  StringRef MangledName = getMangledName(AliasDecl);
128  llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
129  if (Entry && !Entry->isDeclaration())
130  return false;
131  if (Replacements.count(MangledName))
132  return false;
133 
134  // Derive the type for the alias.
135  llvm::Type *AliasValueType = getTypes().GetFunctionType(AliasDecl);
136  llvm::PointerType *AliasType = AliasValueType->getPointerTo();
137 
138  // Find the referent. Some aliases might require a bitcast, in
139  // which case the caller is responsible for ensuring the soundness
140  // of these semantics.
141  auto *Ref = cast<llvm::GlobalValue>(GetAddrOfGlobal(TargetDecl));
142  llvm::Constant *Aliasee = Ref;
143  if (Ref->getType() != AliasType)
144  Aliasee = llvm::ConstantExpr::getBitCast(Ref, AliasType);
145 
146  // Instead of creating as alias to a linkonce_odr, replace all of the uses
147  // of the aliasee.
148  if (llvm::GlobalValue::isDiscardableIfUnused(Linkage) &&
149  !(TargetLinkage == llvm::GlobalValue::AvailableExternallyLinkage &&
150  TargetDecl.getDecl()->hasAttr<AlwaysInlineAttr>())) {
151  // FIXME: An extern template instantiation will create functions with
152  // linkage "AvailableExternally". In libc++, some classes also define
153  // members with attribute "AlwaysInline" and expect no reference to
154  // be generated. It is desirable to reenable this optimisation after
155  // corresponding LLVM changes.
156  addReplacement(MangledName, Aliasee);
157  return false;
158  }
159 
160  // If we have a weak, non-discardable alias (weak, weak_odr), like an extern
161  // template instantiation or a dllexported class, avoid forming it on COFF.
162  // A COFF weak external alias cannot satisfy a normal undefined symbol
163  // reference from another TU. The other TU must also mark the referenced
164  // symbol as weak, which we cannot rely on.
165  if (llvm::GlobalValue::isWeakForLinker(Linkage) &&
166  getTriple().isOSBinFormatCOFF()) {
167  return true;
168  }
169 
170  // If we don't have a definition for the destructor yet or the definition is
171  // avaialable_externally, don't emit an alias. We can't emit aliases to
172  // declarations; that's just not how aliases work.
173  if (Ref->isDeclarationForLinker())
174  return true;
175 
176  // Don't create an alias to a linker weak symbol. This avoids producing
177  // different COMDATs in different TUs. Another option would be to
178  // output the alias both for weak_odr and linkonce_odr, but that
179  // requires explicit comdat support in the IL.
180  if (llvm::GlobalValue::isWeakForLinker(TargetLinkage))
181  return true;
182 
183  // Create the alias with no name.
184  auto *Alias = llvm::GlobalAlias::create(AliasValueType, 0, Linkage, "",
185  Aliasee, &getModule());
186 
187  // Destructors are always unnamed_addr.
188  Alias->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
189 
190  // Switch any previous uses to the alias.
191  if (Entry) {
192  assert(Entry->getType() == AliasType &&
193  "declaration exists with different type");
194  Alias->takeName(Entry);
195  Entry->replaceAllUsesWith(Alias);
196  Entry->eraseFromParent();
197  } else {
198  Alias->setName(MangledName);
199  }
200 
201  // Finally, set up the alias with its proper name and attributes.
203 
204  return false;
205 }
206 
209  auto *Fn = cast<llvm::Function>(
210  getAddrOfCXXStructor(GD, &FnInfo, /*FnType=*/nullptr,
211  /*DontDefer=*/true, ForDefinition));
212 
213  setFunctionLinkage(GD, Fn);
214 
215  CodeGenFunction(*this).GenerateCode(GD, Fn, FnInfo);
216  setNonAliasAttributes(GD, Fn);
217  SetLLVMFunctionAttributesForDefinition(cast<CXXMethodDecl>(GD.getDecl()), Fn);
218  return Fn;
219 }
220 
222  GlobalDecl GD, const CGFunctionInfo *FnInfo, llvm::FunctionType *FnType,
223  bool DontDefer, ForDefinition_t IsForDefinition) {
224  auto *MD = cast<CXXMethodDecl>(GD.getDecl());
225 
226  if (isa<CXXDestructorDecl>(MD)) {
227  // Always alias equivalent complete destructors to base destructors in the
228  // MS ABI.
229  if (getTarget().getCXXABI().isMicrosoft() &&
230  GD.getDtorType() == Dtor_Complete &&
231  MD->getParent()->getNumVBases() == 0)
232  GD = GD.getWithDtorType(Dtor_Base);
233  }
234 
235  if (!FnType) {
236  if (!FnInfo)
237  FnInfo = &getTypes().arrangeCXXStructorDeclaration(GD);
238  FnType = getTypes().GetFunctionType(*FnInfo);
239  }
240 
241  llvm::Constant *Ptr = GetOrCreateLLVMFunction(
242  getMangledName(GD), FnType, GD, /*ForVTable=*/false, DontDefer,
243  /*IsThunk=*/false, /*ExtraAttrs=*/llvm::AttributeList(), IsForDefinition);
244  return {FnType, Ptr};
245 }
246 
248  GlobalDecl GD,
249  llvm::Type *Ty,
250  const CXXRecordDecl *RD) {
251  assert(!CGF.CGM.getTarget().getCXXABI().isMicrosoft() &&
252  "No kext in Microsoft ABI");
253  CodeGenModule &CGM = CGF.CGM;
254  llvm::Value *VTable = CGM.getCXXABI().getAddrOfVTable(RD, CharUnits());
255  Ty = Ty->getPointerTo();
256  VTable = CGF.Builder.CreateBitCast(VTable, Ty->getPointerTo());
257  assert(VTable && "BuildVirtualCall = kext vtbl pointer is null");
258  uint64_t VTableIndex = CGM.getItaniumVTableContext().getMethodVTableIndex(GD);
259  const VTableLayout &VTLayout = CGM.getItaniumVTableContext().getVTableLayout(RD);
262  VTableIndex += VTLayout.getVTableOffset(AddressPoint.VTableIndex) +
263  AddressPoint.AddressPointIndex;
264  llvm::Value *VFuncPtr =
265  CGF.Builder.CreateConstInBoundsGEP1_64(Ty, VTable, VTableIndex, "vfnkxt");
267  Ty, VFuncPtr, llvm::Align(CGF.PointerAlignInBytes));
268  CGCallee Callee(GD, VFunc);
269  return Callee;
270 }
271 
272 /// BuildAppleKextVirtualCall - This routine is to support gcc's kext ABI making
273 /// indirect call to virtual functions. It makes the call through indexing
274 /// into the vtable.
275 CGCallee
277  NestedNameSpecifier *Qual,
278  llvm::Type *Ty) {
279  assert((Qual->getKind() == NestedNameSpecifier::TypeSpec) &&
280  "BuildAppleKextVirtualCall - bad Qual kind");
281 
282  const Type *QTy = Qual->getAsType();
283  QualType T = QualType(QTy, 0);
284  const RecordType *RT = T->getAs<RecordType>();
285  assert(RT && "BuildAppleKextVirtualCall - Qual type must be record");
286  const auto *RD = cast<CXXRecordDecl>(RT->getDecl());
287 
288  if (const auto *DD = dyn_cast<CXXDestructorDecl>(MD))
290 
291  return ::BuildAppleKextVirtualCall(*this, MD, Ty, RD);
292 }
293 
294 /// BuildVirtualCall - This routine makes indirect vtable call for
295 /// call to virtual destructors. It returns 0 if it could not do it.
296 CGCallee
298  const CXXDestructorDecl *DD,
300  const CXXRecordDecl *RD) {
301  assert(DD->isVirtual() && Type != Dtor_Base);
302  // Compute the function type we're calling.
305  llvm::Type *Ty = CGM.getTypes().GetFunctionType(FInfo);
307 }
clang::GlobalDecl::getDtorType
CXXDtorType getDtorType() const
Definition: GlobalDecl.h:109
clang::Dtor_Base
@ Dtor_Base
Base object dtor.
Definition: ABI.h:36
clang::CodeGen::CodeGenModule::getItaniumVTableContext
ItaniumVTableContext & getItaniumVTableContext()
Definition: CodeGenModule.h:730
CodeGenFunction.h
clang::Decl::hasAttr
bool hasAttr() const
Definition: DeclBase.h:547
BuildAppleKextVirtualCall
static CGCallee BuildAppleKextVirtualCall(CodeGenFunction &CGF, GlobalDecl GD, llvm::Type *Ty, const CXXRecordDecl *RD)
Definition: CGCXX.cpp:247
clang::CodeGen::ForDefinition_t
ForDefinition_t
Definition: CodeGenModule.h:101
clang::CodeGen::CodeGenModule::codegenCXXStructor
llvm::Function * codegenCXXStructor(GlobalDecl GD)
Definition: CGCXX.cpp:207
clang::RecordDecl::field_empty
bool field_empty() const
Definition: Decl.h:4091
clang::TargetCXXABI::isMicrosoft
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
Definition: TargetCXXABI.h:138
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:673
Attr.h
clang::CodeGen::CodeGenTypeCache::PointerAlignInBytes
unsigned char PointerAlignInBytes
Definition: CodeGenTypeCache.h:96
clang::NestedNameSpecifier
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Definition: NestedNameSpecifier.h:50
clang::ASTRecordLayout::getBaseClassOffset
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
Definition: RecordLayout.h:249
clang::TargetInfo::getCXXABI
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
Definition: TargetInfo.h:1203
DeclCXX.h
clang::CodeGen::CodeGenFunction::BuildAppleKextVirtualDestructorCall
CGCallee BuildAppleKextVirtualDestructorCall(const CXXDestructorDecl *DD, CXXDtorType Type, const CXXRecordDecl *RD)
BuildVirtualCall - This routine makes indirect vtable call for call to virtual destructors.
Definition: CGCXX.cpp:297
clang::ItaniumVTableContext::getMethodVTableIndex
uint64_t getMethodVTableIndex(GlobalDecl GD)
Locate a virtual function in the vtable.
Definition: VTableBuilder.cpp:2270
clang::FunctionType
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3546
clang::CodeGen::CodeGenFunction::Builder
CGBuilderTy Builder
Definition: CodeGenFunction.h:274
clang::Dtor_Complete
@ Dtor_Complete
Complete object dtor.
Definition: ABI.h:35
clang::CodeGen::CodeGenModule::getMangledName
StringRef getMangledName(GlobalDecl GD)
Definition: CodeGenModule.cpp:1351
clang::CodeGen::CGBuilderTy::CreateBitCast
Address CreateBitCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name="")
Definition: CGBuilder.h:151
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1490
Decl.h
DeclObjC.h
clang::CodeGen::CodeGenModule::GetGlobalValue
llvm::GlobalValue * GetGlobalValue(StringRef Ref)
Definition: CodeGenModule.cpp:1425
clang::GlobalDecl
GlobalDecl - represents a global declaration.
Definition: GlobalDecl.h:55
clang::CodeGen::CGCXXABI::getAddrOfVTable
virtual llvm::GlobalVariable * getAddrOfVTable(const CXXRecordDecl *RD, CharUnits VPtrOffset)=0
Get the address of the vtable for the given record decl which should be used for the vptr at the give...
clang::VTableLayout::getVTableOffset
size_t getVTableOffset(size_t i) const
Definition: VTableBuilder.h:299
clang::CodeGen::CodeGenFunction::GenerateCode
void GenerateCode(GlobalDecl GD, llvm::Function *Fn, const CGFunctionInfo &FnInfo)
Definition: CodeGenFunction.cpp:1291
CodeGenOptions.h
clang::GlobalDecl::getWithDtorType
GlobalDecl getWithDtorType(CXXDtorType Type)
Definition: GlobalDecl.h:171
clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributesForDefinition
void SetLLVMFunctionAttributesForDefinition(const Decl *D, llvm::Function *F)
Set the LLVM function attributes which only apply to a function definition.
Definition: CodeGenModule.cpp:1761
clang::VTableLayout::AddressPointLocation
Definition: VTableBuilder.h:236
clang::RecordType
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:4613
clang::Linkage
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
Definition: Linkage.h:23
clang::BaseSubobject
Definition: BaseSubobject.h:30
clang::CodeGen::CodeGenModule::getCodeGenOpts
const CodeGenOptions & getCodeGenOpts() const
Definition: CodeGenModule.h:708
clang::FunctionDecl::hasTrivialBody
bool hasTrivialBody() const
Returns whether the function has a trivial body that does not require any specific codegen.
Definition: Decl.cpp:2966
clang::CXXDtorType
CXXDtorType
C++ destructor types.
Definition: ABI.h:33
clang::Type::getAs
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:7161
clang::CodeGen::CodeGenModule::GetAddrOfGlobal
llvm::Constant * GetAddrOfGlobal(GlobalDecl GD, ForDefinition_t IsForDefinition=NotForDefinition)
Definition: CodeGenModule.cpp:4053
clang::FunctionType::getCallConv
CallingConv getCallConv() const
Definition: Type.h:3820
clang::CodeGen::CodeGenModule::getModule
llvm::Module & getModule() const
Definition: CodeGenModule.h:709
clang::CXXDestructorDecl
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2668
clang::CodeGen::CodeGenModule::setFunctionLinkage
void setFunctionLinkage(GlobalDecl GD, llvm::Function *F)
Definition: CodeGenModule.h:1252
ASTContext.h
clang::CodeGen::CodeGenModule::getTypes
CodeGenTypes & getTypes()
Definition: CodeGenModule.h:726
clang::CharUnits::Zero
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
Definition: CharUnits.h:53
Base
CodeGenModule.h
clang::CodeGen::CodeGenModule::getAddrAndTypeOfCXXStructor
llvm::FunctionCallee getAddrAndTypeOfCXXStructor(GlobalDecl GD, const CGFunctionInfo *FnInfo=nullptr, llvm::FunctionType *FnType=nullptr, bool DontDefer=false, ForDefinition_t IsForDefinition=NotForDefinition)
Definition: CGCXX.cpp:221
clang::VTableLayout::AddressPointLocation::VTableIndex
unsigned VTableIndex
Definition: VTableBuilder.h:237
clang::VTableLayout::AddressPointLocation::AddressPointIndex
unsigned AddressPointIndex
Definition: VTableBuilder.h:237
clang::CodeGen::CodeGenModule::getTarget
const TargetInfo & getTarget() const
Definition: CodeGenModule.h:714
clang::CodeGen::CodeGenTypes::GetFunctionType
llvm::FunctionType * GetFunctionType(const CGFunctionInfo &Info)
GetFunctionType - Get the LLVM function type for.
Definition: CGCall.cpp:1595
clang::Type::castAs
const T * castAs() const
Member-template castAs<specific type>.
Definition: Type.h:7226
clang::ASTRecordLayout
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
Definition: RecordLayout.h:38
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:255
clang::serialized_diags::create
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
Definition: SerializedDiagnosticPrinter.cpp:302
clang::VTableLayout::getAddressPoint
AddressPointLocation getAddressPoint(BaseSubobject Base) const
Definition: VTableBuilder.h:280
clang::CodeGen::CodeGenFunction
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
Definition: CodeGenFunction.h:235
clang::CharUnits::isZero
bool isZero() const
isZero - Test whether the quantity equals zero.
Definition: CharUnits.h:116
clang::CodeGen::CodeGenModule::getCXXABI
CGCXXABI & getCXXABI() const
Definition: CodeGenModule.h:719
clang::CodeGen::CodeGenTypes::arrangeCXXStructorDeclaration
const CGFunctionInfo & arrangeCXXStructorDeclaration(GlobalDecl GD)
Definition: CGCall.cpp:310
clang::CodeGen::CodeGenModule
This class organizes the cross-function state that is used while generating LLVM code.
Definition: CodeGenModule.h:284
Value
Value
Definition: UninitializedValues.cpp:102
clang::CodeGen::CodeGenModule::getTriple
const llvm::Triple & getTriple() const
Definition: CodeGenModule.h:715
clang::CodeGen::CGBuilderTy::CreateAlignedLoad
llvm::LoadInst * CreateAlignedLoad(llvm::Type *Ty, llvm::Value *Addr, CharUnits Align, const llvm::Twine &Name="")
Definition: CGBuilder.h:86
clang::CodeGen::CGCallee
All available information about a concrete callee.
Definition: CGCall.h:67
clang::CodeGen::ForDefinition
@ ForDefinition
Definition: CodeGenModule.h:103
clang::CXXRecordDecl::getDestructor
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
Definition: DeclCXX.cpp:1887
clang::CodeGen::CGFunctionInfo
CGFunctionInfo - Class to encapsulate the information about a function definition.
Definition: CGFunctionInfo.h:546
CGCXXABI.h
clang::CodeGen::CodeGenFunction::CGM
CodeGenModule & CGM
Definition: CodeGenFunction.h:266
clang::VTableLayout
Definition: VTableBuilder.h:233
clang
Definition: CalledOnceCheck.h:17
clang::NestedNameSpecifier::getAsType
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
Definition: NestedNameSpecifier.h:196
clang::CodeGen::CodeGenModule::addReplacement
void addReplacement(StringRef Name, llvm::Constant *C)
Definition: CodeGenModule.cpp:269
clang::ItaniumVTableContext::getVTableLayout
const VTableLayout & getVTableLayout(const CXXRecordDecl *RD)
Definition: VTableBuilder.h:403
clang::CodeGen::CodeGenModule::TryEmitBaseDestructorAsAlias
bool TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D)
Try to emit a base destructor as an alias to its primary base-class destructor.
Definition: CGCXX.cpp:34
clang::CodeGen::CodeGenFunction::BuildAppleKextVirtualCall
CGCallee BuildAppleKextVirtualCall(const CXXMethodDecl *MD, NestedNameSpecifier *Qual, llvm::Type *Ty)
BuildAppleKextVirtualCall - This routine is to support gcc's kext ABI making indirect call to virtual...
Definition: CGCXX.cpp:276
clang::ASTContext::getASTRecordLayout
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D,...
Definition: RecordLayoutBuilder.cpp:3246
clang::GlobalDecl::getDecl
const Decl * getDecl() const
Definition: GlobalDecl.h:102
clang::CodeGen::CodeGenModule::getFunctionLinkage
llvm::GlobalVariable::LinkageTypes getFunctionLinkage(GlobalDecl GD)
Definition: CodeGenModule.cpp:1490
clang::RecordType::getDecl
RecordDecl * getDecl() const
Definition: Type.h:4623
clang::CharUnits
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
clang::NestedNameSpecifier::TypeSpec
@ TypeSpec
A type, stored as a Type*.
Definition: NestedNameSpecifier.h:90
Mangle.h
clang::ValueDecl::getType
QualType getType() const
Definition: Decl.h:687
clang::CodeGen::CodeGenModule::getAddrOfCXXStructor
llvm::Constant * getAddrOfCXXStructor(GlobalDecl GD, const CGFunctionInfo *FnInfo=nullptr, llvm::FunctionType *FnType=nullptr, bool DontDefer=false, ForDefinition_t IsForDefinition=NotForDefinition)
Return the address of the constructor/destructor of the given type.
Definition: CodeGenModule.h:1022
clang::NestedNameSpecifier::getKind
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
Definition: NestedNameSpecifier.cpp:143
StmtCXX.h
clang::DeclaratorContext::AliasDecl
@ AliasDecl
clang::CXXMethodDecl::isVirtual
bool isVirtual() const
Definition: DeclCXX.h:1992
clang::CodeGen::CodeGenModule::SetCommonAttributes
void SetCommonAttributes(GlobalDecl GD, llvm::GlobalValue *GV)
Set attributes which are common to any form of a global definition (alias, Objective-C method,...
Definition: CodeGenModule.cpp:1932
RecordLayout.h
clang::CXXMethodDecl::getParent
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
Definition: DeclCXX.h:2063
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1948