Get rid of GlobalLanguageMap. Global state is evil.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56462 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvmc2/CompilationGraph.h b/tools/llvmc2/CompilationGraph.h
index 4324c38..71ae227 100644
--- a/tools/llvmc2/CompilationGraph.h
+++ b/tools/llvmc2/CompilationGraph.h
@@ -32,6 +32,14 @@
 
   typedef llvm::StringSet<> InputLanguagesSet;
 
+  /// LanguageMap - Maps from extensions to language names.
+  class LanguageMap : public llvm::StringMap<std::string> {
+  public:
+
+    /// GetLanguage -  Find the language name corresponding to a given file.
+    const std::string& GetLanguage(const llvm::sys::Path&) const;
+  };
+
   /// Edge - Represents an edge of the compilation graph.
   class Edge : public llvm::RefCountedBaseVPTR<Edge> {
   public:
@@ -128,7 +136,7 @@
 
     /// Build - Build target(s) from the input file set. Command-line
     /// options are passed implicitly as global variables.
-    int Build(llvm::sys::Path const& tempDir);
+    int Build(llvm::sys::Path const& TempDir, const LanguageMap& LangMap);
 
     /// getNode - Return a reference to the node correponding to the
     /// given tool name. Throws std::runtime_error.
@@ -161,16 +169,19 @@
     /// starting at StartNode.
     void PassThroughGraph (const llvm::sys::Path& In, const Node* StartNode,
                            const InputLanguagesSet& InLangs,
-                           const llvm::sys::Path& TempDir) const;
+                           const llvm::sys::Path& TempDir,
+                           const LanguageMap& LangMap) const;
 
     /// FindToolChain - Find head of the toolchain corresponding to the given file.
     const Node* FindToolChain(const llvm::sys::Path& In,
-                              const std::string* forceLanguage,
-                              InputLanguagesSet& InLangs) const;
+                              const std::string* ForceLanguage,
+                              InputLanguagesSet& InLangs,
+                              const LanguageMap& LangMap) const;
 
     /// BuildInitial - Traverse the initial parts of the toolchains.
     void BuildInitial(InputLanguagesSet& InLangs,
-                      const llvm::sys::Path& TempDir);
+                      const llvm::sys::Path& TempDir,
+                      const LanguageMap& LangMap);
 
     /// TopologicalSort - Sort the nodes in topological order.
     void TopologicalSort(std::vector<const Node*>& Out);