aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2023-03-15 18:06:34 -0700
committerKazu Hirata <kazu@google.com>2023-03-15 18:06:34 -0700
commit7eaa7b055389799643cd6c2e992985f71de73ee5 (patch)
treef852a289b0c24ecad0745151a3ef87f2e4f4b538 /clang/lib/Analysis
parent398af9b43bbfbff291faac5bce524eca675d6caf (diff)
downloadllvm-7eaa7b055389799643cd6c2e992985f71de73ee5.zip
llvm-7eaa7b055389799643cd6c2e992985f71de73ee5.tar.gz
llvm-7eaa7b055389799643cd6c2e992985f71de73ee5.tar.bz2
[clang] Use *{Map,Set}::contains (NFC)
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/CFG.cpp3
-rw-r--r--clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp7
-rw-r--r--clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp4
3 files changed, 6 insertions, 8 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index ea8b73e..7e93247 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/lib/Analysis/CFG.cpp
@@ -3387,8 +3387,7 @@ CFGBlock *CFGBuilder::VisitLabelStmt(LabelStmt *L) {
if (!LabelBlock) // This can happen when the body is empty, i.e.
LabelBlock = createBlock(); // scopes that only contains NullStmts.
- assert(LabelMap.find(L->getDecl()) == LabelMap.end() &&
- "label already in map");
+ assert(!LabelMap.contains(L->getDecl()) && "label already in map");
LabelMap[L->getDecl()] = JumpTarget(LabelBlock, ScopePos);
// Labels partition blocks, so this is the end of the basic block we were
diff --git a/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp b/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
index 480606b..4405324 100644
--- a/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
+++ b/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
@@ -316,10 +316,9 @@ BoolValue &DataflowAnalysisContext::substituteBoolValue(
BoolValue &DataflowAnalysisContext::buildAndSubstituteFlowCondition(
AtomicBoolValue &Token,
llvm::DenseMap<AtomicBoolValue *, BoolValue *> Substitutions) {
- assert(
- Substitutions.find(&getBoolLiteralValue(true)) == Substitutions.end() &&
- Substitutions.find(&getBoolLiteralValue(false)) == Substitutions.end() &&
- "Do not substitute true/false boolean literals");
+ assert(!Substitutions.contains(&getBoolLiteralValue(true)) &&
+ !Substitutions.contains(&getBoolLiteralValue(false)) &&
+ "Do not substitute true/false boolean literals");
llvm::DenseMap<BoolValue *, BoolValue *> SubstitutionsCache(
Substitutions.begin(), Substitutions.end());
return buildAndSubstituteFlowConditionWithCache(Token, SubstitutionsCache);
diff --git a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
index 5d502fe..46fb7bd 100644
--- a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
+++ b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
@@ -583,7 +583,7 @@ StorageLocation &Environment::createStorageLocation(const Expr &E) {
}
void Environment::setStorageLocation(const ValueDecl &D, StorageLocation &Loc) {
- assert(DeclToLoc.find(&D) == DeclToLoc.end());
+ assert(!DeclToLoc.contains(&D));
DeclToLoc[&D] = &Loc;
}
@@ -595,7 +595,7 @@ StorageLocation *Environment::getStorageLocation(const ValueDecl &D,
void Environment::setStorageLocation(const Expr &E, StorageLocation &Loc) {
const Expr &CanonE = ignoreCFGOmittedNodes(E);
- assert(ExprToLoc.find(&CanonE) == ExprToLoc.end());
+ assert(!ExprToLoc.contains(&CanonE));
ExprToLoc[&CanonE] = &Loc;
}