int D = 0;
const_iterator F = *this;
while (F.Scope != L.Scope) {
- if (F == const_iterator())
- return D;
+ assert (F != const_iterator()
+ && "L iterator is not reachable from F iterator.");
D += F.VarIter;
F = F.Scope->Prev;
}
/// performed in place specified with iterator.
void CFGBuilder::insertAutomaticObjDtors(CFGBlock* Blk, CFGBlock::iterator I,
LocalScope::const_iterator B, LocalScope::const_iterator E, Stmt* S) {
- if (int Cnt = B.distance(E)) {
- BumpVectorContext& C = cfg->getBumpVectorContext();
- I = Blk->beginAutomaticObjDtorsInsert(I, Cnt, C);
- while (B != E)
- I = Blk->insertAutomaticObjDtor(I, *B++, S);
- }
+ BumpVectorContext& C = cfg->getBumpVectorContext();
+ I = Blk->beginAutomaticObjDtorsInsert(I, B.distance(E), C);
+ while (B != E)
+ I = Blk->insertAutomaticObjDtor(I, *B++, S);
}
/// appendAutomaticObjDtors - Append destructor CFGElements for variables with
+++ /dev/null
-// RUN: %clang_cc1 -fsyntax-only -Wuninitialized -fsyntax-only %s
-
-// Test that the CFG builder handles destructors and gotos jumping between
-// scope boundaries. Previously this crashed (PR 10620).
-struct S_10620 {
- S_10620(const S_10620 &x);
- ~S_10620();
-};
-void PR10620(int x, const S_10620& s) {
- if (x) {
- goto done;
- }
- const S_10620 s2(s);
-done:
- ;
-}
-void PR10620_2(int x, const S_10620& s) {
- if (x)
- goto done;
- const S_10620 s2(s);
-done:
- ;
-}
\ No newline at end of file