blob: 2d7b27b18b5754b79564134269bf6a677071293e [file] [log] [blame]
Anders Carlssone1b29ef2008-08-22 16:00:37 +00001//===--- CGDecl.cpp - Emit LLVM Code for declarations ---------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This contains code dealing with C++ code generation.
11//
12//===----------------------------------------------------------------------===//
13
Mike Stump1eb44332009-09-09 15:08:12 +000014// We might split this into multiple files if it gets too unwieldy
Anders Carlssone1b29ef2008-08-22 16:00:37 +000015
Charles Davis3a811f12010-05-25 19:52:27 +000016#include "CGCXXABI.h"
Anders Carlssone1b29ef2008-08-22 16:00:37 +000017#include "CodeGenFunction.h"
18#include "CodeGenModule.h"
Anders Carlsson283a0622009-04-13 18:03:33 +000019#include "Mangle.h"
Anders Carlssone1b29ef2008-08-22 16:00:37 +000020#include "clang/AST/ASTContext.h"
Fariborz Jahanian742cd1b2009-07-25 21:12:28 +000021#include "clang/AST/RecordLayout.h"
Anders Carlssone1b29ef2008-08-22 16:00:37 +000022#include "clang/AST/Decl.h"
Anders Carlsson774e7c62009-04-03 22:50:24 +000023#include "clang/AST/DeclCXX.h"
Anders Carlsson86e96442008-08-23 19:42:54 +000024#include "clang/AST/DeclObjC.h"
Anders Carlsson6815e942009-09-27 18:58:34 +000025#include "clang/AST/StmtCXX.h"
Chandler Carruth06057ce2010-06-15 23:19:56 +000026#include "clang/Frontend/CodeGenOptions.h"
Anders Carlssone1b29ef2008-08-22 16:00:37 +000027#include "llvm/ADT/StringExtras.h"
Anders Carlssone1b29ef2008-08-22 16:00:37 +000028using namespace clang;
29using namespace CodeGen;
30
John McCallc0bf4622010-02-23 00:48:20 +000031/// Determines whether the given function has a trivial body that does
32/// not require any specific codegen.
33static bool HasTrivialBody(const FunctionDecl *FD) {
34 Stmt *S = FD->getBody();
35 if (!S)
36 return true;
37 if (isa<CompoundStmt>(S) && cast<CompoundStmt>(S)->body_empty())
38 return true;
39 return false;
40}
41
42/// Try to emit a base destructor as an alias to its primary
43/// base-class destructor.
44bool CodeGenModule::TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D) {
45 if (!getCodeGenOpts().CXXCtorDtorAliases)
46 return true;
47
48 // If the destructor doesn't have a trivial body, we have to emit it
49 // separately.
50 if (!HasTrivialBody(D))
51 return true;
52
53 const CXXRecordDecl *Class = D->getParent();
54
55 // If we need to manipulate a VTT parameter, give up.
56 if (Class->getNumVBases()) {
57 // Extra Credit: passing extra parameters is perfectly safe
58 // in many calling conventions, so only bail out if the ctor's
59 // calling convention is nonstandard.
60 return true;
61 }
62
63 // If any fields have a non-trivial destructor, we have to emit it
64 // separately.
65 for (CXXRecordDecl::field_iterator I = Class->field_begin(),
66 E = Class->field_end(); I != E; ++I)
67 if (const RecordType *RT = (*I)->getType()->getAs<RecordType>())
68 if (!cast<CXXRecordDecl>(RT->getDecl())->hasTrivialDestructor())
69 return true;
70
71 // Try to find a unique base class with a non-trivial destructor.
72 const CXXRecordDecl *UniqueBase = 0;
73 for (CXXRecordDecl::base_class_const_iterator I = Class->bases_begin(),
74 E = Class->bases_end(); I != E; ++I) {
75
76 // We're in the base destructor, so skip virtual bases.
77 if (I->isVirtual()) continue;
78
79 // Skip base classes with trivial destructors.
80 const CXXRecordDecl *Base
81 = cast<CXXRecordDecl>(I->getType()->getAs<RecordType>()->getDecl());
82 if (Base->hasTrivialDestructor()) continue;
83
84 // If we've already found a base class with a non-trivial
85 // destructor, give up.
86 if (UniqueBase) return true;
87 UniqueBase = Base;
88 }
89
90 // If we didn't find any bases with a non-trivial destructor, then
91 // the base destructor is actually effectively trivial, which can
92 // happen if it was needlessly user-defined or if there are virtual
93 // bases with non-trivial destructors.
94 if (!UniqueBase)
95 return true;
96
John McCall9a708462010-03-03 03:40:11 +000097 /// If we don't have a definition for the destructor yet, don't
98 /// emit. We can't emit aliases to declarations; that's just not
99 /// how aliases work.
Douglas Gregor1d110e02010-07-01 14:13:13 +0000100 const CXXDestructorDecl *BaseD = UniqueBase->getDestructor();
Argyrios Kyrtzidis06a54a32010-07-07 11:31:19 +0000101 if (!BaseD->isImplicit() && !BaseD->hasBody())
John McCall9a708462010-03-03 03:40:11 +0000102 return true;
103
John McCallc0bf4622010-02-23 00:48:20 +0000104 // If the base is at a non-zero offset, give up.
105 const ASTRecordLayout &ClassLayout = Context.getASTRecordLayout(Class);
106 if (ClassLayout.getBaseClassOffset(UniqueBase) != 0)
107 return true;
108
John McCallc0bf4622010-02-23 00:48:20 +0000109 return TryEmitDefinitionAsAlias(GlobalDecl(D, Dtor_Base),
110 GlobalDecl(BaseD, Dtor_Base));
111}
112
John McCalld46f9852010-02-19 01:32:20 +0000113/// Try to emit a definition as a global alias for another definition.
114bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl,
115 GlobalDecl TargetDecl) {
116 if (!getCodeGenOpts().CXXCtorDtorAliases)
117 return true;
118
John McCalld46f9852010-02-19 01:32:20 +0000119 // The alias will use the linkage of the referrent. If we can't
120 // support aliases with that linkage, fail.
121 llvm::GlobalValue::LinkageTypes Linkage
122 = getFunctionLinkage(cast<FunctionDecl>(AliasDecl.getDecl()));
123
124 switch (Linkage) {
125 // We can definitely emit aliases to definitions with external linkage.
126 case llvm::GlobalValue::ExternalLinkage:
127 case llvm::GlobalValue::ExternalWeakLinkage:
128 break;
129
130 // Same with local linkage.
131 case llvm::GlobalValue::InternalLinkage:
132 case llvm::GlobalValue::PrivateLinkage:
133 case llvm::GlobalValue::LinkerPrivateLinkage:
134 break;
135
136 // We should try to support linkonce linkages.
137 case llvm::GlobalValue::LinkOnceAnyLinkage:
138 case llvm::GlobalValue::LinkOnceODRLinkage:
139 return true;
140
141 // Other linkages will probably never be supported.
142 default:
143 return true;
144 }
145
Rafael Espindolabc6afd12010-03-05 01:21:10 +0000146 llvm::GlobalValue::LinkageTypes TargetLinkage
147 = getFunctionLinkage(cast<FunctionDecl>(TargetDecl.getDecl()));
148
Rafael Espindola3c157452010-03-06 07:35:18 +0000149 if (llvm::GlobalValue::isWeakForLinker(TargetLinkage))
Rafael Espindolabc6afd12010-03-05 01:21:10 +0000150 return true;
151
John McCallc0bf4622010-02-23 00:48:20 +0000152 // Derive the type for the alias.
153 const llvm::PointerType *AliasType
154 = getTypes().GetFunctionType(AliasDecl)->getPointerTo();
155
John McCallc0bf4622010-02-23 00:48:20 +0000156 // Find the referrent. Some aliases might require a bitcast, in
157 // which case the caller is responsible for ensuring the soundness
158 // of these semantics.
159 llvm::GlobalValue *Ref = cast<llvm::GlobalValue>(GetAddrOfGlobal(TargetDecl));
160 llvm::Constant *Aliasee = Ref;
161 if (Ref->getType() != AliasType)
162 Aliasee = llvm::ConstantExpr::getBitCast(Ref, AliasType);
163
John McCalld46f9852010-02-19 01:32:20 +0000164 // Create the alias with no name.
165 llvm::GlobalAlias *Alias =
John McCallc0bf4622010-02-23 00:48:20 +0000166 new llvm::GlobalAlias(AliasType, Linkage, "", Aliasee, &getModule());
John McCalld46f9852010-02-19 01:32:20 +0000167
John McCall1962bee2010-02-24 20:32:01 +0000168 // Switch any previous uses to the alias.
Anders Carlsson9a20d552010-06-22 16:16:50 +0000169 llvm::StringRef MangledName = getMangledName(AliasDecl);
John McCallf746aa62010-03-19 23:29:14 +0000170 llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
John McCalld46f9852010-02-19 01:32:20 +0000171 if (Entry) {
John McCall1962bee2010-02-24 20:32:01 +0000172 assert(Entry->isDeclaration() && "definition already exists for alias");
173 assert(Entry->getType() == AliasType &&
174 "declaration exists with different type");
John McCallf746aa62010-03-19 23:29:14 +0000175 Alias->takeName(Entry);
John McCalld46f9852010-02-19 01:32:20 +0000176 Entry->replaceAllUsesWith(Alias);
177 Entry->eraseFromParent();
John McCallf746aa62010-03-19 23:29:14 +0000178 } else {
Anders Carlsson9a20d552010-06-22 16:16:50 +0000179 Alias->setName(MangledName);
John McCalld46f9852010-02-19 01:32:20 +0000180 }
John McCalld46f9852010-02-19 01:32:20 +0000181
182 // Finally, set up the alias with its proper name and attributes.
John McCalld46f9852010-02-19 01:32:20 +0000183 SetCommonAttributes(AliasDecl.getDecl(), Alias);
184
185 return false;
186}
Anders Carlssonb9de2c52009-05-11 23:37:08 +0000187
Anders Carlsson95d4e5d2009-04-15 15:55:24 +0000188void CodeGenModule::EmitCXXConstructors(const CXXConstructorDecl *D) {
John McCalld46f9852010-02-19 01:32:20 +0000189 // The constructor used for constructing this as a complete class;
190 // constucts the virtual bases, then calls the base constructor.
John McCall92ac9ff2010-02-17 03:52:49 +0000191 EmitGlobal(GlobalDecl(D, Ctor_Complete));
John McCalld46f9852010-02-19 01:32:20 +0000192
193 // The constructor used for constructing this as a base class;
194 // ignores virtual bases.
John McCall8e51a1f2010-02-18 21:31:48 +0000195 EmitGlobal(GlobalDecl(D, Ctor_Base));
Anders Carlsson95d4e5d2009-04-15 15:55:24 +0000196}
Anders Carlsson363c1842009-04-16 23:57:24 +0000197
Mike Stump1eb44332009-09-09 15:08:12 +0000198void CodeGenModule::EmitCXXConstructor(const CXXConstructorDecl *D,
Anders Carlsson27ae5362009-04-17 01:58:57 +0000199 CXXCtorType Type) {
John McCalld46f9852010-02-19 01:32:20 +0000200 // The complete constructor is equivalent to the base constructor
201 // for classes with no virtual bases. Try to emit it as an alias.
202 if (Type == Ctor_Complete &&
203 !D->getParent()->getNumVBases() &&
204 !TryEmitDefinitionAsAlias(GlobalDecl(D, Ctor_Complete),
205 GlobalDecl(D, Ctor_Base)))
206 return;
Mike Stump1eb44332009-09-09 15:08:12 +0000207
John McCalld46f9852010-02-19 01:32:20 +0000208 llvm::Function *Fn = cast<llvm::Function>(GetAddrOfCXXConstructor(D, Type));
John McCall8b242332010-05-25 04:30:21 +0000209 setFunctionLinkage(D, Fn);
Mike Stump1eb44332009-09-09 15:08:12 +0000210
Anders Carlsson0ff8baf2009-09-11 00:07:24 +0000211 CodeGenFunction(*this).GenerateCode(GlobalDecl(D, Type), Fn);
Mike Stump1eb44332009-09-09 15:08:12 +0000212
Anders Carlsson27ae5362009-04-17 01:58:57 +0000213 SetFunctionDefinitionAttributes(D, Fn);
214 SetLLVMFunctionAttributesForDefinition(D, Fn);
215}
216
John McCalld46f9852010-02-19 01:32:20 +0000217llvm::GlobalValue *
Mike Stump1eb44332009-09-09 15:08:12 +0000218CodeGenModule::GetAddrOfCXXConstructor(const CXXConstructorDecl *D,
Anders Carlsson363c1842009-04-16 23:57:24 +0000219 CXXCtorType Type) {
Anders Carlssondc709a82010-06-09 02:30:12 +0000220 GlobalDecl GD(D, Type);
221
Anders Carlsson9a20d552010-06-22 16:16:50 +0000222 llvm::StringRef Name = getMangledName(GD);
John McCallf746aa62010-03-19 23:29:14 +0000223 if (llvm::GlobalValue *V = GetGlobalValue(Name))
John McCalld46f9852010-02-19 01:32:20 +0000224 return V;
225
Fariborz Jahanian30509a32009-11-06 18:47:57 +0000226 const FunctionProtoType *FPT = D->getType()->getAs<FunctionProtoType>();
Anders Carlsson363c1842009-04-16 23:57:24 +0000227 const llvm::FunctionType *FTy =
Anders Carlssonf6c56e22009-11-25 03:15:49 +0000228 getTypes().GetFunctionType(getTypes().getFunctionInfo(D, Type),
Fariborz Jahanian30509a32009-11-06 18:47:57 +0000229 FPT->isVariadic());
Anders Carlssondc709a82010-06-09 02:30:12 +0000230 return cast<llvm::Function>(GetOrCreateLLVMFunction(Name, FTy, GD));
Anders Carlsson363c1842009-04-16 23:57:24 +0000231}
Anders Carlsson27ae5362009-04-17 01:58:57 +0000232
Anders Carlsson27ae5362009-04-17 01:58:57 +0000233void CodeGenModule::EmitCXXDestructors(const CXXDestructorDecl *D) {
John McCalld46f9852010-02-19 01:32:20 +0000234 // The destructor in a virtual table is always a 'deleting'
235 // destructor, which calls the complete destructor and then uses the
236 // appropriate operator delete.
Eli Friedmanea9a2082009-11-14 04:19:37 +0000237 if (D->isVirtual())
Eli Friedman624c7d72009-12-15 02:06:15 +0000238 EmitGlobal(GlobalDecl(D, Dtor_Deleting));
John McCalld46f9852010-02-19 01:32:20 +0000239
240 // The destructor used for destructing this as a most-derived class;
241 // call the base destructor and then destructs any virtual bases.
John McCall8e51a1f2010-02-18 21:31:48 +0000242 EmitGlobal(GlobalDecl(D, Dtor_Complete));
John McCalld46f9852010-02-19 01:32:20 +0000243
244 // The destructor used for destructing this as a base class; ignores
245 // virtual bases.
John McCall8e51a1f2010-02-18 21:31:48 +0000246 EmitGlobal(GlobalDecl(D, Dtor_Base));
Anders Carlsson27ae5362009-04-17 01:58:57 +0000247}
248
Mike Stump1eb44332009-09-09 15:08:12 +0000249void CodeGenModule::EmitCXXDestructor(const CXXDestructorDecl *D,
Anders Carlsson27ae5362009-04-17 01:58:57 +0000250 CXXDtorType Type) {
John McCalld46f9852010-02-19 01:32:20 +0000251 // The complete destructor is equivalent to the base destructor for
252 // classes with no virtual bases, so try to emit it as an alias.
253 if (Type == Dtor_Complete &&
254 !D->getParent()->getNumVBases() &&
255 !TryEmitDefinitionAsAlias(GlobalDecl(D, Dtor_Complete),
256 GlobalDecl(D, Dtor_Base)))
257 return;
258
John McCallc0bf4622010-02-23 00:48:20 +0000259 // The base destructor is equivalent to the base destructor of its
260 // base class if there is exactly one non-virtual base class with a
261 // non-trivial destructor, there are no fields with a non-trivial
262 // destructor, and the body of the destructor is trivial.
263 if (Type == Dtor_Base && !TryEmitBaseDestructorAsAlias(D))
264 return;
265
John McCalld46f9852010-02-19 01:32:20 +0000266 llvm::Function *Fn = cast<llvm::Function>(GetAddrOfCXXDestructor(D, Type));
John McCall8b242332010-05-25 04:30:21 +0000267 setFunctionLinkage(D, Fn);
Mike Stump1eb44332009-09-09 15:08:12 +0000268
Anders Carlsson0ff8baf2009-09-11 00:07:24 +0000269 CodeGenFunction(*this).GenerateCode(GlobalDecl(D, Type), Fn);
Mike Stump1eb44332009-09-09 15:08:12 +0000270
Anders Carlsson27ae5362009-04-17 01:58:57 +0000271 SetFunctionDefinitionAttributes(D, Fn);
272 SetLLVMFunctionAttributesForDefinition(D, Fn);
273}
274
John McCalld46f9852010-02-19 01:32:20 +0000275llvm::GlobalValue *
Mike Stump1eb44332009-09-09 15:08:12 +0000276CodeGenModule::GetAddrOfCXXDestructor(const CXXDestructorDecl *D,
Anders Carlsson27ae5362009-04-17 01:58:57 +0000277 CXXDtorType Type) {
Anders Carlssondc709a82010-06-09 02:30:12 +0000278 GlobalDecl GD(D, Type);
279
Anders Carlsson9a20d552010-06-22 16:16:50 +0000280 llvm::StringRef Name = getMangledName(GD);
John McCallf746aa62010-03-19 23:29:14 +0000281 if (llvm::GlobalValue *V = GetGlobalValue(Name))
John McCalld46f9852010-02-19 01:32:20 +0000282 return V;
283
Anders Carlsson27ae5362009-04-17 01:58:57 +0000284 const llvm::FunctionType *FTy =
Anders Carlssonf6c56e22009-11-25 03:15:49 +0000285 getTypes().GetFunctionType(getTypes().getFunctionInfo(D, Type), false);
Mike Stump1eb44332009-09-09 15:08:12 +0000286
Anders Carlssondc709a82010-06-09 02:30:12 +0000287 return cast<llvm::Function>(GetOrCreateLLVMFunction(Name, FTy, GD));
Anders Carlsson27ae5362009-04-17 01:58:57 +0000288}
289
Anders Carlsson046c2942010-04-17 20:15:18 +0000290static llvm::Value *BuildVirtualCall(CodeGenFunction &CGF, uint64_t VTableIndex,
Anders Carlsson566abee2009-11-13 04:45:41 +0000291 llvm::Value *This, const llvm::Type *Ty) {
292 Ty = Ty->getPointerTo()->getPointerTo()->getPointerTo();
Anders Carlsson2b358352009-10-03 14:56:57 +0000293
Anders Carlsson046c2942010-04-17 20:15:18 +0000294 llvm::Value *VTable = CGF.Builder.CreateBitCast(This, Ty);
295 VTable = CGF.Builder.CreateLoad(VTable);
Anders Carlsson566abee2009-11-13 04:45:41 +0000296
297 llvm::Value *VFuncPtr =
Anders Carlsson046c2942010-04-17 20:15:18 +0000298 CGF.Builder.CreateConstInBoundsGEP1_64(VTable, VTableIndex, "vfn");
Anders Carlsson566abee2009-11-13 04:45:41 +0000299 return CGF.Builder.CreateLoad(VFuncPtr);
300}
301
302llvm::Value *
303CodeGenFunction::BuildVirtualCall(const CXXMethodDecl *MD, llvm::Value *This,
304 const llvm::Type *Ty) {
305 MD = MD->getCanonicalDecl();
Anders Carlsson046c2942010-04-17 20:15:18 +0000306 uint64_t VTableIndex = CGM.getVTables().getMethodVTableIndex(MD);
Anders Carlsson566abee2009-11-13 04:45:41 +0000307
Anders Carlssonaf440352010-03-23 04:11:45 +0000308 return ::BuildVirtualCall(*this, VTableIndex, This, Ty);
Anders Carlsson566abee2009-11-13 04:45:41 +0000309}
310
311llvm::Value *
312CodeGenFunction::BuildVirtualCall(const CXXDestructorDecl *DD, CXXDtorType Type,
313 llvm::Value *&This, const llvm::Type *Ty) {
314 DD = cast<CXXDestructorDecl>(DD->getCanonicalDecl());
Anders Carlssonaf440352010-03-23 04:11:45 +0000315 uint64_t VTableIndex =
Anders Carlsson046c2942010-04-17 20:15:18 +0000316 CGM.getVTables().getMethodVTableIndex(GlobalDecl(DD, Type));
Anders Carlsson566abee2009-11-13 04:45:41 +0000317
Anders Carlssonaf440352010-03-23 04:11:45 +0000318 return ::BuildVirtualCall(*this, VTableIndex, This, Ty);
Mike Stumpf0070db2009-08-26 20:46:33 +0000319}
Charles Davis3a811f12010-05-25 19:52:27 +0000320
Charles Davis071cc7d2010-08-16 03:33:14 +0000321CGCXXABI::~CGCXXABI() {}
John McCall93d557b2010-08-22 00:05:51 +0000322
John McCall3023def2010-08-22 03:04:22 +0000323static void ErrorUnsupportedABI(CodeGenFunction &CGF,
324 llvm::StringRef S) {
325 Diagnostic &Diags = CGF.CGM.getDiags();
326 unsigned DiagID = Diags.getCustomDiagID(Diagnostic::Error,
327 "cannot yet compile %s in this ABI");
328 Diags.Report(CGF.getContext().getFullLoc(CGF.CurCodeDecl->getLocation()),
329 DiagID)
330 << S;
331}
332
John McCall93d557b2010-08-22 00:05:51 +0000333llvm::Value *CGCXXABI::EmitLoadOfMemberFunctionPointer(CodeGenFunction &CGF,
334 llvm::Value *&This,
335 llvm::Value *MemPtr,
336 const MemberPointerType *MPT) {
John McCall3023def2010-08-22 03:04:22 +0000337 ErrorUnsupportedABI(CGF, "calls through member pointers");
John McCall93d557b2010-08-22 00:05:51 +0000338
339 const FunctionProtoType *FPT =
340 MPT->getPointeeType()->getAs<FunctionProtoType>();
341 const CXXRecordDecl *RD =
342 cast<CXXRecordDecl>(MPT->getClass()->getAs<RecordType>()->getDecl());
343 const llvm::FunctionType *FTy =
344 CGF.CGM.getTypes().GetFunctionType(
345 CGF.CGM.getTypes().getFunctionInfo(RD, FPT),
346 FPT->isVariadic());
347 return llvm::Constant::getNullValue(FTy->getPointerTo());
348}
John McCall3023def2010-08-22 03:04:22 +0000349
John McCallcf2c85e2010-08-22 04:16:24 +0000350void CGCXXABI::EmitMemberFunctionPointerConversion(CodeGenFunction &CGF,
351 const CastExpr *E,
352 llvm::Value *Src,
353 llvm::Value *Dest,
354 bool VolatileDest) {
355 ErrorUnsupportedABI(CGF, "member function pointer conversions");
356}
357
358void CGCXXABI::EmitNullMemberFunctionPointer(CodeGenFunction &CGF,
359 const MemberPointerType *MPT,
360 llvm::Value *Dest,
361 bool VolatileDest) {
362 ErrorUnsupportedABI(CGF, "null member function pointers");
363}
364
John McCall875ab102010-08-22 06:43:33 +0000365void CGCXXABI::EmitMemberFunctionPointer(CodeGenFunction &CGF,
366 const CXXMethodDecl *MD,
367 llvm::Value *DestPtr,
368 bool VolatileDest) {
369 ErrorUnsupportedABI(CGF, "member function pointers");
370}
371
John McCalle9fd7eb2010-08-22 08:30:07 +0000372llvm::Value *
373CGCXXABI::EmitMemberFunctionPointerComparison(CodeGenFunction &CGF,
374 llvm::Value *L,
375 llvm::Value *R,
376 const MemberPointerType *MPT,
377 bool Inequality) {
378 ErrorUnsupportedABI(CGF, "member function pointer comparison");
379 return CGF.Builder.getFalse();
380}
381
382llvm::Value *
383CGCXXABI::EmitMemberFunctionPointerIsNotNull(CodeGenFunction &CGF,
384 llvm::Value *MemPtr,
385 const MemberPointerType *MPT) {
386 ErrorUnsupportedABI(CGF, "member function pointer null testing");
387 return CGF.Builder.getFalse();
388}
389
John McCallcf2c85e2010-08-22 04:16:24 +0000390llvm::Constant *
391CGCXXABI::EmitMemberFunctionPointerConversion(llvm::Constant *C,
392 const CastExpr *E) {
393 return 0;
394}
395
396llvm::Constant *
397CGCXXABI::EmitNullMemberFunctionPointer(const MemberPointerType *MPT) {
398 return 0;
399}
400
John McCall875ab102010-08-22 06:43:33 +0000401llvm::Constant *CGCXXABI::EmitMemberFunctionPointer(const CXXMethodDecl *MD) {
402 return 0;
403}
404
John McCallcf2c85e2010-08-22 04:16:24 +0000405bool CGCXXABI::RequiresNonZeroInitializer(QualType T) {
406 return false;
407}
408
409bool CGCXXABI::RequiresNonZeroInitializer(const CXXRecordDecl *D) {
410 return RequiresNonZeroInitializer(QualType(D->getTypeForDecl(), 0));
John McCall3023def2010-08-22 03:04:22 +0000411}