summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-03-10 15:08:09 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-03-10 15:08:09 +0000
commit616f80225ce5c98eebbaa35ef7e7d9011d016c35 (patch)
treea6acd923e2bbf54c5164a7bb05848d81688dd76e /clang/lib
parent1f71a239857f9830ed8d9abff56a31a26c9480ac (diff)
downloadbcm5719-llvm-616f80225ce5c98eebbaa35ef7e7d9011d016c35.tar.gz
bcm5719-llvm-616f80225ce5c98eebbaa35ef7e7d9011d016c35.zip
Replace a map of boolean values with a set.
No functionality change. llvm-svn: 152494
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Analysis/AnalysisDeclContext.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/clang/lib/Analysis/AnalysisDeclContext.cpp b/clang/lib/Analysis/AnalysisDeclContext.cpp
index 1020898e60c..3291764b9ad 100644
--- a/clang/lib/Analysis/AnalysisDeclContext.cpp
+++ b/clang/lib/Analysis/AnalysisDeclContext.cpp
@@ -25,7 +25,7 @@
#include "clang/Analysis/CFGStmtMap.h"
#include "clang/Analysis/Support/BumpVector.h"
#include "llvm/Support/SaveAndRestore.h"
-#include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/ErrorHandling.h"
using namespace clang;
@@ -335,8 +335,8 @@ namespace {
class FindBlockDeclRefExprsVals : public StmtVisitor<FindBlockDeclRefExprsVals>{
BumpVector<const VarDecl*> &BEVals;
BumpVectorContext &BC;
- llvm::DenseMap<const VarDecl*, unsigned> Visited;
- llvm::SmallSet<const DeclContext*, 4> IgnoredContexts;
+ llvm::SmallPtrSet<const VarDecl*, 4> Visited;
+ llvm::SmallPtrSet<const DeclContext*, 4> IgnoredContexts;
public:
FindBlockDeclRefExprsVals(BumpVector<const VarDecl*> &bevals,
BumpVectorContext &bc)
@@ -355,21 +355,15 @@ public:
void VisitDeclRefExpr(DeclRefExpr *DR) {
// Non-local variables are also directly modified.
- if (const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl()))
+ if (const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl())) {
if (!VD->hasLocalStorage()) {
- unsigned &flag = Visited[VD];
- if (!flag) {
- flag = 1;
+ if (Visited.insert(VD))
BEVals.push_back(VD, BC);
- }
} else if (DR->refersToEnclosingLocal()) {
- unsigned &flag = Visited[VD];
- if (!flag) {
- flag = 1;
- if (IsTrackedDecl(VD))
- BEVals.push_back(VD, BC);
- }
+ if (Visited.insert(VD) && IsTrackedDecl(VD))
+ BEVals.push_back(VD, BC);
}
+ }
}
void VisitBlockExpr(BlockExpr *BR) {
OpenPOWER on IntegriCloud