aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorDan Gohman <sunfish@mozilla.com>2014-04-25 16:00:38 -0700
committerDan Gohman <sunfish@mozilla.com>2014-04-25 16:00:38 -0700
commit364355da26053c321180fa31ecd731d36c4cffae (patch)
tree36308273d5ec44a8ad508b7726f5ca02cc14d373 /lib/CodeGen/CodeGenModule.cpp
parentad32fdb927a37dba26cb8b56f3a6b11667fe6584 (diff)
Don't align member functions.
Emscripten uses the ARM ABI for pointers to member functions and doesn't require that member functions are aligned.
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 15e4a50eaa..3fb7cba914 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -657,9 +657,11 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
if (alignment)
F->setAlignment(alignment);
- // C++ ABI requires 2-byte alignment for member functions.
- if (F->getAlignment() < 2 && isa<CXXMethodDecl>(D))
- F->setAlignment(2);
+ 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,