On Sun, Apr 29, 2012 at 9:24 PM, Nico Weber <[email protected]> wrote: > Richard landed a different fix in r155803. Are both needed?
Not strictly, no. My change fixes a surprising/broken API, Richard's works around it. There's no harm in the workaround & arguably the separation is probably nicer to read anyway (maybe faster, maybe slower - it copies a CFGBlock unnecessarily - which is just two pointers). Richard mentioned on IRC that he was OK with my change being the authoritative one & reverting his change - though my git foo is clearly failing me & I've had trouble reverting his change (yeah, it's easy enough for me to just manually create a change that undoes it, but I've just been trying to do it the 'right' way out of curiosity). Though I haven't actually verified my change with GCC 4.7 (I don't have it installed yet), whereas (I assume) Richard has verified his. - David > > On Sun, Apr 29, 2012 at 5:42 PM, David Blaikie <[email protected]> wrote: >> Author: dblaikie >> Date: Sun Apr 29 19:42:50 2012 >> New Revision: 155805 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=155805&view=rev >> Log: >> Correct CFGBlock's front() and back() to return by const ref rather than >> value. >> >> This ought to fix PR11926, a crash when when running Clang built with GCC 4.7 >> >> Modified: >> cfe/trunk/include/clang/Analysis/CFG.h >> >> Modified: cfe/trunk/include/clang/Analysis/CFG.h >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CFG.h?rev=155805&r1=155804&r2=155805&view=diff >> ============================================================================== >> --- cfe/trunk/include/clang/Analysis/CFG.h (original) >> +++ cfe/trunk/include/clang/Analysis/CFG.h Sun Apr 29 19:42:50 2012 >> @@ -277,6 +277,7 @@ >> typedef std::reverse_iterator<ImplTy::const_iterator> const_iterator; >> typedef ImplTy::iterator reverse_iterator; >> typedef ImplTy::const_iterator >> const_reverse_iterator; >> + typedef ImplTy::const_reference const_reference; >> >> void push_back(CFGElement e, BumpVectorContext &C) { Impl.push_back(e, >> C); } >> reverse_iterator insert(reverse_iterator I, size_t Cnt, CFGElement E, >> @@ -284,8 +285,8 @@ >> return Impl.insert(I, Cnt, E, C); >> } >> >> - CFGElement front() const { return Impl.back(); } >> - CFGElement back() const { return Impl.front(); } >> + const_reference front() const { return Impl.back(); } >> + const_reference back() const { return Impl.front(); } >> >> iterator begin() { return Impl.rbegin(); } >> iterator end() { return Impl.rend(); } >> >> >> _______________________________________________ >> cfe-commits mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
