<div dir="ltr">Thanks. It was clean on a build with clang, but I guess gcc is unhappy.</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 29, 2014 at 6:43 PM, Hans Wennborg <span dir="ltr"><<a href="mailto:hans@hanshq.net" target="_blank">hans@hanshq.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: hans<br>
Date: Sat Nov 29 18:43:50 2014<br>
New Revision: 222970<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=222970&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=222970&view=rev</a><br>
Log:<br>
Revert r222965 "Make MultiClass::DefPrototypes own their Records to fix memory leaks."<br>
<br>
The bots started failing with the error below. I suspect this revision was the cause.<br>
<br>
FAILED: /home/bb/bin/g++47   -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -O3 -DNDEBUG -Ilib/TableGen -I/home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen -Iinclude -I/home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include    -fno-exceptions -fno-rtti -MMD -MT lib/TableGen/CMakeFiles/LLVMTableGen.dir/TGParser.cpp.o -MF "lib/TableGen/CMakeFiles/LLVMTableGen.dir/TGParser.cpp.o.d" -o lib/TableGen/CMakeFiles/LLVMTableGen.dir/TGParser.cpp.o -c /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.cpp<br>
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_tempbuf.h:62:0,<br>
                 from /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_algo.h:64,<br>
                 from /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/algorithm:63,<br>
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include/llvm/ADT/StringRef.h:13,<br>
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGLexer.h:17,<br>
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.h:17,<br>
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.cpp:14:<br>
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_construct.h: In instantiation of 'void std::_Construct(_T1*, _Args&& ...) [with _T1 = std::unique_ptr<llvm::Record>; _Args = {const std::unique_ptr<llvm::Record, std::default_delete<llvm::Record> >&}]':<br>
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_uninitialized.h:77:3:   required from 'static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const std::unique_ptr<llvm::Record>*, std::vector<std::unique_ptr<llvm::Record> > >; _ForwardIterator = std::unique_ptr<llvm::Record>*; bool _TrivialValueTypes = false]'<br>
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_uninitialized.h:119:41:   required from '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const std::unique_ptr<llvm::Record>*, std::vector<std::unique_ptr<llvm::Record> > >; _ForwardIterator = std::unique_ptr<llvm::Record>*]'<br>
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_uninitialized.h:260:63:   required from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = __gnu_cxx::__normal_iterator<const std::unique_ptr<llvm::Record>*, std::vector<std::unique_ptr<llvm::Record> > >; _ForwardIterator = std::unique_ptr<llvm::Record>*; _Tp = std::unique_ptr<llvm::Record>]'<br>
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_vector.h:310:9:   required from 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::unique_ptr<llvm::Record>; _Alloc = std::allocator<std::unique_ptr<llvm::Record> >]'<br>
/home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include/llvm/TableGen/Record.h:1664:8:   required from 'constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = std::basic_string<char>&; _U2 = llvm::MultiClass; <template-parameter-2-3> = void; _T1 = std::basic_string<char>; _T2 = llvm::MultiClass]'<br>
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_pair.h:273:72:   required from 'constexpr std::pair<typename std::__decay_and_strip<_T1>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = std::basic_string<char>&; _T2 = llvm::MultiClass; typename std::__decay_and_strip<_T2>::__type = llvm::MultiClass; typename std::__decay_and_strip<_T1>::__type = std::basic_string<char>]'<br>
/home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.cpp:2295:78:   required from here<br>
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_construct.h:77:7: error: use of deleted function 'std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = llvm::Record; _Dp = std::default_delete<llvm::Record>]'<br>
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/memory:86:0,<br>
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include/llvm/ADT/STLExtras.h:25,<br>
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:14,<br>
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include/llvm/Support/SourceMgr.h:19,<br>
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.h:19,<br>
                 from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.cpp:14:<br>
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/unique_ptr.h:262:7: error: declared here<br>
ninja: build stopped: subcommand failed.<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/TableGen/Record.h<br>
    llvm/trunk/lib/TableGen/TGParser.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/TableGen/Record.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=222970&r1=222969&r2=222970&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=222970&r1=222969&r2=222970&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/TableGen/Record.h (original)<br>
+++ llvm/trunk/include/llvm/TableGen/Record.h Sat Nov 29 18:43:50 2014<br>
@@ -1663,7 +1663,7 @@ raw_ostream &operator<<(raw_ostream &OS,<br>
<br>
 struct MultiClass {<br>
   Record Rec;  // Placeholder for template args and Name.<br>
-  typedef std::vector<std::unique_ptr<Record>> RecordVector;<br>
+  typedef std::vector<Record*> RecordVector;<br>
   RecordVector DefPrototypes;<br>
<br>
   void dump() const;<br>
<br>
Modified: llvm/trunk/lib/TableGen/TGParser.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.cpp?rev=222970&r1=222969&r2=222970&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.cpp?rev=222970&r1=222969&r2=222970&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/TableGen/TGParser.cpp (original)<br>
+++ llvm/trunk/lib/TableGen/TGParser.cpp Sat Nov 29 18:43:50 2014<br>
@@ -239,7 +239,7 @@ bool TGParser::AddSubMultiClass(MultiCla<br>
       if (AddValue(NewDef.get(), SubMultiClass.RefRange.Start, MCVals[i]))<br>
         return true;<br>
<br>
-    CurMC->DefPrototypes.push_back(std::move(NewDef));<br>
+    CurMC->DefPrototypes.push_back(NewDef.release());<br>
   }<br>
<br>
   const std::vector<Init *> &SMCTArgs = SMC->Rec.getTemplateArgs();<br>
@@ -274,7 +274,7 @@ bool TGParser::AddSubMultiClass(MultiCla<br>
              jend = CurMC->DefPrototypes.end();<br>
            j != jend;<br>
            ++j) {<br>
-        Record *Def = j->get();<br>
+        Record *Def = *j;<br>
<br>
         if (SetValue(Def, SubMultiClass.RefRange.Start, SMCTArgs[i],<br>
                      std::vector<unsigned>(),<br>
@@ -1258,7 +1258,7 @@ Init *TGParser::ParseSimpleValue(Record<br>
       // known before any use.<br>
       NewRec->setResolveFirst(true);<br>
       // Otherwise, we're inside a multiclass, add it to the multiclass.<br>
-      CurMultiClass->DefPrototypes.push_back(std::move(NewRecOwner));<br>
+      CurMultiClass->DefPrototypes.push_back(NewRecOwner.release());<br>
<br>
       // Copy the template arguments for the multiclass into the def.<br>
       const std::vector<Init *> &TArgs =<br>
@@ -2063,7 +2063,7 @@ bool TGParser::ParseDef(MultiClass *CurM<br>
           == CurRec->getNameInit())<br>
         return Error(DefLoc, "def '" + CurRec->getNameInitAsString() +<br>
                      "' already defined in this multiclass!");<br>
-    CurMultiClass->DefPrototypes.push_back(std::move(CurRecOwner));<br>
+    CurMultiClass->DefPrototypes.push_back(CurRecOwner.release());<br>
   } else if (ParseObjectBody(CurRec)) {<br>
     return true;<br>
   }<br>
@@ -2507,7 +2507,7 @@ bool TGParser::ResolveMulticlassDef(Mult<br>
         == CurRec->getNameInit())<br>
       return Error(DefmPrefixLoc, "defm '" + CurRec->getNameInitAsString() +<br>
                    "' already defined in this multiclass!");<br>
-  CurMultiClass->DefPrototypes.push_back(std::unique_ptr<Record>(CurRec));<br>
+  CurMultiClass->DefPrototypes.push_back(CurRec);<br>
<br>
   // Copy the template arguments for the multiclass into the new def.<br>
   const std::vector<Init *> &TA =<br>
@@ -2570,7 +2570,7 @@ bool TGParser::ParseDefm(MultiClass *Cur<br>
<br>
     // Loop over all the def's in the multiclass, instantiating each one.<br>
     for (unsigned i = 0, e = MC->DefPrototypes.size(); i != e; ++i) {<br>
-      Record *DefProto = MC->DefPrototypes[i].get();<br>
+      Record *DefProto = MC->DefPrototypes[i];<br>
<br>
       Record *CurRec = InstantiateMulticlassDef(*MC, DefProto, DefmPrefix,<br>
                                                 SMRange(DefmLoc,<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><br clear="all"><div><br></div>-- <br><div class="gmail_signature">~Craig</div>
</div>