summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-08-01 10:24:17 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-08-01 10:24:17 +0000
commit3a04bea91adb13dd5abb16252c628ee91c700306 (patch)
treefaccdec2561c466b09f37507a56d05b19933a97e /clang/lib/CodeGen/CGExprAgg.cpp
parent4b53d74e8989593e34a129e28a2cc81959dd4413 (diff)
downloadbcm5719-llvm-3a04bea91adb13dd5abb16252c628ee91c700306.tar.gz
bcm5719-llvm-3a04bea91adb13dd5abb16252c628ee91c700306.zip
[DebugInfo] Have custom std::reverse_iterator<DWARFDie>
The DWARFDie is a lightweight utility wrapper that stores a pointer to a compile unit and a debug info entry. Currently, its iterator (used for walking over its children) stores a DWARFDie and returns a const reference when dereferencing it. When the iterator is modified (by incrementing or decrementing it), this reference becomes invalid. This was happening when calling reverse on it, because the std::reverse_iterator is keeping a temporary copy of the iterator (see https://en.cppreference.com/w/cpp/iterator/reverse_iterator for a good illustration). The relevant code in libcxx: reference operator*() const {_Iter __tmp = current; return *--__tmp;} When dereferencing the reverse iterator, we decrement and return a reference to a DWARFDie stored in the stack frame of this function, resulting in UB at runtime. This patch specifies the std::reverse_iterator for DWARFDie to do the right thing. Differential revision: https://reviews.llvm.org/D49679 llvm-svn: 338506
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud