Exemplo n.º 1
0
void CtorDtorRunner::add(iterator_range<CtorDtorIterator> CtorDtors) {
  if (CtorDtors.begin() == CtorDtors.end())
    return;

  MangleAndInterner Mangle(
      JD.getExecutionSession(),
      (*CtorDtors.begin()).Func->getParent()->getDataLayout());

  for (const auto &CtorDtor : CtorDtors) {
    assert(CtorDtor.Func && CtorDtor.Func->hasName() &&
           "Ctor/Dtor function must be named to be runnable under the JIT");

    // FIXME: Maybe use a symbol promoter here instead.
    if (CtorDtor.Func->hasLocalLinkage()) {
      CtorDtor.Func->setLinkage(GlobalValue::ExternalLinkage);
      CtorDtor.Func->setVisibility(GlobalValue::HiddenVisibility);
    }

    if (CtorDtor.Data && cast<GlobalValue>(CtorDtor.Data)->isDeclaration()) {
      dbgs() << "  Skipping because why now?\n";
      continue;
    }

    CtorDtorsByPriority[CtorDtor.Priority].push_back(
        Mangle(CtorDtor.Func->getName()));
  }
}
Exemplo n.º 2
0
 success append(iterator_range<element_type const *> data) const
 {
     assert(m_destination);
     m_destination->insert(
         m_destination->end(), data.begin(), data.end());
     return success();
 }
/*
    Convert an input to upper case. 
    Note, that this formatter can be used only on std::string inputs.
*/
inline string upcase_formatter( 
    const iterator_range<string::const_iterator>& Replace )
{
    string Temp(Replace.begin(), Replace.end());
    to_upper(Temp);
    return Temp;
}
 static typename iterator_range<iterator>::iterator::difference_type count_not_removed(const iterator_range<iterator>& range) noexcept {
     return std::count_if(range.begin(), range.end(), [](const element& elem) {
         return !elem.is_removed();
     });
 }
Exemplo n.º 5
0
 constexpr iterator_range(iterator_range<X, Y> rng)
   : base_t{detail::move(rng.begin()), detail::move(rng.end())}
 {}
 iterator_range( const iterator_range<OtherItT>& Other ) :
     m_Begin(Other.begin()), m_End(Other.end()) {}
 inline SeqT transform_iterator_range( const iterator_range<IteratorT>& Range, FuncT Func )
 {
     SeqT Seq;
     std::transform( Range.begin(), Range.end(), std::back_inserter(Seq), Func );
     return Seq;
 }
 inline SeqT copy_iterator_range( const iterator_range<IteratorT>& Range )
 {
     return SeqT( Range.begin(), Range.end() );
 }
 /*!
     Swap two ranges
 */
 void swap( iterator_range& Other )
 {
     std::swap( m_Begin, Other.begin() );
     std::swap( m_End, Other.end() );
 }
 bool operator!=( const iterator_range<OtherItT>& Other ) const
 {
     return m_Begin!=Other.begin() || m_End!=Other.end();
 }
 bool operator==( const iterator_range<OtherItT>& Other ) const
 {
     return m_Begin==Other.begin() && m_End==Other.end();
 }
Exemplo n.º 12
0
void print(ostream& out, iterator_range<string::iterator> const& rng)
{
    copy(rng.begin(),rng.end(),ostream_iterator<char>(out));
}