@@ -647,13 +647,12 @@ namespace {
647647 // that are currently known to be valid for the variable.
648648 using BoundsContextTy = llvm::DenseMap<const VarDecl *, BoundsExpr *>;
649649
650- // EqualExprTy denotes a set of expressions that produce the same value
651- // as an expression e.
652- using EqualExprTy = SmallVector<Expr *, 4 >;
650+ // ExprSetTy denotes a set of expressions.
651+ using ExprSetTy = SmallVector<Expr *, 4 >;
653652
654653 // ExprEqualMapTy denotes a map of an expression e to the set of
655654 // expressions that produce the same value as e.
656- using ExprEqualMapTy = llvm::DenseMap<Expr *, EqualExprTy >;
655+ using ExprEqualMapTy = llvm::DenseMap<Expr *, ExprSetTy >;
657656
658657 // CheckingState stores the outputs of bounds checking methods.
659658 // These members represent the state during bounds checking
@@ -686,7 +685,7 @@ namespace {
686685 // expression e once checking of e is complete.
687686 //
688687 // SameValue is named G in the Checked C spec.
689- EqualExprTy SameValue;
688+ ExprSetTy SameValue;
690689
691690 // LostVariables maps a variable declaration V whose observed bounds
692691 // are unknown to a pair <B, W>, where the initial observed bounds B
@@ -932,7 +931,7 @@ namespace {
932931 }
933932 }
934933
935- void DumpExprsSet (raw_ostream &OS, EqualExprTy Exprs) {
934+ void DumpExprsSet (raw_ostream &OS, ExprSetTy Exprs) {
936935 if (Exprs.size () == 0 )
937936 OS << " { }\n " ;
938937 else {
@@ -4270,7 +4269,7 @@ namespace {
42704269 // Adjust EquivExprs to account for any uses of V in PrevState.EquivExprs.
42714270 State.EquivExprs .clear ();
42724271 for (auto I = PrevState.EquivExprs .begin (); I != PrevState.EquivExprs .end (); ++I) {
4273- EqualExprTy ExprList;
4272+ ExprSetTy ExprList;
42744273 for (auto InnerList = (*I).begin (); InnerList != (*I).end (); ++InnerList) {
42754274 Expr *E = *InnerList;
42764275 Expr *AdjustedE = ReplaceVariableReferences (S, E, V, OriginalValue, CSS);
@@ -4387,8 +4386,8 @@ namespace {
43874386 // Val is an optional expression that may be contained in the updated
43884387 // SameValue set. If Val is not provided, e is used instead. If Val
43894388 // and e are null, SameValue is not updated.
4390- void UpdateSameValue (Expr *E, const EqualExprTy SubExprSameValue,
4391- EqualExprTy &SameValue, Expr *Val = nullptr ) {
4389+ void UpdateSameValue (Expr *E, const ExprSetTy SubExprSameValue,
4390+ ExprSetTy &SameValue, Expr *Val = nullptr ) {
43924391 Expr *SubExpr = dyn_cast<Expr>(*(E->child_begin ()));
43934392 assert (SubExpr);
43944393 ExprEqualMapTy SubExprSameValueSets;
@@ -4412,7 +4411,7 @@ namespace {
44124411 // SameValue set. If Val is not provided, e is used instead. If Val
44134412 // and e are null, SameValue is not updated.
44144413 void UpdateSameValue (Expr *E, ExprEqualMapTy SubExprSameValueSets,
4415- EqualExprTy &SameValue, Expr *Val = nullptr ) {
4414+ ExprSetTy &SameValue, Expr *Val = nullptr ) {
44164415 SameValue.clear ();
44174416
44184417 if (!Val) Val = E;
@@ -4438,13 +4437,13 @@ namespace {
44384437 // the same value as Val.
44394438 else {
44404439 Expr *ValPrime = nullptr ;
4441- for (llvm::detail::DenseMapPair<Expr *, EqualExprTy > Pair : SubExprSameValueSets) {
4440+ for (llvm::detail::DenseMapPair<Expr *, ExprSetTy > Pair : SubExprSameValueSets) {
44424441 Expr *SubExpr_i = Pair.first ;
44434442 // For any modifying subexpression SubExpr_i of e, try to set
44444443 // ValPrime to a nonmodifying expression from the set SameValue_i
44454444 // of expressions that produce the same value as SubExpr_i.
44464445 if (!CheckIsNonModifying (SubExpr_i)) {
4447- EqualExprTy SameValue_i = Pair.second ;
4446+ ExprSetTy SameValue_i = Pair.second ;
44484447 for (auto I = SameValue_i.begin (); I != SameValue_i.end (); ++I) {
44494448 Expr *E_i = *I;
44504449 if (CheckIsNonModifying (E_i)) {
@@ -4500,7 +4499,7 @@ namespace {
45004499
45014500 // Check EQ for a variable w != v that produces the same value as v.
45024501 Expr *ValuePreservingV = nullptr ;
4503- EqualExprTy F = GetEqualExprSetContainingExpr (Target, EQ, ValuePreservingV);
4502+ ExprSetTy F = GetEqualExprSetContainingExpr (Target, EQ, ValuePreservingV);
45044503 for (auto I = F.begin (); I != F.end (); ++I) {
45054504 // Account for value-preserving operations on w when searching for
45064505 // a variable w in F. For example, if F contains (T)LValueToRValue(w),
@@ -4922,10 +4921,10 @@ namespace {
49224921 const EquivExprSets EQ2) {
49234922 EquivExprSets IntersectedEQ;
49244923 for (auto I1 = EQ1.begin (); I1 != EQ1.end (); ++I1) {
4925- EqualExprTy Set1 = *I1;
4924+ ExprSetTy Set1 = *I1;
49264925 for (auto I2 = EQ2.begin (); I2 != EQ2.end (); ++I2) {
4927- EqualExprTy Set2 = *I2;
4928- EqualExprTy IntersectedExprSet = IntersectExprSets (Set1, Set2);
4926+ ExprSetTy Set2 = *I2;
4927+ ExprSetTy IntersectedExprSet = IntersectExprSets (Set1, Set2);
49294928 if (IntersectedExprSet.size () > 1 )
49304929 IntersectedEQ.push_back (IntersectedExprSet);
49314930 }
@@ -4934,9 +4933,8 @@ namespace {
49344933 }
49354934
49364935 // IntersectExprSets returns the intersection of two sets of expressions.
4937- EqualExprTy IntersectExprSets (const EqualExprTy Set1,
4938- const EqualExprTy Set2) {
4939- EqualExprTy IntersectedSet;
4936+ ExprSetTy IntersectExprSets (const ExprSetTy Set1, const ExprSetTy Set2) {
4937+ ExprSetTy IntersectedSet;
49404938 for (auto I = Set1.begin (); I != Set1.end (); ++I) {
49414939 Expr *E1 = *I;
49424940 if (EqualExprsContainsExpr (Set2, E1 ))
@@ -4965,11 +4963,11 @@ namespace {
49654963 // e1 may include value-preserving operations. For example, if a set F
49664964 // in EQ contains (T)e, where (T) is a value-preserving cast,
49674965 // ValuePreservingE will be set to (T)e.
4968- EqualExprTy GetEqualExprSetContainingExpr (Expr *E, EquivExprSets EQ,
4969- Expr *&ValuePreservingE) {
4966+ ExprSetTy GetEqualExprSetContainingExpr (Expr *E, EquivExprSets EQ,
4967+ Expr *&ValuePreservingE) {
49704968 ValuePreservingE = nullptr ;
49714969 for (auto OuterList = EQ.begin (); OuterList != EQ.end (); ++OuterList) {
4972- EqualExprTy F = *OuterList;
4970+ ExprSetTy F = *OuterList;
49734971 for (auto InnerList = F.begin (); InnerList != F.end (); ++InnerList) {
49744972 Expr *E1 = *InnerList;
49754973 if (EqualValue (S.Context , E, E1 , nullptr )) {
@@ -4983,18 +4981,17 @@ namespace {
49834981
49844982 // If e appears in a set F in EQ, GetEqualExprSetContainingExpr
49854983 // returns F. Otherwise, it returns an empty set.
4986- EqualExprTy GetEqualExprSetContainingExpr (Expr *E, EquivExprSets EQ) {
4984+ ExprSetTy GetEqualExprSetContainingExpr (Expr *E, EquivExprSets EQ) {
49874985 for (auto OuterList = EQ.begin (); OuterList != EQ.end (); ++OuterList) {
4988- EqualExprTy F = *OuterList;
4986+ ExprSetTy F = *OuterList;
49894987 if (EqualExprsContainsExpr (F, E))
49904988 return F;
49914989 }
49924990 return { };
49934991 }
49944992
49954993 // IsEqualExprsSubset returns true if Exprs1 is a subset of Exprs2.
4996- bool IsEqualExprsSubset (const EqualExprTy Exprs1,
4997- const EqualExprTy Exprs2) {
4994+ bool IsEqualExprsSubset (const ExprSetTy Exprs1, const ExprSetTy Exprs2) {
49984995 for (auto I = Exprs1.begin (); I != Exprs1.end (); ++I) {
49994996 Expr *E = *I;
50004997 if (!EqualExprsContainsExpr (Exprs2, E))
@@ -5005,8 +5002,7 @@ namespace {
50055002
50065003 // DoExprSetsIntersect returns true if the intersection of Exprs1 and
50075004 // Exprs2 is nonempty.
5008- bool DoExprSetsIntersect (const EqualExprTy Exprs1,
5009- const EqualExprTy Exprs2) {
5005+ bool DoExprSetsIntersect (const ExprSetTy Exprs1, const ExprSetTy Exprs2) {
50105006 for (auto I = Exprs1.begin (); I != Exprs1.end (); ++I) {
50115007 Expr *E = *I;
50125008 if (EqualExprsContainsExpr (Exprs2, E))
@@ -5016,7 +5012,7 @@ namespace {
50165012 }
50175013
50185014 // EqualExprsContainsExpr returns true if the set Exprs contains E.
5019- bool EqualExprsContainsExpr (const EqualExprTy Exprs, Expr *E) {
5015+ bool EqualExprsContainsExpr (const ExprSetTy Exprs, Expr *E) {
50205016 for (auto I = Exprs.begin (); I != Exprs.end (); ++I) {
50215017 if (EqualValue (S.Context , E, *I, nullptr ))
50225018 return true ;
0 commit comments