[cfe-commits] r76955 - /cfe/trunk/lib/Analysis/CFG.cpp

Ted Kremenek kremenek at apple.com
Thu Jul 23 23:55:42 PDT 2009


Author: kremenek
Date: Fri Jul 24 01:55:42 2009
New Revision: 76955

URL: http://llvm.org/viewvc/llvm-project?rev=76955&view=rev
Log:
Add doxygen comments and simplify expression.

Modified:
    cfe/trunk/lib/Analysis/CFG.cpp

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=76955&r1=76954&r2=76955&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Fri Jul 24 01:55:42 2009
@@ -135,6 +135,11 @@
   bool FinishBlock(CFGBlock* B);
   CFGBlock *addStmt(Stmt *S) { return Visit(S, true); }
   
+  
+  /// TryResult - a class representing a variant over the values
+  ///  'true', 'false', or 'unknown'.  This is returned by TryEvaluateBool,
+  ///  and is used by the CFGBuilder to decide if a branch condition
+  ///  can be decided up front during CFG construction.
   class TryResult {
     int X;
   public:
@@ -155,7 +160,7 @@
   TryResult TryEvaluateBool(Expr *S) {
     Expr::EvalResult Result;
     if (S->Evaluate(Result, *Context) && Result.Val.isInt())
-      return Result.Val.getInt().getBoolValue() ? true : false;
+      return Result.Val.getInt().getBoolValue();
 
     return TryResult();
   }





More information about the cfe-commits mailing list