libclang: pass return code out argument by reference

r212427 formalized the message-passing pattern by making these argument
structures const. This commit changes output arguments to get passed by
reference so we can eliminate mutable fields.

llvm-svn: 212497
diff --git a/clang/tools/libclang/Indexing.cpp b/clang/tools/libclang/Indexing.cpp
index 05a18b7..58af618 100644
--- a/clang/tools/libclang/Indexing.cpp
+++ b/clang/tools/libclang/Indexing.cpp
@@ -475,7 +475,7 @@
   ArrayRef<CXUnsavedFile> unsaved_files;
   CXTranslationUnit *out_TU;
   unsigned TU_options;
-  mutable int result;
+  CXErrorCode &result;
 };
 
 } // anonymous namespace
@@ -494,9 +494,6 @@
   CXTranslationUnit *out_TU  = ITUI->out_TU;
   unsigned TU_options = ITUI->TU_options;
 
-  // Set up the initial return value.
-  ITUI->result = CXError_Failure;
-
   if (out_TU)
     *out_TU = nullptr;
   bool requestedToGetTU = (out_TU != nullptr);
@@ -982,6 +979,7 @@
   if (num_unsaved_files && !unsaved_files)
     return CXError_InvalidArguments;
 
+  CXErrorCode result = CXError_Failure;
   IndexSourceFileInfo ITUI = {
       idxAction,
       client_data,
@@ -994,11 +992,11 @@
       llvm::makeArrayRef(unsaved_files, num_unsaved_files),
       out_TU,
       TU_options,
-      CXError_Failure};
+      result};
 
   if (getenv("LIBCLANG_NOTHREADS")) {
     clang_indexSourceFile_Impl(&ITUI);
-    return ITUI.result;
+    return result;
   }
 
   llvm::CrashRecoveryContext CRC;
@@ -1029,8 +1027,8 @@
     if (out_TU)
       PrintLibclangResourceUsage(*out_TU);
   }
-  
-  return ITUI.result;
+
+  return result;
 }
 
 int clang_indexTranslationUnit(CXIndexAction idxAction,