From: David Blaikie Date: Mon, 30 Apr 2012 00:42:50 +0000 (+0000) Subject: Correct CFGBlock's front() and back() to return by const ref rather than value. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=298038352b34c5503db418201f3ddea6e56fd0e1;p=clang 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155805 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/CFG.h b/include/clang/Analysis/CFG.h index 27b22b8c62..c8adfef442 100644 --- a/include/clang/Analysis/CFG.h +++ b/include/clang/Analysis/CFG.h @@ -277,6 +277,7 @@ class CFGBlock { typedef std::reverse_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 @@ class CFGBlock { 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(); }