Add a new expression node, CXXOperatorCallExpr, which expresses a
function call created in response to the use of operator syntax that
resolves to an overloaded operator in C++, e.g., "str1 +
str2" that resolves to std::operator+(str1, str2)". We now build a
CXXOperatorCallExpr in C++ when we pick an overloaded operator. (But
only for binary operators, where we actually implement overloading)

I decided *not* to refactor the current CallExpr to make it abstract
(with FunctionCallExpr and CXXOperatorCallExpr as derived
classes). Doing so would allow us to make CXXOperatorCallExpr a little
bit smaller, at the cost of making the argument and callee accessors
virtual. We won't know if this is going to be a win until we can parse
lots of C++ code to determine how much memory we'll save by making
this change vs. the performance penalty due to the extra virtual
calls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59306 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 6dd9fa7..76835bc 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1237,6 +1237,7 @@
   case Expr::ObjCStringLiteralClass:
     return false;
   case Expr::CallExprClass:
+  case Expr::CXXOperatorCallExprClass:
     // __builtin___CFStringMakeConstantString is a valid constant l-value.
     if (cast<CallExpr>(Init)->isBuiltinCall() == 
            Builtin::BI__builtin___CFStringMakeConstantString)
@@ -1432,7 +1433,8 @@
   case Expr::TypesCompatibleExprClass:
   case Expr::CXXBoolLiteralExprClass:
     return false;
-  case Expr::CallExprClass: {
+  case Expr::CallExprClass: 
+  case Expr::CXXOperatorCallExprClass: {
     const CallExpr *CE = cast<CallExpr>(Init);
 
     // Allow any constant foldable calls to builtins.