<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 13, 2015 at 3:36 AM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@gmail.com" target="_blank">chandlerc@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: chandlerc<br>
Date: Tue Jan 13 05:36:43 2015<br>
New Revision: 225785<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=225785&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=225785&view=rev</a><br>
Log:<br>
[PM] In the PassManager template, remove a pointless indirection through<br>
a nested class template for the PassModel, and use the T-suffix for the<br>
two typedefs to match the code in the AnalysisManager.<br>
<br>
This is the last of the fairly fundamental code cleanups here. Will be<br>
focusing on the printing of analyses next to finish that aspect off.<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/IR/PassManager.h<br>
<br>
Modified: llvm/trunk/include/llvm/IR/PassManager.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=225785&r1=225784&r2=225785&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=225785&r1=225784&r2=225785&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/IR/PassManager.h (original)<br>
+++ llvm/trunk/include/llvm/IR/PassManager.h Tue Jan 13 05:36:43 2015<br>
@@ -236,24 +236,19 @@ public:<br>
   }<br>
<br>
   template <typename PassT> void addPass(PassT Pass) {<br>
-    Passes.emplace_back(new PassModel<PassT>(std::move(Pass)));<br>
+    typedef detail::PassModel<IRUnitT, PassT> PassModelT;<br>
+    Passes.emplace_back(new PassModelT(std::move(Pass)));<br></blockquote><div><br>Generally I prefer to avoid raw 'new' because it makes me think harder about the code - but perhaps there's something I'm missing (PassModelT private/protected in some way?) that makes this preferable over push_back(make_unique<PassModelT>(...)) - or just avoiding the extra move?<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
   }<br>
<br>
   static StringRef name() { return "PassManager"; }<br>
<br>
 private:<br>
-  // Pull in the concept type and model template specialized for modules.<br>
-  typedef detail::PassConcept<IRUnitT> PassConcept;<br>
-  template <typename PassT><br>
-  struct PassModel : detail::PassModel<IRUnitT, PassT> {<br>
-    PassModel(PassT Pass)<br>
-        : detail::PassModel<IRUnitT, PassT>(std::move(Pass)) {}<br>
-  };<br>
+  typedef detail::PassConcept<IRUnitT> PassConceptT;<br>
<br>
   PassManager(const PassManager &) LLVM_DELETED_FUNCTION;<br>
   PassManager &operator=(const PassManager &) LLVM_DELETED_FUNCTION;<br>
<br>
-  std::vector<std::unique_ptr<PassConcept>> Passes;<br>
+  std::vector<std::unique_ptr<PassConceptT>> Passes;<br>
 };<br>
<br>
 /// \brief Convenience typedef for a pass manager over modules.<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>