Implement Sema support for the 'condition' part of C++ selection-statements and iteration-statements (if/switch/while/for).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56044 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index f7c9a99..3fc152a 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -615,6 +615,15 @@
                                                SourceLocation *CommaLocs,
                                                SourceLocation RParenLoc);
 
+  /// ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a
+  /// C++ if/switch/while/for statement.
+  /// e.g: "if (int x = f()) {...}"
+  virtual ExprResult ActOnCXXConditionDeclarationExpr(Scope *S,
+                                                      SourceLocation StartLoc,
+                                                      Declarator &D,
+                                                      SourceLocation EqualLoc,
+                                                      ExprTy *AssignExprVal);
+
   // ParseObjCStringLiteral - Parse Objective-C string literals.
   virtual ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, 
                                             ExprTy **Strings,
@@ -955,6 +964,9 @@
   // returns true if there were any incompatible arguments.                           
   bool CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs,
                                  ObjCMethodDecl *Method);
+
+  /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
+  bool CheckCXXBooleanCondition(Expr *&CondExpr);
                     
   /// ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have
   /// the specified width and sign.  If an overflow occurs, detect it and emit