From b011c66da4412327619352f2b4a625b574b592b1 Mon Sep 17 00:00:00 2001 From: Tanya Lattner Date: Wed, 20 Jun 2007 18:33:15 +0000 Subject: [PATCH] Add blurb on deleting global variables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37674 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/ProgrammersManual.html | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html index 347861e9638..571d4ba27af 100644 --- a/docs/ProgrammersManual.html +++ b/docs/ProgrammersManual.html @@ -106,6 +106,7 @@ use-def chains
  • Deleting Instructions
  • Replacing an Instruction with another Value
  • +
  • Deleting GlobalVariables
  • + +
    + Deleting GlobalVariables +
    + +
    + +

    Deleting a global variable from a module is similar to deleting an +instruction. First, you must have a pointer to the global variable that you wish + to delete. Second, you must have a pointer to the module the global variable + belongs to. You use the pointer to the module to get its list of global + variables and then use the erase function to remove your global variable. + For example:

    + +
    +
    +GlobalVariable *GV = .. ;
    +Module *M = GV->getParent();
    +
    +M->getGlobaleList().erase(GV);
    +
    +
    + +
    +
    Advanced Topics