| Index: lib/CodeGen/CodeGenModule.cpp
|
| diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
|
| index 9090ff274fa8e137b21ff928a4141a2274a5f0d6..9ba8396f9edfe286ebc1270e815ba854273e6a53 100644
|
| --- a/lib/CodeGen/CodeGenModule.cpp
|
| +++ b/lib/CodeGen/CodeGenModule.cpp
|
| @@ -793,6 +793,12 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
|
| unsigned alignment = D->getMaxAlignment() / Context.getCharWidth();
|
| if (alignment)
|
| F->setAlignment(alignment);
|
| +
|
| + if (getTarget().getCXXABI().arePointersToMemberFunctionsAligned()) {
|
| + // C++ ABI requires 2-byte alignment for member functions.
|
| + if (F->getAlignment() < 2 && isa<CXXMethodDecl>(D))
|
| + F->setAlignment(2);
|
| + }
|
| }
|
|
|
| void CodeGenModule::SetCommonAttributes(const Decl *D,
|
|
|