More compiler workarounds. I have to admit that I was not

expecting so much concentrated oddity on what seemed like a
trivial feature.  Thanks to François Pichet for doing the
MSVC legwork here.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134813 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
John McCall 2011-07-09 09:09:00 +00:00
Родитель f0733249ff
Коммит 0850e8d1b0
1 изменённых файлов: 14 добавлений и 4 удалений

Просмотреть файл

@ -1099,13 +1099,23 @@ void CodeGenFunction::EmitAutoVarCleanups(const AutoVarEmission &emission) {
CodeGenFunction::Destroyer &
CodeGenFunction::getDestroyer(QualType::DestructionKind kind) {
// GCC 4.2 requires the *& on these function references.
// This is surprisingly compiler-dependent. GCC 4.2 can't bind
// references to functions directly in returns, and using '*&foo'
// confuses MSVC. Luckily, the following code pattern works in both.
Destroyer *destroyer = 0;
switch (kind) {
case QualType::DK_none: llvm_unreachable("no destroyer for trivial dtor");
case QualType::DK_cxx_destructor: return *&destroyCXXObject;
case QualType::DK_objc_strong_lifetime: return *&destroyARCStrongPrecise;
case QualType::DK_objc_weak_lifetime: return *&destroyARCWeak;
case QualType::DK_cxx_destructor:
destroyer = &destroyCXXObject;
break;
case QualType::DK_objc_strong_lifetime:
destroyer = &destroyARCStrongPrecise;
break;
case QualType::DK_objc_weak_lifetime:
destroyer = &destroyARCWeak;
break;
}
return *destroyer;
}
void CodeGenFunction::pushDestroy(CleanupKind cleanupKind, llvm::Value *addr,