aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r--lib/VMCore/Instructions.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 3531bad2e4..b76b11d4f6 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -71,6 +71,12 @@ bool CallSite::doesNotThrow() const {
else
return cast<InvokeInst>(I)->doesNotThrow();
}
+void CallSite::setDoesNotThrow(bool doesNotThrow) {
+ if (CallInst *CI = dyn_cast<CallInst>(I))
+ CI->setDoesNotThrow(doesNotThrow);
+ else
+ cast<InvokeInst>(I)->setDoesNotThrow(doesNotThrow);
+}
//===----------------------------------------------------------------------===//
// TerminatorInst Class
@@ -405,6 +411,15 @@ bool CallInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
return false;
}
+void CallInst::setDoesNotThrow(bool doesNotThrow) {
+ const ParamAttrsList *PAL = getParamAttrs();
+ if (doesNotThrow)
+ PAL = ParamAttrsList::includeAttrs(PAL, 0, ParamAttr::NoUnwind);
+ else
+ PAL = ParamAttrsList::excludeAttrs(PAL, 0, ParamAttr::NoUnwind);
+ setParamAttrs(PAL);
+}
+
//===----------------------------------------------------------------------===//
// InvokeInst Implementation
@@ -483,6 +498,15 @@ bool InvokeInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
return false;
}
+void InvokeInst::setDoesNotThrow(bool doesNotThrow) {
+ const ParamAttrsList *PAL = getParamAttrs();
+ if (doesNotThrow)
+ PAL = ParamAttrsList::includeAttrs(PAL, 0, ParamAttr::NoUnwind);
+ else
+ PAL = ParamAttrsList::excludeAttrs(PAL, 0, ParamAttr::NoUnwind);
+ setParamAttrs(PAL);
+}
+
//===----------------------------------------------------------------------===//
// ReturnInst Implementation