Add support for out-of-line definitions of conversion functions and member operators

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61442 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index e3fd696..23c0c61 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -1514,7 +1514,7 @@
 
         // If this identifier is followed by a '<', we may have a template-id.
         DeclTy *Template;
-        if (getLang().CPlusPlus && NextToken().is(tok::less) &&
+        if (NextToken().is(tok::less) &&
             (Template = Actions.isTemplateName(*Tok.getIdentifierInfo(), 
                                                CurScope))) {
           IdentifierInfo *II = Tok.getIdentifierInfo();
@@ -1525,8 +1525,7 @@
         }
         // If this identifier is the name of the current class, it's a
         // constructor name. 
-        else if (getLang().CPlusPlus &&
-                 Actions.isCurrentClassName(*Tok.getIdentifierInfo(), CurScope))
+        else if (Actions.isCurrentClassName(*Tok.getIdentifierInfo(), CurScope))
           D.setConstructor(Actions.isTypeName(*Tok.getIdentifierInfo(),
                                               CurScope),
                            Tok.getLocation());
@@ -1535,9 +1534,21 @@
           D.SetIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
         ConsumeToken();
         goto PastIdentifier;
-      }
+      } else if (Tok.is(tok::kw_operator)) {
+        SourceLocation OperatorLoc = Tok.getLocation();
 
-      if (Tok.is(tok::tilde)) {
+        // First try the name of an overloaded operator
+        if (OverloadedOperatorKind Op = TryParseOperatorFunctionId()) {
+          D.setOverloadedOperator(Op, OperatorLoc);
+        } else {
+          // This must be a conversion function (C++ [class.conv.fct]).
+          if (TypeTy *ConvType = ParseConversionFunctionId())
+            D.setConversionFunction(ConvType, OperatorLoc);
+          else
+            D.SetIdentifier(0, Tok.getLocation());
+        }
+        goto PastIdentifier;
+      } else if (Tok.is(tok::tilde)) {
         // This should be a C++ destructor.
         SourceLocation TildeLoc = ConsumeToken();
         if (Tok.is(tok::identifier)) {
@@ -1561,22 +1572,6 @@
         goto PastIdentifier;
       }
     }
-
-    if (Tok.is(tok::kw_operator)) {
-      SourceLocation OperatorLoc = Tok.getLocation();
-
-      // First try the name of an overloaded operator
-      if (OverloadedOperatorKind Op = TryParseOperatorFunctionId()) {
-        D.setOverloadedOperator(Op, OperatorLoc);
-      } else {
-        // This must be a conversion function (C++ [class.conv.fct]).
-        if (TypeTy *ConvType = ParseConversionFunctionId())
-          D.setConversionFunction(ConvType, OperatorLoc);
-        else
-          D.SetIdentifier(0, Tok.getLocation());
-      }
-      goto PastIdentifier;
-    }
   }
 
   // If we reached this point, we are either in C/ObjC or the token didn't