diff options
author | Dan Gohman <gohman@apple.com> | 2008-07-25 00:36:05 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-07-25 00:36:05 +0000 |
commit | 219c7905c503ece263bb755479edc16430870e83 (patch) | |
tree | 3794a86897ed386f78f67cd9ae8d4a52ebe45601 /include/llvm/CodeGen/MachineFunction.h | |
parent | 8b4588fa64f0ebfbb7d2b9b4af8c682ddddf29c0 (diff) |
Apply a patch from Mahadevan R, with minor formatting changes, to
workaround a GCC 3.3 bug observed on OpenBSD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54002 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineFunction.h')
-rw-r--r-- | include/llvm/CodeGen/MachineFunction.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h index 2fbe9b803e..98f3a94839 100644 --- a/include/llvm/CodeGen/MachineFunction.h +++ b/include/llvm/CodeGen/MachineFunction.h @@ -136,7 +136,13 @@ public: /// template<typename Ty> Ty *getInfo() { - if (!MFInfo) MFInfo = new (Allocator.Allocate<Ty>()) Ty(*this); + if (!MFInfo) { + // This should be just `new (Allocator.Allocate<Ty>()) Ty(*this)', but + // that apparently breaks GCC 3.3. + Ty *Loc = static_cast<Ty*>(Allocator.Allocate(sizeof(Ty), + AlignOf<Ty>::Alignment)); + MFInfo = new (Loc) Ty(*this); + } assert((void*)dynamic_cast<Ty*>(MFInfo) == (void*)MFInfo && "Invalid concrete type or multiple inheritence for getInfo"); |