summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-23 05:01:54 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-23 05:01:54 +0000
commita2f7c95dcafd2751be823e585aa1ad1cf0f4bb50 (patch)
tree466907f237d7c7cbfec096a5c50fae6dc543c780 /clang/lib/Sema/SemaDecl.cpp
parentf55922b8b8bb12a88738e04c81316dcefeda118d (diff)
downloadbcm5719-llvm-a2f7c95dcafd2751be823e585aa1ad1cf0f4bb50.tar.gz
bcm5719-llvm-a2f7c95dcafd2751be823e585aa1ad1cf0f4bb50.zip
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. llvm-svn: 76857
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index f3732e1b513..760a95f9d03 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/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 <algorithm>
@@ -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<CFGBlock*> workq;
- llvm::OwningArrayPtr<char> 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);
}
}
OpenPOWER on IntegriCloud