[LCG] Fix the bugs that Ben pointed out in code review (and the MSan bot
authorChandler Carruth <chandlerc@gmail.com>
Fri, 18 Apr 2014 20:44:16 +0000 (20:44 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 18 Apr 2014 20:44:16 +0000 (20:44 +0000)
caught). Sad that we don't have warnings for these things, but bleh, no
idea how to fix that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206646 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/LazyCallGraph.cpp

index 229e2c93adea83b32cad4b56a1270a559cb0f6e7..a981dcceaade45a43301ea4fb439edc489d66420 100644 (file)
@@ -65,7 +65,7 @@ LazyCallGraph::Node::Node(LazyCallGraph &G, Function &F)
   findCallees(Worklist, Visited, Callees, CalleeSet);
 }
 
-LazyCallGraph::LazyCallGraph(Module &M) {
+LazyCallGraph::LazyCallGraph(Module &M) : NextDFSNumber(0) {
   for (Function &F : M)
     if (!F.isDeclaration() && !F.hasLocalLinkage())
       if (EntryNodeSet.insert(&F))
@@ -89,16 +89,19 @@ LazyCallGraph::LazyCallGraph(Module &M) {
 }
 
 LazyCallGraph::LazyCallGraph(LazyCallGraph &&G)
-    : BPA(std::move(G.BPA)), EntryNodes(std::move(G.EntryNodes)),
+    : BPA(std::move(G.BPA)), NodeMap(std::move(G.NodeMap)),
+      EntryNodes(std::move(G.EntryNodes)),
       EntryNodeSet(std::move(G.EntryNodeSet)), SCCBPA(std::move(G.SCCBPA)),
       SCCMap(std::move(G.SCCMap)), LeafSCCs(std::move(G.LeafSCCs)),
       DFSStack(std::move(G.DFSStack)),
-      SCCEntryNodes(std::move(G.SCCEntryNodes)) {
+      SCCEntryNodes(std::move(G.SCCEntryNodes)),
+      NextDFSNumber(G.NextDFSNumber) {
   updateGraphPtrs();
 }
 
 LazyCallGraph &LazyCallGraph::operator=(LazyCallGraph &&G) {
   BPA = std::move(G.BPA);
+  NodeMap = std::move(G.NodeMap);
   EntryNodes = std::move(G.EntryNodes);
   EntryNodeSet = std::move(G.EntryNodeSet);
   SCCBPA = std::move(G.SCCBPA);
@@ -106,6 +109,7 @@ LazyCallGraph &LazyCallGraph::operator=(LazyCallGraph &&G) {
   LeafSCCs = std::move(G.LeafSCCs);
   DFSStack = std::move(G.DFSStack);
   SCCEntryNodes = std::move(G.SCCEntryNodes);
+  NextDFSNumber = G.NextDFSNumber;
   updateGraphPtrs();
   return *this;
 }