search for: const_iterator

Displaying 20 results from an estimated 165 matches for "const_iterator".

2009 Nov 04
2
[LLVMdev] DenseMap iterator constness fix
...meant "for iterator" of course. Attached is a corrected patch together with an old patch for clang just to keep them together. Could someone commit these, please? Thanks, Victor 2009/11/4 Jeffrey Yasskin <jyasskin at google.com> > + // Otherwise this is a copy constructor for const_iterator. > > Do you mean "for iterator"? > > Otherwise, looks good to me. If you can commit this, please do. > Otherwise, someone else should as I'm not going to be around tomorrow. > > On Wed, Nov 4, 2009 at 12:27 AM, Victor Zverovich > <victor.zverovich at googlem...
2009 Nov 04
2
[LLVMdev] DenseMap iterator constness fix
Hi Jeffrey, You are right that the generated copy constructor is used for const_iterator. I have added a comment clarifying this. Also I have added the tests you suggested and corrected the comparison operators. Please find attached the updated patches. Best regards, Victor 2009/11/3 Jeffrey Yasskin <jyasskin at google.com> > +template <bool, typename True, typename Fals...
2017 May 02
2
When to use auto instead of iterator/const_iterator?
Hi All, While reading LLVM source code, sometimes I am wondering when should we use auto instead of iterator/const_iterator. I want to use the patch [1] I sent before as an example. Could someone give me advice/guideline here? Also, I have another question. Sometimes the for-loop uses const_iterator, say for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end(); I != E; ++I) if (...
2009 Nov 04
0
[LLVMdev] DenseMap iterator constness fix
+ // Otherwise this is a copy constructor for const_iterator. Do you mean "for iterator"? Otherwise, looks good to me. If you can commit this, please do. Otherwise, someone else should as I'm not going to be around tomorrow. On Wed, Nov 4, 2009 at 12:27 AM, Victor Zverovich <victor.zverovich at googlemail.com> wrote: > Hi Jeffrey, &...
2014 Mar 04
3
[LLVMdev] [cfe-dev] C++11 reverse iterators (was C++11 is here)
On Mon, Mar 3, 2014 at 12:26 AM, Chris Lattner <sabre at nondot.org> wrote: > > On Mar 2, 2014, at 8:53 PM, Renato Golin <renato.golin at linaro.org> wrote: > > > On 3 March 2014 12:32, Pete Cooper <peter_cooper at apple.com> wrote: > >> Would those work with a foreach construct? Perhaps I forgot to mention > that was what I'm trying to work out
2009 Nov 09
0
[LLVMdev] DenseMap iterator constness fix
...rse. Attached is a corrected patch > together with an old patch for clang just to keep them together. > Could someone commit these, please? > > Thanks, > Victor > > 2009/11/4 Jeffrey Yasskin <jyasskin at google.com> > > + // Otherwise this is a copy constructor for const_iterator. >> >> Do you mean "for iterator"? >> >> Otherwise, looks good to me. If you can commit this, please do. >> Otherwise, someone else should as I'm not going to be around tomorrow. >> >> On Wed, Nov 4, 2009 at 12:27 AM, Victor Zverovich >>...
2015 Feb 08
2
[LLVMdev] Fwd: Improper Function::iterator increment
void Wave::init (const Function &F){ Function::const_iterator ie = F.end(); outs() << ie << "\n\n"; for (Function::const_iterator I = F.begin(), IE = F.end(); I != IE; I++, K++){ outs() << I << "\n"; // some manipulation with I } } I used the above shown function in my pass in LLVM 3.4.2 a...
2012 Dec 17
4
[LLVMdev] BasicBlock back()
...ion. I don't know how back() works. (Definition at line 199<http://llvm.org/doxygen/BasicBlock_8h_source.html#l00199>of file BasicBlock.h <http://llvm.org/doxygen/BasicBlock_8h_source.html>.) 2. I also tried : bool patternDC::runOnBasicBlock(BasicBlock &BB) { ... BasicBlock::const_iterator I = BB.begin(); BasicBlock::const_iterator E = BB.end(); BasicBlock::const_iterator prev_iter,last_iter; prev_iter = NULL; last_iter = NULL; for(;I!=E;I++){ prev_iter = last_iter; last_iter = I; } if(prev_iter){ errs() << "prev_iter: " << *(dyn_cast<Instruction&...
2009 Nov 03
2
[LLVMdev] DenseMap iterator constness fix
Dear all, The first of the proposed patches (DenseMapIterator.patch) forbids implicit conversion of DenseMap::const_iterator to DenseMap::iterator which was possible because DenseMapIterator inherited (publicly) from DenseMapConstIterator. Conversion the other way around is now allowed as one may expect. The template DenseMapConstIterator is removed and the template parameter IsConst which specifies whether the iterator...
2009 Nov 03
0
[LLVMdev] DenseMap iterator constness fix
...ction 20.6.7), so I think you should use the same name, despite the standard committee's bad taste. + DenseMapIterator(const DenseMapIterator<KeyT, ValueT, + KeyInfoT, ValueInfoT, false>& I) This looks like it will make it impossible to copy const_iterators. I guess it doesn't because the copy-constructor is auto-generated, but please comment that and add tests for it and for the non-const->const conversion to unittests/ADT/DenseMapTest.cpp. Otherwise, the patches just change iterator to const_iterator, which looks fine. On Tue, Nov 3, 2009...
2015 Feb 08
2
[LLVMdev] Fwd: Improper Function::iterator increment
...m> wrote: > This may be difficult yo reproduce or debug without a more complete > (though preferably minimal) test case. > On Feb 8, 2015 8:31 AM, "Pranav Kant" <pranav913 at gmail.com> wrote: > >> void Wave::init (const Function &F){ >> Function::const_iterator ie = F.end(); >> outs() << ie << "\n\n"; >> for (Function::const_iterator I = F.begin(), IE = F.end(); I != IE; >> I++, K++){ >> outs() << I << "\n"; >> // some manipulation with I >> } >&gt...
2008 May 27
2
[LLVMdev] Iterator issue in BranchFolder::RemoveBlocksWithHash?
...; only iterators and references to the erased elements. >> >> Pretty clear. > > > In the current standard that language appears under "associative > containers", but this is a vector. Ah, and from vector: 23.2.5.4 vector modifiers [vector.modifiers] iterator erase(const_iterator position); iterator erase(const_iterator first, const_iterator last); 4 Effects: Invalidates iterators and references at or after the point of the erase. :-) Sorry, didn't realize this was vector and the page this was on was marked container requirements and I didn't realize I was rea...
2011 Mar 30
1
[LLVMdev] Trouble traversing the CallGraph
...epresenting external functions. Take the following code: ----- #include <stdio.h> int main() { printf( "Hello World!\n" ); } ----- If I try to traverse the CallGraph using the following code: ----- CallGraph CG = this->getAnalysis<CallGraph>(); for( CallGraph::const_iterator i = CG.begin(); i != CG.end(); ++i ) { CallGraphNode * cgn = i->second; for( CallGraphNode::const_iterator ii = cgn->begin(); ii != cgn->end(); ++ii ) {} } ----- The CallGraphNode::const_iterator is inconsistent. For starters, the inner loop never exits and, besides, if I try to us...
2012 Dec 17
0
[LLVMdev] BasicBlock back()
...or to the last instruction in the BasicBlock which should be its terminator instruction (basic blocks are required to have a TerminatorInst as their last instruction). > > > > 2. I also tried : > > bool patternDC::runOnBasicBlock(BasicBlock &BB) { > ... > BasicBlock::const_iterator I = BB.begin(); > BasicBlock::const_iterator E = BB.end(); > BasicBlock::const_iterator prev_iter,last_iter; > prev_iter = NULL; last_iter = NULL; > for(;I!=E;I++){ > prev_iter = last_iter; > last_iter = I; > } > if(prev_iter){ > errs() << "prev_ite...
2015 Feb 08
2
[LLVMdev] Fwd: Improper Function::iterator increment
...yo reproduce or debug without a more complete >>> (though preferably minimal) test case. >>> On Feb 8, 2015 8:31 AM, "Pranav Kant" <pranav913 at gmail.com> wrote: >>> >>>> void Wave::init (const Function &F){ >>>> Function::const_iterator ie = F.end(); >>>> outs() << ie << "\n\n"; >>>> for (Function::const_iterator I = F.begin(), IE = F.end(); I != IE; >>>> I++, K++){ >>>> outs() << I << "\n"; >>>> // some ma...
2010 Jan 09
2
[LLVMdev] [PATCH] Fix nondeterministic behaviour in the CodeExtractor
...t;getTerminator())) { BasicBlock *New = (*I)->splitBasicBlock(RI, (*I)->getName()+".ret"); @@ -206,7 +207,7 @@ // void CodeExtractor::findInputsOutputs(Values &inputs, Values &outputs) { std::set<BasicBlock*> ExitBlocks; - for (std::set<BasicBlock*>::const_iterator ci = BlocksToExtract.begin(), + for (SetVector<BasicBlock*>::const_iterator ci = BlocksToExtract.begin(), ce = BlocksToExtract.end(); ci != ce; ++ci) { BasicBlock *BB = *ci; @@ -482,7 +483,7 @@ std::map<BasicBlock*, BasicBlock*> ExitBlockMap; unsigned switchVal =...
2010 Sep 15
2
[LLVMdev] getAnalysis<LoopInfo> from ModulePass
.../LoopInfo.h" using namespace llvm; namespace { struct bb_info: public ModulePass { static char ID; bb_info() : ModulePass(&ID) {} void getLoopInfo(const Function& F) const { const LoopInfo *LI = &getAnalysis<LoopInfo> (); Function::const_iterator BB = F.begin(), E = F.end(); for (; BB != E; ++BB) errs() << BB->getName() << " " << LI->getLoopDepth(&*BB) << "\n"; }; virtual bool runOnModule(Module &M) { Module::const_iterator f_it = M.begin(), f_ite...
2012 Dec 18
1
[LLVMdev] BasicBlock back()
...ction > in the BasicBlock which should be its terminator instruction (basic blocks > are required to have a TerminatorInst as their last instruction). > > > > > > > 2. I also tried : > > bool patternDC::runOnBasicBlock(BasicBlock &BB) { > ... > BasicBlock::const_iterator I = BB.begin(); > BasicBlock::const_iterator E = BB.end(); > BasicBlock::const_iterator prev_iter,last_iter; > prev_iter = NULL; last_iter = NULL; > for(;I!=E;I++){ > prev_iter = last_iter; > last_iter = I; > } > if(prev_iter){ > errs() << "prev_ite...
2002 Nov 18
0
[LLVMdev] Fixed DSGraph iteration, depth first search, etc...
...-------------------------------------------===// /// DSNode - Data structure node class @@ -76,11 +79,13 @@ assert(Referrers.empty() && "Referrers to dead node exist!"); } - // Iterator for graph interface... - typedef DSNodeIterator iterator; - typedef DSNodeIterator const_iterator; - inline iterator begin() const; // Defined in DSGraphTraits.h - inline iterator end() const; + // Iterator for graph interface... Defined in DSGraphTraits.h + typedef DSNodeIterator<DSNode> iterator; + typedef DSNodeIterator<const DSNode> const_iterator; + inline iterator begi...
2008 Feb 11
0
[LLVMdev] Some questions about live intervals
...6 +167,23 @@ > return MBB2IdxMap[MBBNo].second; > } > > + /// getMBBFromIndex - given an index in any instruction of an > + /// MBB return a pointer the MBB > + MachineBasicBlock* getMBBFromIndex(unsigned index) const { > + std::vector<IdxMBBPair>::const_iterator I = > + std::lower_bound(Idx2MBBMap.begin(), Idx2MBBMap.end(), index); > + > + // Take previous pair > + std::vector<IdxMBBPair>::const_iterator J = > + ((I != Idx2MBBMap.end() && I->first > index) || > + (I == Idx2MBBMap.end() && Idx...