From 1f15e768983a614e45c3ca01df1ddb3339e746dd Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 23 Jul 2009 05:01:54 +0000 Subject: [PATCH] Use llvm::BitVector instead of managing memory by hand. - As it happens, this also fixes a use-of-uninitialized memory that was causing non-deterministic test failures. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76857 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDecl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index f3732e1b51..760a95f9d0 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -28,6 +28,7 @@ // FIXME: layering (ideally, Sema shouldn't be dependent on Lex API's) #include "clang/Lex/Preprocessor.h" #include "clang/Lex/HeaderSearch.h" +#include "llvm/ADT/BitVector.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/STLExtras.h" #include @@ -1023,18 +1024,18 @@ Sema::ControlFlowKind Sema::CheckFallThrough(Stmt *Root) { // The CFG leaves in dead things, run a simple mark and sweep on it // to weed out the trivially dead things. std::queue workq; - llvm::OwningArrayPtr live(new char[cfg->getNumBlockIDs()]); + llvm::BitVector live(cfg->getNumBlockIDs()); // Prep work queue workq.push(&cfg->getEntry()); // Solve while (!workq.empty()) { CFGBlock *item = workq.front(); workq.pop(); - live[item->getBlockID()] = 1; + live.set(item->getBlockID()); CFGBlock::succ_iterator i; for (i=item->succ_begin(); i != item->succ_end(); ++i) { if ((*i) && ! live[(*i)->getBlockID()]) { - live[(*i)->getBlockID()] = 1; + live.set((*i)->getBlockID()); workq.push(*i); } } -- 2.50.1