llvm.org GIT mirror llvm / 066fdfa
Revert r222965 "Make MultiClass::DefPrototypes own their Records to fix memory leaks." The bots started failing with the error below. I suspect this revision was the cause. 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 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, from /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_algo.h:64, from /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/algorithm:63, from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include/llvm/ADT/StringRef.h:13, from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGLexer.h:17, from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.h:17, from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.cpp:14: /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> >&}]': /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]' /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>*]' /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>]' /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> >]' /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]' /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>]' /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.cpp:2295:78: required from here /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>]' In file included from /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/memory:86:0, from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include/llvm/ADT/STLExtras.h:25, from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:14, from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/include/llvm/Support/SourceMgr.h:19, from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.h:19, from /home/bb/cmake-llvm-x86_64-linux/llvm-project/llvm/lib/TableGen/TGParser.cpp:14: /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/unique_ptr.h:262:7: error: declared here ninja: build stopped: subcommand failed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222970 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 6 years ago
2 changed file(s) with 7 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
16621662
16631663 struct MultiClass {
16641664 Record Rec; // Placeholder for template args and Name.
1665 typedef std::vector<std::unique_ptr> RecordVector;
1665 typedef std::vector<Record*> RecordVector;
16661666 RecordVector DefPrototypes;
16671667
16681668 void dump() const;
238238 if (AddValue(NewDef.get(), SubMultiClass.RefRange.Start, MCVals[i]))
239239 return true;
240240
241 CurMC->DefPrototypes.push_back(std::move(NewDef));
241 CurMC->DefPrototypes.push_back(NewDef.release());
242242 }
243243
244244 const std::vector &SMCTArgs = SMC->Rec.getTemplateArgs();
273273 jend = CurMC->DefPrototypes.end();
274274 j != jend;
275275 ++j) {
276 Record *Def = j->get();
276 Record *Def = *j;
277277
278278 if (SetValue(Def, SubMultiClass.RefRange.Start, SMCTArgs[i],
279279 std::vector(),
12571257 // known before any use.
12581258 NewRec->setResolveFirst(true);
12591259 // Otherwise, we're inside a multiclass, add it to the multiclass.
1260 CurMultiClass->DefPrototypes.push_back(std::move(NewRecOwner));
1260 CurMultiClass->DefPrototypes.push_back(NewRecOwner.release());
12611261
12621262 // Copy the template arguments for the multiclass into the def.
12631263 const std::vector &TArgs =
20622062 == CurRec->getNameInit())
20632063 return Error(DefLoc, "def '" + CurRec->getNameInitAsString() +
20642064 "' already defined in this multiclass!");
2065 CurMultiClass->DefPrototypes.push_back(std::move(CurRecOwner));
2065 CurMultiClass->DefPrototypes.push_back(CurRecOwner.release());
20662066 } else if (ParseObjectBody(CurRec)) {
20672067 return true;
20682068 }
25062506 == CurRec->getNameInit())
25072507 return Error(DefmPrefixLoc, "defm '" + CurRec->getNameInitAsString() +
25082508 "' already defined in this multiclass!");
2509 CurMultiClass->DefPrototypes.push_back(std::unique_ptr(CurRec));
2509 CurMultiClass->DefPrototypes.push_back(CurRec);
25102510
25112511 // Copy the template arguments for the multiclass into the new def.
25122512 const std::vector &TA =
25692569
25702570 // Loop over all the def's in the multiclass, instantiating each one.
25712571 for (unsigned i = 0, e = MC->DefPrototypes.size(); i != e; ++i) {
2572 Record *DefProto = MC->DefPrototypes[i].get();
2572 Record *DefProto = MC->DefPrototypes[i];
25732573
25742574 Record *CurRec = InstantiateMulticlassDef(*MC, DefProto, DefmPrefix,
25752575 SMRange(DefmLoc,