зеркало из https://github.com/microsoft/clang-1.git
Revert the ctor/dtor alias optimization for now; the buildbots can detect
some failure here that I can't. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96612 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
b372b0ff1f
Коммит
8e51a1f5da
|
@ -26,88 +26,17 @@
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
using namespace CodeGen;
|
using namespace CodeGen;
|
||||||
|
|
||||||
/// Try to emit a definition as a global alias for another definition.
|
|
||||||
bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl,
|
|
||||||
GlobalDecl TargetDecl) {
|
|
||||||
// Find the referrent.
|
|
||||||
llvm::GlobalValue *Ref = cast<llvm::GlobalValue>(GetAddrOfGlobal(TargetDecl));
|
|
||||||
|
|
||||||
// Look for an existing entry.
|
|
||||||
const char *MangledName = getMangledName(AliasDecl);
|
|
||||||
llvm::GlobalValue *&Entry = GlobalDeclMap[MangledName];
|
|
||||||
if (Entry) {
|
|
||||||
assert(Entry->isDeclaration() && "definition already exists for alias");
|
|
||||||
assert(Entry->getType() == Ref->getType() &&
|
|
||||||
"declaration exists with different type");
|
|
||||||
}
|
|
||||||
|
|
||||||
// The alias will use the linkage of the referrent. If we can't
|
|
||||||
// support aliases with that linkage, fail.
|
|
||||||
llvm::GlobalValue::LinkageTypes Linkage
|
|
||||||
= getFunctionLinkage(cast<FunctionDecl>(AliasDecl.getDecl()));
|
|
||||||
|
|
||||||
switch (Linkage) {
|
|
||||||
// We can definitely emit aliases to definitions with external linkage.
|
|
||||||
case llvm::GlobalValue::ExternalLinkage:
|
|
||||||
case llvm::GlobalValue::ExternalWeakLinkage:
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Same with local linkage.
|
|
||||||
case llvm::GlobalValue::InternalLinkage:
|
|
||||||
case llvm::GlobalValue::PrivateLinkage:
|
|
||||||
case llvm::GlobalValue::LinkerPrivateLinkage:
|
|
||||||
break;
|
|
||||||
|
|
||||||
// We should try to support linkonce linkages.
|
|
||||||
case llvm::GlobalValue::LinkOnceAnyLinkage:
|
|
||||||
case llvm::GlobalValue::LinkOnceODRLinkage:
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Other linkages will probably never be supported.
|
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the alias with no name.
|
|
||||||
llvm::GlobalAlias *Alias =
|
|
||||||
new llvm::GlobalAlias(Ref->getType(), Linkage, "", Ref, &getModule());
|
|
||||||
|
|
||||||
// Switch any previous uses to the alias and continue.
|
|
||||||
if (Entry) {
|
|
||||||
Entry->replaceAllUsesWith(Alias);
|
|
||||||
Entry->eraseFromParent();
|
|
||||||
}
|
|
||||||
Entry = Alias;
|
|
||||||
|
|
||||||
// Finally, set up the alias with its proper name and attributes.
|
|
||||||
Alias->setName(MangledName);
|
|
||||||
SetCommonAttributes(AliasDecl.getDecl(), Alias);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CodeGenModule::EmitCXXConstructors(const CXXConstructorDecl *D) {
|
void CodeGenModule::EmitCXXConstructors(const CXXConstructorDecl *D) {
|
||||||
// The constructor used for constructing this as a base class;
|
|
||||||
// ignores virtual bases.
|
|
||||||
EmitGlobal(GlobalDecl(D, Ctor_Base));
|
|
||||||
|
|
||||||
// The constructor used for constructing this as a complete class;
|
|
||||||
// constucts the virtual bases, then calls the base constructor.
|
|
||||||
EmitGlobal(GlobalDecl(D, Ctor_Complete));
|
EmitGlobal(GlobalDecl(D, Ctor_Complete));
|
||||||
|
EmitGlobal(GlobalDecl(D, Ctor_Base));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeGenModule::EmitCXXConstructor(const CXXConstructorDecl *D,
|
void CodeGenModule::EmitCXXConstructor(const CXXConstructorDecl *D,
|
||||||
CXXCtorType Type) {
|
CXXCtorType Type) {
|
||||||
// The complete constructor is equivalent to the base constructor
|
|
||||||
// for classes with no virtual bases. Try to emit it as an alias.
|
|
||||||
if (Type == Ctor_Complete &&
|
|
||||||
!D->getParent()->getNumVBases() &&
|
|
||||||
!TryEmitDefinitionAsAlias(GlobalDecl(D, Ctor_Complete),
|
|
||||||
GlobalDecl(D, Ctor_Base)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
llvm::Function *Fn = cast<llvm::Function>(GetAddrOfCXXConstructor(D, Type));
|
llvm::Function *Fn = GetAddrOfCXXConstructor(D, Type);
|
||||||
|
|
||||||
CodeGenFunction(*this).GenerateCode(GlobalDecl(D, Type), Fn);
|
CodeGenFunction(*this).GenerateCode(GlobalDecl(D, Type), Fn);
|
||||||
|
|
||||||
|
@ -115,17 +44,15 @@ void CodeGenModule::EmitCXXConstructor(const CXXConstructorDecl *D,
|
||||||
SetLLVMFunctionAttributesForDefinition(D, Fn);
|
SetLLVMFunctionAttributesForDefinition(D, Fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::GlobalValue *
|
llvm::Function *
|
||||||
CodeGenModule::GetAddrOfCXXConstructor(const CXXConstructorDecl *D,
|
CodeGenModule::GetAddrOfCXXConstructor(const CXXConstructorDecl *D,
|
||||||
CXXCtorType Type) {
|
CXXCtorType Type) {
|
||||||
const char *Name = getMangledCXXCtorName(D, Type);
|
|
||||||
if (llvm::GlobalValue *V = GlobalDeclMap[Name])
|
|
||||||
return V;
|
|
||||||
|
|
||||||
const FunctionProtoType *FPT = D->getType()->getAs<FunctionProtoType>();
|
const FunctionProtoType *FPT = D->getType()->getAs<FunctionProtoType>();
|
||||||
const llvm::FunctionType *FTy =
|
const llvm::FunctionType *FTy =
|
||||||
getTypes().GetFunctionType(getTypes().getFunctionInfo(D, Type),
|
getTypes().GetFunctionType(getTypes().getFunctionInfo(D, Type),
|
||||||
FPT->isVariadic());
|
FPT->isVariadic());
|
||||||
|
|
||||||
|
const char *Name = getMangledCXXCtorName(D, Type);
|
||||||
return cast<llvm::Function>(
|
return cast<llvm::Function>(
|
||||||
GetOrCreateLLVMFunction(Name, FTy, GlobalDecl(D, Type)));
|
GetOrCreateLLVMFunction(Name, FTy, GlobalDecl(D, Type)));
|
||||||
}
|
}
|
||||||
|
@ -140,32 +67,15 @@ const char *CodeGenModule::getMangledCXXCtorName(const CXXConstructorDecl *D,
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeGenModule::EmitCXXDestructors(const CXXDestructorDecl *D) {
|
void CodeGenModule::EmitCXXDestructors(const CXXDestructorDecl *D) {
|
||||||
// The destructor used for destructing this as a base class; ignores
|
|
||||||
// virtual bases.
|
|
||||||
EmitGlobal(GlobalDecl(D, Dtor_Base));
|
|
||||||
|
|
||||||
// The destructor used for destructing this as a most-derived class;
|
|
||||||
// call the base destructor and then destructs any virtual bases.
|
|
||||||
EmitGlobal(GlobalDecl(D, Dtor_Complete));
|
|
||||||
|
|
||||||
// The destructor in a virtual table is always a 'deleting'
|
|
||||||
// destructor, which calls the complete destructor and then uses the
|
|
||||||
// appropriate operator delete.
|
|
||||||
if (D->isVirtual())
|
if (D->isVirtual())
|
||||||
EmitGlobal(GlobalDecl(D, Dtor_Deleting));
|
EmitGlobal(GlobalDecl(D, Dtor_Deleting));
|
||||||
|
EmitGlobal(GlobalDecl(D, Dtor_Complete));
|
||||||
|
EmitGlobal(GlobalDecl(D, Dtor_Base));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeGenModule::EmitCXXDestructor(const CXXDestructorDecl *D,
|
void CodeGenModule::EmitCXXDestructor(const CXXDestructorDecl *D,
|
||||||
CXXDtorType Type) {
|
CXXDtorType Type) {
|
||||||
// The complete destructor is equivalent to the base destructor for
|
llvm::Function *Fn = GetAddrOfCXXDestructor(D, Type);
|
||||||
// classes with no virtual bases, so try to emit it as an alias.
|
|
||||||
if (Type == Dtor_Complete &&
|
|
||||||
!D->getParent()->getNumVBases() &&
|
|
||||||
!TryEmitDefinitionAsAlias(GlobalDecl(D, Dtor_Complete),
|
|
||||||
GlobalDecl(D, Dtor_Base)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
llvm::Function *Fn = cast<llvm::Function>(GetAddrOfCXXDestructor(D, Type));
|
|
||||||
|
|
||||||
CodeGenFunction(*this).GenerateCode(GlobalDecl(D, Type), Fn);
|
CodeGenFunction(*this).GenerateCode(GlobalDecl(D, Type), Fn);
|
||||||
|
|
||||||
|
@ -173,16 +83,13 @@ void CodeGenModule::EmitCXXDestructor(const CXXDestructorDecl *D,
|
||||||
SetLLVMFunctionAttributesForDefinition(D, Fn);
|
SetLLVMFunctionAttributesForDefinition(D, Fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::GlobalValue *
|
llvm::Function *
|
||||||
CodeGenModule::GetAddrOfCXXDestructor(const CXXDestructorDecl *D,
|
CodeGenModule::GetAddrOfCXXDestructor(const CXXDestructorDecl *D,
|
||||||
CXXDtorType Type) {
|
CXXDtorType Type) {
|
||||||
const char *Name = getMangledCXXDtorName(D, Type);
|
|
||||||
if (llvm::GlobalValue *V = GlobalDeclMap[Name])
|
|
||||||
return V;
|
|
||||||
|
|
||||||
const llvm::FunctionType *FTy =
|
const llvm::FunctionType *FTy =
|
||||||
getTypes().GetFunctionType(getTypes().getFunctionInfo(D, Type), false);
|
getTypes().GetFunctionType(getTypes().getFunctionInfo(D, Type), false);
|
||||||
|
|
||||||
|
const char *Name = getMangledCXXDtorName(D, Type);
|
||||||
return cast<llvm::Function>(
|
return cast<llvm::Function>(
|
||||||
GetOrCreateLLVMFunction(Name, FTy, GlobalDecl(D, Type)));
|
GetOrCreateLLVMFunction(Name, FTy, GlobalDecl(D, Type)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,20 +316,24 @@ GetLinkageForFunction(ASTContext &Context, const FunctionDecl *FD,
|
||||||
return CodeGenModule::GVA_CXXInline;
|
return CodeGenModule::GVA_CXXInline;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::GlobalValue::LinkageTypes
|
/// SetFunctionDefinitionAttributes - Set attributes for a global.
|
||||||
CodeGenModule::getFunctionLinkage(const FunctionDecl *D) {
|
///
|
||||||
|
/// FIXME: This is currently only done for aliases and functions, but not for
|
||||||
|
/// variables (these details are set in EmitGlobalVarDefinition for variables).
|
||||||
|
void CodeGenModule::SetFunctionDefinitionAttributes(const FunctionDecl *D,
|
||||||
|
llvm::GlobalValue *GV) {
|
||||||
GVALinkage Linkage = GetLinkageForFunction(getContext(), D, Features);
|
GVALinkage Linkage = GetLinkageForFunction(getContext(), D, Features);
|
||||||
|
|
||||||
if (Linkage == GVA_Internal) {
|
if (Linkage == GVA_Internal) {
|
||||||
return llvm::Function::InternalLinkage;
|
GV->setLinkage(llvm::Function::InternalLinkage);
|
||||||
} else if (D->hasAttr<DLLExportAttr>()) {
|
} else if (D->hasAttr<DLLExportAttr>()) {
|
||||||
return llvm::Function::DLLExportLinkage;
|
GV->setLinkage(llvm::Function::DLLExportLinkage);
|
||||||
} else if (D->hasAttr<WeakAttr>()) {
|
} else if (D->hasAttr<WeakAttr>()) {
|
||||||
return llvm::Function::WeakAnyLinkage;
|
GV->setLinkage(llvm::Function::WeakAnyLinkage);
|
||||||
} else if (Linkage == GVA_C99Inline) {
|
} else if (Linkage == GVA_C99Inline) {
|
||||||
// In C99 mode, 'inline' functions are guaranteed to have a strong
|
// In C99 mode, 'inline' functions are guaranteed to have a strong
|
||||||
// definition somewhere else, so we can use available_externally linkage.
|
// definition somewhere else, so we can use available_externally linkage.
|
||||||
return llvm::Function::AvailableExternallyLinkage;
|
GV->setLinkage(llvm::Function::AvailableExternallyLinkage);
|
||||||
} else if (Linkage == GVA_CXXInline || Linkage == GVA_TemplateInstantiation) {
|
} else if (Linkage == GVA_CXXInline || Linkage == GVA_TemplateInstantiation) {
|
||||||
// In C++, the compiler has to emit a definition in every translation unit
|
// In C++, the compiler has to emit a definition in every translation unit
|
||||||
// that references the function. We should use linkonce_odr because
|
// that references the function. We should use linkonce_odr because
|
||||||
|
@ -337,22 +341,13 @@ CodeGenModule::getFunctionLinkage(const FunctionDecl *D) {
|
||||||
// don't need to codegen it. b) if the function persists, it needs to be
|
// don't need to codegen it. b) if the function persists, it needs to be
|
||||||
// merged with other definitions. c) C++ has the ODR, so we know the
|
// merged with other definitions. c) C++ has the ODR, so we know the
|
||||||
// definition is dependable.
|
// definition is dependable.
|
||||||
return llvm::Function::LinkOnceODRLinkage;
|
GV->setLinkage(llvm::Function::LinkOnceODRLinkage);
|
||||||
} else {
|
} else {
|
||||||
assert(Linkage == GVA_StrongExternal);
|
assert(Linkage == GVA_StrongExternal);
|
||||||
// Otherwise, we have strong external linkage.
|
// Otherwise, we have strong external linkage.
|
||||||
return llvm::Function::ExternalLinkage;
|
GV->setLinkage(llvm::Function::ExternalLinkage);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// SetFunctionDefinitionAttributes - Set attributes for a global.
|
|
||||||
///
|
|
||||||
/// FIXME: This is currently only done for aliases and functions, but not for
|
|
||||||
/// variables (these details are set in EmitGlobalVarDefinition for variables).
|
|
||||||
void CodeGenModule::SetFunctionDefinitionAttributes(const FunctionDecl *D,
|
|
||||||
llvm::GlobalValue *GV) {
|
|
||||||
GV->setLinkage(getFunctionLinkage(D));
|
|
||||||
SetCommonAttributes(D, GV);
|
SetCommonAttributes(D, GV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,19 +206,6 @@ public:
|
||||||
/// GlobalValue.
|
/// GlobalValue.
|
||||||
void setGlobalVisibility(llvm::GlobalValue *GV, const Decl *D) const;
|
void setGlobalVisibility(llvm::GlobalValue *GV, const Decl *D) const;
|
||||||
|
|
||||||
llvm::Constant *GetAddrOfGlobal(GlobalDecl GD) {
|
|
||||||
if (isa<CXXConstructorDecl>(GD.getDecl()))
|
|
||||||
return GetAddrOfCXXConstructor(cast<CXXConstructorDecl>(GD.getDecl()),
|
|
||||||
GD.getCtorType());
|
|
||||||
else if (isa<CXXDestructorDecl>(GD.getDecl()))
|
|
||||||
return GetAddrOfCXXDestructor(cast<CXXDestructorDecl>(GD.getDecl()),
|
|
||||||
GD.getDtorType());
|
|
||||||
else if (isa<FunctionDecl>(GD.getDecl()))
|
|
||||||
return GetAddrOfFunction(GD);
|
|
||||||
else
|
|
||||||
return GetAddrOfGlobalVar(cast<VarDecl>(GD.getDecl()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// GetAddrOfGlobalVar - Return the llvm::Constant for the address of the
|
/// GetAddrOfGlobalVar - Return the llvm::Constant for the address of the
|
||||||
/// given global variable. If Ty is non-null and if the global doesn't exist,
|
/// given global variable. If Ty is non-null and if the global doesn't exist,
|
||||||
/// then it will be greated with the specified type instead of whatever the
|
/// then it will be greated with the specified type instead of whatever the
|
||||||
|
@ -304,13 +291,13 @@ public:
|
||||||
|
|
||||||
/// GetAddrOfCXXConstructor - Return the address of the constructor of the
|
/// GetAddrOfCXXConstructor - Return the address of the constructor of the
|
||||||
/// given type.
|
/// given type.
|
||||||
llvm::GlobalValue *GetAddrOfCXXConstructor(const CXXConstructorDecl *D,
|
llvm::Function *GetAddrOfCXXConstructor(const CXXConstructorDecl *D,
|
||||||
CXXCtorType Type);
|
CXXCtorType Type);
|
||||||
|
|
||||||
/// GetAddrOfCXXDestructor - Return the address of the constructor of the
|
/// GetAddrOfCXXDestructor - Return the address of the constructor of the
|
||||||
/// given type.
|
/// given type.
|
||||||
llvm::GlobalValue *GetAddrOfCXXDestructor(const CXXDestructorDecl *D,
|
llvm::Function *GetAddrOfCXXDestructor(const CXXDestructorDecl *D,
|
||||||
CXXDtorType Type);
|
CXXDtorType Type);
|
||||||
|
|
||||||
/// getBuiltinLibFunction - Given a builtin id for a function like
|
/// getBuiltinLibFunction - Given a builtin id for a function like
|
||||||
/// "__builtin_fabsf", return a Function* for "fabsf".
|
/// "__builtin_fabsf", return a Function* for "fabsf".
|
||||||
|
@ -430,9 +417,6 @@ public:
|
||||||
GVA_TemplateInstantiation
|
GVA_TemplateInstantiation
|
||||||
};
|
};
|
||||||
|
|
||||||
llvm::GlobalVariable::LinkageTypes
|
|
||||||
getFunctionLinkage(const FunctionDecl *FD);
|
|
||||||
|
|
||||||
/// getVtableLinkage - Return the appropriate linkage for the vtable, VTT,
|
/// getVtableLinkage - Return the appropriate linkage for the vtable, VTT,
|
||||||
/// and type information of the given class.
|
/// and type information of the given class.
|
||||||
static llvm::GlobalVariable::LinkageTypes
|
static llvm::GlobalVariable::LinkageTypes
|
||||||
|
@ -484,8 +468,6 @@ private:
|
||||||
|
|
||||||
// C++ related functions.
|
// C++ related functions.
|
||||||
|
|
||||||
bool TryEmitDefinitionAsAlias(GlobalDecl Alias, GlobalDecl Target);
|
|
||||||
|
|
||||||
void EmitNamespace(const NamespaceDecl *D);
|
void EmitNamespace(const NamespaceDecl *D);
|
||||||
void EmitLinkageSpec(const LinkageSpecDecl *D);
|
void EmitLinkageSpec(const LinkageSpecDecl *D);
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,6 @@ struct B {
|
||||||
B(const A1& = A1(), const A2& = A2());
|
B(const A1& = A1(), const A2& = A2());
|
||||||
};
|
};
|
||||||
|
|
||||||
// CHECK: @_ZN1CC1Ev = alias {{.*}} @_ZN1CC2Ev
|
|
||||||
|
|
||||||
// CHECK: define void @_Z2f1v()
|
// CHECK: define void @_Z2f1v()
|
||||||
void f1() {
|
void f1() {
|
||||||
|
|
||||||
|
@ -44,6 +42,13 @@ struct C {
|
||||||
C();
|
C();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// CHECK: define void @_ZN1CC1Ev(
|
||||||
|
// CHECK: call void @_ZN2A1C1Ev(
|
||||||
|
// CHECK: call void @_ZN2A2C1Ev(
|
||||||
|
// CHECK: call void @_ZN1BC1ERK2A1RK2A2(
|
||||||
|
// CHECK: call void @_ZN2A2D1Ev
|
||||||
|
// CHECK: call void @_ZN2A1D1Ev
|
||||||
|
|
||||||
// CHECK: define void @_ZN1CC2Ev(
|
// CHECK: define void @_ZN1CC2Ev(
|
||||||
// CHECK: call void @_ZN2A1C1Ev(
|
// CHECK: call void @_ZN2A1C1Ev(
|
||||||
// CHECK: call void @_ZN2A2C1Ev(
|
// CHECK: call void @_ZN2A2C1Ev(
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
|
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
|
||||||
|
|
||||||
// CHECK: @_ZNSt1AC1Ev = alias {{.*}} @_ZNSt1AC2Ev
|
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
struct A { A(); };
|
struct A { A(); };
|
||||||
|
|
||||||
|
// CHECK: define void @_ZNSt1AC1Ev
|
||||||
// CHECK: define void @_ZNSt1AC2Ev
|
// CHECK: define void @_ZNSt1AC2Ev
|
||||||
A::A() { }
|
A::A() { }
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,8 +11,6 @@ struct Y { };
|
||||||
//CHECK: @pr5966_i = external global
|
//CHECK: @pr5966_i = external global
|
||||||
//CHECK: @_ZL8pr5966_i = internal global
|
//CHECK: @_ZL8pr5966_i = internal global
|
||||||
|
|
||||||
// CHECK: @_ZN2S7C1Ev = alias {{.*}} @_ZN2S7C2Ev
|
|
||||||
|
|
||||||
// CHECK: define zeroext i1 @_ZplRK1YRA100_P1X
|
// CHECK: define zeroext i1 @_ZplRK1YRA100_P1X
|
||||||
bool operator+(const Y&, X* (&xs)[100]) { return false; }
|
bool operator+(const Y&, X* (&xs)[100]) { return false; }
|
||||||
|
|
||||||
|
@ -221,6 +219,7 @@ struct S7 {
|
||||||
};
|
};
|
||||||
|
|
||||||
// PR5139
|
// PR5139
|
||||||
|
// CHECK: @_ZN2S7C1Ev
|
||||||
// CHECK: @_ZN2S7C2Ev
|
// CHECK: @_ZN2S7C2Ev
|
||||||
// CHECK: @"_ZN2S73$_0C1Ev"
|
// CHECK: @"_ZN2S73$_0C1Ev"
|
||||||
S7::S7() {}
|
S7::S7() {}
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct B {
|
||||||
|
|
||||||
template<typename T> B::B(T) {}
|
template<typename T> B::B(T) {}
|
||||||
|
|
||||||
// CHECK: @_ZN1BC1IiEET_ = alias {{.*}} @_ZN1BC2IiEET_
|
// CHECK: define void @_ZN1BC1IiEET_(%struct.B* %this, i32)
|
||||||
// CHECK: define void @_ZN1BC2IiEET_(%struct.B* %this, i32)
|
// CHECK: define void @_ZN1BC2IiEET_(%struct.B* %this, i32)
|
||||||
template B::B(int);
|
template B::B(int);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ struct A {
|
||||||
A();
|
A();
|
||||||
};
|
};
|
||||||
|
|
||||||
// CHECK: @_ZN1AC1Ev = alias {{.*}} @_ZN1AC2Ev
|
// CHECK: define void @_ZN1AC1Ev(%struct.A* %this)
|
||||||
// CHECK: define void @_ZN1AC2Ev(%struct.A* %this)
|
// CHECK: define void @_ZN1AC2Ev(%struct.A* %this)
|
||||||
A::A() { }
|
A::A() { }
|
||||||
|
|
||||||
|
@ -12,14 +12,14 @@ struct B : virtual A {
|
||||||
B();
|
B();
|
||||||
};
|
};
|
||||||
|
|
||||||
// CHECK: define void @_ZN1BC2Ev(%struct.B* %this, i8** %vtt)
|
|
||||||
// CHECK: define void @_ZN1BC1Ev(%struct.B* %this)
|
// CHECK: define void @_ZN1BC1Ev(%struct.B* %this)
|
||||||
|
// CHECK: define void @_ZN1BC2Ev(%struct.B* %this, i8** %vtt)
|
||||||
B::B() { }
|
B::B() { }
|
||||||
|
|
||||||
struct C : virtual A {
|
struct C : virtual A {
|
||||||
C(bool);
|
C(bool);
|
||||||
};
|
};
|
||||||
|
|
||||||
// CHECK: define void @_ZN1CC2Eb(%struct.B* %this, i8** %vtt, i1 zeroext)
|
|
||||||
// CHECK: define void @_ZN1CC1Eb(%struct.B* %this, i1 zeroext)
|
// CHECK: define void @_ZN1CC1Eb(%struct.B* %this, i1 zeroext)
|
||||||
|
// CHECK: define void @_ZN1CC2Eb(%struct.B* %this, i8** %vtt, i1 zeroext)
|
||||||
C::C(bool) { }
|
C::C(bool) { }
|
||||||
|
|
|
@ -8,8 +8,9 @@ struct B : A {
|
||||||
virtual ~B();
|
virtual ~B();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Complete dtor: just an alias because there are no virtual bases.
|
// Complete dtor: just defers to base dtor because there are no vbases.
|
||||||
// CHECK: @_ZN1BD1Ev = alias {{.*}} @_ZN1BD2Ev
|
// CHECK: define void @_ZN1BD1Ev
|
||||||
|
// CHECK: call void @_ZN1BD2Ev
|
||||||
|
|
||||||
// Deleting dtor: defers to the complete dtor.
|
// Deleting dtor: defers to the complete dtor.
|
||||||
// CHECK: define void @_ZN1BD0Ev
|
// CHECK: define void @_ZN1BD0Ev
|
||||||
|
|
|
@ -19,14 +19,14 @@ struct A : Base {
|
||||||
Field field;
|
Field field;
|
||||||
};
|
};
|
||||||
|
|
||||||
// CHECK: define void @_ZN1AC2Ev(
|
// CHECK: define void @_ZN1AC1Ev(
|
||||||
// CHECK: call void @_ZN4BaseC2Ev(
|
// CHECK: call void @_ZN4BaseC2Ev(
|
||||||
// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1A, i64 0, i64 2)
|
// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1A, i64 0, i64 2)
|
||||||
// CHECK: call void @_ZN5FieldC1Ev(
|
// CHECK: call void @_ZN5FieldC1Ev(
|
||||||
// CHECK: ret void
|
// CHECK: ret void
|
||||||
A::A() { }
|
A::A() { }
|
||||||
|
|
||||||
// CHECK: define void @_ZN1AD2Ev(
|
// CHECK: define void @_ZN1AD1Ev(
|
||||||
// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1A, i64 0, i64 2)
|
// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1A, i64 0, i64 2)
|
||||||
// CHECK: call void @_ZN5FieldD1Ev(
|
// CHECK: call void @_ZN5FieldD1Ev(
|
||||||
// CHECK: call void @_ZN4BaseD2Ev(
|
// CHECK: call void @_ZN4BaseD2Ev(
|
||||||
|
|
Загрузка…
Ссылка в новой задаче