aboutsummaryrefslogtreecommitdiff
path: root/tools/llvmc2/CompilationGraph.h
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2008-09-22 20:47:46 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2008-09-22 20:47:46 +0000
commit11a353a20614010029ee11bd30be4414ec36e315 (patch)
treebd6c8475e211483b2956467729abb6d5044e9908 /tools/llvmc2/CompilationGraph.h
parentac69f91e444cc82b969e13a89c74f232d6b73a7d (diff)
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
Diffstat (limited to 'tools/llvmc2/CompilationGraph.h')
-rw-r--r--tools/llvmc2/CompilationGraph.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/tools/llvmc2/CompilationGraph.h b/tools/llvmc2/CompilationGraph.h
index 4324c38ab8..71ae2272eb 100644
--- a/tools/llvmc2/CompilationGraph.h
+++ b/tools/llvmc2/CompilationGraph.h
@@ -32,6 +32,14 @@ namespace llvmc {
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 @@ namespace llvmc {
/// 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 @@ namespace llvmc {
/// 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);