lur*_*her 5 c++ exception llvm
我在http://llvm.org/demo中运行以下代码片段:
class X { public: ~X() __attribute((nothrow)); };
void a(X* p);
void nothr() throw();
void b() { try { X x; a(&x); } catch (X* foo) { nothr(); } }
Run Code Online (Sandbox Code Playgroud)
我看到一些调用(例如,对 func_llvm_eh_typeid_for)设置了 Attribute::NoUnwind:
CallInst* int32_71 = CallInst::Create(func_llvm_eh_typeid_for, const_ptr_43, "", label_49);
int32_71->setCallingConv(CallingConv::C);
int32_71->setTailCall(false);
AttrListPtr int32_71_PAL;
{
SmallVector<AttributeWithIndex, 4> Attrs;
AttributeWithIndex PAWI;
PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind;
Attrs.push_back(PAWI);
int32_71_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
}
int32_71->setAttributes(int32_71_PAL);
Run Code Online (Sandbox Code Playgroud)
由于此调用是使用 CallInst 而不是 InvokeInst 创建的,因此我认为调用本身不能抛出异常,因此我想知道在此上下文中 Unwind 属性的用途是什么?
| 归档时间: |
|
| 查看次数: |
2188 次 |
| 最近记录: |