Allow llvm-upgrade to read from stdin. Configure the lexer for reading
from C++ std::istream.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32041 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvm-upgrade/UpgradeParser.y.cvs b/tools/llvm-upgrade/UpgradeParser.y.cvs
index 48ea0b7..924af64 100644
--- a/tools/llvm-upgrade/UpgradeParser.y.cvs
+++ b/tools/llvm-upgrade/UpgradeParser.y.cvs
@@ -1,4 +1,4 @@
-//===-- upgradeParser.y - Upgrade parser for llvm assmbly -------*- C++ -*-===//
+//===-- UpgradeParser.y - Upgrade parser for llvm assmbly -------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  This file implements the bison parser for LLVM assembly language upgrade.
+//  This file implements the bison parser for LLVM 1.9 assembly language.
 //
 //===----------------------------------------------------------------------===//
 
@@ -17,12 +17,12 @@
 
 #include "ParserInternals.h"
 #include <llvm/ADT/StringExtras.h>
-#include <llvm/System/MappedFile.h>
 #include <algorithm>
 #include <list>
 #include <utility>
 #include <iostream>
 
+#define YYINCLUDED_STDLIB_H
 
 int yylex();                       // declaration" of xxx warnings.
 int yyparse();
@@ -31,19 +31,14 @@
 
 static std::ostream *O = 0;
 
-void UpgradeAssembly(const std::string &infile, std::ostream &out)
+std::istream* LexInput = 0;
+
+void UpgradeAssembly(const std::string &infile, std::istream& in, 
+                     std::ostream &out)
 {
   Upgradelineno = 1; 
   CurFilename = infile;
-  llvm::sys::Path p(infile);
-  llvm::sys::MappedFile mf;
-  mf.open(p);
-  mf.map();
-  const char* base = mf.charBase();
-  size_t sz = mf.size();
-
-  set_scan_bytes(base, sz);
-
+  LexInput = &in;
   O = &out;
 
   if (yyparse()) {