c – llvm属性:: NoUnwind
发布时间:2020-12-16 07:27:12 所属栏目:百科 来源:网络整理
导读:我正在 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(); } } 我看到一些调用(例如,func_llvm_eh_typeid_for)设置了
我正在
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(); } } 我看到一些调用(例如,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); 由于这个调用是用CallInst而不是InvokeInst创建的,所以我认为调用本身不能抛出,所以它让我想知道在这种情况下Unwind属性的用途是什么? 解决方法
这意味着您不必担心生成异常处理代码或进行优化,就好像异常可以通过该代码段传播,因为您已经说过它没有.如果有人碰巧遇到那么它应该正确传播到程序中的下一个堆栈帧.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |