[cfe-commits] r155805 - /cfe/trunk/include/clang/Analysis/CFG.h

David Blaikie dblaikie at gmail.com
Sun Apr 29 17:42:50 PDT 2012


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(); }





More information about the cfe-commits mailing list