[llvm-commits] [llvm] r49373 - in /llvm/trunk: include/llvm/Function.h lib/VMCore/Function.cpp
Duncan Sands
baldrick at free.fr
Tue Apr 8 00:23:58 PDT 2008
Author: baldrick
Date: Tue Apr 8 02:23:58 2008
New Revision: 49373
URL: http://llvm.org/viewvc/llvm-project?rev=49373&view=rev
Log:
Convenience method for setting the nounwind
attribute for a function.
Modified:
llvm/trunk/include/llvm/Function.h
llvm/trunk/lib/VMCore/Function.cpp
Modified: llvm/trunk/include/llvm/Function.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=49373&r1=49372&r2=49373&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Function.h (original)
+++ llvm/trunk/include/llvm/Function.h Tue Apr 8 02:23:58 2008
@@ -178,6 +178,7 @@
/// @brief Determine if the function cannot return.
bool doesNotReturn() const { return paramHasAttr(0, ParamAttr::NoReturn); }
+ void setDoesNotThrow(bool doesNotThrow = true);
/// @brief Determine if the function cannot unwind.
bool doesNotThrow() const {
Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=49373&r1=49372&r2=49373&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Tue Apr 8 02:23:58 2008
@@ -219,6 +219,15 @@
BasicBlocks.clear(); // Delete all basic blocks...
}
+void Function::setDoesNotThrow(bool doesNotThrow) {
+ PAListPtr PAL = getParamAttrs();
+ if (doesNotThrow)
+ PAL = PAL.addAttr(0, ParamAttr::NoUnwind);
+ else
+ PAL = PAL.removeAttr(0, ParamAttr::NoUnwind);
+ setParamAttrs(PAL);
+}
+
// Maintain the collector name for each function in an on-the-side table. This
// saves allocating an additional word in Function for programs which do not use
// GC (i.e., most programs) at the cost of increased overhead for clients which
More information about the llvm-commits
mailing list