summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-09-17 04:58:43 +0000
committerChris Lattner <sabre@nondot.org>2003-09-17 04:58:43 +0000
commit0c448e58d346201d91767ee27423931101132c9d (patch)
tree473fcb4dcab5aa11ce33c8abe37862dd8a1ec167 /include
parentdabaf7de39cd42f9a249ec094349fb58ee7b4377 (diff)
downloadllvm-0c448e58d346201d91767ee27423931101132c9d.tar.gz
llvm-0c448e58d346201d91767ee27423931101132c9d.tar.bz2
llvm-0c448e58d346201d91767ee27423931101132c9d.tar.xz
Add new deleteBody method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8571 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Function.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index abf381916e..5c466e17b3 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -97,6 +97,13 @@ public:
unsigned getIntrinsicID() const;
bool isIntrinsic() const { return getIntrinsicID() != 0; }
+ /// deleteBody - This method deletes the body of the function, and converts
+ /// the linkage to external.
+ void deleteBody() {
+ dropAllReferences();
+ setLinkage(ExternalLinkage);
+ }
+
// getNext/Prev - Return the next or previous function in the list. These
// methods should never be used directly, and are only used to implement the
// function list as part of the module.
@@ -175,14 +182,18 @@ public:
return V->getValueType() == Value::FunctionVal;
}
- /// dropAllReferences() - This function causes all the subinstructions to "let
+ /// dropAllReferences() - This method causes all the subinstructions to "let
/// go" of all references that they are maintaining. This allows one to
- /// 'delete' a whole class at a time, even though there may be circular
+ /// 'delete' a whole module at a time, even though there may be circular
/// references... first all references are dropped, and all use counts go to
/// zero. Then everything is delete'd for real. Note that no operations are
/// valid on an object that has "dropped all references", except operator
/// delete.
///
+ /// Since no other object in the module can have references into the body of a
+ /// function, dropping all references deletes the entire body of the function,
+ /// including any contained basic blocks.
+ ///
void dropAllReferences();
};