We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa54851 commit 14a8451Copy full SHA for 14a8451
clang/lib/CodeGen/CGDebugInfo.cpp
@@ -5833,8 +5833,13 @@ void CGDebugInfo::setDwoId(uint64_t Signature) {
5833
}
5834
5835
void CGDebugInfo::finalize() {
5836
- for (auto const *VD : StaticDataMemberDefinitionsToEmit) {
5837
- assert(VD->isStaticDataMember());
+ // We can't use a for-each here because `EmitGlobalVariable`
+ // may push new decls into `StaticDataMemberDefinitionsToEmit`,
5838
+ // which would invalidate any iterator.
5839
+ for (size_t i = 0; i < StaticDataMemberDefinitionsToEmit.size(); ++i) {
5840
+ auto const *VD = StaticDataMemberDefinitionsToEmit[i];
5841
+
5842
+ assert(VD && VD->isStaticDataMember());
5843
5844
if (DeclCache.contains(VD))
5845
continue;
0 commit comments