[llvm] r245011 - [PM/AA] Hoist the value handle definition for CFLAA into the header to

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 19:50:34 PDT 2015


Author: chandlerc
Date: Thu Aug 13 21:50:34 2015
New Revision: 245011

URL: http://llvm.org/viewvc/llvm-project?rev=245011&view=rev
Log:
[PM/AA] Hoist the value handle definition for CFLAA into the header to
satisfy libc++'s std::forward_list which requires the value type to be
complete.

Modified:
    llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h
    llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp

Modified: llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h?rev=245011&r1=245010&r2=245011&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h Thu Aug 13 21:50:34 2015
@@ -20,6 +20,7 @@
 #include "llvm/ADT/Optional.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
 #include <forward_list>
 
@@ -27,7 +28,27 @@ namespace llvm {
 
 class CFLAliasAnalysis : public ImmutablePass, public AliasAnalysis {
   struct FunctionInfo;
-  struct FunctionHandle;
+
+  struct FunctionHandle final : public CallbackVH {
+    FunctionHandle(Function *Fn, CFLAliasAnalysis *CFLAA)
+        : CallbackVH(Fn), CFLAA(CFLAA) {
+      assert(Fn != nullptr);
+      assert(CFLAA != nullptr);
+    }
+
+    void deleted() override { removeSelfFromCache(); }
+    void allUsesReplacedWith(Value *) override { removeSelfFromCache(); }
+
+  private:
+    CFLAliasAnalysis *CFLAA;
+
+    void removeSelfFromCache() {
+      assert(CFLAA != nullptr);
+      auto *Val = getValPtr();
+      CFLAA->evict(cast<Function>(Val));
+      setValPtr(nullptr);
+    }
+  };
 
   /// \brief Cached mapping of Functions to their StratifiedSets.
   /// If a function's sets are currently being built, it is marked

Modified: llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp?rev=245011&r1=245010&r2=245011&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp Thu Aug 13 21:50:34 2015
@@ -38,7 +38,6 @@
 #include "llvm/IR/Function.h"
 #include "llvm/IR/InstVisitor.h"
 #include "llvm/IR/Instructions.h"
-#include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Compiler.h"
@@ -74,27 +73,6 @@ struct CFLAliasAnalysis::FunctionInfo {
       : Sets(std::move(S)), ReturnedValues(std::move(RV)) {}
 };
 
-struct CFLAliasAnalysis::FunctionHandle final : public CallbackVH {
-  FunctionHandle(Function *Fn, CFLAliasAnalysis *CFLAA)
-      : CallbackVH(Fn), CFLAA(CFLAA) {
-    assert(Fn != nullptr);
-    assert(CFLAA != nullptr);
-  }
-
-  void deleted() override { removeSelfFromCache(); }
-  void allUsesReplacedWith(Value *) override { removeSelfFromCache(); }
-
-private:
-  CFLAliasAnalysis *CFLAA;
-
-  void removeSelfFromCache() {
-    assert(CFLAA != nullptr);
-    auto *Val = getValPtr();
-    CFLAA->evict(cast<Function>(Val));
-    setValPtr(nullptr);
-  }
-};
-
 CFLAliasAnalysis::CFLAliasAnalysis() : ImmutablePass(ID) {
   initializeCFLAliasAnalysisPass(*PassRegistry::getPassRegistry());
 }




More information about the llvm-commits mailing list