[LLVMdev] question

Bill? Wendling wendling at isanbard.org
Sat Nov 16 14:41:01 PST 2002

Also sprach Xiaodong Li:
} When I tried to compile the program, I got this error:
} ../../../include/llvm/Analysis/DSGraph.h: In member function `virtual bool
}    <unnamed>::GlobalMemLeakage::run(Module&)':
} ../../../include/llvm/Analysis/DSGraph.h:38: `void
} DSGraph::operator=(const
}    DSGraph&)' is private
} MemLeakage.cpp:87: within this context
} gmake: *** [Debug/MemLeakage.o] Error 1
} I don't understand what this means. Basically what I did is I defined:
} map<Function *, DSGraph> funsetmap;
} and I was trying to assign the DSGraph for each function to the map.
} funsetmap[&F] = dsg;
} Could you tell me what's wrong how to fix this?
You're invoking the copy constructor in this code snippet:

    funsetmap[&F] = dsg;

That is, the copy constructor for dsg (which I take to be a DSGraph
object). Ways around this:

    - Store a pointer to DSGraph instead of the DSGraph object. So
      something like this:

        map<Function *, DSGraph *> funsetmap;

        // code

        funsetmap[&F] = &dsg;

      You have to be careful not to store local variables and pass them
      back from a function, of course.

    - Create a wrapper class for DSGraph and have its copy constructor
      clone the DSGraph object for you. This way is a bit more
      complicated and might not really be necessary for what you need to
      do though...

|| Bill Wendling           "A computer without a Microsoft operating
|| wendling at isanbard.org    system is like a dog without bricks tied
||                          to its head."   -- Anonymous

More information about the llvm-dev mailing list