diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-02-12 21:37:25 +0000 | 
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-02-12 21:37:25 +0000 | 
| commit | 1f3d4a73f54a7864760691625b385fb78191e0cd (patch) | |
| tree | 146955d541eda2cb56437ff61762f786cefc5fdc /clang/Analysis/GRConstants.cpp | |
| parent | 2ae968abcb131fc0da534497e58d1a83696b2451 (diff) | |
| download | bcm5719-llvm-1f3d4a73f54a7864760691625b385fb78191e0cd.tar.gz bcm5719-llvm-1f3d4a73f54a7864760691625b385fb78191e0cd.zip | |
Minor (cosmetic) reshuffling of code. Fixed a bug in "Assume" logic when
handling Non-Lvalues of the type nonlval::SymbolVal; we were accidentally
casting them to lval::SymbolVal.
llvm-svn: 47029
Diffstat (limited to 'clang/Analysis/GRConstants.cpp')
| -rw-r--r-- | clang/Analysis/GRConstants.cpp | 27 | 
1 files changed, 16 insertions, 11 deletions
| diff --git a/clang/Analysis/GRConstants.cpp b/clang/Analysis/GRConstants.cpp index 90b055c3702..86ac5ef1aab 100644 --- a/clang/Analysis/GRConstants.cpp +++ b/clang/Analysis/GRConstants.cpp @@ -272,17 +272,14 @@ public:    ///  other functions that handle specific kinds of statements.    void Visit(Stmt* S, NodeTy* Pred, NodeSet& Dst); -  /// VisitCast - Transfer function logic for all casts (implicit and explicit). -  void VisitCast(Expr* CastE, Expr* E, NodeTy* Pred, NodeSet& Dst); -   -  /// VisitUnaryOperator - Transfer function logic for unary operators. -  void VisitUnaryOperator(UnaryOperator* B, NodeTy* Pred, NodeSet& Dst); -      /// VisitBinaryOperator - Transfer function logic for binary operators.    void VisitBinaryOperator(BinaryOperator* B, NodeTy* Pred, NodeSet& Dst);    void VisitAssignmentLHS(Expr* E, NodeTy* Pred, NodeSet& Dst); +  /// VisitCast - Transfer function logic for all casts (implicit and explicit). +  void VisitCast(Expr* CastE, Expr* E, NodeTy* Pred, NodeSet& Dst);   +      /// VisitDeclRefExpr - Transfer function logic for DeclRefExprs.    void VisitDeclRefExpr(DeclRefExpr* DR, NodeTy* Pred, NodeSet& Dst);  @@ -299,6 +296,10 @@ public:    /// VisitSizeOfAlignOfTypeExpr - Transfer function for sizeof(type).    void VisitSizeOfAlignOfTypeExpr(SizeOfAlignOfTypeExpr* S, NodeTy* Pred,                                    NodeSet& Dst); +   +  /// VisitUnaryOperator - Transfer function logic for unary operators. +  void VisitUnaryOperator(UnaryOperator* B, NodeTy* Pred, NodeSet& Dst); +    };  } // end anonymous namespace @@ -919,6 +920,14 @@ void GRConstants::Visit(Stmt* S, GRConstants::NodeTy* Pred,    }    switch (S->getStmtClass()) { +       +    default: +      // Cases we intentionally have "default" handle: +      //   AddrLabelExpr, CharacterLiteral, IntegerLiteral +       +      Dst.Add(Pred); // No-op. Simply propagate the current state unchanged. +      break; +                                                             case Stmt::BinaryOperatorClass: {        BinaryOperator* B = cast<BinaryOperator>(S); @@ -1001,10 +1010,6 @@ void GRConstants::Visit(Stmt* S, GRConstants::NodeTy* Pred,      case Stmt::UnaryOperatorClass:        VisitUnaryOperator(cast<UnaryOperator>(S), Pred, Dst);        break; -       -    default: -      Dst.Add(Pred); // No-op. Simply propagate the current state unchanged. -      break;    }  } @@ -1053,7 +1058,7 @@ GRConstants::StateTy GRConstants::Assume(StateTy St, NonLValue Cond,      case nonlval::SymbolValKind: { -      lval::SymbolVal& SV = cast<lval::SymbolVal>(Cond); +      nonlval::SymbolVal& SV = cast<nonlval::SymbolVal>(Cond);        SymbolID sym = SV.getSymbol();        if (Assumption) | 

